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 privateCreated; //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 pthread_cond_t htimSendCond; //for wake up
196 pthread_mutex_t htimSendMutex;
197 int htimSendCondValue;
198 Boolean htimNeedWakeUp;
202 * struct ParameterSequence -
204 typedef struct ParameterSequence {
206 ParameterId parameterID;
207 ParameterLength parameterLength;
208 u_char parameterLocal[MAX_PARAMETER_LOCAL_LENGTH];
215 typedef struct CSChange {
216 ul_list_node_t nodeList;
217 gavl_node_t nodeGAVL;
221 SequenceNumber gapSN; //>0 means sn is in GAP
222 // 1 - sn is gap, 2 - sn,sn+1 are gaps, ...
223 ul_list_head_t attributes;
224 ORTECDRStream cdrStream; //for issue
225 //how many times was a cstRemoteWriter acknowledged
226 int remoteReaderCount;
227 int remoteReaderBest;
228 int remoteReaderStrict;
229 //receiving informations
230 NtpTime remoteTimePublished;
231 NtpTime localTimeReceived;
235 * struct CSTWriterParams -
237 typedef struct CSTWriterParams {
238 NtpTime waitWhileDataUnderwayTime;
239 NtpTime repeatAnnounceTime;
240 NtpTime delayResponceTime;
241 NtpTime refreshPeriod;
242 unsigned int HBMaxRetries;
243 Boolean fullAcknowledge;
247 * struct CSChangeForReader -
249 typedef struct CSChangeForReader {
252 StateMachineChFReader commStateChFReader;
253 HTimFncUserNode waitWhileDataUnderwayTimer;
257 * struct CSTRemoteReader -
259 typedef struct CSTRemoteReader {
261 CSTWriter *cstWriter;
262 ObjectEntryOID *objectEntryOID;
265 gavl_cust_root_field_t csChangeForReader;
266 unsigned int csChangesCounter;
269 StateMachineHB commStateHB;
270 StateMachineSend commStateSend;
273 HTimFncUserNode delayResponceTimer;
274 HTimFncUserNode repeatAnnounceTimer;
276 unsigned int HBRetriesCounter;
278 NtpTime lastSentIssueTime;
281 typedef struct CSTPublications CSTPublications;
289 ObjectEntryOID *objectEntryOID;
291 SequenceNumber firstSN;
292 SequenceNumber lastSN;
294 CSTWriterParams params;
296 ul_list_head_t csChanges;
297 unsigned int csChangesCounter;
298 gavl_cust_root_field_t cstRemoteReader;
299 unsigned int cstRemoteReaderCounter;
300 pthread_rwlock_t lock;
302 HTimFncUserNode refreshPeriodTimer;
304 //ser./deser. function
305 ORTETypeRegister *typeRegister;
307 //only for CSTPublications
308 unsigned int strictReliableCounter;
309 unsigned int bestEffortsCounter;
310 pthread_cond_t condCSChangeDestroyed; //for wake up
311 pthread_mutex_t mutexCSChangeDestroyed;
312 int condValueCSChangeDestroyed;
316 * struct CSTReaderParams -
318 typedef struct CSTReaderParams {
319 NtpTime delayResponceTimeMin;
320 NtpTime delayResponceTimeMax;
321 NtpTime repeatActiveQueryTime;
322 Boolean fullAcknowledge;
323 unsigned int ACKMaxRetries;
327 * struct CSChangeFromWriter -
329 typedef struct CSChangeFromWriter {
332 StateMachineChFWriter commStateChFWriter;
333 } CSChangeFromWriter;
336 * struct CSTRemoteWriter -
338 typedef struct CSTRemoteWriter {
340 CSTReader *cstReader;
341 ObjectEntryOID *objectEntryOID;
344 gavl_cust_root_field_t csChangeFromWriter;
345 unsigned int csChangesCounter;
348 SequenceNumber firstSN;
349 SequenceNumber lastSN;
352 StateMachineACK commStateACK;
355 HTimFncUserNode delayResponceTimer;
356 HTimFncUserNode repeatActiveQueryTimer;
358 unsigned int ACKRetriesCounter;
361 typedef struct CSTSubscriptions CSTSubscriptions;
369 ObjectEntryOID *objectEntryOID;
371 CSTReaderParams params;
373 ul_list_head_t csChanges;
374 gavl_cust_root_field_t cstRemoteWriter;
375 unsigned int cstRemoteWriterCounter;
376 pthread_rwlock_t lock;
378 //ser./deser. function
379 ORTETypeRegister *typeRegister;
381 //only for CSTSubcriptions
382 CSTRemoteWriter *cstRemoteWriterSubscribed;
383 HTimFncUserNode deadlineTimer;
384 HTimFncUserNode persistenceTimer;
386 unsigned int strictReliableCounter;
387 unsigned int bestEffortsCounter;
389 Boolean createdByPattern;
393 * struct CSTPublications -
395 struct CSTPublications {
396 gavl_cust_root_field_t cstWriter;
397 pthread_rwlock_t lock;
402 * struct CSTSubscriptions -
404 struct CSTSubscriptions {
405 gavl_cust_root_field_t cstReader;
406 pthread_rwlock_t lock;
413 typedef struct PSEntry {
414 gavl_cust_root_field_t publications;
415 pthread_rwlock_t publicationsLock;
416 gavl_cust_root_field_t subscriptions;
417 pthread_rwlock_t subscriptionsLock;
421 * struct ORTEDomain -
424 uint32_t domain; //domain value
425 GUID_RTPS guid; //guid of self application
426 AppParams *appParams; //self parameters (share from objectEntry)
427 ObjectEntryOID *objectEntryOID;//entry point for self OID
429 ////////////////////////////////////////////////////
430 //variables for tasks
431 TaskProp taskRecvMetatraffic;
432 MessageBuffer mbRecvMetatraffic;
434 MessageBuffer mbSend;
435 TaskProp taskRecvUserdata;
436 MessageBuffer mbRecvUserdata;
438 ////////////////////////////////////////////////////
440 TypeEntry typeEntry; //db of types
441 ObjectEntry objectEntry; //Objects Tree
442 PSEntry psEntry; //lists of publ/subs
443 PatternEntry patternEntry;
445 ORTEDomainProp domainProp;
446 ORTEDomainAppEvents domainEvents;
448 ////////////////////////////////////////////////////
449 //information used by event system
454 ////////////////////////////////////////////////////
455 //communication objects
456 CSTWriter writerApplicationSelf; //Manager,App
457 CSTReader readerManagers; //Manager,App
458 CSTReader readerApplications; //Manager,App
459 CSTWriter writerManagers; //Manager
460 CSTWriter writerApplications; //Manager
461 CSTWriter writerPublications; //App
462 CSTReader readerPublications; //App
463 CSTWriter writerSubscriptions; //App
464 CSTReader readerSubscriptions; //App
466 CSTPublications publications; //App
467 CSTSubscriptions subscriptions; //App
474 #endif /* _TYPEDEFS_H */