38
39
GString *str = g_string_sized_new (objkey->_length * 2 + 4);
40
41
for (i = 0; i < objkey->_length; i++)
41
g_string_append_printf (str, "%2x", objkey->_buffer [i]);
42
g_string_append_printf (str, "%02x", objkey->_buffer [i]);
43
44
return g_string_free (str, FALSE);
61
62
key = IOP_ObjectKey_dump (obj->object_key);
62
63
g_string_printf (str, "P-IIOP %s:0x%x '%s'",
63
64
iiop->host, iiop->port, key);
67
69
case IOP_TAG_GENERIC_IOP: {
318
IOP_mem_hash (gconstpointer key, gulong len)
321
const char *p, *pend;
323
for (p = key, pend = p + len; p < pend; p++)
324
h = (h << 5) - h + *p;
330
IOP_ObjectKey_hash (ORBit_ObjectKey *k)
332
return IOP_mem_hash (k->_buffer, k->_length);
316
336
IOP_profile_equal (CORBA_Object obj1, CORBA_Object obj2,
317
337
gpointer d1, gpointer d2)
394
IOP_mem_hash (gconstpointer key, gulong len)
396
const char *p, *pend;
399
for(p = key, pend = p + len; p < pend; p++)
400
h = (h << 5) - h + *p;
417
* This performs really badly, and is pretty useless.
406
IOP_profile_hash(gpointer item, gpointer data)
420
IOP_profile_hash (gpointer item, gpointer data)
408
IOP_Profile_info *p = item;
410
IOP_TAG_INTERNET_IOP_info *iiop;
411
IOP_TAG_GENERIC_IOP_info *giop;
412
IOP_TAG_ORBIT_SPECIFIC_info *osi;
413
IOP_TAG_MULTIPLE_COMPONENTS_info *mci;
414
IOP_UnknownProfile_info *upi;
422
IOP_Profile_info *p = item;
424
IOP_TAG_INTERNET_IOP_info *iiop;
425
IOP_TAG_GENERIC_IOP_info *giop;
426
IOP_TAG_ORBIT_SPECIFIC_info *osi;
427
IOP_TAG_MULTIPLE_COMPONENTS_info *mci;
428
IOP_UnknownProfile_info *upi;
416
*h ^= p->profile_type;
417
switch(p->profile_type)
419
case IOP_TAG_ORBIT_SPECIFIC:
421
*h ^= g_str_hash(osi->unix_sock_path);
423
case IOP_TAG_INTERNET_IOP:
425
*h ^= g_str_hash(iiop->host);
428
case IOP_TAG_GENERIC_IOP:
430
*h ^= g_str_hash(giop->proto);
431
*h ^= g_str_hash(giop->host);
432
*h ^= g_str_hash(giop->service);
434
case IOP_TAG_MULTIPLE_COMPONENTS:
436
*h ^= g_slist_length(mci->components);
440
*h ^= IOP_mem_hash(upi->data._buffer, upi->data._length);
430
*h ^= p->profile_type;
431
switch (p->profile_type) {
432
case IOP_TAG_ORBIT_SPECIFIC:
434
*h ^= g_str_hash(osi->unix_sock_path);
436
case IOP_TAG_INTERNET_IOP:
438
*h ^= g_str_hash(iiop->host);
441
case IOP_TAG_GENERIC_IOP:
443
*h ^= g_str_hash(giop->proto);
444
*h ^= g_str_hash(giop->host);
445
*h ^= g_str_hash(giop->service);
447
case IOP_TAG_MULTIPLE_COMPONENTS:
449
*h ^= g_slist_length(mci->components);
453
*h ^= IOP_mem_hash(upi->data._buffer, upi->data._length);
452
465
if (orb && *profiles == orb->profiles)
455
g_slist_foreach (*profiles, (GFunc)IOP_profile_free, NULL);
456
g_slist_free (*profiles);
468
g_slist_foreach (*profiles,
469
(GFunc)IOP_profile_free, NULL);
470
g_slist_free (*profiles);
468
483
IOP_TAG_INTERNET_IOP_info *iiop = NULL;
470
485
for (l = orb->servers ; l != NULL ; l = l->next) {
471
LINCServer *serv = l->data;
486
LinkServer *serv = l->data;
472
487
gboolean ipv4, ipv6, uds, ssl;
474
489
ipv4 = !strcmp (serv->proto->name, "IPv4");
475
490
ipv6 = !strcmp (serv->proto->name, "IPv6");
476
491
uds = !strcmp (serv->proto->name, "UNIX");
478
ssl = (serv->create_options & LINC_CONNECTION_SSL);
493
ssl = (serv->create_options & LINK_CONNECTION_SSL);
480
if (!osi && (uds || (ipv6 && !ssl))) {
481
496
osi = g_new0 (IOP_TAG_ORBIT_SPECIFIC_info, 1);
482
497
osi->parent.profile_type = IOP_TAG_ORBIT_SPECIFIC;
570
582
csets = g_new0 (IOP_TAG_CODE_SETS_info, 1);
571
583
csets->parent.component_type = IOP_TAG_CODE_SETS;
585
csets->data.ForCharData.native_code_set = IOP_PROFILES_CODE_SET_UTF8;
586
csets->data.ForWcharData.native_code_set = IOP_PROFILES_CODE_SET_UTF16;
572
588
mci->components = g_slist_append (mci->components, csets);
629
643
case IOP_TAG_SSL_SEC_TRANS:
631
case IOP_TAG_CODE_SETS:
645
case IOP_TAG_CODE_SETS: {
646
IOP_TAG_CODE_SETS_info *csets = (IOP_TAG_CODE_SETS_info*)c;
647
CORBA_sequence_CONV_FRAME_CodeSetId *conv_codesets;
650
= &(csets->data.ForCharData.conversion_code_sets);
651
if (conv_codesets->_buffer)
652
ORBit_free_T (conv_codesets->_buffer);
655
= &(csets->data.ForWcharData.conversion_code_sets);
656
if (conv_codesets->_buffer)
657
ORBit_free_T (conv_codesets->_buffer);
634
662
g_free (((IOP_UnknownProfile_info*)c)->data._buffer);
771
799
/* native_code_set */
772
800
giop_send_buffer_append_aligned (buf, &native_code_set, 4);
774
if (opt_conversion_code_sets)
775
g_error ("Unimplemented as yet");
802
if (opt_conversion_code_sets && opt_conversion_code_sets->_buffer) {
803
CORBA_unsigned_long length = opt_conversion_code_sets->_length;
804
giop_send_buffer_append_aligned (buf, &length, 4);
805
giop_send_buffer_append (buf,
806
opt_conversion_code_sets->_buffer,
807
length * sizeof(CORBA_unsigned_long));
777
809
CORBA_unsigned_long length = 0;
778
810
giop_send_buffer_append_aligned (buf, &length, 4);
787
819
/* To get these magic numbers see the 'OSF Character
788
820
and Codeset Registry'; ftp.opengroup.org/pub/code_set_registry */
789
CORBA_unsigned_long utf8_key = 0x05010001;
790
CORBA_unsigned_long utf16_key = 0x00010109;
821
/* CORBA_unsigned_long utf8_key = 0x05010001; */
822
/* CORBA_unsigned_long utf16_key = 0x00010109; */
823
IOP_TAG_CODE_SETS_info *csets = (IOP_TAG_CODE_SETS_info*) ci;
792
825
/* Marshal a CodeSetComponentInfo structure */
793
CodeSetComponent_marshal (buf, utf8_key, NULL);
794
CodeSetComponent_marshal (buf, utf16_key, NULL);
826
CodeSetComponent_marshal (buf,
827
csets->data.ForCharData.native_code_set,
828
&(csets->data.ForCharData.conversion_code_sets));
829
CodeSetComponent_marshal (buf,
830
csets->data.ForWcharData.native_code_set,
831
&(csets->data.ForWcharData.conversion_code_sets));
1126
1164
static gboolean
1127
1165
CodeSetComponent_demarshal (GIOPRecvBuffer *buf,
1128
CORBA_unsigned_long *native_code_set,
1129
CORBA_sequence_CORBA_unsigned_long **opt_conversion_code_sets)
1166
CONV_FRAME_CodeSetComponent *component)
1131
1168
CORBA_unsigned_long sequence_length;
1135
1172
if (buf->cur + 8 > buf->end)
1138
*native_code_set = *(CORBA_unsigned_long *)buf->cur;
1175
component->native_code_set = *(CORBA_unsigned_long *)buf->cur;
1139
1176
if (giop_msg_conversion_needed (buf))
1140
*native_code_set = GUINT32_SWAP_LE_BE (*native_code_set);
1177
component->native_code_set
1178
= GUINT32_SWAP_LE_BE (component->native_code_set);
1143
1181
sequence_length = *(CORBA_unsigned_long *)buf->cur;
1145
1183
sequence_length = GUINT32_SWAP_LE_BE (sequence_length);
1186
if (buf->cur + sequence_length * 4 > buf->end)
1148
1189
if (sequence_length > 0) {
1149
static int warned = 0;
1151
g_warning ("Ignoring incoming code_sets component");
1153
if (buf->cur + sequence_length * 4 < buf->end)
1154
buf->cur += sequence_length * 4;
1191
dprintf (OBJECTS, "Ignoring incoming code_sets component");
1192
component->conversion_code_sets._maximum = sequence_length;
1193
component->conversion_code_sets._length = sequence_length;
1194
component->conversion_code_sets._release = TRUE;
1195
component->conversion_code_sets._buffer =
1196
CORBA_sequence_CORBA_unsigned_long_allocbuf (sequence_length);
1197
for (i=0; i<sequence_length; ++i) {
1198
component->conversion_code_sets._buffer [i] =
1199
*(CORBA_unsigned_long *)buf->cur;
1200
if (giop_msg_conversion_needed (buf))
1201
component->conversion_code_sets._buffer [i]
1202
= GUINT32_SWAP_LE_BE (component->conversion_code_sets._buffer [i]);
1164
1212
GIOPRecvBuffer *buf)
1166
1214
IOP_TAG_CODE_SETS_info *retval;
1167
CORBA_unsigned_long dummy;
1168
1215
GIOPRecvBuffer *encaps;
1170
encaps = giop_recv_buffer_use_encaps_buf (buf);
1217
if (!(encaps = giop_recv_buffer_use_encaps_buf (buf)))
1174
retval = g_new (IOP_TAG_CODE_SETS_info, 1);
1220
retval = g_new0 (IOP_TAG_CODE_SETS_info, 1);
1175
1221
retval->parent.component_type = id;
1177
1223
/* We don't care about the data much */
1178
if (!CodeSetComponent_demarshal (encaps, &dummy, NULL) ||
1179
!CodeSetComponent_demarshal (encaps, &dummy, NULL)) {
1224
if (!CodeSetComponent_demarshal (encaps, &(retval->data.ForCharData)) ||
1225
!CodeSetComponent_demarshal (encaps, &(retval->data.ForWcharData))) {
1180
1226
giop_recv_buffer_unuse (encaps);
1227
if (retval->data.ForCharData.conversion_code_sets._buffer)
1228
ORBit_free_T (retval->data.ForCharData.conversion_code_sets._buffer);
1229
if (retval->data.ForWcharData.conversion_code_sets._buffer)
1230
ORBit_free_T (retval->data.ForWcharData.conversion_code_sets._buffer);
1181
1231
g_free (retval);