OpenClovis Logo

clTransport.h
1 #ifndef _CL_TRANSPORT_H_
2 #define _CL_TRANSPORT_H_
3 
4 #include <clCommon.h>
5 #include <clCommonErrors.h>
6 #include <clList.h>
7 #include <clIocApi.h>
8 #include <clIocIpi.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #define CL_TRANSPORT_BASE_PORT (18000)
15 
16 typedef ClRcT (*ClTransportNotifyCallbackT)
17 (ClIocPhysicalAddressT *compAddr, ClUint32T status, ClPtrT arg);
18 
19 extern ClInt32T gClTransportId;
20 
21 typedef struct ClIocAddrMap
22 {
23  int family;
24  char addrstr[80];
25  union
26  {
27  struct sockaddr_in sin_addr;
28  struct sockaddr_in6 sin6_addr;
29  } _addr;
30  ClListHeadT list;
31 }ClIocAddrMapT;
32 
33 /*
34  * We aren't going to be having multiple transports requesting at the same time.
35  * So keep this simple. No need for bitmaps as these aren't moving targets.
36  */
37 static __inline__ ClInt32T clTransportIdGet(void)
38 {
39  return ++gClTransportId;
40 }
41 
42 extern ClRcT clTransportLayerInitialize(void);
43 extern ClRcT clTransportLayerFinalize(void);
44 extern ClRcT clTransportInitialize(const ClCharT *type, ClBoolT nodeRep);
45 extern ClRcT clTransportFinalize(const ClCharT *type, ClBoolT nodeRep);
46 
47 extern ClRcT clTransportNotifyInitialize(void);
48 extern ClRcT clTransportNotifyFinalize(void);
49 extern ClRcT clTransportAddressAssign(const ClCharT *type);
50 extern ClRcT clTransportNotificationInitialize(const ClCharT *type);
51 extern ClRcT clTransportNotificationFinalize(const ClCharT *type);
52 
53 extern ClRcT clTransportBind(const ClCharT *type, ClIocPortT port);
54 extern ClRcT clTransportBindClose(const ClCharT *type, ClIocPortT port);
55 extern ClRcT clTransportMaxPayloadSizeGet(const ClCharT *type, ClUint32T *pSize);
56 extern ClRcT clTransportListen(const ClCharT *type, ClIocPortT port);
57 extern ClRcT clTransportListenStop(const ClCharT *type, ClIocPortT port);
58 extern ClRcT clTransportServerReady(const ClCharT *type, ClIocAddressT *pAddress);
59 extern ClRcT
60 clTransportMasterAddressGet(const ClCharT *type, ClIocLogicalAddressT la,
61  ClIocPortT port, ClIocNodeAddressT *masterAddress);
62 extern ClRcT
63 clTransportMasterAddressGetDefault(ClIocLogicalAddressT la, ClIocPortT port,
64  ClIocNodeAddressT *masterAddress);
65 extern ClRcT clTransportNotifyOpen(ClIocPortT port);
66 extern ClRcT clTransportNotifyClose(ClIocPortT port);
67 extern ClRcT clTransportNotifyRegister(ClTransportNotifyCallbackT callback, ClPtrT arg);
68 extern ClRcT clTransportNotifyDeregister(ClTransportNotifyCallbackT callback);
69 extern ClRcT
70 clTransportNotificationOpen(const ClCharT *type, ClIocNodeAddressT node,
71  ClIocPortT port, ClIocNotificationIdT event);
72 extern ClRcT
73 clTransportNotificationClose(const ClCharT *type, ClIocNodeAddressT nodeAddress,
74  ClIocPortT port, ClIocNotificationIdT event);
75 extern ClRcT
76 clTransportSend(const ClCharT *type, ClIocPortT port, ClUint32T priority, ClIocAddressT *address,
77  struct iovec *iov, ClInt32T iovlen, ClInt32T flags);
78 extern ClRcT
79 clTransportRecv(const ClCharT *type, ClIocCommPortHandleT commPort, ClIocDispatchOptionT *pRecvOption,
80  ClUint8T *buffer, ClUint32T bufSize,
81  ClBufferHandleT message, ClIocRecvParamT *pRecvParam);
82 extern ClRcT
83 clTransportRecvDefault(ClIocCommPortHandleT commPort, ClIocDispatchOptionT *pRecvOption,
84  ClUint8T *buffer, ClUint32T bufSize,
85  ClBufferHandleT message, ClIocRecvParamT *pRecvParam);
86 
87 extern ClRcT clTransportTransparencyRegister(const ClCharT *type,
88  ClIocPortT port, ClIocLogicalAddressT logicalAddr, ClUint32T haState);
89 extern ClRcT clTransportTransparencyDeregister(const ClCharT *type,
90  ClIocPortT port, ClIocLogicalAddressT logicalAddr);
91 extern ClRcT clTransportMulticastRegister(const ClCharT *type,
92  ClIocPortT port, ClIocMulticastAddressT mcastAddr);
93 extern ClRcT clTransportMulticastDeregister(const ClCharT *type,
94  ClIocPortT port, ClIocMulticastAddressT mcastAddr);
95 extern ClRcT
96 clTransportListenerRegister(ClInt32T fd, ClRcT (*dispatchCallback)(ClInt32T fd, ClInt32T events, void *cookie),
97  void *cookie);
98 extern ClRcT
99 clTransportListenerDeregister(ClInt32T fd);
100 
101 extern void
102 clTransportPrivateDataSet(ClInt32T fd, ClIocPortT port, void *private, void **privateLast);
103 
104 extern void *
105 clTransportPrivateDataGet(ClInt32T fd, ClIocPortT port);
106 
107 extern void *
108 clTransportPrivateDataDelete(ClInt32T fd, ClIocPortT port);
109 
110 extern ClRcT
111 clTransportDispatch(ClIocPortT port, ClUint8T *buffer, ClUint32T bufSize);
112 
113 extern ClRcT clFindTransport(ClIocNodeAddressT dstIocAddress, ClIocAddressT *rdstIocAddress,
114  ClCharT **typeXport);
115 
116 extern ClRcT clTransportNodeAddrGet(ClUint32T *pNumberOfEntries,
117  ClIocNodeAddressT *pAddrList);
118 
119 extern ClCharT *clTransportMcastAddressGet();
120 extern ClUint32T clTransportMcastPortGet();
121 extern ClUint32T clTransportHeartBeatIntervalGet();
122 extern ClUint32T clTransportHeartBeatIntervalCompGet();
123 extern ClUint32T clTransportHeartBeatRetriesGet();
124 extern ClBoolT clTransportBridgeEnabled(ClIocNodeAddressT node);
125 
126 extern ClBoolT clTransportMcastSupported(ClUint32T *numPeers);
127 extern ClRcT clTransportMcastPeerListGet(ClIocAddrMapT *peers, ClUint32T *numPeers);
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen