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 #define CL_TRANSPORT_CONFIG_FILE "clTransport.xml"
16 
17 /*
18  * Maximum multicast peer addresses node cache
19  */
20 #define CL_MCAST_MAX_NODES 16
21 
22 typedef ClRcT (*ClTransportNotifyCallbackT)
23 (ClIocPhysicalAddressT *compAddr, ClUint32T status, ClPtrT arg);
24 
25 typedef ClPtrT ClTransportListenerHandleT;
26 
27 extern ClInt32T gClTransportId;
28 
29 typedef struct ClIocAddrMap
30 {
31  int family;
32  char addrstr[80];
33  union
34  {
35  struct sockaddr_in sin_addr;
36  struct sockaddr_in6 sin6_addr;
37  } _addr;
38 
39  /* status of peer address: up/down */
40  ClUint8T status;
41 }ClIocAddrMapT;
42 
43 /*
44  * We aren't going to be having multiple transports requesting at the same time.
45  * So keep this simple. No need for bitmaps as these aren't moving targets.
46  */
47 static __inline__ ClInt32T clTransportIdGet(void)
48 {
49  return ++gClTransportId;
50 }
51 
52 extern ClRcT clTransportLayerInitialize(void);
53 extern ClRcT clTransportLayerFinalize(void);
54 extern ClRcT clTransportLayerGmsFinalize(void);
55 extern ClRcT clTransportInitialize(const ClCharT *type, ClBoolT nodeRep);
56 extern ClRcT clTransportFinalize(const ClCharT *type, ClBoolT nodeRep);
57 
58 extern ClRcT clTransportNotifyInitialize(void);
59 extern ClRcT clTransportNotifyFinalize(void);
60 extern ClRcT clTransportAddressAssign(const ClCharT *type);
61 extern ClRcT clTransportNotificationInitialize(const ClCharT *type);
62 extern ClRcT clTransportNotificationFinalize(const ClCharT *type);
63 
64 extern ClRcT clTransportBind(const ClCharT *type, ClIocPortT port);
65 extern ClRcT clTransportBindClose(const ClCharT *type, ClIocPortT port);
66 extern ClRcT clTransportMaxPayloadSizeGet(const ClCharT *type, ClUint32T *pSize);
67 extern ClRcT clTransportListen(const ClCharT *type, ClIocPortT port);
68 extern ClRcT clTransportListenStop(const ClCharT *type, ClIocPortT port);
69 extern ClRcT clTransportServerReady(const ClCharT *type, ClIocAddressT *pAddress);
70 extern ClRcT
71 clTransportMasterAddressGet(const ClCharT *type, ClIocLogicalAddressT la,
72  ClIocPortT port, ClIocNodeAddressT *masterAddress);
73 extern ClRcT
74 clTransportMasterAddressGetDefault(ClIocLogicalAddressT la, ClIocPortT port,
75  ClIocNodeAddressT *masterAddress);
76 extern ClRcT clTransportNotifyOpen(ClIocPortT port);
77 extern ClRcT clTransportNotifyClose(ClIocPortT port);
78 extern ClRcT clTransportNotifyRegister(ClTransportNotifyCallbackT callback, ClPtrT arg);
79 extern ClRcT clTransportNotifyDeregister(ClTransportNotifyCallbackT callback);
80 extern ClRcT
81 clTransportNotificationOpen(const ClCharT *type, ClIocNodeAddressT node,
82  ClIocPortT port, ClIocNotificationIdT event);
83 extern ClRcT
84 clTransportNotificationClose(const ClCharT *type, ClIocNodeAddressT nodeAddress,
85  ClIocPortT port, ClIocNotificationIdT event);
86 extern ClRcT
87 clTransportSend(const ClCharT *type, ClIocPortT port, ClUint32T priority, ClIocAddressT *address,
88  struct iovec *iov, ClInt32T iovlen, ClInt32T flags);
89 extern ClRcT
90 clTransportSendProxy(const ClCharT *type, ClIocPortT port, ClUint32T priority, ClIocAddressT *address,
91  struct iovec *iov, ClInt32T iovlen, ClInt32T flags, ClBoolT proxy);
92 
93 extern ClRcT
94 clTransportRecv(const ClCharT *type, ClIocCommPortHandleT commPort, ClIocDispatchOptionT *pRecvOption,
95  ClUint8T *buffer, ClUint32T bufSize,
96  ClBufferHandleT message, ClIocRecvParamT *pRecvParam);
97 extern ClRcT
98 clTransportRecvDefault(ClIocCommPortHandleT commPort, ClIocDispatchOptionT *pRecvOption,
99  ClUint8T *buffer, ClUint32T bufSize,
100  ClBufferHandleT message, ClIocRecvParamT *pRecvParam);
101 
102 extern ClRcT clTransportTransparencyRegister(const ClCharT *type,
103  ClIocPortT port, ClIocLogicalAddressT logicalAddr, ClUint32T haState);
104 extern ClRcT clTransportTransparencyDeregister(const ClCharT *type,
105  ClIocPortT port, ClIocLogicalAddressT logicalAddr);
106 extern ClRcT clTransportMulticastRegister(const ClCharT *type,
107  ClIocPortT port, ClIocMulticastAddressT mcastAddr);
108 extern ClRcT clTransportMulticastDeregister(const ClCharT *type,
109  ClIocPortT port, ClIocMulticastAddressT mcastAddr);
110 
111 extern ClRcT
112 clTransportListenerCreate(ClTransportListenerHandleT *handle);
113 
114 extern ClRcT
115 clTransportListenerDestroy(ClTransportListenerHandleT *handle);
116 
117 extern ClRcT
118 clTransportListenerAdd(ClTransportListenerHandleT handle, ClInt32T fd,
119  ClRcT (*dispatchCallback)(ClInt32T fd, ClInt32T events, void *cookie),
120  void *cookie);
121 
122 extern ClRcT
123 clTransportListenerDel(ClTransportListenerHandleT handle, ClInt32T fd);
124 
125 extern ClRcT
126 clTransportListenerRegister(ClInt32T fd, ClRcT (*dispatchCallback)(ClInt32T fd, ClInt32T events, void *cookie),
127  void *cookie);
128 extern ClRcT
129 clTransportListenerDeregister(ClInt32T fd);
130 
131 extern void
132 clTransportPrivateDataSet(ClInt32T fd, ClIocPortT port, void *private, void **privateLast);
133 
134 extern void *
135 clTransportPrivateDataGet(ClInt32T fd, ClIocPortT port);
136 
137 extern void *
138 clTransportPrivateDataDelete(ClInt32T fd, ClIocPortT port);
139 
140 extern ClRcT
141 clTransportDispatch(ClIocPortT port, ClUint8T *buffer, ClUint32T bufSize);
142 
143 extern ClRcT clFindTransport(ClIocNodeAddressT dstIocAddress, ClIocAddressT *rdstIocAddress,
144  ClCharT **typeXport);
145 
146 extern ClCharT *clTransportMcastAddressGet();
147 extern void clTransportMcastAddressSet(const ClCharT* maddr);
148 extern ClUint32T clTransportMcastPortGet();
149 extern ClUint32T clTransportHeartBeatIntervalGet();
150 extern ClUint32T clTransportHeartBeatIntervalCompGet();
151 extern ClUint32T clTransportHeartBeatRetriesGet();
152 extern ClBoolT clTransportBridgeEnabled(ClIocNodeAddressT node);
153 extern ClRcT clTransportBroadcastListGet(const ClCharT *hostXport,
154  ClIocPhysicalAddressT *hostAddr,
155  ClUint32T *pNumEntries, ClIocAddressT **ppDestSlots);
156 
157 extern ClBoolT clTransportMcastSupported(ClUint32T *numPeers);
158 extern ClRcT clTransportMcastPeerListGet(ClIocAddrMapT *peers, ClUint32T *numPeers);
159 extern ClRcT clTransportMcastPeerListAdd(const ClCharT *addr);
160 extern ClRcT clTransportMcastPeerListDelete(const ClCharT *addr);
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif
Typical defines found in any software project.
Common Error Codes shared across multiple Clovis ASP Components.
Header file of Ioc Data Structures and APIs.
ClPtrT ClBufferHandleT
The type of the handle for the buffer messages.
Definition: clBufferApi.h:82
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
ClWordT ClIocCommPortHandleT
The Communication port handle.
Definition: clIocApi.h:353
ClUint64T ClIocMulticastAddressT
IOC Multicast address.
Definition: clIocApi.h:376
ClUint64T ClIocLogicalAddressT
IOC Logical address.
Definition: clIocApi.h:371
ClUint32T ClIocPortT
The IOC communication port.
Definition: clIocApi.h:348
enum ClIocNotificationId ClIocNotificationIdT
The port close notification payload.
ClUint32T ClIocNodeAddressT
The IOC node address.
Definition: clIocApi.h:343
The IOC Physical address of an application's communication end point.
Definition: clIocApi.h:383
IOC address.
Definition: clIocApi.h:401
The IOC receive returns this structure along with the message.
Definition: clIocApi.h:491

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