1ic_clib(3)                    C Library Functions                   ic_clib(3)
2
3
4

NAME

6       ic_clib - IC C Library Functions
7

DESCRIPTION

9       This  manual  page  lists some of the functions in the IC C runtime li‐
10       brary.
11

ALLOCATION AND DEALLOCATION FUNCTIONS

13       The following functions are used  for  allocating  and  deallocating  a
14       CORBA_Environment structure.
15

EXPORTS

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  al‐
21              locate  a CORBA_Environment structure and set the default values
22              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

EXCEPTION FUNCTIONS

56       Functions  for retrieving exception ids and values, and for setting ex‐
57       ceptions.
58

EXPORTS

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

SERVER RECEPTION

77       The following function is provided for convenience.
78

EXPORTS

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,   un‐
82       signed 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 re‐
86              ply.
87
88              send_ms  and  recv_ms specify timeout values in milliseconds for
89              send and receive, respectively.
90

GENERIC EXECUTION SWITCH AND MAP MERGING

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

EXPORTS

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

HELP FUNCTIONS FOR THE TYPE IC_ERLANG_TERM

107       Functions for creating ic_erlang_terms.
108

EXPORTS

110       ic_erlang_term*ic_mk_int_term(long l)
111
112       ic_erlang_term*ic_mk_float_term(double d)
113
114       ic_erlang_term*ic_mk_atom_term(char *atom_name)
115
116       ic_erlang_term*ic_mk_pid_term(char *node, int num, int serial, int cre‐
117       ation)
118
119       ic_erlang_term*ic_mk_port_term(char *node, int id, int creation)
120
121       ic_erlang_term*ic_mk_ref_term(char *node, int len, int n[3],  int  cre‐
122       ation)
123
124       ic_erlang_term*ic_mk_tuple_term(int arity)
125
126       int  ic_tuple_add_elem(ic_erlang_term *tuple, ic_erlang_term *elem, int
127       pos)
128
129       ic_erlang_term*ic_mk_list_term(long l)
130
131       int ic_list_add_elem(ic_erlang_term *list, ic_erlang_term *term)
132
133       ic_erlang_term*ic_mk_list_term_from_string(char *str)
134
135       ic_erlang_term*ic_mk_binary_term(int size, char *b)
136
137       int ic_free_erlang_term(ic_erlang_term *term)
138
139       void ic_print_erlang_term(ic_erlang_term *term)
140

THE CORBA_ENVIRONMENT STRUCTURE

142       Here is the complete definition of the CORBA_Environment structure, de‐
143       fined in file ic.h:
144
145             /* Environment definition */
146             typedef struct {
147
148             /*----- CORBA compatibility part ------------------------*/
149             /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/
150             CORBA_exception_type   _major;
151
152             /*----- External Implementation part - initiated by the user ---*/
153             /* File descriptor                                              */
154             int                    _fd;
155             /* Size of input buffer                                         */
156             int                    _inbufsz;
157             /* Pointer to always dynamically allocated buffer for input     */
158             char                  *_inbuf;
159             /* Size of output buffer                                        */
160             int                    _outbufsz;
161             /* Pointer to always dynamically allocated buffer for output    */
162             char                  *_outbuf;
163             /* Size of memory chunks in bytes, used for increasing the output
164             buffer, set to >= 32, should be around >= 1024 for performance
165             reasons                                                       */
166             int                    _memchunk;
167             /* Pointer for registered name                                   */
168             char                   _regname[256];
169             /* Process identity for caller                                   */
170             erlang_pid            *_to_pid;
171             /* Process identity for callee                                  */
172             erlang_pid            *_from_pid;
173
174             /*- Internal Implementation part - used by the server/client ---*/
175             /* Index for input buffer                                       */
176             int                    _iin;
177             /* Index for output buffer                                      */
178             int                    _iout;
179             /* Pointer for operation name                                   */
180             char                   _operation[256];
181             /* Used to count parameters                                    */
182             int                    _received;
183             /* Used to identify the caller                                  */
184             erlang_pid             _caller;
185             /* Used to identify the call                                     */
186             erlang_ref             _unique;
187             /* Exception id field                                           */
188             CORBA_char            *_exc_id;
189             /* Exception value field                                        */
190             void                  *_exc_value;
191
192
193             } CORBA_Environment;
194
195
196   Note:
197       Always set the field values _fd, _regname, _to_pid and/or *_from_pid to
198       appropriate application values. These are not automatically set by  the
199       stubs.
200
201
202   Warning:
203       Never  assign  static buffers to the buffer pointers, and never set the
204       _memchunk field to a value less than 32.
205
206

SEE ALSO

208       ic(3), ic_c_protocol(3)
209
210
211
212Ericsson AB                         ic 5.1                          ic_clib(3)
Impressum