2 * $Id: typedefs.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.
28 typedef struct CSTWriter CSTWriter; //forward declarations
29 typedef struct CSTReader CSTReader;
30 typedef struct ObjectEntryOID ObjectEntryOID;
31 typedef struct ObjectEntryHID ObjectEntryHID;
32 typedef struct ObjectEntryAID ObjectEntryAID;
33 typedef struct ObjectEntry ObjectEntry;
38 typedef struct sock_t {
44 * struct - MessageBuffer
46 typedef struct MessageBuffer {
47 ORTECDRStream cdrStream;
48 ORTECDRStream *cdrStreamDirect;
50 Boolean containsInfoReply;
55 typedef struct TaskProp {
65 typedef struct TypeEntry {
66 gavl_cust_root_field_t types; //Types
67 pthread_rwlock_t lock;
73 typedef struct TypeNode {
75 ORTETypeRegister typeRegister;
79 * struct PatternsNode -
81 typedef struct PatternNode {
85 ORTESubscriptionPatternCallBack subscriptionCallBack;
90 * struct PatternEntry -
92 typedef struct PatternEntry {
93 ul_list_head_t patterns;
94 ORTEPatternCheck check;
95 ORTEPatternMatch match;
97 pthread_rwlock_t lock;
101 * struct AppParams - Manager & ManagedApplication
103 typedef struct AppParams {
106 IPAddress unicastIPAddressList[MAX_INTERFACES];
107 unsigned char unicastIPAddressCount;
108 IPAddress metatrafficMulticastIPAddressList[MAX_INTERFACES];
109 unsigned char metatrafficMulticastIPAddressCount;
110 IPAddress managerKeyList[MAX_INTERFACES];//useful only for manager
111 unsigned char managerKeyCount; //useful only for manager
112 Port metatrafficUnicastPort;
113 Port userdataUnicastPort;
115 ProtocolVersion protocolVersion;
116 NtpTime expirationTime;
117 SequenceNumber vargAppsSequenceNumber; //useful only for manager
120 typedef void EVH1(ORTEDomain *,ObjectEntryAID *,ul_htim_time_t *);
122 * struct HTimFncRootNode -
124 typedef struct HTimFncRootNode {
128 ObjectEntryAID *objectEntryAID;
134 typedef struct HTimNode {
135 ul_htim_queue_t common; //timing queue for a timer function
136 HTimFncRootNode commonNode; //root node
137 ul_htim_queue_t sendMetatraffic; //timing queue for sendMetatraffic
138 HTimFncRootNode sendMetatrafficNode; //root node
139 ul_htim_queue_t sendUserData; //timing queue for sendUserData
140 HTimFncRootNode sendUserDataNode; //root node
144 * struct HTimFncUserNode -
146 typedef int EVH2(ORTEDomain *,void *);
147 typedef struct HTimFncUserNode {
150 pthread_rwlock_t *lock; //when func share params, lock is called before call the func
156 * struct ObjectEntry - Tree of objects
158 struct ObjectEntryOID{
161 GUID_RTPS guid; //for easy access to guid
163 ObjectEntryAID *objectEntryAID;
164 ObjectEntryHID *objectEntryHID;
165 void *attributes; //atributes of object
167 Boolean private; //object created by me self app
168 HTimFncUserNode expirationPurgeTimer;
169 //only for private CSTPublication,CSTSubscription
170 void *instance; //data stream
171 ORTERecvCallBack recvCallBack;
172 ORTESendCallBack sendCallBack;
174 NtpTime sendCallBackDelay;
175 HTimFncUserNode sendCallBackDelayTimer;
176 //only for list of publishers or subscribers
179 struct ObjectEntryAID {
182 HTimNode htimUnicast; //parameters for Unicast
183 gavl_cust_root_field_t oidRoot;
185 struct ObjectEntryHID{
188 gavl_cust_root_field_t aidRoot;
191 gavl_cust_root_field_t objRoot; //root of tree objects
192 pthread_rwlock_t objRootLock;
193 ul_htim_queue_t htimRoot; //root of tree htimers
194 pthread_rwlock_t htimRootLock;
195 sem_t htimSendSem; //for wake up
196 Boolean htimNeedWakeUp;
200 * struct ParameterSequence -
202 typedef struct ParameterSequence {
204 ParameterId parameterID;
205 ParameterLength parameterLength;
206 u_char parameterLocal[MAX_PARAMETER_LOCAL_LENGTH];
213 typedef struct CSChange {
214 ul_list_node_t nodeList;
215 gavl_node_t nodeGAVL;
219 SequenceNumber gapSN; //>0 means sn is in GAP
220 // 1 - sn is gap, 2 - sn,sn+1 are gaps, ...
221 ul_list_head_t attributes;
222 ORTECDRStream cdrStream; //for issue
223 //how many times was a cstRemoteWriter acknowledged
224 int remoteReaderCount;
225 int remoteReaderBest;
226 int remoteReaderStrict;
227 //receiving informations
228 NtpTime remoteTimePublished;
229 NtpTime localTimeReceived;
233 * struct CSTWriterParams -
235 typedef struct CSTWriterParams {
236 NtpTime waitWhileDataUnderwayTime;
237 NtpTime repeatAnnounceTime;
238 NtpTime delayResponceTime;
239 NtpTime refreshPeriod;
240 unsigned int HBMaxRetries;
241 Boolean fullAcknowledge;
245 * struct CSChangeForReader -
247 typedef struct CSChangeForReader {
250 StateMachineChFReader commStateChFReader;
251 HTimFncUserNode waitWhileDataUnderwayTimer;
255 * struct CSTRemoteReader -
257 typedef struct CSTRemoteReader {
259 CSTWriter *cstWriter;
260 ObjectEntryOID *objectEntryOID;
263 gavl_cust_root_field_t csChangeForReader;
264 int csChangesCounter;
267 StateMachineHB commStateHB;
268 StateMachineSend commStateSend;
271 HTimFncUserNode delayResponceTimer;
272 HTimFncUserNode repeatAnnounceTimer;
274 unsigned int HBRetriesCounter;
276 NtpTime lastSentIssueTime;
279 typedef struct CSTPublications CSTPublications;
287 ObjectEntryOID *objectEntryOID;
289 SequenceNumber firstSN;
290 SequenceNumber lastSN;
292 CSTWriterParams params;
294 ul_list_head_t csChanges;
295 int csChangesCounter;
296 gavl_cust_root_field_t cstRemoteReader;
297 int cstRemoteReaderCounter;
298 pthread_rwlock_t lock;
300 HTimFncUserNode refreshPeriodTimer;
302 //ser./deser. function
303 ORTETypeRegister *typeRegister;
305 //only for CSTPublications
306 unsigned int strictReliableCounter;
307 unsigned int bestEffortsCounter;
308 sem_t semCSChangeDestroyed;
312 * struct CSTReaderParams -
314 typedef struct CSTReaderParams {
315 NtpTime delayResponceTimeMin;
316 NtpTime delayResponceTimeMax;
317 NtpTime repeatActiveQueryTime;
318 Boolean fullAcknowledge;
319 unsigned int ACKMaxRetries;
323 * struct CSChangeFromWriter -
325 typedef struct CSChangeFromWriter {
328 StateMachineChFWriter commStateChFWriter;
329 } CSChangeFromWriter;
332 * struct CSTRemoteWriter -
334 typedef struct CSTRemoteWriter {
336 CSTReader *cstReader;
337 ObjectEntryOID *objectEntryOID;
340 gavl_cust_root_field_t csChangeFromWriter;
341 int csChangesCounter;
344 SequenceNumber firstSN;
345 SequenceNumber lastSN;
348 StateMachineACK commStateACK;
351 HTimFncUserNode delayResponceTimer;
352 HTimFncUserNode repeatActiveQueryTimer;
354 int ACKRetriesCounter;
357 typedef struct CSTSubscriptions CSTSubscriptions;
365 ObjectEntryOID *objectEntryOID;
367 CSTReaderParams params;
369 ul_list_head_t csChanges;
370 gavl_cust_root_field_t cstRemoteWriter;
371 int cstRemoteWriterCounter;
372 pthread_rwlock_t lock;
374 //ser./deser. function
375 ORTETypeRegister *typeRegister;
377 //only for CSTSubcriptions
378 CSTRemoteWriter *cstRemoteWriterSubscribed;
379 HTimFncUserNode deadlineTimer;
380 HTimFncUserNode persistenceTimer;
382 unsigned int strictReliableCounter;
383 unsigned int bestEffortsCounter;
385 Boolean createdByPattern;
389 * struct CSTPublications -
391 struct CSTPublications {
392 gavl_cust_root_field_t cstWriter;
393 pthread_rwlock_t lock;
398 * struct CSTSubscriptions -
400 struct CSTSubscriptions {
401 gavl_cust_root_field_t cstReader;
402 pthread_rwlock_t lock;
409 typedef struct PSEntry {
410 gavl_cust_root_field_t publications;
411 pthread_rwlock_t publicationsLock;
412 gavl_cust_root_field_t subscriptions;
413 pthread_rwlock_t subscriptionsLock;
417 * struct ORTEDomain -
420 u_int32_t domain; //domain value
421 GUID_RTPS guid; //guid of self application
422 AppParams *appParams; //self parameters (share from objectEntry)
423 ObjectEntryOID *objectEntryOID;//entry point for self OID
425 ////////////////////////////////////////////////////
426 //variables for tasks
427 TaskProp taskRecvMetatraffic;
428 MessageBuffer mbRecvMetatraffic;
430 MessageBuffer mbSend;
431 TaskProp taskRecvUserdata;
432 MessageBuffer mbRecvUserdata;
434 ////////////////////////////////////////////////////
436 TypeEntry typeEntry; //db of types
437 ObjectEntry objectEntry; //Objects Tree
438 PSEntry psEntry; //lists of publ/subs
439 PatternEntry patternEntry;
441 ORTEDomainProp domainProp;
442 ORTEDomainAppEvents domainEvents;
444 ////////////////////////////////////////////////////
445 //information used by event system
450 ////////////////////////////////////////////////////
451 //communication objects
452 CSTWriter writerApplicationSelf; //Manager,App
453 CSTReader readerManagers; //Manager,App
454 CSTReader readerApplications; //Manager,App
455 CSTWriter writerManagers; //Manager
456 CSTWriter writerApplications; //Manager
457 CSTWriter writerPublications; //App
458 CSTReader readerPublications; //App
459 CSTWriter writerSubscriptions; //App
460 CSTReader readerSubscriptions; //App
462 CSTPublications publications; //App
463 CSTSubscriptions subscriptions; //App
470 #endif /* _TYPEDEFS_H */