1ic_clib(3) C Library Functions ic_clib(3)
2
3
4
6 ic_clib - IC C Library Functions
7
9 This manual page lists some of the functions in the IC C runtime
10 library.
11
13 The following functions are used for allocating and deallocating a
14 CORBA_Environment structure.
15
17 CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz)
18
19 This function is used to allocate and initiate the CORBA_Envi‐
20 ronment structure. In particular, it is used to dynamically
21 allocate a CORBA_Environment structure and set the default val‐
22 ues for the structure's fields.
23
24 inbufsize is the initial size of the input buffer.
25
26 outbufsize is the initial size of the output buffer.
27
28 CORBA_Environment is the CORBA 2.0 state structure used by the
29 generated stub.
30
31 This function will set all needed default values and allocate
32 buffers the lengths of which are equal to the values passed, but
33 will not allocate space for the _to_pid and _from_pid fields.
34
35 To free the space allocated by CORBA_Environment_alloc() do as
36 follows.
37
38 * First call CORBA_free for the input and output buffers.
39
40 * After freeing the buffer space, call CORBA_free for the
41 CORBA_Environment space.
42
43 void CORBA_free(void *p)
44
45 Frees allocated space pointed to by p.
46
47 CORBA_char *CORBA_string_alloc(CORBA_unsigned_long len)
48
49 Allocates a (simple) CORBA character string of length len + 1.
50
51 CORBA_wchar *CORBA_wstring_alloc(CORBA_unsigned_long len)
52
53 Allocates a CORBA wide string of length len + 1.
54
56 Functions for retrieving exception ids and values, and for setting
57 exceptions.
58
60 CORBA_char *CORBA_exception_id(CORBA_Environment *env)
61
62 Returns the exception identity if an exception is set, otherwise
63 it returns NULL.
64
65 void *CORBA_exception_value(CORBA_Environment *env)
66
67 Returns the exception value, if an exception is set, otherwise
68 it returns NULL.
69
70 void CORBA_exc_set(CORBA_Environment *env, CORBA_exception_type Major,
71 CORBA_char *Id, CORBA_char *Value)
72
73 Sets the exception type, exception identity, and exception value
74 in the environment pointed to by env.
75
77 The following function is provided for convenience.
78
80 int oe_server_receive(CORBA_Environment *env, oe_map_t *map)
81 int oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map,
82 unsigned int send_ms, unsigned int recv_ms)
83
84 Provides a loop that receives one message, executes the opera‐
85 tion in question, and in case of a two-way operation sends a
86 reply.
87
88 send_ms and recv_ms specify timeout values in milliseconds for
89 send and receive, respectively.
90
92 Function for searching for server operation function, and for calling
93 it if found. Function for merging maps (see the include file ic.h for
94 definitions).
95
97 int oe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t
98 *map)
99
100 Search for server operation and execute it.
101
102 oe_map_t *oe_merge_maps(oe_map_t *maps, int size)
103
104 Merge an array of server maps to one single map.
105
107 Here is the complete definition of the CORBA_Environment structure,
108 defined in file ic.h:
109
110 /* Environment definition */
111 typedef struct {
112
113 /*----- CORBA compatibility part ------------------------*/
114 /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/
115 CORBA_exception_type _major;
116
117 /*----- External Implementation part - initiated by the user ---*/
118 /* File descriptor */
119 int _fd;
120 /* Size of input buffer */
121 int _inbufsz;
122 /* Pointer to always dynamically allocated buffer for input */
123 char *_inbuf;
124 /* Size of output buffer */
125 int _outbufsz;
126 /* Pointer to always dynamically allocated buffer for output */
127 char *_outbuf;
128 /* Size of memory chunks in bytes, used for increasing the output
129 buffer, set to >= 32, should be around >= 1024 for performance
130 reasons */
131 int _memchunk;
132 /* Pointer for registered name */
133 char _regname[256];
134 /* Process identity for caller */
135 erlang_pid *_to_pid;
136 /* Process identity for callee */
137 erlang_pid *_from_pid;
138
139 /*- Internal Implementation part - used by the server/client ---*/
140 /* Index for input buffer */
141 int _iin;
142 /* Index for output buffer */
143 int _iout;
144 /* Pointer for operation name */
145 char _operation[256];
146 /* Used to count parameters */
147 int _received;
148 /* Used to identify the caller */
149 erlang_pid _caller;
150 /* Used to identify the call */
151 erlang_ref _unique;
152 /* Exception id field */
153 CORBA_char *_exc_id;
154 /* Exception value field */
155 void *_exc_value;
156
157
158 } CORBA_Environment;
159
160
161 Note:
162 Always set the field values _fd, _regname, _to_pid and/or *_from_pid to
163 appropriate application values. These are not automatically set by the
164 stubs.
165
166
167 Warning:
168 Never assign static buffers to the buffer pointers, and never set the
169 _memchunk field to a value less than 32.
170
171
173 ic(3), ic_c_protocol(3)
174
175
176
177Ericsson AB ic 4.5.2 ic_clib(3)