OpenDDS  Snapshot(2023/04/28-20:55)
Classes | Typedefs | Functions | Variables
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL Namespace Reference

Classes

class  ArgCopier
 Define an argument copying functor. More...
 
struct  MD5_CTX
 

Typedefs

typedef unsigned int MD5_u32plus
 

Functions

static const void * body (MD5_CTX *ctx, const void *data, unsigned long size)
 
void MD5_Init (MD5_CTX *ctx)
 
void MD5_Update (MD5_CTX *ctx, const void *data, unsigned long size)
 
void MD5_Final (unsigned char *result, MD5_CTX *ctx)
 
void handle_tryconstruct_flags (DDS::MemberDescriptor *md, MemberFlag mf)
 
int random_id ()
 
void hash_endpoint (::CORBA::Long &hash, const char *const endpoint, const size_t len)
 
void hash_endpoints (::CORBA::Long &hash, const ACE_TCHAR *const endpoints_str)
 
::CORBA::Long hash_endpoints (int argc, ACE_TCHAR **argv)
 
void assign (Update::BinSeq &to, const Update::BinSeq &from, Update::PersistenceUpdater::ALLOCATOR *allocator)
 
void assign (ACE_CString &to, const char *from, Update::PersistenceUpdater::ALLOCATOR *allocator)
 

Variables

const ACE_CDR::ULong transportContextDefault = 0xffffffff
 
const ACE_TCHAR FEDERATION_DOMAIN_KEY [] = ACE_TEXT("FederationDomain")
 
const ACE_TCHAR FEDERATION_ID_KEY [] = ACE_TEXT("FederationId")
 
const ACE_TCHAR FEDERATION_PORT_KEY [] = ACE_TEXT("FederationPort")
 

Typedef Documentation

◆ MD5_u32plus

Definition at line 57 of file Hash.cpp.

Function Documentation

◆ assign() [1/2]

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::assign ( Update::BinSeq to,
const Update::BinSeq from,
Update::PersistenceUpdater::ALLOCATOR allocator 
)

Definition at line 28 of file PersistenceUpdater.cpp.

References ACE_ALLOCATOR, ACE_Allocator_Adapter< class >::malloc(), and ACE_OS::memcpy().

30  {
31  const size_t len = from.first;
32  void* out_buf;
33  ACE_ALLOCATOR(out_buf, allocator->malloc(len));
34  ACE_OS::memcpy(out_buf, from.second, len);
35  to = std::make_pair(len, static_cast<char*>(out_buf));
36  }
void * memcpy(void *t, const void *s, size_t len)
virtual void * malloc(size_t nbytes)
#define ACE_ALLOCATOR(POINTER, ALLOCATOR)

◆ assign() [2/2]

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::assign ( ACE_CString to,
const char *  from,
Update::PersistenceUpdater::ALLOCATOR allocator 
)

Definition at line 38 of file PersistenceUpdater.cpp.

References ACE_ALLOCATOR, ACE_Allocator_Adapter< class >::malloc(), ACE_OS::memcpy(), ACE_String_Base< char >::set(), and ACE_OS::strlen().

Referenced by Update::ActorStrt< QosSeq, QosSeq, ACE_CString, BinSeq, ContentSubscriptionBin, BinSeq >::ActorStrt(), Update::ParticipantStrt< QosSeq >::ParticipantStrt(), and Update::TopicStrt< QosSeq, ACE_CString >::TopicStrt().

40  {
41  const size_t len = ACE_OS::strlen (from) + 1;
42  void* out_buf;
43  ACE_ALLOCATOR(out_buf, allocator->malloc(len));
44  ACE_OS::memcpy(out_buf, from, len);
45  to.set(static_cast<char*>(out_buf), len - 1, false);
46  }
void * memcpy(void *t, const void *s, size_t len)
virtual void * malloc(size_t nbytes)
size_t strlen(const char *s)
void set(const char *s, bool release=true)
#define ACE_ALLOCATOR(POINTER, ALLOCATOR)

◆ body()

static const void* OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::body ( MD5_CTX ctx,
const void *  data,
unsigned long  size 
)
static

Definition at line 115 of file Hash.cpp.

References OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::a, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::b, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::c, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::d, F, G, GET, H, I, SET, and STEP.

Referenced by OpenDDS::XTypes::has_type_object(), MD5_Final(), and MD5_Update().

