1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>IC C Library Functions</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>IC C Library Functions</H1>
</CENTER>
<H3>C LIBRARY</H3>
<DIV CLASS=REFBODY>
ic_clib
</DIV>
<H3>C LIBRARY SUMMARY</H3>
<DIV CLASS=REFBODY>
IC C Library Functions
</DIV>
<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>
<P>This manual page lists some of the functions in the IC C runtime
library.
</DIV>
<H3>Allocation and Deallocation Functions</H3>
<DIV CLASS=REFBODY>
<P>The following functions are used for allocating and
deallocating a <STRONG>CORBA_Environment</STRONG> structure.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="CORBA_Environment_alloc/2"><STRONG><CODE>CORBA_Environment*
CORBA_Environment_alloc(int inbufsz, int outbufsz)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P>This funtion is used to allocate and initiate the
<CODE>CORBA_Environment</CODE> structure. In particular, it is used
to dynamically allocate a CORBA_Environment structure and set
the default values for the structure's fields.
<P><STRONG>inbufsize</STRONG> is the initial size of the input
buffer.
<P><STRONG>outbufsize</STRONG> is the initial size of the output
buffer.
<P><STRONG>CORBA_Environment</STRONG> is the CORBA 2.0 state structure
used by the generated stub.
<P>This function will set all needed default values and
allocate buffers the lengths of which are equal to the
values passed, but will not allocate space for the _to_pid
and _from_pid fields.
<P>To free the space allocated by CORBA_Environment_alloc() do
as follows.
<P>
<UL>
<LI>
First call CORBA_free for the input and output buffers.
<BR>
</LI>
<LI>
After freeing the buffer space, call CORBA_free for the
CORBA_Environment space.
<BR>
</LI>
</UL>
</DIV>
<P><A NAME="CORBA_free/1"><STRONG><CODE>voidCORBA_free(void *p)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Frees allocated space pointed to by <CODE>p</CODE>.
</DIV>
<P><A NAME="CORBA_string_alloc/1"><STRONG><CODE>CORBA_char*
CORBA_string_alloc(CORBA_unsigned_long len)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Allocates a (simple) CORBA character string of length <CODE>len
+ 1</CODE>.
</DIV>
<P><A NAME="CORBA_wstring_alloc/1"><STRONG><CODE>CORBA_wchar*
CORBA_wstring_alloc(CORBA_unsigned_long len)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Allocates a CORBA wide string of length <CODE>len + 1</CODE>.
</DIV>
<H3>Exception Functions</H3>
<DIV CLASS=REFBODY>
<P> Functions for retreiving exception ids and values, and for setting
exceptions.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="CORBA_exception_id/1"><STRONG><CODE>CORBA_char* CORBA_exception_id(CORBA_Environment *env)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Returns the exception identity if an exception is set, otherwise
it returns <CODE>NULL</CODE>.
</DIV>
<P><A NAME="CORBA_exception_value/1"><STRONG><CODE>void* CORBA_exception_value(CORBA_Environment *env)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Returns the exception value, if an exception is set, otherwise
it returns <CODE>NULL</CODE>.
</DIV>
<P><A NAME="CORBA_exc_set/4"><STRONG><CODE>void CORBA_exc_set(CORBA_Environment *env,
CORBA_exception_type Major, CORBA_char *Id,
CORBA_char *Value)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Sets the exception type, exception identity, and exception value
in the environment pointed to by <CODE>env</CODE>.
</DIV>
<H3>Server Reception</H3>
<DIV CLASS=REFBODY>
<P> The following function is provided for convenience.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="oe_server_receive/2"><STRONG><CODE>int
oe_server_receive(CORBA_Environment *env, oe_map_t *map)
</CODE></STRONG></A><BR>
<A NAME="oe_server_receive_tmo/4"><STRONG><CODE>int
oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map,
unsigned int send_ms, unsigned int recv_ms)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P> Provides a loop that receives one message, executes the
operation in question, and in case of a two-way operation
sends a reply.
<P><CODE>send_ms</CODE> and <CODE>recv_ms</CODE> specify timeout values
in milliseconds for send and receive, respectively.
</DIV>
<H3>Generic Execution Switch and Map Merging</H3>
<DIV CLASS=REFBODY>
<P> Function for searching for server operation function, and for
calling it if found. Function for merging maps (see the include
file <CODE>ic.h</CODE> for definitions).
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="oe_exec_switch/3"><STRONG><CODE>int
oe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P>Search for server operation and execute it.
</DIV>
<P><A NAME="oe_merge_maps/2"><STRONG><CODE>oe_map_t*
oe_merge_maps(oe_map_t *maps, int size)
</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P>Merge an array of server maps to one single map.
</DIV>
<H3>The CORBA_Environment structure</H3>
<DIV CLASS=REFBODY>
<P> Here is the complete definition of the CORBA_Environment structure,
defined in file <STRONG>ic.h</STRONG>:
<PRE>
/* Environment definition */
typedef struct {
/*----- CORBA compatibility part ------------------------*/
/* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/
CORBA_exception_type _major;
/*----- External Implementation part - initiated by the user ---*/
/* File descriptor */
int _fd;
/* Size of input buffer */
int _inbufsz;
/* Pointer to always dynamically allocated buffer for input */
char *_inbuf;
/* Size of output buffer */
int _outbufsz;
/* Pointer to always dynamically allocated buffer for output */
char *_outbuf;
/* Size of memory chunks in bytes, used for increasing the output
buffer, set to >= 32, should be around >= 1024 for performance
reasons */
int _memchunk;
/* Pointer for registered name */
char _regname[256];
/* Process identity for caller */
erlang_pid *_to_pid;
/* Process identity for callee */
erlang_pid *_from_pid;
/*- Internal Implementation part - used by the server/client ---*/
/* Index for input buffer */
int _iin;
/* Index for output buffer */
int _iout;
/* Pointer for operation name */
char _operation[256];
/* Used to count parameters */
int _received;
/* Used to identify the caller */
erlang_pid _caller;
/* Used to identify the call */
erlang_ref _unique;
/* Exception id field */
CORBA_char *_exc_id;
/* Exception value field */
void *_exc_value;
} CORBA_Environment;
</PRE>
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P> Always set the field values <STRONG>_fd</STRONG>, <STRONG>_regname</STRONG>,
<STRONG>_to_pid</STRONG> and/or <STRONG>*_from_pid</STRONG> to appropriate
application values. These are not automatically set by the
stubs.
</TD>
</TR>
</TABLE>
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Warning!" SRC="warning.gif"></TD>
<TD>
<P>Never assign static buffers to the buffer pointers, and never
set the <STRONG>_memchunk</STRONG> field to a value less than
<STRONG>32</STRONG>.
</TD>
</TR>
</TABLE>
</DIV>
<H3>SEE ALSO</H3>
<DIV CLASS=REFBODY>
<P>ic(3), ic_c_protocol(3)
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Peter Hfeldt - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>ic 4.2.11<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|