1 #ifndef GIOP_TYPES_H 2 #define GIOP_TYPES_H 1 3 4 #include <glib.h> 5 #include <glib-object.h> 6 #include <linc/linc.h> 7 #include <orbit/orbit-config.h> 8 #include <orbit/util/orbit-util.h> 9 10 #include <orbit/orb-core/corba-defs.h> 11 #include <orbit/orb-core/iop-defs.h> 12 13 #include <orbit/GIOP/giop-basics.h> 14 15 G_BEGIN_DECLS 16 17 #ifdef ORBIT2_INTERNAL_API 18 19 typedef struct _GIOPThread GIOPThread; 20 21 struct _GIOPThread { 22 GMutex *lock; 23 GCond *incoming; 24 GMainContext *wake_context; 25 26 GList *keys; /* ie. per POA, per Connection, per Object etc. */ 27 28 GList *async_ents; 29 GList *request_queue; 30 31 GQueue *invoke_policies; 32 33 void (*request_handler) (gpointer poa_object, 34 gpointer recv_buffer, 35 gpointer dummy); 36 }; 37 38 #define GIOP_INITIAL_MSG_SIZE_LIMIT (256*1024) 39 40 typedef enum { 41 GIOP_CONNECTION_SSL 42 } GIOPConnectionOptions; 43 44 extern const char giop_version_ids[GIOP_NUM_VERSIONS][2]; 45 46 typedef struct { 47 CORBA_char magic[4]; 48 CORBA_char version[2]; 49 CORBA_octet flags; 50 CORBA_octet message_type; 51 CORBA_unsigned_long message_size; 52 } GIOPMsgHeader; 53 54 typedef enum 55 { 56 GIOP_REQUEST, 57 GIOP_REPLY, 58 GIOP_CANCELREQUEST, 59 GIOP_LOCATEREQUEST, 60 GIOP_LOCATEREPLY, 61 GIOP_CLOSECONNECTION, 62 GIOP_MESSAGEERROR, 63 GIOP_FRAGMENT, 64 GIOP_NUM_MSG_TYPES 65 } GIOPMsgType; 66 67 #if 0 68 typedef enum 69 { 70 GIOP_NO_EXCEPTION, 71 GIOP_USER_EXCEPTION, 72 GIOP_SYSTEM_EXCEPTION, 73 GIOP_LOCATION_FORWARD, 74 GIOP_LOCATION_FORWARD_PERM, 75 GIOP_NEEDS_ADDRESSING_MODE 76 } GIOPReplyStatusType_1_2; 77 78 typedef enum 79 { 80 GIOP_UNKNOWN_OBJECT, 81 GIOP_OBJECT_HERE, 82 GIOP_OBJECT_FORWARD, 83 GIOP_OBJECT_FORWARD_PERM, 84 GIOP_LOC_SYSTEM_EXCEPTION, 85 GIOP_LOC_NEEDS_ADDRESSING_MODE 86 } GIOPLocateStatusType_1_2; 87 88 typedef CORBA_unsigned_long IOP_ServiceId; 89 typedef struct { 90 IOP_ServiceId context_id; 91 CORBA_sequence_CORBA_octet context_data; 92 } IOP_ServiceContext; 93 94 typedef struct { 95 CORBA_unsigned_long _length; 96 IOP_ServiceContext *_buffer; 97 CORBA_boolean _release : 1; 98 } IOP_ServiceContextList; 99 #endif 100 101 typedef CORBA_sequence_CORBA_octet CORBA_Principal; 102 103 typedef struct { 104 IOP_ServiceContextList service_context; 105 CORBA_unsigned_long request_id; 106 CORBA_boolean response_expected; 107 CORBA_sequence_CORBA_octet object_key; 108 CORBA_char *operation; 109 CORBA_Principal requesting_principal; 110 } GIOPMsgRequest_1_0; 111 112 typedef struct { 113 IOP_ServiceContextList service_context; 114 CORBA_unsigned_long request_id; 115 CORBA_boolean response_expected; 116 CORBA_char reserved[3]; 117 CORBA_sequence_CORBA_octet object_key; 118 CORBA_char *operation; 119 CORBA_Principal requesting_principal; 120 } GIOPMsgRequest_1_1; 121 122 typedef struct { 123 CORBA_unsigned_long request_id; 124 CORBA_octet response_flags; 125 CORBA_octet reserved[3]; 126 GIOP_TargetAddress target; 127 CORBA_char *operation; 128 IOP_ServiceContextList service_context; 129 } GIOPMsgRequest_1_2; 130 131 typedef struct { 132 IOP_ServiceContextList service_context; 133 CORBA_unsigned_long request_id; 134 CORBA_unsigned_long reply_status; /* lame */ 135 } GIOPMsgReply_1_0; 136 137 typedef GIOPMsgReply_1_0 GIOPMsgReply_1_1; 138 139 typedef struct { 140 CORBA_unsigned_long request_id; 141 CORBA_unsigned_long reply_status; 142 IOP_ServiceContextList service_context; 143 } GIOPMsgReply_1_2; 144 145 typedef struct { 146 CORBA_unsigned_long request_id; 147 } GIOPMsgCancelRequest; 148 149 typedef struct { 150 CORBA_unsigned_long request_id; 151 CORBA_sequence_CORBA_octet object_key; 152 } GIOPMsgLocateRequest_1_0; 153 154 typedef GIOPMsgLocateRequest_1_0 GIOPMsgLocateRequest_1_1; 155 156 typedef struct { 157 CORBA_unsigned_long request_id; 158 GIOP_TargetAddress target; 159 } GIOPMsgLocateRequest_1_2; 160 161 typedef struct { 162 CORBA_unsigned_long request_id; 163 CORBA_unsigned_long locate_status; /* lame */ 164 } GIOPMsgLocateReply_1_0; 165 166 typedef GIOPMsgLocateReply_1_0 GIOPMsgLocateReply_1_1; 167 168 typedef struct { 169 CORBA_unsigned_long request_id; 170 CORBA_unsigned_long locate_status; 171 } GIOPMsgLocateReply_1_2; 172 173 typedef struct { 174 GIOPMsgHeader header; 175 176 union { 177 GIOPMsgRequest_1_0 request_1_0; 178 GIOPMsgRequest_1_1 request_1_1; 179 GIOPMsgRequest_1_2 request_1_2; 180 GIOPMsgReply_1_0 reply_1_0; 181 GIOPMsgReply_1_1 reply_1_1; 182 GIOPMsgReply_1_2 reply_1_2; 183 GIOPMsgCancelRequest cancel_request; 184 GIOPMsgLocateRequest_1_0 locate_request_1_0; 185 GIOPMsgLocateRequest_1_1 locate_request_1_1; 186 GIOPMsgLocateRequest_1_2 locate_request_1_2; 187 GIOPMsgLocateReply_1_0 locate_reply_1_0; 188 GIOPMsgLocateReply_1_1 locate_reply_1_1; 189 GIOPMsgLocateReply_1_2 locate_reply_1_2; 190 } u; 191 } GIOPMsg; 192 193 #define GIOP_FLAG_BIG_ENDIAN 0 194 #define GIOP_FLAG_LITTLE_ENDIAN 1 195 #define GIOP_FLAG_FRAGMENTED 2 196 197 #if G_BYTE_ORDER == G_BIG_ENDIAN 198 # define GIOP_FLAG_ENDIANNESS GIOP_FLAG_BIG_ENDIAN 199 #elif G_BYTE_ORDER == G_LITTLE_ENDIAN 200 # define GIOP_FLAG_ENDIANNESS GIOP_FLAG_LITTLE_ENDIAN 201 #else 202 # error "Unsupported endianness on this system." 203 #endif 204 205 #define giop_endian_conversion_needed(to_endianness) ((to_endianness&GIOP_FLAG_LITTLE_ENDIAN)!=GIOP_FLAG_ENDIANNESS) 206 207 #define GIOP_MSG(x) ((GIOPMsg *)(x)) 208 209 #endif /* ORBIT2_INTERNAL_API */ 210 211 G_END_DECLS 212 213 #endif 214