116 {
117  const unsigned char *ptr;
118  MD5_u32plus a, b, c, d;
119  MD5_u32plus saved_a, saved_b, saved_c, saved_d;
120 
121  ptr = (const unsigned char *) data;
122 
123  a = ctx->a;
124  b = ctx->b;
125  c = ctx->c;
126  d = ctx->d;
127 
128  do {
129  saved_a = a;
130  saved_b = b;
131  saved_c = c;
132  saved_d = d;
133 
134 /* Round 1 */
135  STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
136  STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
137  STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
138  STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
139  STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
140  STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
141  STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
142  STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
143  STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
144  STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
145  STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
146  STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
147  STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
148  STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
149  STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
150  STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
151 
152 /* Round 2 */
153  STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
154  STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
155  STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
156  STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
157  STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
158  STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
159  STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
160  STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
161  STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
162  STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
163  STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
164  STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
165  STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
166  STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
167  STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
168  STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
169 
170 /* Round 3 */
171  STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
172  STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
173  STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
174  STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
175  STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
176  STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
177  STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
178  STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
179  STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
180  STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
181  STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
182  STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
183  STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
184  STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
185  STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
186  STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
187 
188 /* Round 4 */
189  STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
190  STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
191  STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
192  STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
193  STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
194  STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
195  STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
196  STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
197  STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
198  STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
199  STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
200  STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
201  STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
202  STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
203  STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
204  STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
205 
206  a += saved_a;
207  b += saved_b;
208  c += saved_c;
209  d += saved_d;
210 
211  ptr += 64;
212  } while (size -= 64);
213 
214  ctx->a = a;
215  ctx->b = b;
216  ctx->c = c;
217  ctx->d = d;
218 
219  return ptr;
220 }
#define I(x, y, z)
Definition: Hash.cpp:77
#define GET(n)
Definition: Hash.cpp:107
#define STEP(f, a, b, c, d, x, t, s)
Definition: Hash.cpp:82
#define SET(n)
Definition: Hash.cpp:101
#define F(x, y, z)
Definition: Hash.cpp:74
#define H(x, y, z)
Definition: Hash.cpp:76
#define G(x, y, z)
Definition: Hash.cpp:75

◆ handle_tryconstruct_flags()

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::handle_tryconstruct_flags ( DDS::MemberDescriptor md,
MemberFlag  mf 
)

Definition at line 19 of file TypeLookupService.cpp.

References ACE_ERROR, ACE_TEXT(), DDS::DISCARD, LM_ERROR, DDS::TRIM, OpenDDS::XTypes::TRY_CONSTRUCT1, OpenDDS::XTypes::TRY_CONSTRUCT2, DDS::MemberDescriptor::try_construct_kind, and DDS::USE_DEFAULT.

Referenced by OpenDDS::XTypes::TypeLookupService::complete_struct_member_to_member_descriptor(), and OpenDDS::XTypes::TypeLookupService::complete_union_member_to_member_descriptor().

20 {
21  if (mf & TRY_CONSTRUCT1) {
23  } else if (mf & TRY_CONSTRUCT2) {
25  } else {
26  ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) handle_tryconstruct_flags -")
27  ACE_TEXT(" Invalid TryConstruct Kind\n")));
28  }
29 }
#define ACE_ERROR(X)
const MemberFlag TRY_CONSTRUCT2
Definition: TypeObject.h:370
public TryConstructKind try_construct_kind
ACE_TEXT("TCP_Factory")
const MemberFlag TRY_CONSTRUCT1
Definition: TypeObject.h:369

◆ hash_endpoint()

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::hash_endpoint ( ::CORBA::Long hash,
const char *const  endpoint,
const size_t  len 
)

Definition at line 121 of file FederatorConfig.cpp.

References OpenDDS::Security::SSL::hash().

Referenced by hash_endpoints().

122 {
123  std::string toprint(endpoint, len);
124  if (len > 0)
125  {
126  for (size_t i = 0; i < len; i++)
127  {
128  hash = 31 * hash + endpoint[i];
129  }
130  }
131 }
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)

