00001 /***************************************************************** 00002 * 00003 * file: dds_types.h 00004 * desc: CoreDX DDS types 00005 * 00006 ***************************************************************** 00007 * 00008 * Copyright(C) 2006-2013 Twin Oaks Computing, Inc 00009 * All rights reserved. Castle Rock, CO 80108 00010 * 00011 ***************************************************************** 00012 * 00013 * This software has been provided pursuant to a License Agreement 00014 * containing restrictions on its use. This software contains 00015 * valuable trade secrets and proprietary information of 00016 * Twin Oaks Computing, Inc and is protected by law. It may not be 00017 * copied or distributed in any form or medium, disclosed to third 00018 * parties, reverse engineered or used in any manner not provided 00019 * for in said License Agreement except with the prior written 00020 * authorization from Twin Oaks Computing, Inc. 00021 * 00022 *****************************************************************/ 00023 #ifndef _DDS_TYPES_H 00024 #define _DDS_TYPES_H 00025 00031 #include <dds/dds_seq.h> 00032 #include <dds/dds_inttypes.h> 00033 00034 #define DDS_DOMAINID_TYPE_NATIVE unsigned int 00035 #define DDS_HANDLE_TYPE_NATIVE unsigned long 00036 #define DDS_HANDLE_NIL_NATIVE 0 00037 #define DDS_HANDLE_DEFAULT_NATIVE 1 00038 #define DDS_BUILTIN_TOPIC_KEY_TYPE_NATIVE int 00039 00040 #define CDX_UNUSED(x) (void)(x) 00041 00042 typedef unsigned char DDS_Octet; 00043 typedef DDS_DOMAINID_TYPE_NATIVE DDS_DomainId_t; 00044 typedef DDS_HANDLE_TYPE_NATIVE DDS_InstanceHandle_t; 00045 00046 typedef int DDS_ReturnCode_t; 00047 typedef int DDS_QosPolicyId_t; 00048 typedef unsigned int DDS_SampleStateKind; 00049 typedef unsigned int DDS_SampleStateMask; 00050 typedef unsigned int DDS_ViewStateKind; 00051 typedef unsigned int DDS_ViewStateMask; 00052 typedef unsigned int DDS_InstanceStateKind; 00053 typedef unsigned int DDS_InstanceStateMask; 00054 00055 /* for IDL that references 'boolean', these are used: */ 00056 # define DDS_TRUE 1 00057 # define DDS_FALSE 0 00058 00059 typedef struct DDS_BuiltinTopicKey_t { 00060 DDS_BUILTIN_TOPIC_KEY_TYPE_NATIVE value[3]; 00061 } DDS_BuiltinTopicKey_t; 00062 00066 typedef struct DDS_Duration_t 00067 { 00068 int sec; 00069 unsigned int nanosec; 00070 } DDS_Duration_t; 00071 00075 typedef struct DDS_Time_t 00076 { 00077 int sec; 00078 unsigned int nanosec; 00079 } DDS_Time_t; 00080 00081 /* 00082 * Pre-defined values 00083 */ 00084 #define DDS_LENGTH_UNLIMITED (-1) 00085 00086 #define DDS_DURATION_INFINITE_SEC (0x7fffffff) 00087 #define DDS_DURATION_INFINITE_NSEC (0xffffffff) 00088 00089 #define DDS_DURATION_ZERO_SEC ( 0 ) 00090 #define DDS_DURATION_ZERO_NSEC ( 0 ) 00091 00092 #define DDS_TIMESTAMP_INVALID_SEC ( -1 ) 00093 #define DDS_TIMESTAMP_INVALID_NSEC ( 0xffffffff ) 00094 #define DDS_TIMESTAMP_INVALID { DDS_TIMESTAMP_INVALID_SEC, DDS_TIMESTAMP_INVALID_NSEC } 00095 00096 /* 00097 * InstanceHandle codes 00098 */ 00099 COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_NIL; 00100 COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_DEFAULT; /* TOC, Inc defined */ 00101 COREDX_C_API DDS_InstanceHandle_t DDS_HANDLE_NOT_ENABLED; /* TOC, Inc defined */ 00102 00103 /* 00104 * Return codes 00105 */ 00106 #define DDS_RETCODE_OK ( 0 ) 00107 #define DDS_RETCODE_ERROR ( 1 ) 00108 #define DDS_RETCODE_UNSUPPORTED ( 2 ) 00109 #define DDS_RETCODE_BAD_PARAMETER ( 3 ) 00110 #define DDS_RETCODE_PRECONDITION_NOT_MET ( 4 ) 00111 #define DDS_RETCODE_OUT_OF_RESOURCES ( 5 ) 00112 #define DDS_RETCODE_NOT_ENABLED ( 6 ) 00113 #define DDS_RETCODE_IMMUTABLE_POLICY ( 7 ) 00114 #define DDS_RETCODE_INCONSISTENT_POLICY ( 8 ) 00115 #define DDS_RETCODE_ALREADY_DELETED ( 9 ) 00116 #define DDS_RETCODE_TIMEOUT ( 10 ) 00117 #define DDS_RETCODE_NO_DATA ( 11 ) 00118 00119 #define DDS_READ_SAMPLE_STATE ( 0x0001 ) 00120 #define DDS_NOT_READ_SAMPLE_STATE ( 0x0002 ) 00121 #define DDS_ANY_SAMPLE_STATE ( 0x00FF ) 00122 00123 #define DDS_NEW_VIEW_STATE ( 0x0001 ) 00124 #define DDS_NOT_NEW_VIEW_STATE ( 0x0002 ) 00125 #define DDS_ANY_VIEW_STATE ( 0x00FF ) 00126 00127 /* Instance states to support reads */ 00128 #define DDS_ALIVE_INSTANCE_STATE ( 0x0001 ) 00129 #define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE ( 0x0002 ) 00130 #define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE ( 0x0004 ) 00131 00132 /* This is a bit-mask InstanceStateKind */ 00133 #define DDS_NOT_ALIVE_INSTANCE_STATE ( 0x0006 ) 00134 #define DDS_ANY_INSTANCE_STATE ( 0x00FF ) 00135 00136 /* 00137 * Status to support listeners and conditions 00138 */ 00139 typedef unsigned int DDS_StatusKind; 00140 typedef unsigned int DDS_StatusMask; /* bit-mask StatusKind */ 00141 00142 COREDX_C_API DDS_StatusKind DDS_INCONSISTENT_TOPIC_STATUS; 00143 COREDX_C_API DDS_StatusKind DDS_OFFERED_DEADLINE_MISSED_STATUS; 00144 COREDX_C_API DDS_StatusKind DDS_REQUESTED_DEADLINE_MISSED_STATUS; 00145 COREDX_C_API DDS_StatusKind DDS_OFFERED_INCOMPATIBLE_QOS_STATUS; 00146 COREDX_C_API DDS_StatusKind DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS; 00147 COREDX_C_API DDS_StatusKind DDS_SAMPLE_LOST_STATUS; 00148 COREDX_C_API DDS_StatusKind DDS_SAMPLE_REJECTED_STATUS; 00149 COREDX_C_API DDS_StatusKind DDS_DATA_ON_READERS_STATUS; 00150 COREDX_C_API DDS_StatusKind DDS_DATA_AVAILABLE_STATUS; 00151 COREDX_C_API DDS_StatusKind DDS_LIVELINESS_LOST_STATUS; 00152 COREDX_C_API DDS_StatusKind DDS_LIVELINESS_CHANGED_STATUS; 00153 COREDX_C_API DDS_StatusKind DDS_PUBLICATION_MATCHED_STATUS; 00154 COREDX_C_API DDS_StatusKind DDS_SUBSCRIPTION_MATCHED_STATUS; 00155 COREDX_C_API DDS_StatusKind DDS_ALL_STATUS; 00156 00157 /*********************************************************** 00158 * SampleInfo * 00159 ***********************************************************/ 00163 typedef struct DDS_SampleInfo 00164 { 00173 DDS_SampleStateKind sample_state; 00182 DDS_ViewStateKind view_state; 00194 DDS_InstanceStateKind instance_state; 00196 DDS_Time_t source_timestamp; 00198 DDS_Time_t reception_timestamp; 00200 DDS_InstanceHandle_t instance_handle; 00202 DDS_InstanceHandle_t publication_handle; 00206 int disposed_generation_count; 00212 int no_writers_generation_count; 00216 int sample_rank; 00222 int generation_rank; 00228 int absolute_generation_rank; 00233 unsigned char valid_data; 00234 } DDS_SampleInfo ; 00235 00236 00237 /*********************************************************** 00238 * STATUS types * 00239 ***********************************************************/ 00245 typedef struct DDS_InconsistentTopicStatus 00246 { 00247 int total_count; 00248 int total_count_change; 00249 } DDS_InconsistentTopicStatus; 00250 00256 typedef struct DDS_SampleLostStatus 00257 { 00258 int total_count; 00259 int total_count_change; 00260 } DDS_SampleLostStatus; 00261 00262 typedef enum DDS_SampleRejectedStatusKind 00263 { 00264 DDS_NOT_REJECTED, 00265 DDS_REJECTED_BY_INSTANCE_LIMIT, 00266 DDS_REJECTED_BY_SAMPLES_LIMIT, 00267 DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT 00268 } DDS_SampleRejectedStatusKind; 00269 00275 typedef struct DDS_SampleRejectedStatus 00276 { 00277 int total_count; 00278 int total_count_change; 00279 DDS_SampleRejectedStatusKind last_reason; 00280 DDS_InstanceHandle_t last_instance_handle; 00281 } DDS_SampleRejectedStatus; 00282 00288 typedef struct DDS_LivelinessLostStatus 00289 { 00290 int total_count; 00291 int total_count_change; 00292 } DDS_LivelinessLostStatus; 00293 00299 typedef struct DDS_LivelinessChangedStatus 00300 { 00301 int alive_count; 00302 int not_alive_count; 00303 int alive_count_change; 00304 int not_alive_count_change; 00305 DDS_InstanceHandle_t last_publication_handle; 00306 } DDS_LivelinessChangedStatus; 00307 00313 typedef struct DDS_OfferedDeadlineMissedStatus 00314 { 00315 int total_count; 00316 int total_count_change; 00317 DDS_InstanceHandle_t last_instance_handle; 00318 } DDS_OfferedDeadlineMissedStatus; 00324 typedef struct DDS_RequestedDeadlineMissedStatus 00325 { 00326 int total_count; 00327 int total_count_change; 00328 DDS_InstanceHandle_t last_instance_handle; 00329 } DDS_RequestedDeadlineMissedStatus; 00330 00335 typedef struct DDS_QosPolicyCount { 00336 DDS_QosPolicyId_t policy_id; 00337 int count; 00338 } DDS_QosPolicyCount; 00339 00340 DECLARE_SEQ(DDS_QosPolicyCount*, DDS_QosPolicyCountSeq); 00341 00347 typedef struct DDS_OfferedIncompatibleQosStatus 00348 { 00349 int total_count; 00350 int total_count_change; 00351 DDS_QosPolicyId_t last_policy_id; 00352 DDS_QosPolicyCountSeq policies; 00353 } DDS_OfferedIncompatibleQosStatus; 00354 00360 typedef struct DDS_RequestedIncompatibleQosStatus 00361 { 00362 int total_count; 00363 int total_count_change; 00364 DDS_QosPolicyId_t last_policy_id; 00365 DDS_QosPolicyCountSeq policies; 00366 } DDS_RequestedIncompatibleQosStatus; 00367 00373 typedef struct DDS_PublicationMatchedStatus 00374 { 00375 int total_count; 00376 int total_count_change; 00377 int current_count; 00378 int current_count_change; 00379 DDS_InstanceHandle_t last_subscription_handle; 00380 } DDS_PublicationMatchedStatus; 00381 00387 typedef struct DDS_SubscriptionMatchedStatus 00388 { 00389 int total_count; 00390 int total_count_change; 00391 int current_count; 00392 int current_count_change; 00393 DDS_InstanceHandle_t last_publication_handle; 00394 } DDS_SubscriptionMatchedStatus; 00395 00396 00397 #endif