1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE cref SYSTEM "cref.dtd">
9
<holder>Ericsson AB, All Rights Reserved</holder>
12
The contents of this file are subject to the Erlang Public License,
13
Version 1.1, (the "License"); you may not use this file except in
14
compliance with the License. You should have received a copy of the
15
Erlang Public License along with this software. If not, it can be
16
retrieved online at http://www.erlang.org/.
18
Software distributed under the License is distributed on an "AS IS"
19
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
20
the License for the specific language governing rights and limitations
23
The Initial Developer of the Original Code is Ericsson AB.
26
<title>IC C Library Functions</title>
29
<date>2003-12-16</date>
33
<libsummary>IC C Library Functions</libsummary>
35
<p>This manual page lists some of the functions in the IC C runtime
40
<title>Allocation and Deallocation Functions</title>
41
<p>The following functions are used for allocating and
42
deallocating a <em>CORBA_Environment</em> structure.</p>
46
<name><ret>CORBA_Environment*</ret><nametext>CORBA_Environment_alloc(int inbufsz, int outbufsz)</nametext></name>
47
<fsummary>Allocate environment data.</fsummary>
49
<p>This function is used to allocate and initiate the
50
<c>CORBA_Environment</c> structure. In particular, it is used
51
to dynamically allocate a CORBA_Environment structure and set
52
the default values for the structure's fields.</p>
53
<p><em>inbufsize</em> is the initial size of the input
55
<p><em>outbufsize</em> is the initial size of the output
57
<p><em>CORBA_Environment</em> is the CORBA 2.0 state structure
58
used by the generated stub.</p>
59
<p>This function will set all needed default values and
60
allocate buffers the lengths of which are equal to the
61
values passed, but will not allocate space for the _to_pid
62
and _from_pid fields.</p>
63
<p>To free the space allocated by CORBA_Environment_alloc() do
65
<list type="bulleted">
67
<p>First call CORBA_free for the input and output buffers.</p>
70
<p>After freeing the buffer space, call CORBA_free for the
71
CORBA_Environment space.</p>
77
<name><ret>void</ret><nametext>CORBA_free(void *p)</nametext></name>
78
<fsummary>Free any allocated data.</fsummary>
80
<p>Frees allocated space pointed to by <c>p</c>.</p>
84
<name><ret>CORBA_char*</ret><nametext>CORBA_string_alloc(CORBA_unsigned_long len)</nametext></name>
85
<fsummary>Allocate a string.</fsummary>
87
<p>Allocates a (simple) CORBA character string of length <c>len + 1</c>.</p>
91
<name><ret>CORBA_wchar*</ret><nametext>CORBA_wstring_alloc(CORBA_unsigned_long len)</nametext></name>
92
<fsummary>Allocate a wide string.</fsummary>
94
<p>Allocates a CORBA wide string of length <c>len + 1</c>.</p>
100
<title>Exception Functions</title>
101
<p>Functions for retrieving exception ids and values, and for setting
106
<name><ret>CORBA_char*</ret><nametext>CORBA_exception_id(CORBA_Environment *env)</nametext></name>
107
<fsummary>Get exception identity.</fsummary>
109
<p>Returns the exception identity if an exception is set, otherwise
110
it returns <c>NULL</c>.</p>
114
<name><ret>void*</ret><nametext>CORBA_exception_value(CORBA_Environment *env)</nametext></name>
115
<fsummary>Get exception value.</fsummary>
117
<p>Returns the exception value, if an exception is set, otherwise
118
it returns <c>NULL</c>.</p>
122
<name><ret>void</ret><nametext>CORBA_exc_set(CORBA_Environment *env, CORBA_exception_type Major, CORBA_char *Id, CORBA_char *Value)</nametext></name>
123
<fsummary>Set exception.</fsummary>
125
<p>Sets the exception type, exception identity, and exception value
126
in the environment pointed to by <c>env</c>.</p>
132
<title>Server Reception</title>
133
<p>The following function is provided for convenience. </p>
137
<name><ret>int</ret><nametext>oe_server_receive(CORBA_Environment *env, oe_map_t *map)</nametext></name>
138
<name><ret>int</ret><nametext>oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, unsigned int send_ms, unsigned int recv_ms)</nametext></name>
139
<fsummary>Server receive of notification or request, and sending of reply (in case of request).</fsummary>
141
<p>Provides a loop that receives one message, executes the
142
operation in question, and in case of a two-way operation
144
<p><c>send_ms</c> and <c>recv_ms</c> specify timeout values
145
in milliseconds for send and receive, respectively.</p>
151
<title>Generic Execution Switch and Map Merging</title>
152
<p>Function for searching for server operation function, and for
153
calling it if found. Function for merging maps (see the include
154
file <c>ic.h</c> for definitions). </p>
158
<name><ret>int</ret><nametext>oe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map)</nametext></name>
159
<fsummary>Search for server operation and execute it.</fsummary>
161
<p>Search for server operation and execute it.</p>
165
<name><ret>oe_map_t*</ret><nametext>oe_merge_maps(oe_map_t *maps, int size)</nametext></name>
166
<fsummary>Merge an array of server maps to one single map.</fsummary>
168
<p>Merge an array of server maps to one single map.</p>
174
<title>The CORBA_Environment structure</title>
175
<p>Here is the complete definition of the CORBA_Environment structure,
176
defined in file <em>ic.h</em>: </p>
178
/* Environment definition */
181
/*----- CORBA compatibility part ------------------------*/
182
/* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/
183
CORBA_exception_type _major;
185
/*----- External Implementation part - initiated by the user ---*/
186
/* File descriptor */
188
/* Size of input buffer */
190
/* Pointer to always dynamically allocated buffer for input */
192
/* Size of output buffer */
194
/* Pointer to always dynamically allocated buffer for output */
196
/* Size of memory chunks in bytes, used for increasing the output
197
buffer, set to >= 32, should be around >= 1024 for performance
200
/* Pointer for registered name */
202
/* Process identity for caller */
204
/* Process identity for callee */
205
erlang_pid *_from_pid;
207
/*- Internal Implementation part - used by the server/client ---*/
208
/* Index for input buffer */
210
/* Index for output buffer */
212
/* Pointer for operation name */
213
char _operation[256];
214
/* Used to count parameters */
216
/* Used to identify the caller */
218
/* Used to identify the call */
220
/* Exception id field */
222
/* Exception value field */
229
<p>Always set the field values <em>_fd</em>, <em>_regname</em>,
230
<em>_to_pid</em> and/or <em>*_from_pid</em> to appropriate
231
application values. These are not automatically set by the
235
<p>Never assign static buffers to the buffer pointers, and never
236
set the <em>_memchunk</em> field to a value less than
242
<title>SEE ALSO</title>
243
<p>ic(3), ic_c_protocol(3)