◆ hash_endpoints() [1/2]

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::hash_endpoints ( ::CORBA::Long hash,
const ACE_TCHAR *const  endpoints_str 
)

Definition at line 141 of file FederatorConfig.cpp.

References ACE_TEXT(), hash_endpoint(), ACE_OS::strlen(), and ACE_OS::strstr().

Referenced by hash_endpoints().

142 {
143  const ACE_TCHAR* delim = ACE_TEXT(";");
144  const size_t len = ACE_OS::strlen(endpoints_str);
145  const ACE_TCHAR* curr = endpoints_str;
146  while (curr < endpoints_str + len) {
147  const ACE_TCHAR* next = ACE_OS::strstr(curr, delim);
148  if (next == 0)
149  next = endpoints_str + len;
150  hash_endpoint(hash, curr, (next - curr));
151  curr = next + 1;
152  }
153 }
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)
size_t strlen(const char *s)
char ACE_TCHAR
ACE_TEXT("TCP_Factory")
const char * strstr(const char *s, const char *t)
void hash_endpoint(::CORBA::Long &hash, const char *const endpoint, const size_t len)

◆ hash_endpoints() [2/2]

::CORBA::Long OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::hash_endpoints ( int  argc,
ACE_TCHAR **  argv 
)

Definition at line 155 of file FederatorConfig.cpp.

References ACE_TEXT(), OpenDDS::Security::SSL::hash(), hash_endpoints(), random_id(), ACE_OS::strcasecmp(), ACE_OS::strlen(), and ACE_OS::strncasecmp().

156 {
157  ::CORBA::Long hash = 0;
158  bool found = false;
159  for (int i = 0; i < argc - 1; ++i) {
160  if (ACE_OS::strncasecmp(argv[i], ACE_TEXT("-ORB"), ACE_OS::strlen(ACE_TEXT("-ORB"))) == 0 &&
161  (ACE_OS::strcasecmp(ACE_TEXT("-ORBEndpoint"), argv[i]) == 0 ||
162  ACE_OS::strcasecmp(ACE_TEXT("-ORBListenEndpoints"), argv[i]) == 0 ||
163  ACE_OS::strcasecmp(ACE_TEXT("-ORBLaneEndpoint"), argv[i]) == 0 ||
164  ACE_OS::strcasecmp(ACE_TEXT("-ORBLaneListenEndpoints"), argv[i]) == 0)) {
165  const ACE_TCHAR* enpoints = argv[++i];
166  hash_endpoints(hash, enpoints);
167  found = true;
168  }
169  }
170  if (!found) {
171  hash = random_id();
172  }
173  return hash;
174 }
ACE_CDR::Long Long
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)
int strncasecmp(const char *s, const char *t, size_t len)
size_t strlen(const char *s)
char ACE_TCHAR
::CORBA::Long hash_endpoints(int argc, ACE_TCHAR **argv)
ACE_TEXT("TCP_Factory")
int strcasecmp(const char *s, const char *t)

◆ MD5_Final()

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_Final ( unsigned char *  result,
MD5_CTX ctx 
)

Definition at line 267 of file Hash.cpp.

References OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::a, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::b, body(), OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::buffer, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::c, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::d, free(), OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::hi, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::lo, and memset().

Referenced by OpenDDS::DCPS::MD5Hash().

268 {
269  unsigned long used, free;
270 
271  used = ctx->lo & 0x3f;
272 
273  ctx->buffer[used++] = 0x80;
274 
275  free = 64 - used;
276 
277  if (free < 8) {
278  memset(&ctx->buffer[used], 0, free);
279  body(ctx, ctx->buffer, 64);
280  used = 0;
281  free = 64;
282  }
283 
284  memset(&ctx->buffer[used], 0, free - 8);
285 
286  ctx->lo <<= 3;
287  ctx->buffer[56] = ctx->lo;
288  ctx->buffer[57] = ctx->lo >> 8;
289  ctx->buffer[58] = ctx->lo >> 16;
290  ctx->buffer[59] = ctx->lo >> 24;
291  ctx->buffer[60] = ctx->hi;
292  ctx->buffer[61] = ctx->hi >> 8;
293  ctx->buffer[62] = ctx->hi >> 16;
294  ctx->buffer[63] = ctx->hi >> 24;
295 
296  body(ctx, ctx->buffer, 64);
297 
298  result[0] = ctx->a;
299  result[1] = ctx->a >> 8;
300  result[2] = ctx->a >> 16;
301  result[3] = ctx->a >> 24;
302  result[4] = ctx->b;
303  result[5] = ctx->b >> 8;
304  result[6] = ctx->b >> 16;
305  result[7] = ctx->b >> 24;
306  result[8] = ctx->c;
307  result[9] = ctx->c >> 8;
308  result[10] = ctx->c >> 16;
309  result[11] = ctx->c >> 24;
310  result[12] = ctx->d;
311  result[13] = ctx->d >> 8;
312  result[14] = ctx->d >> 16;
313  result[15] = ctx->d >> 24;
314 
315  memset(ctx, 0, sizeof(*ctx));
316 }
void free(void *)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: Hash.cpp:115
void * memset(void *s, int c, size_t len)
unsigned char buffer[64]

