1 #ifndef __ORBIT_ADAPTOR_H__
2 #define __ORBIT_ADAPTOR_H__
3 
4 #include <glib.h>
5 #include <stdarg.h>
6 
7 G_BEGIN_DECLS
8 
9 typedef enum {
10 	ORBIT_THREAD_HINT_NONE = 0,
11 	ORBIT_THREAD_HINT_PER_OBJECT,
12 	ORBIT_THREAD_HINT_PER_REQUEST,
13 	ORBIT_THREAD_HINT_PER_POA,
14 	ORBIT_THREAD_HINT_PER_CONNECTION,
15 	ORBIT_THREAD_HINT_ONEWAY_AT_IDLE,
16 	ORBIT_THREAD_HINT_ALL_AT_IDLE,
17 	ORBIT_THREAD_HINT_ON_CONTEXT
18 } ORBitThreadHint;
19 
20 typedef struct ORBit_ObjectAdaptor_type *ORBit_ObjectAdaptor;
21 
22 void            ORBit_ObjectAdaptor_set_thread_hint  (ORBit_ObjectAdaptor adaptor,
23 						      ORBitThreadHint     thread_hint,
24 						      ...);
25 void            ORBit_ObjectAdaptor_set_thread_hintv (ORBit_ObjectAdaptor adaptor,
26 						      ORBitThreadHint     thread_hint,
27 						      va_list             args);
28 ORBitThreadHint ORBit_ObjectAdaptor_get_thread_hint  (ORBit_ObjectAdaptor adaptor);
29 
30 void            ORBit_ObjectAdaptor_object_bind_to_current_thread (CORBA_Object obj);
31 
32 
33 #ifdef ORBIT2_INTERNAL_API
34 
35 void                ORBit_handle_locate_request     (CORBA_ORB          orb,
36 						     GIOPRecvBuffer    *recv_buffer);
37 
38 void                ORBit_handle_request            (CORBA_ORB          orb,
39 						     GIOPRecvBuffer    *recv_buffer);
40 
41 void                ORBit_small_handle_request      (ORBit_OAObject     adaptor_obj,
42 						     CORBA_Identifier   opname,
43 						     gpointer           ret,
44 						     gpointer          *args,
45 						     CORBA_Context      ctx,
46 						     GIOPRecvBuffer    *recv_buffer,
47 						     CORBA_Environment *ev);
48 
49 gboolean            ORBit_OAObject_is_active        (ORBit_OAObject     adaptor_obj);
50 
51 ORBit_ObjectKey    *ORBit_OAObject_object_to_objkey (ORBit_OAObject     adaptor_obj);
52 
53 void                ORBit_OAObject_invoke           (ORBit_OAObject     adaptor_obj,
54 						     gpointer           ret,
55 						     gpointer          *args,
56 						     CORBA_Context      ctx,
57 						     gpointer           data,
58 						     CORBA_Environment *ev);
59 /*
60  * ORBit_OAObject
61  */
62 
63 typedef gboolean            (*ORBitStateCheckFunc) (ORBit_OAObject     adaptor_obj);
64 
65 typedef ORBit_ObjectKey    *(*ORBitKeyGenFunc)     (ORBit_OAObject     adaptor_obj);
66 
67 typedef void                (*ORBitInvokeFunc)     (ORBit_OAObject     adaptor_obj,
68 						    gpointer           ret,
69 						    gpointer          *args,
70 						    CORBA_Context      ctx,
71 						    gpointer           data,
72 						    CORBA_Environment *ev);
73 
74 typedef void                (*ORBitReqFunc)        (ORBit_OAObject     adaptor_obj,
75 						    CORBA_Identifier   opname,
76 						    gpointer           ret,
77 						    gpointer          *args,
78 						    CORBA_Context      ctx,
79 						    GIOPRecvBuffer    *recv_buffer,
80 						    CORBA_Environment *ev);
81 
82 typedef enum {
83 	ORBIT_ADAPTOR_POA        = 1 << 0
84 } ORBit_Adaptor_type;
85 
86 struct ORBit_OAObject_Interface_type {
87 	ORBit_Adaptor_type  adaptor_type;
88 
89 	ORBitStateCheckFunc is_active;
90 	ORBitKeyGenFunc     object_to_objkey;
91 	ORBitInvokeFunc     invoke;
92 	ORBitReqFunc        handle_request;
93 };
94 
95 typedef struct ORBit_OAObject_Interface_type *ORBit_OAObject_Interface;
96 
97 struct ORBit_OAObject_type {
98 	struct ORBit_RootObject_struct parent;
99 
100 	CORBA_Object                   objref;
101 
102 	ORBit_OAObject_Interface       interface;
103 };
104 
105 /*
106  * ORBit_ObjectAdaptor
107  */
108 
109 typedef CORBA_sequence_CORBA_octet ORBit_AdaptorKey;
110 
111 typedef void (*ORBitReqHandlerFunc) (ORBit_ObjectAdaptor         adaptor,
112 				     GIOPRecvBuffer             *recv_buffer,
113 				     ORBit_ObjectKey            *objkey);
114 
115 struct ORBit_ObjectAdaptor_type {
116 	struct ORBit_RootObject_struct parent;
117 
118 	GMutex                        *lock;
119 
120 	ORBitReqHandlerFunc            handle_request;
121 
122 	ORBit_AdaptorKey               adaptor_key;
123 
124 	ORBitThreadHint                thread_hint;
125 
126 	GMainContext                  *context;
127 };
128 
129 int ORBit_adaptor_setup (ORBit_ObjectAdaptor adaptor, CORBA_ORB orb);
130 
131 #endif /* ORBIT2_INTERNAL_API */
132 
133 G_END_DECLS
134 
135 #endif /* __ORBIT_ADAPTOR_H__ */
136