]> rtime.felk.cvut.cz Git - orte.git/blob - orte/include/typedefs_api.h
fe4109be83cbf3450feb1432883c0ca96cd87d5a
[orte.git] / orte / include / typedefs_api.h
1 /*
2  *  $Id: typedefs_api.h,v 0.0.0.1       2003/08/21 
3  *
4  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
5  *
6  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
7  *  --------------------------------------------------------------------
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *  
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *  
19  */
20
21 #ifndef _TYPEDEFS_API_H
22 #define _TYPEDEFS_API_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef struct ORTEDomain ORTEDomain;             //forward declaration
29 typedef struct CSTWriter ORTEPublication;         //forward declaration
30 typedef struct CSTReader ORTESubscription;        //forward declaration
31
32 typedef enum {
33         PULLED           = 0x01,
34         IMMEDIATE        = 0x02
35       } SubscriptionMode;
36
37 typedef enum {
38         BEST_EFFORTS     = 0x01,
39         STRICT_RELIABLE  = 0x02
40       } SubscriptionType;
41       
42 typedef enum {
43         NEW_DATA         = 0x01,
44         DEADLINE         = 0x02
45       } ORTERecvStatus;
46
47 typedef enum {
48         NEED_DATA        = 0x01,
49         CQL              = 0x02
50       } ORTESendStatus;
51
52 typedef struct ORTEIFProp {
53   int32_t        ifFlags;
54   IPAddress      ipAddress;
55 } ORTEIFProp;
56
57 typedef struct ORTEMulticastProp {
58   Boolean        enabled;
59   unsigned char  ttl;
60   Boolean        loopBackEnabled;
61   IPAddress      ipAddress;
62 } ORTEMulticastProp;
63
64 typedef struct ORTECDRStream {
65   char           *buffer;
66   char           *bufferPtr;
67   Boolean        needByteSwap;
68   int            length;
69 } ORTECDRStream;
70
71 typedef void (*ORTETypeSerialize)(ORTECDRStream *cdr_stream, void *instance);
72 typedef void (*ORTETypeDeserialize)(ORTECDRStream *cdr_stream, void *instance);
73
74 /**
75  * struct ORTETypeRegister - 
76  */
77 typedef struct ORTETypeRegister {
78   char                   *typeName;
79   ORTETypeSerialize      serialize;
80   ORTETypeDeserialize    deserialize;
81   unsigned int           getMaxSize;
82 } ORTETypeRegister;
83
84 /**
85  * struct ORTEDomainBaseProp - 
86  */
87 typedef struct ORTEDomainBaseProp {
88   NtpTime                expirationTime;
89   NtpTime                refreshPeriod;
90   NtpTime                purgeTime;
91   NtpTime                repeatAnnounceTime;
92   NtpTime                repeatActiveQueryTime;
93   NtpTime                delayResponceTimeACKMin;
94   NtpTime                delayResponceTimeACKMax;
95   unsigned int           HBMaxRetries;
96   unsigned int           ACKMaxRetries;
97   NtpTime                maxBlockTime;
98 } ORTEDomainBaseProp;
99
100 /**
101  * struct ORTEDomainWireProp - 
102  */
103 typedef struct ORTEDomainWireProp {
104   unsigned int           metaBytesPerPacket;
105   unsigned int           metaBytesPerFastPacket;
106   unsigned int           metabitsPerACKBitmap;
107   unsigned int           userMaxSerDeserSize;
108 } ORTEDomainWireProp;
109
110 /**
111  * struct ORTEPublProp - 
112  */
113 typedef struct ORTEPublProp {
114   PathName               topic;
115   TypeName               typeName; 
116   TypeChecksum           typeChecksum;
117   Boolean                expectsAck;
118   NtpTime                persistence;
119   u_int32_t              reliabilityOffered;
120   u_int32_t              sendQueueSize;
121   int32_t                strength;
122   //Additional properties
123   u_int32_t              criticalQueueLevel;
124   NtpTime                HBNornalRate;
125   NtpTime                HBCQLRate;
126   unsigned int           HBMaxRetries;
127   //
128   NtpTime                maxBlockTime;
129 } ORTEPublProp;
130
131 /**
132  * struct ORTESubsProp - 
133  */
134 typedef struct ORTESubsProp {
135   PathName               topic;
136   TypeName               typeName;
137   TypeChecksum           typeChecksum;
138   NtpTime                minimumSeparation;
139   u_int32_t              recvQueueSize;
140   u_int32_t              reliabilityRequested;
141   //additional parameters
142   NtpTime                deadline;
143   u_int32_t              mode;
144 }  ORTESubsProp;
145
146 /**
147  * struct ORTEAppInfo - 
148  */
149 typedef struct ORTEAppInfo {
150   HostId                 hostId;
151   AppId                  appId;
152   IPAddress              *unicastIPAddressList;
153   unsigned char          unicastIPAddressCount;
154   IPAddress              *metatrafficMulticastIPAddressList;
155   unsigned char          metatrafficMulticastIPAddressCount;
156   Port                   metatrafficUnicastPort;
157   Port                   userdataUnicastPort;
158   VendorId               vendorId;
159   ProtocolVersion        protocolVersion;
160 } ORTEAppInfo;
161
162 /**
163  * struct ORTEPubInfo - 
164  */
165 typedef struct ORTEPubInfo {
166   const char            *topic;
167   const char            *type;
168   ObjectId              objectId;
169 } ORTEPubInfo;
170
171 /**
172  * struct ORTEPubInfo - 
173  */
174 typedef struct ORTESubInfo {
175   const char            *topic;
176   const char            *type;
177   ObjectId              objectId;
178 } ORTESubInfo;
179
180 /**
181  * struct ORTEPublStatus - status of a publication
182  * @reliable: count of reliable subscriptions (best effort) connected on responsible publication
183  * @unReliable: count of unreliable subscriptions (strict) connected on responsible publication
184  * @issues: number of messages in sending queue
185  * @unacknowledgedIssues: number of unacknowledged issues (only for best effort)
186  */
187 typedef struct ORTEPublStatus {
188   unsigned int           strict;
189   unsigned int           bestEffort;
190   unsigned int           issues;
191 } ORTEPublStatus;
192
193 /**
194  * struct ORTESubsStatus - status of a subscription
195  * @reliable: count of reliable publications (best effort) connected to responsible subscription
196  * @unReliable: count of unreliable publications (strict) connected to responsible subscription
197  * @issues: number of messages in receiving queue
198  *
199  * Current implementation has always issues=0. It means, that all messages were sent to user application
200  */
201 typedef struct ORTESubsStatus {
202   unsigned int           strict;
203   unsigned int           bestEffort;
204   unsigned int           issues;
205 } ORTESubsStatus;
206
207 /**
208  * struct ORTERecvInfo - 
209  */
210 typedef struct ORTERecvInfo {
211   ORTERecvStatus        status;
212   const char            *topic;
213   const char            *type;
214   GUID_RTPS             senderGUID;
215   NtpTime               localTimeReceived;
216   NtpTime               remoteTimePublished;
217   SequenceNumber        sn;
218 } ORTERecvInfo;
219
220 /**
221  * struct ORTESendInfo - 
222  */
223 typedef struct ORTESendInfo {
224   ORTESendStatus        status;
225   const char            *topic;
226   const char            *type;
227   GUID_RTPS             senderGUID;
228   SequenceNumber        sn;
229 } ORTESendInfo;
230
231 //CallBackRutines
232 typedef void 
233 (*ORTERecvCallBack)(const ORTERecvInfo *info,void *instance, void *recvCallBackParam);
234 typedef void 
235 (*ORTESendCallBack)(const ORTESendInfo *info,void *instance, void *sendCallBackParam);
236 typedef ORTESubscription*
237 (*ORTESubscriptionPatternCallBack)(const char *topic, const char *nddsType, void *Param);
238
239
240 //Pattern
241 typedef Boolean
242 (*ORTEPatternCheck)(const char *string);
243 typedef Boolean
244 (*ORTEPatternMatch)(const char *topic,const char *pattern,void *param);
245 extern Boolean
246 ORTEPatternCheckDefault(const char *topic);
247 extern Boolean
248 ORTEPatternMatchDefault(const char *topic,const char *pattern,void *param);
249 extern void
250 ORTEPatternRegister(ORTEDomain *d,ORTEPatternCheck check,
251      ORTEPatternMatch match,void *param);
252
253 //Manager
254 typedef Boolean 
255 (*ORTEOnMgrNew)(const struct ORTEAppInfo *appInfo, void *param);
256 typedef void 
257 (*ORTEOnMgrDelete)(const struct ORTEAppInfo *appInfo, void *param);
258 //Application
259 typedef Boolean 
260 (*ORTEOnAppRemoteNew)(const struct ORTEAppInfo *appInfo, void *param);
261 typedef void (*ORTEOnAppDelete)
262 (const struct ORTEAppInfo *appInfo, void *param);
263 //Publication
264 typedef Boolean 
265 (*ORTEOnPubRemote)(const struct ORTEAppInfo *appInfo,
266                    const struct ORTEPubInfo *pubInfo, void *param);
267 typedef void 
268 (*ORTEOnPubDelete)(const struct ORTEAppInfo *appInfo,
269                    const struct ORTEPubInfo *pubInfo, void *param);
270 //Subscription
271 typedef Boolean 
272 (*ORTEOnSubRemote)(const struct ORTEAppInfo *appInfo,
273                    const struct ORTESubInfo *subInfo, void *param);
274 typedef void 
275 (*ORTEOnSubDelete)(const struct ORTEAppInfo *appInfo,
276                    const struct ORTESubInfo *subInfo, void *param);
277
278 /**
279  * struct ORTEDomainAppEvents - Domain events of an application
280  */
281 typedef struct ORTEDomainAppEvents {
282   ORTEOnMgrNew           onMgrNew;
283   void                   *onMgrNewParam;
284   ORTEOnMgrDelete        onMgrDelete;
285   void                   *onMgrDeleteParam;
286   ORTEOnAppRemoteNew     onAppRemoteNew;
287   void                   *onAppRemoteNewParam;
288   ORTEOnAppDelete        onAppDelete;
289   void                   *onAppDeleteParam;
290   ORTEOnPubRemote        onPubRemoteNew;
291   void                   *onPubRemoteNewParam;
292   ORTEOnPubRemote        onPubRemoteChanged;
293   void                   *onPubRemoteChangedParam;
294   ORTEOnPubDelete        onPubDelete;
295   void                   *onPubDeleteParam;
296   ORTEOnSubRemote        onSubRemoteNew;
297   void                   *onSubRemoteNewParam;
298   ORTEOnSubRemote        onSubRemoteChanged;
299   void                   *onSubRemoteChangedParam;
300   ORTEOnSubDelete        onSubDelete;
301   void                   *onSubDeleteParam;
302 } ORTEDomainAppEvents;
303
304 /**
305  * struct ORTETaskProp - 
306  */
307 typedef struct ORTETasksProp {
308   Boolean                realTimeEnabled;
309   int                    smtStackSize;
310   int                    smtPriority;
311   int                    rmtStackSize;
312   int                    rmtPriority;
313 } ORTETasksProp; 
314
315 /**
316  * struct ORTEDomainApp - 
317  */
318 typedef struct ORTEDomainProp {
319   ORTETasksProp          tasksProp;
320   ORTEIFProp             IFProp[MAX_INTERFACES];  //interface properties
321   unsigned char          IFCount;                 //count of interfaces
322   ORTEDomainBaseProp     baseProp;
323   ORTEDomainWireProp     wireProp;
324   ORTEMulticastProp      multicast;               //multicast properies
325   char                   *mgrs;                   //managers
326   IPAddress              mgrAddKey;               //keys
327   IPAddress              appLocalManager;         //applications
328   char                   version[60];             //string product version
329   int                    recvBuffSize;
330   int                    sendBuffSize;      
331 } ORTEDomainProp;
332
333 #ifdef __cplusplus
334 } /* extern "C"*/
335 #endif
336
337 #endif  /* _TYPEDEFS_API_H */
338