◆ MD5_Init()

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_Init ( MD5_CTX ctx)

Definition at line 222 of file Hash.cpp.

References OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::a, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::b, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::c, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::d, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::hi, and OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::lo.

Referenced by OpenDDS::DCPS::MD5Hash().

223 {
224  ctx->a = 0x67452301;
225  ctx->b = 0xefcdab89;
226  ctx->c = 0x98badcfe;
227  ctx->d = 0x10325476;
228 
229  ctx->lo = 0;
230  ctx->hi = 0;
231 }

◆ MD5_Update()

void OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_Update ( MD5_CTX ctx,
const void *  data,
unsigned long  size 
)

Definition at line 233 of file Hash.cpp.

References body(), OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::buffer, free(), OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::hi, OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::MD5_CTX::lo, and memcpy().

Referenced by OpenDDS::DCPS::MD5Hash().

234 {
235  MD5_u32plus saved_lo;
236  unsigned long used;
237 
238  saved_lo = ctx->lo;
239  if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
240  ctx->hi++;
241  ctx->hi += size >> 29;
242 
243  used = saved_lo & 0x3f;
244 
245  if (used) {
246  unsigned long free = 64 - used;
247 
248  if (size < free) {
249  memcpy(&ctx->buffer[used], data, size);
250  return;
251  }
252 
253  memcpy(&ctx->buffer[used], data, free);
254  data = (unsigned char *)data + free;
255  size -= free;
256  body(ctx, ctx->buffer, 64);
257  }
258 
259  if (size >= 64) {
260  data = body(ctx, data, size & ~(unsigned long)0x3f);
261  size &= 0x3f;
262  }
263 
264  memcpy(ctx->buffer, data, size);
265 }
void free(void *)
void * memcpy(void *t, const void *s, size_t len)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: Hash.cpp:115
unsigned char buffer[64]

◆ random_id()

int OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::random_id ( )

Definition at line 112 of file FederatorConfig.cpp.

References ACE_OS::gettimeofday(), ACE_Time_Value::msec(), ACE_OS::rand(), and ACE_OS::srand().

Referenced by hash_endpoints().

113 {
114  ACE_UINT64 msec;
115  ACE_OS::gettimeofday().msec(msec);
116  ACE_OS::srand((unsigned int)msec);
117  const int r = ACE_OS::rand();
118  return r;
119 }
int rand(void)
unsigned long long ACE_UINT64
unsigned long msec(void) const
void srand(u_int seed)
ACE_Time_Value gettimeofday(void)

Variable Documentation

◆ FEDERATION_DOMAIN_KEY

const ACE_TCHAR OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::FEDERATION_DOMAIN_KEY[] = ACE_TEXT("FederationDomain")

Definition at line 31 of file FederatorConfig.cpp.

Referenced by OpenDDS::Federator::Config::processFile().

◆ FEDERATION_ID_KEY

const ACE_TCHAR OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::FEDERATION_ID_KEY[] = ACE_TEXT("FederationId")

Definition at line 34 of file FederatorConfig.cpp.

Referenced by OpenDDS::Federator::Config::processFile().

◆ FEDERATION_PORT_KEY

const ACE_TCHAR OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::FEDERATION_PORT_KEY[] = ACE_TEXT("FederationPort")

Definition at line 37 of file FederatorConfig.cpp.

Referenced by OpenDDS::Federator::Config::processFile().

◆ transportContextDefault

const ACE_CDR::ULong OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL::transportContextDefault = 0xffffffff