2 * $Id: typedefs_api.h,v 0.0.0.1 2003/08/21
4 * AUTHOR: Petr Smolik petr.smolik@wo.cz
6 * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
7 * --------------------------------------------------------------------
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.
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.
21 #ifndef _TYPEDEFS_API_H
22 #define _TYPEDEFS_API_H
28 typedef struct ORTEDomain ORTEDomain; //forward declaration
29 typedef struct CSTWriter ORTEPublication; //forward declaration
30 typedef struct CSTReader ORTESubscription; //forward declaration
33 * enum SubscriptionMode - mode of subscription
35 * @IMMEDIATE: using callback function
37 * Specifies whether user application will poll for data or whether a callback function will be called by ORTE middleware when new data will be available.
39 typedef enum SubscriptionMode {
45 * enum SubscriptionType - type of subcsription
46 * @BEST_EFFORTS: best effort subscription
47 * @STRICT_RELIABLE: strict reliable subscription.
49 * Specifies which mode will be used for this subscription.
51 typedef enum SubscriptionType {
53 STRICT_RELIABLE = 0x02
57 * enum ORTERecvStatus - status of a subscription
58 * @NEW_DATA: new data has arrived
59 * @DEADLINE: deadline has occurred
61 * Specifies which event has occurred in the subscription object.
63 typedef enum ORTERecvStatus {
69 * enum ORTESendStatus - status of a publication
70 * @NEED_DATA: need new data (set when callback function specified for publciation is beeing called)
71 * @CQL: transmit queue has been filled up to critical level.
73 * Specifies which event has occurred in the publication object. Critical level of transmit queue is specified as one of publication properties (ORTEPublProp.criticalQueueLevel).
75 typedef enum ORTESendStatus {
81 * struct ORTEIFProp - interface flags
83 * @ipAddress: IP address
85 * Flags for network interface.
87 typedef struct ORTEIFProp {
93 * struct ORTEMulticastProp - properties for ORTE multicast (not supported yet)
94 * @enabled: ORTE_TRUE if multicast enabled otherwise ORTE_FALSE
95 * @ttl: time-to-live (TTL) for sent datagrams
96 * @loopBackEnabled: ORTE_TRUE if data should be received by sender itself otherwise ORTE_FALSE
97 * @ipAddress: desired multicast IP address
99 * Properties for ORTE multicast subsystem which is not fully supported yet. Multicast IP address is assigned by the ORTE middleware itself.
101 typedef struct ORTEMulticastProp {
104 Boolean loopBackEnabled;
110 * struct ORTETypeGetMaxSizeParam - parameters for function ORTETypeGetMaxSize
118 * It used to determine maximal size of intermal buffer for incomming data
120 typedef struct ORTEGetMaxSizeParam {
121 CDR_Endianness host_endian;
122 CDR_Endianness data_endian;
124 unsigned int max_size;
127 } ORTEGetMaxSizeParam;
129 typedef void (*ORTETypeSerialize)(CDR_Codec *cdrCodec, void *instance);
131 typedef void (*ORTETypeDeserialize)(CDR_Codec *cdrCodec, void *instance);
133 typedef int (*ORTETypeGetMaxSize)(ORTEGetMaxSizeParam *gms);
136 * struct ORTETypeRegister - registered data type
137 * @typeName: name of data type
138 * @serialize: pointer to serialization function
139 * @deserialize: pointer to deserialization function
140 * @getMaxSize: pointer to function given maximal data length
141 * @maxSize: maximal size of ser./deser. data
143 * Contains description of registered data type. See @ORTETypeRegisterAdd function for details.
145 typedef struct ORTETypeRegister {
146 const char *typeName;
147 ORTETypeSerialize serialize;
148 ORTETypeDeserialize deserialize;
149 ORTETypeGetMaxSize getMaxSize;
150 unsigned int maxSize;
154 * struct ORTEDomainBaseProp - base properties of a domain
155 * @registrationMgrRetries: a manager which want to start communication have to register to other manager. This parametr
156 * is used for specify maximal repetition retries of registration process when it fail.
157 * @registrationMgrPeriod: an application which want to start communication have to register to a manager. This parametr
158 * is used for specify maximal repetition retries of registration process when it fail.
159 * @registrationAppRetries: same like registrationMgrRetries parameter, but is used for an application
160 * @registrationAppPeriod: repetition time for registration process
161 * @expirationTime: specifies how long is this application taken as alive in other applications/managers (default 180s)
162 * @refreshPeriod: how often an application refresh itself to its manager or manager to other managers (default 60s)
163 * @purgeTime: how often the local database should be cleaned from invalid (expired) objects (default 60s)
164 * @repeatAnnounceTime: This is the period with which the CSTWriter will announce its existence and/or the availability of new CSChanges to the CSTReader. This period determines how quickly the protocol recovers when an announcement of data is lost.
165 * @repeatActiveQueryTime: ???
166 * @delayResponceTimeACKMin: minimum time the CSTWriter waits before responding to an incoming message.
167 * @delayResponceTimeACKMax: maximum time the CSTWriter waits before responding to an incoming message.
168 * @HBMaxRetries: how many times a HB message is retransmitted if no response has been received until timeout
169 * @ACKMaxRetries: how many times an ACK message is retransmitted if no response has been received until timeout
170 * @maxBlockTime: timeout for send functions if sending queue is full (default 30s)
172 typedef struct ORTEDomainBaseProp {
173 unsigned int registrationMgrRetries;
174 NtpTime registrationMgrPeriod;
175 unsigned int registrationAppRetries;
176 NtpTime registrationAppPeriod;
177 NtpTime expirationTime;
178 NtpTime refreshPeriod;
180 NtpTime repeatAnnounceTime;
181 NtpTime repeatActiveQueryTime;
182 NtpTime delayResponceTimeACKMin;
183 NtpTime delayResponceTimeACKMax;
184 unsigned int HBMaxRetries;
185 unsigned int ACKMaxRetries;
186 NtpTime maxBlockTime;
187 } ORTEDomainBaseProp;
190 * struct ORTEDomainWireProp - wire properties of a message
191 * @metaBytesPerPacket: maximum number of bytes in single frame (default 1500B)
192 * @metaBytesPerFastPacket: maximum number of bytes in single frame if transmitting queue has reached @criticalQueueLevel level (see @ORTEPublProp struct)
193 * @metabitsPerACKBitmap: not supported yet (default 32)
194 * @userMaxSerDeserSize: maximum number of user data in frame (default 0x3000B)
196 typedef struct ORTEDomainWireProp {
197 unsigned int metaBytesPerPacket;
198 unsigned int metaBytesPerFastPacket;
199 unsigned int metabitsPerACKBitmap;
200 unsigned int userBytesPerPacket;
201 } ORTEDomainWireProp;
204 * struct ORTEPublProp - properties of a publication
205 * @topic: the name of the information in the Network that is published or subscribed to
206 * @typeName: the name of the type of this data
207 * @typeChecksum: a checksum that identifies the CDR-representation of the data
208 * @expectsAck: indicates wherther publication expects to receive ACKs to its messages
209 * @persistence: indicates how long the issue is valid
210 * @reliabilityOffered: reliability policy as offered by the publication
211 * @sendQueueSize: size of transmitting queue
212 * @strength: precedence of the issue sent by the publication
213 * @criticalQueueLevel: treshold for transmitting queue content length indicating the queue can became full immediately
214 * @HBNornalRate: how often send HBs to subscription objects
215 * @HBCQLRate: how often send HBs to subscription objects if transmittiong queue has reached @criticalQueueLevel
216 * @HBMaxRetries: how many times retransmit HBs if no replay from target object has not been received
217 * @maxBlockTime: unsupported
219 typedef struct ORTEPublProp {
222 TypeChecksum typeChecksum;
225 uint32_t reliabilityOffered;
226 uint32_t sendQueueSize;
228 uint32_t criticalQueueLevel;
229 NtpTime HBNornalRate;
231 unsigned int HBMaxRetries;
232 NtpTime maxBlockTime;
236 * struct ORTESubsProp - properties of a subscription
237 * @topic: the name of the information in the Network that is published or subscribed to
238 * @typeName: the name of the type of this data
239 * @typeChecksum: a checksum that identifies the CDR-representation of the data
240 * @minimumSeparation: minimum time between two consecutive issues received by the subscription
241 * @recvQueueSize: size of receiving queue
242 * @reliabilityRequested: reliability policy requested by the subscription
243 * @deadline: deadline for subscription, a callback function (see @ORTESubscriptionCreate) will be called if no data were received within this period of time
244 * @mode: mode of subscription (strict reliable/best effort), see @SubscriptionType enum for values
245 * @multicast: registered multicast IP address(read only)
247 typedef struct ORTESubsProp {
250 TypeChecksum typeChecksum;
251 NtpTime minimumSeparation;
252 uint32_t recvQueueSize;
253 uint32_t reliabilityRequested;
254 //additional parameters
261 * struct ORTEAppInfo -
262 * @hostId: hostId of application
263 * @appId: appId of application
264 * @unicastIPAddressList: unicast IP addresses of the host on which the application runs (there can be multiple addresses on a multi-NIC host)
265 * @unicastIPAddressCount: number of IPaddresses in @unicastIPAddressList
266 * @metatrafficMulticastIPAddressList: for the purposes of meta-traffic, an application can also accept Messages on this set of multicast addresses
267 * @metatrafficMulticastIPAddressCount: number of IPaddresses in @metatrafficMulticastIPAddressList
268 * @metatrafficUnicastPort: UDP port used for metatraffic communication
269 * @userdataUnicastPort: UDP port used for metatraffic communication
270 * @vendorId: identifies the vendor of the middleware implementing the RTPS protocol and allows this vendor to add specific extensions to the protocol
271 * @protocolVersion: describes the protocol version
273 typedef struct ORTEAppInfo {
276 IPAddress *unicastIPAddressList;
277 unsigned char unicastIPAddressCount;
278 IPAddress *metatrafficMulticastIPAddressList;
279 unsigned char metatrafficMulticastIPAddressCount;
280 Port metatrafficUnicastPort;
281 Port userdataUnicastPort;
283 ProtocolVersion protocolVersion;
287 * struct ORTEPubInfo -information about publication
288 * @topic: the name of the information in the Network that is published or subscribed to
289 * @type: the name of the type of this data
290 * @objectId: object providing this publication
292 typedef struct ORTEPubInfo {
299 * struct ORTEPubInfo - information about subscription
300 * @topic: the name of the information in the Network that is published or subscribed to
301 * @type: the name of the type of this data
302 * @objectId: object with this subscription
304 typedef struct ORTESubInfo {
311 * struct ORTEPublStatus - status of a publication
312 * @strict: count of unreliable subscription (strict) connected on responsible subscription
313 * @bestEffort: count of reliable subscription (best effort) connected on responsible subscription
314 * @issues: number of messages in transmitting queue
316 typedef struct ORTEPublStatus {
318 unsigned int bestEffort;
323 * struct ORTESubsStatus - status of a subscription
324 * @strict: count of unreliable publications (strict) connected to responsible subscription
325 * @bestEffort: count of reliable publications (best effort) connected to responsible subscription
326 * @issues: number of messages in receiving queue
328 typedef struct ORTESubsStatus {
330 unsigned int bestEffort;
335 * struct ORTERecvInfo - description of received data
336 * @status: status of this event
337 * @topic: the name of the information
338 * @type: the name of the type of this data
339 * @senderGUID: GUID of object who sent this information
340 * @localTimeReceived: local timestamp when data were received
341 * @remoteTimePublished: remote timestam when data were published
342 * @sn: sequencial number of data
344 typedef struct ORTERecvInfo {
345 ORTERecvStatus status;
348 GUID_RTPS senderGUID;
349 NtpTime localTimeReceived;
350 NtpTime remoteTimePublished;
355 * struct ORTESendInfo - description of sending data
356 * @status: status of this event
357 * @topic: the name of the information
358 * @type: the name of the type of this information
359 * @senderGUID: GUID of object who sent this information
360 * @sn: sequencial number of information
362 typedef struct ORTESendInfo {
363 ORTESendStatus status;
366 GUID_RTPS senderGUID;
373 (*ORTERecvCallBack)(const ORTERecvInfo *info,void *instance, void *recvCallBackParam);
375 (*ORTESendCallBack)(const ORTESendInfo *info,void *instance, void *sendCallBackParam);
376 typedef ORTESubscription*
377 (*ORTESubscriptionPatternCallBack)(const char *topic, const char *type, void *Param);
380 * struct ORTEPublicationSendParam - description of sending data
381 * @instance: pointer to new data instance
382 * @data_endian: endianing of sending data (BIG | LITTLE)
384 typedef struct ORTEPublicationSendParam {
387 } ORTEPublicationSendParam;
391 (*ORTEPatternCheck)(const char *string);
393 (*ORTEPatternMatch)(const char *topic,const char *pattern,void *param);
395 ORTEPatternCheckDefault(const char *topic);
397 ORTEPatternMatchDefault(const char *topic,const char *pattern,void *param);
399 ORTEPatternRegister(ORTEDomain *d,ORTEPatternCheck check,
400 ORTEPatternMatch match,void *param);
405 (*ORTEOnRegFail)(void *param);
407 (*ORTEOnMgrNew)(const struct ORTEAppInfo *appInfo, void *param);
409 (*ORTEOnMgrDelete)(const struct ORTEAppInfo *appInfo, void *param);
412 (*ORTEOnAppRemoteNew)(const struct ORTEAppInfo *appInfo, void *param);
413 typedef void (*ORTEOnAppDelete)
414 (const struct ORTEAppInfo *appInfo, void *param);
417 (*ORTEOnPubRemote)(const struct ORTEAppInfo *appInfo,
418 const struct ORTEPubInfo *pubInfo, void *param);
420 (*ORTEOnPubDelete)(const struct ORTEAppInfo *appInfo,
421 const struct ORTEPubInfo *pubInfo, void *param);
424 (*ORTEOnSubRemote)(const struct ORTEAppInfo *appInfo,
425 const struct ORTESubInfo *subInfo, void *param);
427 (*ORTEOnSubDelete)(const struct ORTEAppInfo *appInfo,
428 const struct ORTESubInfo *subInfo, void *param);
431 * struct ORTEDomainAppEvents - Domain event handlers of an application
432 * @onRegFail: registration protocol has been failed
433 * @onRegFailParam: user parameters for @onRegFail handler
434 * @onMgrNew: new manager has been created
435 * @onMgrNewParam: user parameters for @onMgrNew handler
436 * @onMgrDelete: manager has been deleted
437 * @onMgrDeleteParam: user parameters for @onMgrDelete handler
438 * @onAppRemoteNew: new remote application has been registered
439 * @onAppRemoteNewParam: user parameters for @onAppRemoteNew handler
440 * @onAppDelete: an application has been removed
441 * @onAppDeleteParam: user parameters for @onAppDelete handler
442 * @onPubRemoteNew: new remote publication has been registered
443 * @onPubRemoteNewParam: user parameters for @onPubRemoteNew handler
444 * @onPubRemoteChanged: a remote publication's parameters has been changed
445 * @onPubRemoteChangedParam: user parameters for @onPubRemoteChanged handler
446 * @onPubDelete: a publication has been deleted
447 * @onPubDeleteParam: user parameters for @onPubDelete handler
448 * @onSubRemoteNew: a new remote subscription has been registered
449 * @onSubRemoteNewParam: user parameters for @onSubRemoteNew handler
450 * @onSubRemoteChanged: a remote subscription's parameters has been changed
451 * @onSubRemoteChangedParam: user parameters for @onSubRemoteChanged handler
452 * @onSubDelete: a publication has been deleted
453 * @onSubDeleteParam: user parameters for @onSubDelete handler
455 * Prototypes of events handler fucntions can be found in file typedefs_api.h.
457 typedef struct ORTEDomainAppEvents {
458 ORTEOnRegFail onRegFail;
459 void *onRegFailParam;
460 ORTEOnMgrNew onMgrNew;
462 ORTEOnMgrDelete onMgrDelete;
463 void *onMgrDeleteParam;
464 ORTEOnAppRemoteNew onAppRemoteNew;
465 void *onAppRemoteNewParam;
466 ORTEOnAppDelete onAppDelete;
467 void *onAppDeleteParam;
468 ORTEOnPubRemote onPubRemoteNew;
469 void *onPubRemoteNewParam;
470 ORTEOnPubRemote onPubRemoteChanged;
471 void *onPubRemoteChangedParam;
472 ORTEOnPubDelete onPubDelete;
473 void *onPubDeleteParam;
474 ORTEOnSubRemote onSubRemoteNew;
475 void *onSubRemoteNewParam;
476 ORTEOnSubRemote onSubRemoteChanged;
477 void *onSubRemoteChangedParam;
478 ORTEOnSubDelete onSubDelete;
479 void *onSubDeleteParam;
480 } ORTEDomainAppEvents;
483 * struct ORTETaskProp - ORTE task properties, not supported
484 * @realTimeEnabled: not supported
485 * @smtStackSize: not supported
486 * @smtPriority: not supported
487 * @rmtStackSize: not supported
488 * @rmtPriority: not supported
490 typedef struct ORTETasksProp {
491 Boolean realTimeEnabled;
499 * struct ORTEDomainApp - domain properties
500 * @tasksProp: task properties
501 * @IFProp: properties of network interfaces
502 * @IFCount: number of network interfaces
503 * @baseProp: base properties (see @ORTEDomainBaseProp for details)
504 * @wireProp: wire properties (see @ORTEDomainWireProp for details)
505 * @multicast: multicast properties (see @ORTEMulticastProp for details)
506 * @publPropDefault: default properties of publiciations (see @ORTEPublProp for details)
507 * @subsPropDefault: default properties of subscriptions (see @ORTESubsProp for details)
508 * @mgrs: list of known managers
509 * @keys: access keys for managers
510 * @appLocalManager: IP address of local manager (default localhost)
511 * @version: string product version
512 * @recvBuffSize: receiving queue length
513 * @sendBuffSize: transmitting queue length
515 typedef struct ORTEDomainProp {
516 ORTETasksProp tasksProp;
517 ORTEIFProp IFProp[MAX_INTERFACES]; //interface properties
518 unsigned char IFCount; //count of interfaces
519 ORTEDomainBaseProp baseProp;
520 ORTEDomainWireProp wireProp;
521 ORTEMulticastProp multicast; //multicast properies
522 ORTEPublProp publPropDefault; //default properties for a Publ/Sub
523 ORTESubsProp subsPropDefault;
524 char *mgrs; //managers
526 IPAddress appLocalManager; //applications
527 char version[60]; //string product version
536 #endif /* _TYPEDEFS_API_H */