<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- IC C Library Functions</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/ic-4.2.31.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>ic</strong><br><strong>Reference Manual</strong><br><small>Version 4.2.31</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="no" title="ic " expanded="false">ic<ul> <li><a href="ic.html"> Top of manual page </a></li> <li title="ic:gen-1"><a href="ic.html#ic:gen-1">ic:gen/1</a></li> <li title="ic:gen-2"><a href="ic.html#ic:gen-2">ic:gen/2</a></li> </ul> </li> <li id="loadscrollpos" title="ic_clib " expanded="true">ic_clib<ul> <li><a href="ic_clib.html"> Top of manual page </a></li> <li title="CORBA_Environment_alloc"><a href="ic_clib.html#CORBA_Environment_alloc">CORBA_Environment_alloc() </a></li> <li title="CORBA_free"><a href="ic_clib.html#CORBA_free">CORBA_free() </a></li> <li title="CORBA_string_alloc"><a href="ic_clib.html#CORBA_string_alloc">CORBA_string_alloc() </a></li> <li title="CORBA_wstring_alloc"><a href="ic_clib.html#CORBA_wstring_alloc">CORBA_wstring_alloc() </a></li> <li title="CORBA_exception_id"><a href="ic_clib.html#CORBA_exception_id">CORBA_exception_id() </a></li> <li title="CORBA_exception_value"><a href="ic_clib.html#CORBA_exception_value">CORBA_exception_value() </a></li> <li title="CORBA_exc_set"><a href="ic_clib.html#CORBA_exc_set">CORBA_exc_set() </a></li> <li title="oe_server_receive"><a href="ic_clib.html#oe_server_receive">oe_server_receive() </a></li> <li title="oe_server_receive_tmo"><a href="ic_clib.html#oe_server_receive_tmo">oe_server_receive_tmo() </a></li> <li title="oe_exec_switch"><a href="ic_clib.html#oe_exec_switch">oe_exec_switch() </a></li> <li title="oe_merge_maps"><a href="ic_clib.html#oe_merge_maps">oe_merge_maps() </a></li> </ul> </li> <li id="no" title="ic_c_protocol " expanded="false">ic_c_protocol<ul> <li><a href="ic_c_protocol.html"> Top of manual page </a></li> <li title="oe_prepare_notification_encoding"><a href="ic_c_protocol.html#oe_prepare_notification_encoding">oe_prepare_notification_encoding() </a></li> <li title="oe_send_notification"><a href="ic_c_protocol.html#oe_send_notification">oe_send_notification() </a></li> <li title="oe_send_notification_tmo"><a href="ic_c_protocol.html#oe_send_notification_tmo">oe_send_notification_tmo() </a></li> <li title="oe_prepare_request_encoding"><a href="ic_c_protocol.html#oe_prepare_request_encoding">oe_prepare_request_encoding() </a></li> <li title="oe_send_request_and_receive_reply"><a href="ic_c_protocol.html#oe_send_request_and_receive_reply">oe_send_request_and_receive_reply() </a></li> <li title="oe_send_request_and_receive_reply_tmo"><a href="ic_c_protocol.html#oe_send_request_and_receive_reply_tmo">oe_send_request_and_receive_reply_tmo() </a></li> <li title="oe_prepare_reply_decoding"><a href="ic_c_protocol.html#oe_prepare_reply_decoding">oe_prepare_reply_decoding() </a></li> <li title="oe_prepare_request_decoding"><a href="ic_c_protocol.html#oe_prepare_request_decoding">oe_prepare_request_decoding() </a></li> <li title="oe_prepare_reply_encoding"><a href="ic_c_protocol.html#oe_prepare_reply_encoding">oe_prepare_reply_encoding() </a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>ic_clib</h1></center> <h3>C LIBRARY</h3> <div class="REFBODY">ic_clib</div> <h3>LIBRARY SUMMARY</h3> <div class="REFBODY">IC C Library Functions</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>This manual page lists some of the functions in the IC C runtime library. </p> </p></div> <h3><a name="id64947">Allocation and Deallocation Functions</a></h3> <div class="REFBODY"> <p>The following functions are used for allocating and deallocating a <strong>CORBA_Environment</strong> structure.</p> </div> <h3>EXPORTS</h3> <p><a name="CORBA_Environment_alloc"><span class="bold_code">CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz)</span></a><br></p> <div class="REFBODY"><p> <p>This function is used to allocate and initiate the <span class="code">CORBA_Environment</span> structure. In particular, it is used to dynamically allocate a CORBA_Environment structure and set the default values for the structure's fields.</p> <p><strong>inbufsize</strong> is the initial size of the input buffer.</p> <p><strong>outbufsize</strong> is the initial size of the output buffer.</p> <p><strong>CORBA_Environment</strong> is the CORBA 2.0 state structure used by the generated stub.</p> <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> <p>To free the space allocated by CORBA_Environment_alloc() do as follows.</p> <ul> <li> <p>First call CORBA_free for the input and output buffers.</p> </li> <li> <p>After freeing the buffer space, call CORBA_free for the CORBA_Environment space.</p> </li> </ul> </p></div> <p><a name="CORBA_free"><span class="bold_code">void CORBA_free(void *p)</span></a><br></p> <div class="REFBODY"><p> <p>Frees allocated space pointed to by <span class="code">p</span>.</p> </p></div> <p><a name="CORBA_string_alloc"><span class="bold_code">CORBA_char *CORBA_string_alloc(CORBA_unsigned_long len)</span></a><br></p> <div class="REFBODY"><p> <p>Allocates a (simple) CORBA character string of length <span class="code">len + 1</span>.</p> </p></div> <p><a name="CORBA_wstring_alloc"><span class="bold_code">CORBA_wchar *CORBA_wstring_alloc(CORBA_unsigned_long len)</span></a><br></p> <div class="REFBODY"><p> <p>Allocates a CORBA wide string of length <span class="code">len + 1</span>.</p> </p></div> <h3><a name="id65124">Exception Functions</a></h3> <div class="REFBODY"> <p>Functions for retrieving exception ids and values, and for setting exceptions. </p> </div> <h3>EXPORTS</h3> <p><a name="CORBA_exception_id"><span class="bold_code">CORBA_char *CORBA_exception_id(CORBA_Environment *env)</span></a><br></p> <div class="REFBODY"><p> <p>Returns the exception identity if an exception is set, otherwise it returns <span class="code">NULL</span>.</p> </p></div> <p><a name="CORBA_exception_value"><span class="bold_code">void *CORBA_exception_value(CORBA_Environment *env)</span></a><br></p> <div class="REFBODY"><p> <p>Returns the exception value, if an exception is set, otherwise it returns <span class="code">NULL</span>.</p> </p></div> <p><a name="CORBA_exc_set"><span class="bold_code">void CORBA_exc_set(CORBA_Environment *env, CORBA_exception_type Major, CORBA_char *Id, CORBA_char *Value)</span></a><br></p> <div class="REFBODY"><p> <p>Sets the exception type, exception identity, and exception value in the environment pointed to by <span class="code">env</span>.</p> </p></div> <h3><a name="id63254">Server Reception</a></h3> <div class="REFBODY"> <p>The following function is provided for convenience. </p> </div> <h3>EXPORTS</h3> <p><a name="oe_server_receive"><span class="bold_code">int oe_server_receive(CORBA_Environment *env, oe_map_t *map)</span></a><br><a name="oe_server_receive_tmo"><span class="bold_code">int oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, unsigned int send_ms, unsigned int recv_ms)</span></a><br></p> <div class="REFBODY"><p> <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> <p><span class="code">send_ms</span> and <span class="code">recv_ms</span> specify timeout values in milliseconds for send and receive, respectively.</p> </p></div> <h3><a name="id63312">Generic Execution Switch and Map Merging</a></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 <span class="code">ic.h</span> for definitions). </p> </div> <h3>EXPORTS</h3> <p><a name="oe_exec_switch"><span class="bold_code">int oe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map)</span></a><br></p> <div class="REFBODY"><p> <p>Search for server operation and execute it.</p> </p></div> <p><a name="oe_merge_maps"><span class="bold_code">oe_map_t *oe_merge_maps(oe_map_t *maps, int size)</span></a><br></p> <div class="REFBODY"><p> <p>Merge an array of server maps to one single map.</p> </p></div> <h3><a name="id63378">The CORBA_Environment structure</a></h3> <div class="REFBODY"> <p>Here is the complete definition of the CORBA_Environment structure, defined in file <strong>ic.h</strong>: </p> <div class="example"><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></div> <div class="note"> <div class="label">Note</div> <div class="content"><p> <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.</p> </p></div> </div> <div class="warning"> <div class="label">Warning</div> <div class="content"><p> <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>.</p> </p></div> </div> </div> <h3><a name="id63460">SEE ALSO</a></h3> <div class="REFBODY"> <p>ic(3), ic_c_protocol(3) </p> </div> </div> <div class="footer"> <hr> <p>Copyright © 1998-2012 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>