1#ifndef _RPCPENDINGCALLS_H
2
3#define _RPCPENDINGCALLS_H
4
5#include <malloc.h>
6#include <OS.h>
7#include <sys/socket.h>
8#include <netinet/in.h>
9
10struct SemaphorePool
11{
12	sem_id *fPool;
13	int32 fPoolCount;
14	int32 fPoolSize;
15	sem_id fPoolSem;
16};
17
18void SemaphorePoolInit (struct SemaphorePool *pool);
19void SemaphorePoolDestroy (struct SemaphorePool *pool);
20sem_id SemaphorePoolGet(struct SemaphorePool *pool);
21void SemaphorePoolPut (struct SemaphorePool *pool, sem_id sem);
22
23struct PendingCall
24{
25	struct PendingCall *next;
26
27	sem_id sem;
28	struct sockaddr_in addr;
29	int32 xid;
30	uint8 *buffer;
31};
32
33void PendingCallInit (struct PendingCall *call);
34void PendingCallDestroy (struct PendingCall *call);
35
36struct RPCPendingCalls
37{
38	struct PendingCall *fFirst;
39	sem_id fSem;
40	struct SemaphorePool fPool;
41};
42
43void RPCPendingCallsInit (struct RPCPendingCalls *calls);
44void RPCPendingCallsDestroy (struct RPCPendingCalls *calls);
45
46struct PendingCall *RPCPendingCallsAddPendingCall (struct RPCPendingCalls *calls,
47													int32 xid, const struct sockaddr_in *addr);
48
49struct PendingCall *RPCPendingCallsFindAndRemovePendingCall (struct RPCPendingCalls *calls,
50													int32 xid, const struct sockaddr_in *addr);
51
52#endif
53