CoreDX DDS C Reference Manual
dds_types.h
Go to the documentation of this file.
1 /*****************************************************************
2  *
3  * file: dds_types.h
4  * desc: CoreDX DDS types
5  *
6  *****************************************************************
7  *
8  * Copyright(C) 2006-2016 Twin Oaks Computing, Inc
9  * All rights reserved. Castle Rock, CO 80108
10  *
11  *****************************************************************
12  *
13  * This software has been provided pursuant to a License Agreement
14  * containing restrictions on its use. This software contains
15  * valuable trade secrets and proprietary information of
16  * Twin Oaks Computing, Inc and is protected by law. It may not be
17  * copied or distributed in any form or medium, disclosed to third
18  * parties, reverse engineered or used in any manner not provided
19  * for in said License Agreement except with the prior written
20  * authorization from Twin Oaks Computing, Inc.
21  *
22  *****************************************************************/
23 #ifndef _DDS_TYPES_H
24 #define _DDS_TYPES_H
25 
31 #include <dds/dds_seq.h>
32 #include <dds/dds_map.h>
33 #include <dds/dds_inttypes.h>
34 #include <dds/coredx_logging.h> /* logging flags */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #define DDS_DOMAINID_TYPE_NATIVE unsigned int
41 #define DDS_HANDLE_TYPE_NATIVE intptr_t
42 #define DDS_HANDLE_NIL_NATIVE 0
43 #define DDS_HANDLE_DEFAULT_NATIVE 1
44 #define DDS_BUILTIN_TOPIC_KEY_TYPE_NATIVE int
45 
46 #define CDX_UNUSED(x) (void)(x)
47 
48  typedef unsigned char DDS_Octet;
49 
51  typedef DDS_DOMAINID_TYPE_NATIVE DDS_DomainId_t;
53  typedef DDS_HANDLE_TYPE_NATIVE DDS_InstanceHandle_t;
54 
56  typedef int DDS_ReturnCode_t;
57  typedef int DDS_QosPolicyId_t;
58  typedef unsigned int DDS_SampleStateKind;
59  typedef unsigned int DDS_SampleStateMask;
60  typedef unsigned int DDS_ViewStateKind;
61  typedef unsigned int DDS_ViewStateMask;
62  typedef unsigned int DDS_InstanceStateKind;
63  typedef unsigned int DDS_InstanceStateMask;
64 
65  /* for IDL that references 'boolean', these are used: */
66 # define DDS_TRUE 1
67 # define DDS_FALSE 0
68 
72  typedef struct DDS_Time_t
73  {
74  int sec;
75  uint32_t nanosec;
76  } DDS_Time_t;
77 
78  /*
79  * Pre-defined values
80  */
81 #define DDS_LENGTH_UNLIMITED (-1)
82 
83 #define DDS_DURATION_INFINITE_SEC (0x7fffffff)
84 #define DDS_DURATION_INFINITE_NSEC (0xffffffff)
85 
86 #define DDS_DURATION_ZERO_SEC ( 0 )
87 #define DDS_DURATION_ZERO_NSEC ( 0 )
88 
89 #define DDS_TIMESTAMP_INVALID_SEC ( -1 )
90 #define DDS_TIMESTAMP_INVALID_NSEC ( 0xffffffff )
91 #define DDS_TIMESTAMP_INVALID { DDS_TIMESTAMP_INVALID_SEC, DDS_TIMESTAMP_INVALID_NSEC }
92 
93  /* InstanceHandle codes */
94  COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_NIL;
95  COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_DEFAULT; /* TOC, Inc defined */
96  COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_NOT_ENABLED; /* TOC, Inc defined */
97 
98  /* Return codes */
99 #define DDS_RETCODE_OK ( 0 )
100 #define DDS_RETCODE_ERROR ( 1 )
101 #define DDS_RETCODE_UNSUPPORTED ( 2 )
102 #define DDS_RETCODE_BAD_PARAMETER ( 3 )
103 #define DDS_RETCODE_PRECONDITION_NOT_MET ( 4 )
104 #define DDS_RETCODE_OUT_OF_RESOURCES ( 5 )
105 #define DDS_RETCODE_NOT_ENABLED ( 6 )
106 #define DDS_RETCODE_IMMUTABLE_POLICY ( 7 )
107 #define DDS_RETCODE_INCONSISTENT_POLICY ( 8 )
108 #define DDS_RETCODE_ALREADY_DELETED ( 9 )
109 #define DDS_RETCODE_TIMEOUT ( 10 )
110 #define DDS_RETCODE_NO_DATA ( 11 )
111 
112  /* Sample states */
113 #define DDS_READ_SAMPLE_STATE ( 0x0001 )
114 #define DDS_NOT_READ_SAMPLE_STATE ( 0x0002 )
115 #define DDS_ANY_SAMPLE_STATE ( 0x00FF )
116 
117  /* View states */
118 #define DDS_NEW_VIEW_STATE ( 0x0001 )
119 #define DDS_NOT_NEW_VIEW_STATE ( 0x0002 )
120 #define DDS_ANY_VIEW_STATE ( 0x00FF )
121 
122  /* Instance states to support reads */
123 #define DDS_ALIVE_INSTANCE_STATE ( 0x0001 )
124 #define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE ( 0x0002 )
125 #define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE ( 0x0004 )
126 
127  /* This is a bit-mask InstanceStateKind */
128 #define DDS_NOT_ALIVE_INSTANCE_STATE ( 0x0006 )
129 #define DDS_ANY_INSTANCE_STATE ( 0x00FF )
130 
131  /* Status to support listeners and conditions */
132  typedef unsigned int DDS_StatusKind;
134  typedef unsigned int DDS_StatusMask; /* bit-mask StatusKind */
135 
136 #define DDS_NO_STATUS 0x0000
137 #define DDS_STATUS_MASK_NONE 0x0000
138 #define DDS_INCONSISTENT_TOPIC_STATUS 0x0001
139 #define DDS_OFFERED_DEADLINE_MISSED_STATUS 0x0002
140 #define DDS_REQUESTED_DEADLINE_MISSED_STATUS 0x0004
141 #define DDS_OFFERED_INCOMPATIBLE_QOS_STATUS 0x0008
142 #define DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS 0x0010
143 #define DDS_SAMPLE_LOST_STATUS 0x0020
144 #define DDS_SAMPLE_REJECTED_STATUS 0x0040
145 #define DDS_DATA_ON_READERS_STATUS 0x0080
146 #define DDS_DATA_AVAILABLE_STATUS 0x0100
147 #define DDS_LIVELINESS_LOST_STATUS 0x0200
148 #define DDS_LIVELINESS_CHANGED_STATUS 0x0400
149 #define DDS_PUBLICATION_MATCHED_STATUS 0x0800
150 #define DDS_SUBSCRIPTION_MATCHED_STATUS 0x1000
151 #define DDS_ALL_STATUS 0xFFFF
152 
153  /***********************************************************
154  * SampleInfo *
155  ***********************************************************/
159  typedef struct DDS_SampleInfo
160  {
169  DDS_SampleStateKind sample_state;
178  DDS_ViewStateKind view_state;
190  DDS_InstanceStateKind instance_state;
196  DDS_InstanceHandle_t instance_handle;
198  DDS_InstanceHandle_t publication_handle;
229  unsigned char valid_data;
230  } DDS_SampleInfo ;
231 
232 
233  /***********************************************************
234  * STATUS types *
235  ***********************************************************/
242  {
245  char last_inconsistent_topic_msg[256];
247 
253  typedef struct DDS_SampleLostStatus
254  {
258 
259  typedef enum DDS_SampleRejectedStatusKind
260  {
261  DDS_NOT_REJECTED,
262  DDS_REJECTED_BY_INSTANCE_LIMIT,
263  DDS_REJECTED_BY_SAMPLES_LIMIT,
264  DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT
265  } DDS_SampleRejectedStatusKind;
266 
273  {
276  DDS_SampleRejectedStatusKind last_reason;
277  DDS_InstanceHandle_t last_instance_handle;
279 
286  {
290 
297  {
302  DDS_InstanceHandle_t last_publication_handle;
304 
311  {
314  DDS_InstanceHandle_t last_instance_handle;
322  {
325  DDS_InstanceHandle_t last_instance_handle;
327 
332  typedef struct DDS_QosPolicyCount {
333  DDS_QosPolicyId_t policy_id;
334  int count;
336 
337  DECLARE_SEQ(DDS_QosPolicyCount*, DDS_QosPolicyCountSeq);
338 
345  {
348  DDS_QosPolicyId_t last_policy_id;
349  DDS_QosPolicyCountSeq policies;
351 
358  {
361  DDS_QosPolicyId_t last_policy_id;
362  DDS_QosPolicyCountSeq policies;
364 
371  {
376  DDS_InstanceHandle_t last_subscription_handle;
378 
385  {
390  DDS_InstanceHandle_t last_publication_handle;
392 
393  /***********************************************************
394  * Common Sequence Types *
395  ***********************************************************/
396 
397  DECLARE_SEQ( DDS_SampleInfo *, DDS_SampleInfoSeq );
398  DECLARE_SEQ( short, DDS_ShortSeq);
399  DECLARE_SEQ( void *, DDS_PointerSeq);
400  DECLARE_SEQ( char *, DDS_StringSeq);
401  DECLARE_SEQ( unsigned char, DDS_OctetSeq);
402 
403  COREDX_C_API DDS_SampleInfoSeq * DDS_SampleInfoSeq__alloc(void);
404  COREDX_C_API DDS_PointerSeq * DDS_PointerSeq__alloc(void);
405 
406 
419  typedef struct DDS_CacheStatistics
420  {
421  int32_t instance_count;
426  int32_t sample_count;
428  uint32_t state_flags;
430 
445  COREDX_C_API DDS_ReturnCode_t CoreDX_DDS_heap_init(void * heap_ptr, uint32_t size);
446 
447  /* Memory allocation routines that use the same heap as used by the CoreDX %DDS middleware.
448  * On some platforms this is simply the libC provided malloc system, on other platforms
449  * this is a specialized memory management system provided by CoreDX %DDS.
450  */
451  COREDX_C_API void * CoreDX_DDS_malloc(uint32_t size);
452  COREDX_C_API void * CoreDX_DDS_calloc(uint32_t nmemb, uint32_t size);
453  COREDX_C_API void CoreDX_DDS_free(void * ptr);
454 
455 
456 
457  /***********************************************************************/
458  /* Data types supporting field access by the ContentFilter engine */
459  struct _TypeSupport;
460  struct CoreDX_FieldDef;
461  typedef void *(*CoreDX_fdef_access)(struct _TypeSupport *, const char *field_name, struct CoreDX_FieldDef *def, const void *data);
462  typedef void (*CoreDX_fdef_clear)(struct CoreDX_FieldDef *def);
463  typedef struct CoreDX_FieldDef
464  {
465  unsigned char key;
466  unsigned char kind; /* high bit indicates pointer */
467  unsigned char elem_kind; /* for array */
468  int elem_count; /* for array */
469  CoreDX_fdef_access access;
470  CoreDX_fdef_clear clear;
471  void * user;
472  uint32_t offset;
473  } CoreDX_FieldDef_t;
474 
475  DECLARE_SEQ(unsigned int, CoreDX_FieldDef_OffsetTable);
476 
477  COREDX_C_API void *CoreDX_fielddef_access(struct _TypeSupport *ts,
478  const char *field_name,
479  struct CoreDX_FieldDef *def,
480  const void *data);
481  COREDX_C_API void CoreDX_fielddef_clear(struct CoreDX_FieldDef *def);
482 
483 
484 #ifdef __cplusplus
485 }
486 #endif /* __cplusplus */
487 
488 #endif
int current_count_change
Change in current_count since the last time the listener was called or status was read...
Definition: dds_types.h:375
int alive_count
The number of &#39;active&#39; DataWriters matched to this DataReader.
Definition: dds_types.h:298
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:387
int sample_rank
Number of samples related to this instances that follow in the collection returned by the DataReader ...
Definition: dds_types.h:212
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:360
int generation_rank
The generation difference of this sample and the most recent sample in the collection.
Definition: dds_types.h:218
int total_count
Cummulative count of the number of detected deadline misses for any instance read by the DataReader...
Definition: dds_types.h:323
Status related to the on_offered_incompatible_qos listener methods of the DDS_DataWriter, DDS_Publisher, and DDS_DomainParticipant structures.
Definition: dds_types.h:344
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:347
Encapsulates statistics available from a DataReader or DataWriter.
Definition: dds_types.h:419
DDS_QosPolicyId_t last_policy_id
Id of the most recent requested incompatible QoS policy.
Definition: dds_types.h:348
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:313
Status related to the on_liveliness_changed listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:296
int total_count
Cummulative count of the number of times this DataWriter has discovered a matching DataReader...
Definition: dds_types.h:372
int32_t instance_alive_count
Definition: dds_types.h:422
DDS_InstanceStateKind instance_state
Indicates whether the associated instance currently exists. instance_state can be one of: DDS_ALIVE...
Definition: dds_types.h:190
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:244
int total_count
Cummulative count of the number of deadlines missed by this DataWriter.
Definition: dds_types.h:312
Status related to the on_inconsistent_topic listener methods of the DDS_TopicListener structure...
Definition: dds_types.h:241
uint32_t nanosec
Definition: dds_types.h:75
DDS_QosPolicyCountSeq policies
A list of QoS policies and the total number of times each QoS policy was found to be incompatible...
Definition: dds_types.h:349
DDS_DOMAINID_TYPE_NATIVE DDS_DomainId_t
Definition: dds_types.h:51
int DDS_ReturnCode_t
Definition: dds_types.h:56
int current_count
The current number of DataReaders matched to the DataWriter.
Definition: dds_types.h:374
DDS_InstanceHandle_t publication_handle
The local handle of the source DataWriter.
Definition: dds_types.h:198
int current_count
The current number of DataWriters matched to the DataReader.
Definition: dds_types.h:388
int32_t instance_no_writers_count
Definition: dds_types.h:424
Status related to the on_liveliness_lost listener methods of the DDS_DataWriter, DDS_Publisher, and DDS_DomainParticipant structures.
Definition: dds_types.h:285
int absolute_generation_rank
The generation difference between this sample and the most recent sample.
Definition: dds_types.h:224
Definition: dds_types.h:72
DDS_SampleRejectedStatusKind last_reason
The reason for rejecting the most recently rejected sample.
Definition: dds_types.h:276
int total_count
Cummulative count of all samples lost under the Topic.
Definition: dds_types.h:255
int32_t instance_disposed_count
Definition: dds_types.h:423
unsigned char valid_data
Set to true (non-zero) if the associated DataSample contains data.
Definition: dds_types.h:229
DDS_InstanceHandle_t last_instance_handle
Handle identifying the most recent instance whose deadline was missed.
Definition: dds_types.h:325
Status related to the on_offered_deadline_missed listener methods of the DDS_DataWriter, DDS_Publisher, and DDS_DomainParticipant structures.
Definition: dds_types.h:310
int32_t sample_count
Definition: dds_types.h:426
Holds a DDS_QosPolicyId_t value and a counter to indicate the number of events associated with that P...
Definition: dds_types.h:332
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:288
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:256
int current_count_change
Change in current_count since the last time the listener was called or status was read...
Definition: dds_types.h:389
The SampleInfo structure contains information associated with each sample.
Definition: dds_types.h:159
int not_alive_count_change
Change in not_alive_count since the last time the listener was called or status was read...
Definition: dds_types.h:301
int32_t instance_count
Definition: dds_types.h:421
int no_writers_generation_count
The number of times the instance has become &#39;ALIVE&#39; after being automatically disposed due to no acti...
Definition: dds_types.h:208
DDS_QosPolicyCountSeq policies
A list of QoS policies and the total number of times each QoS policy was found to be incompatible...
Definition: dds_types.h:362
DDS_Time_t reception_timestamp
The time the sample was received by the DataReader.
Definition: dds_types.h:194
DDS_QosPolicyId_t last_policy_id
Handle identifying the most recent QoS policy detected to be incompatible.
Definition: dds_types.h:361
DDS_ViewStateKind view_state
Associated instance has/has not been seen before.
Definition: dds_types.h:178
int total_count
Cummulative number of times that an &#39;alive&#39; DataWriter became not alive.
Definition: dds_types.h:287
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:275
DDS_SampleStateKind sample_state
The associated data sample has/has not been read previously.
Definition: dds_types.h:169
DDS_Time_t source_timestamp
The time provided by the DataWriter when the sample was written.
Definition: dds_types.h:192
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:324
int total_count
Cummulative count of the number of DataWriters discovered having matching Topic and incompatible QoS...
Definition: dds_types.h:346
uint32_t state_flags
Definition: dds_types.h:428
int count
Definition: dds_types.h:334
DECLARE_SEQ(DDS_DynamicTypeMember, DDS_DynamicTypeMemberSeq)
A DDS_DynamicTypeMemberSeq instance is a sequence of DDS_DynamicTypeMember&#39;s.
DDS_InstanceHandle_t last_publication_handle
Handle identifying the most recent DataWriter whose liveliness changed.
Definition: dds_types.h:302
Status related to the on_requested_deadline_missed listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:321
int total_count_change
Change in total_count since the last time the listener was called or status was read.
Definition: dds_types.h:373
int total_count
Cummulative count of the number of times this DataReader has discovered a matching DataWriter...
Definition: dds_types.h:386
int32_t sample_read_count
Definition: dds_types.h:427
Status related to the on_publication_matched listener methods of the DDS_DataWriter, DDS_Publisher, and DDS_DomainParticipant structures.
Definition: dds_types.h:370
int total_count
Cummulative count of samples rejected by the DataReader.
Definition: dds_types.h:274
unsigned int DDS_StatusMask
Definition: dds_types.h:134
DDS_HANDLE_TYPE_NATIVE DDS_InstanceHandle_t
Definition: dds_types.h:53
DDS_InstanceHandle_t last_instance_handle
The handle of the instance associated with the most recently rejected sample.
Definition: dds_types.h:277
int sec
Definition: dds_types.h:74
Status related to the on_subscription_matched listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:384
DDS_InstanceHandle_t last_instance_handle
Handle identifying the most recent instance whose deadline was missed.
Definition: dds_types.h:314
Status related to the on_requested_incompatible_qos listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:357
int not_alive_count
The number of &#39;not-alive&#39; DataWriters matched to this DataReader.
Definition: dds_types.h:299
DDS_InstanceHandle_t instance_handle
The handle that locally identifies the associated instance.
Definition: dds_types.h:196
DDS_QosPolicyId_t policy_id
Definition: dds_types.h:333
int alive_count_change
Change in alive_count since the last time the listener was called or status was read.
Definition: dds_types.h:300
int total_count
Cummulative count of the number of discovered DataReaders having matching Topic and incompatible QoS...
Definition: dds_types.h:359
int disposed_generation_count
The number of times the instance has become &#39;ALIVE&#39; after being explicitly disposed. (Computed at the time the sample arrives at the DataReader.)
Definition: dds_types.h:202
Status related to the on_sample_lost listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:253
int32_t instance_new_count
Definition: dds_types.h:425
int total_count
Cummulative count of the discovered Topics having a matching name and inconsistent characteristics...
Definition: dds_types.h:243
Status related to the on_sample_rejected listener methods of the DDS_DataReader, DDS_Subscriber, and DDS_DomainParticipant structures.
Definition: dds_types.h:272

© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.