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