00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_TRANSPORTDEFS_H
00009 #define OPENDDS_DCPS_TRANSPORTDEFS_H
00010
00011 #include "dds/DCPS/Definitions.h"
00012 #include "dds/DCPS/Cached_Allocator_With_Overflow_T.h"
00013 #include "dds/DCPS/debug.h"
00014 #include "ace/Basic_Types.h"
00015 #include "ace/CDR_Base.h"
00016 #include "TransportDebug.h"
00017
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019 class ACE_Message_Block;
00020 class ACE_Data_Block;
00021 ACE_END_VERSIONED_NAMESPACE_DECL
00022
00023
00024
00025
00026
00027 #define RECEIVE_SYNCH ACE_SYNCH_NULL_MUTEX
00028
00029
00030
00031
00032 #define GET_CONFIG_VALUE(CF, SECT, KEY, VALUE, TYPE) \
00033 { \
00034 ACE_TString stringvalue; \
00035 if (CF.get_string_value (SECT, KEY, stringvalue) == -1) \
00036 { \
00037 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00038 { \
00039 ACE_DEBUG ((LM_NOTICE, \
00040 ACE_TEXT ("(%P|%t) NOTICE: \"%s\" is not defined in config ")\
00041 ACE_TEXT ("file - using code default.\n"), \
00042 KEY)); \
00043 } \
00044 } \
00045 else if (stringvalue == ACE_TEXT("")) \
00046 { \
00047 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00048 { \
00049 ACE_DEBUG ((LM_WARNING, \
00050 ACE_TEXT ("(%P|%t) WARNING: \"%s\" is defined in config ") \
00051 ACE_TEXT ("file, but is missing value - using code default.\n"), \
00052 KEY)); \
00053 } \
00054 } \
00055 else \
00056 { \
00057 VALUE = static_cast<TYPE>(ACE_OS::atoi (stringvalue.c_str ())); \
00058 } \
00059 }
00060
00061
00062
00063 #define GET_CONFIG_STRING_VALUE(CF, SECT, KEY, VALUE) \
00064 { \
00065 ACE_TString stringvalue; \
00066 if (CF.get_string_value (SECT, KEY, stringvalue) == -1) \
00067 { \
00068 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00069 { \
00070 ACE_DEBUG ((LM_NOTICE, \
00071 ACE_TEXT ("(%P|%t) NOTICE: \"%s\" is not defined in config ") \
00072 ACE_TEXT ("file - using code default.\n"), \
00073 KEY)); \
00074 } \
00075 } \
00076 else if (stringvalue == ACE_TEXT("")) \
00077 { \
00078 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00079 { \
00080 ACE_DEBUG ((LM_WARNING, \
00081 ACE_TEXT ("(%P|%t) WARNING: \"%s\" is defined in config ") \
00082 ACE_TEXT ("file, but is missing value - using code default.\n"), \
00083 KEY)); \
00084 } \
00085 } \
00086 else \
00087 { \
00088 VALUE = ACE_TEXT_ALWAYS_CHAR(stringvalue.c_str()); \
00089 } \
00090 }
00091
00092 #define GET_CONFIG_TSTRING_VALUE(CF, SECT, KEY, VALUE) \
00093 { \
00094 ACE_TString stringvalue; \
00095 if (CF.get_string_value (SECT, KEY, stringvalue) == -1) \
00096 { \
00097 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00098 { \
00099 ACE_DEBUG ((LM_NOTICE, \
00100 ACE_TEXT ("(%P|%t) NOTICE: \"%s\" is not defined in config ") \
00101 ACE_TEXT ("file - using code default.\n"), \
00102 KEY)); \
00103 } \
00104 } \
00105 else if (stringvalue == ACE_TEXT("")) \
00106 { \
00107 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00108 { \
00109 ACE_DEBUG ((LM_WARNING, \
00110 ACE_TEXT ("(%P|%t) WARNING: \"%s\" is defined in config ") \
00111 ACE_TEXT ("file, but is missing value - using code default.\n"), \
00112 KEY)); \
00113 } \
00114 } \
00115 else \
00116 { \
00117 VALUE = stringvalue; \
00118 } \
00119 }
00120
00121 #define GET_CONFIG_DOUBLE_VALUE(CF, SECT, KEY, VALUE) \
00122 { \
00123 ACE_TString stringvalue; \
00124 if (CF.get_string_value (SECT, KEY, stringvalue) == -1) \
00125 { \
00126 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00127 { \
00128 ACE_DEBUG ((LM_NOTICE, \
00129 ACE_TEXT ("(%P|%t) NOTICE: \"%s\" is not defined in config ") \
00130 ACE_TEXT ("file - using code default.\n"), \
00131 KEY)); \
00132 } \
00133 } \
00134 else if (stringvalue == ACE_TEXT("")) \
00135 { \
00136 if (OpenDDS::DCPS::Transport_debug_level > 0) \
00137 { \
00138 ACE_DEBUG ((LM_WARNING, \
00139 ACE_TEXT ("(%P|%t) WARNING: \"%s\" is defined in config ") \
00140 ACE_TEXT ("file, but is missing value - using code default.\n"), \
00141 KEY)); \
00142 } \
00143 } \
00144 else \
00145 { \
00146 VALUE = ACE_OS::strtod (stringvalue.c_str (), 0); \
00147 } \
00148 }
00149
00150
00151
00152
00153 #define GET_CONFIG_TIME_VALUE(CF, SECT, KEY, VALUE) \
00154 { \
00155 long tv = -1; \
00156 GET_CONFIG_VALUE(CF, SECT, KEY, tv, long); \
00157 if (tv != -1) VALUE.msec(tv); \
00158 }
00159
00160 namespace OpenDDS {
00161 namespace DCPS {
00162
00163
00164 static const ACE_TCHAR TRANSPORT_SECTION_NAME[] = ACE_TEXT("transport");
00165 static const ACE_TCHAR CONFIG_SECTION_NAME[] = ACE_TEXT("config");
00166
00167
00168 typedef ACE_UINT64 DataLinkIdType;
00169
00170
00171 enum SendControlStatus {
00172 SEND_CONTROL_ERROR,
00173 SEND_CONTROL_OK
00174 };
00175
00176
00177 enum AttachStatus {
00178 ATTACH_BAD_TRANSPORT,
00179 ATTACH_ERROR,
00180 ATTACH_INCOMPATIBLE_QOS,
00181 ATTACH_OK
00182 };
00183
00184
00185 #if 0
00186
00187
00188
00189
00190 #endif
00191
00192
00193 #if defined (ACE_IOV_MAX) && (ACE_IOV_MAX != 0)
00194 enum { MAX_SEND_BLOCKS = ACE_IOV_MAX };
00195 #else
00196 enum { MAX_SEND_BLOCKS = 50 };
00197 #endif
00198
00199
00200
00201
00202
00203 enum { RECEIVE_DATA_BUFFER_SIZE = 65536 };
00204
00205 typedef Cached_Allocator_With_Overflow<ACE_Message_Block, RECEIVE_SYNCH>
00206 TransportMessageBlockAllocator;
00207
00208 typedef Cached_Allocator_With_Overflow<ACE_Data_Block, RECEIVE_SYNCH>
00209 TransportDataBlockAllocator;
00210
00211 typedef Cached_Allocator_With_Overflow<char[RECEIVE_DATA_BUFFER_SIZE],
00212 RECEIVE_SYNCH>
00213 TransportDataAllocator;
00214
00215
00216 enum {
00217 DEFAULT_CONFIG_QUEUE_MESSAGES_PER_POOL = 10,
00218 DEFAULT_CONFIG_QUEUE_INITIAL_POOLS = 5,
00219 DEFAULT_CONFIG_MAX_PACKET_SIZE = 2147481599,
00220 DEFAULT_CONFIG_MAX_SAMPLES_PER_PACKET = 10,
00221 DEFAULT_CONFIG_OPTIMUM_PACKET_SIZE = 4096
00222 };
00223
00224
00225 enum RemoveResult {
00226 REMOVE_ERROR, REMOVE_NOT_FOUND, REMOVE_FOUND, REMOVE_RELEASED
00227 };
00228
00229 typedef ACE_CDR::Long Priority;
00230
00231 }
00232 }
00233
00234 #endif