3
#include <orbit/orbit.h>
6
#include "../src/orb/orb-core/iop-profiles.h"
9
print_objkey (ORBit_ObjectKey *objkey)
12
GString *str = g_string_sized_new (objkey->_length * 2 + 8);
14
for (i = 0; i < objkey->_length; i++)
15
g_string_append_printf (str, "%02x", objkey->_buffer [i]);
17
printf ("(%d) '%s'", objkey->_length, str->str);
19
g_string_free (str, TRUE);
23
print_components(CORBA_Object obj, GSList *components)
26
for(ltmp = components; ltmp; ltmp = ltmp->next)
28
IOP_Component_info *c = ltmp->data;
30
switch(c->component_type)
32
case IOP_TAG_COMPLETE_OBJECT_KEY:
34
printf(" IOP_TAG_COMPLETE_OBJECT_KEY: object_key ");
35
print_objkey(obj->object_key);
39
case IOP_TAG_SSL_SEC_TRANS:
41
IOP_TAG_SSL_SEC_TRANS_info *sst = ltmp->data;
42
printf(" IOP_TAG_SSL_SEC_TRANS: %d:%d port %d\n",
43
sst->target_supports, sst->target_requires,
47
case IOP_TAG_GENERIC_SSL_SEC_TRANS:
49
IOP_TAG_GENERIC_SSL_SEC_TRANS_info *sst = ltmp->data;
50
printf(" IOP_TAG_GENERIC_SSL_SEC_TRANS: service %s\n",
55
printf(" Unknown component %#x\n",
64
print_iiop_version(GIOPVersion ver)
78
g_assert_not_reached();
82
int main(int argc, char *argv[])
89
CORBA_exception_init(&ev);
93
fprintf(stderr, "Usage: ior-decode <IOR>\n");
97
orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev);
99
obj = CORBA_ORB_string_to_object(orb, argv[1], &ev);
102
fprintf(stderr, "Couldn't do string_to_object: %s\n",
103
CORBA_exception_id(&ev));
106
printf("Object ID: %s\n", g_quark_to_string (obj->type_qid));
107
for(ltmp = obj->profile_list; ltmp; ltmp = ltmp->next)
109
IOP_Profile_info *pi = ltmp->data;
110
switch(pi->profile_type)
112
case IOP_TAG_INTERNET_IOP:
114
IOP_TAG_INTERNET_IOP_info *iiop = ltmp->data;
116
printf("IOP_TAG_INTERNET_IOP: ");
117
print_iiop_version(iiop->iiop_version);
119
iiop->host, iiop->port);
120
printf(" object_key ");
121
print_objkey(obj->object_key);
123
print_components(obj, iiop->components);
126
case IOP_TAG_GENERIC_IOP:
128
IOP_TAG_GENERIC_IOP_info *giop = ltmp->data;
129
printf("IOP_TAG_GENERIC_IOP: ");
130
print_iiop_version(giop->iiop_version);
131
printf("[%s] %s:%s\n",
133
giop->host, giop->service);
134
print_components(obj, giop->components);
137
case IOP_TAG_MULTIPLE_COMPONENTS:
139
IOP_TAG_MULTIPLE_COMPONENTS_info *mci = ltmp->data;
140
printf("IOP_TAG_MULTIPLE_COMPONENTS:\n");
141
print_components(obj, mci->components);
144
case IOP_TAG_ORBIT_SPECIFIC:
146
IOP_TAG_ORBIT_SPECIFIC_info *osi = ltmp->data;
147
printf("IOP_TAG_ORBIT_SPECIFIC: usock %s IPv6 port %d\n",
148
osi->unix_sock_path, osi->ipv6_port);
149
printf(" object_key ");
150
print_objkey(obj->object_key);
155
printf("Unknown profile type %#x\n", pi->profile_type);