Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 29c369053a983cc5d8c880dc6e0a2237 > files > 1714

libdtn-devel-2.6.0-2mdv2009.1.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>DTN Reference Implementation: dtn_ipc.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>dtn_ipc.h</h1><a href="dtn__ipc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *    Copyright 2004-2006 Intel Corporation</span>
<a name="l00003"></a>00003 <span class="comment"> * </span>
<a name="l00004"></a>00004 <span class="comment"> *    Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> *    you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> *    You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> *        http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> * </span>
<a name="l00010"></a>00010 <span class="comment"> *    Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> *    distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> *    See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> *    limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef DTN_IPC_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define DTN_IPC_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;rpc/rpc.h&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#ifdef __CYGWIN__</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cygwin/socket.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#endif</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="preprocessor">#ifdef  __cplusplus</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00030"></a>00030 <span class="preprocessor">#endif</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a>00032 <span class="comment">/*************************************************************</span>
<a name="l00033"></a>00033 <span class="comment"> *</span>
<a name="l00034"></a>00034 <span class="comment"> * Internal structures and functions that implement the DTN</span>
<a name="l00035"></a>00035 <span class="comment"> * IPC layer. Generally, this is not exposed to applications.</span>
<a name="l00036"></a>00036 <span class="comment"> *</span>
<a name="l00037"></a>00037 <span class="comment"> *************************************************************/</span>
<a name="l00038"></a>00038 
<a name="l00048"></a><a class="code" href="dtn__ipc_8h.html#2afeec365b4613086d19c23e8551d838">00048</a> <span class="preprocessor">#define DTN_IPC_VERSION 6</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00055"></a><a class="code" href="dtn__ipc_8h.html#7f9f6b66a37fb74f861dec857888c0ba">00055</a> <span class="preprocessor">#define DTN_IPC_PORT 5010</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>
<a name="l00061"></a><a class="code" href="dtn__ipc_8h.html#51d06f90137293f017ba7e9019d6602f">00061</a> <span class="preprocessor">#define DTN_MAX_API_MSG 65536</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00066"></a><a class="code" href="structdtnipc__handle.html">00066</a> <span class="keyword">struct </span><a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle</a> {
<a name="l00067"></a><a class="code" href="structdtnipc__handle.html#d7e67a3808764e8217255940427204bc">00067</a>     <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#d7e67a3808764e8217255940427204bc" title="Socket file descriptor.">sock</a>;                           
<a name="l00068"></a><a class="code" href="structdtnipc__handle.html#b76f241bd49850e48c051fde495d0a78">00068</a>     <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#b76f241bd49850e48c051fde495d0a78" title="Error code.">err</a>;                            
<a name="l00069"></a><a class="code" href="structdtnipc__handle.html#789e27232c351dc8367fe7d81ca3e32d">00069</a>     <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#789e27232c351dc8367fe7d81ca3e32d" title="Flag to register a call to poll().">in_poll</a>;                        
<a name="l00070"></a><a class="code" href="structdtnipc__handle.html#810e16c65902b0a074c2790f0a20c8f4">00070</a>     <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#810e16c65902b0a074c2790f0a20c8f4" title="Debug flag for channel.">debug</a>;                          
<a name="l00071"></a><a class="code" href="structdtnipc__handle.html#21348da7414b669f8d78863e8a8e684e">00071</a>     <span class="keywordtype">char</span> <a class="code" href="structdtnipc__handle.html#21348da7414b669f8d78863e8a8e684e" title="send/recv buffer">buf</a>[<a class="code" href="dtn__ipc_8h.html#51d06f90137293f017ba7e9019d6602f" title="The maximum IPC message size (in bytes).">DTN_MAX_API_MSG</a>];          
<a name="l00072"></a><a class="code" href="structdtnipc__handle.html#ded5c2335049e780a4ee8ab2b2356f95">00072</a>     XDR <a class="code" href="structdtnipc__handle.html#ded5c2335049e780a4ee8ab2b2356f95" title="XDR encoder.">xdr_encode</a>;                     
<a name="l00073"></a><a class="code" href="structdtnipc__handle.html#c09f26354224257a07c51d45f92725fd">00073</a>     XDR <a class="code" href="structdtnipc__handle.html#c09f26354224257a07c51d45f92725fd" title="XDR decoder.">xdr_decode</a>;                     
<a name="l00074"></a><a class="code" href="structdtnipc__handle.html#48ca99de45786eacf7d90206e66f1066">00074</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#48ca99de45786eacf7d90206e66f1066" title="Counter for debugging.">total_sent</a>;            
<a name="l00075"></a><a class="code" href="structdtnipc__handle.html#d55013a175ceb1570d5fe30062098bb7">00075</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structdtnipc__handle.html#d55013a175ceb1570d5fe30062098bb7" title="Counter for debugging.">total_rcvd</a>;            
<a name="l00076"></a>00076 };
<a name="l00077"></a>00077 
<a name="l00078"></a><a class="code" href="dtn__ipc_8h.html#052f7e976c7cd02ed8ed65b073f89b2b">00078</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle</a> <a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>;
<a name="l00079"></a>00079 
<a name="l00083"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d">00083</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00084"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d4e9e92913a117e7b6c92b2dee3eab867">00084</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d4e9e92913a117e7b6c92b2dee3eab867">DTN_OPEN</a>                    = 1,
<a name="l00085"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d88988342732cf7736a9a17338475582e">00085</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d88988342732cf7736a9a17338475582e">DTN_CLOSE</a>                   = 2,
<a name="l00086"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d92dab95353850a6e914e4008347f07c7">00086</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d92dab95353850a6e914e4008347f07c7">DTN_LOCAL_EID</a>               = 3,
<a name="l00087"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5de7933a4eff1b95879d4a353df40b195f">00087</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5de7933a4eff1b95879d4a353df40b195f">DTN_REGISTER</a>                = 4,
<a name="l00088"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d1e3888bf2ac2f73a90c6c142080279f5">00088</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d1e3888bf2ac2f73a90c6c142080279f5">DTN_UNREGISTER</a>              = 5,
<a name="l00089"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5df41ecaa2e442e281718ce6c7cd88fe30">00089</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5df41ecaa2e442e281718ce6c7cd88fe30">DTN_FIND_REGISTRATION</a>       = 6,
<a name="l00090"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5debfbbd5cdea8d1c82c92fe89b50d1b0f">00090</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5debfbbd5cdea8d1c82c92fe89b50d1b0f">DTN_CHANGE_REGISTRATION</a>     = 7,
<a name="l00091"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d59676a9e0dd2cf2a2ebb493721f50198">00091</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d59676a9e0dd2cf2a2ebb493721f50198">DTN_BIND</a>                    = 8,
<a name="l00092"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d801be28596a84f1a0ec58c57eac06b5b">00092</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d801be28596a84f1a0ec58c57eac06b5b">DTN_UNBIND</a>                  = 9,
<a name="l00093"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d00609e70cdd50ac4a6d989603c2976bf">00093</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d00609e70cdd50ac4a6d989603c2976bf">DTN_SEND</a>                    = 10,
<a name="l00094"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5da5a90d9130e7ad725dede5a0c4110495">00094</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5da5a90d9130e7ad725dede5a0c4110495">DTN_RECV</a>                    = 11,
<a name="l00095"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d5f4461d4add4e2832436f9c8ae25e61e">00095</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d5f4461d4add4e2832436f9c8ae25e61e">DTN_BEGIN_POLL</a>              = 12,
<a name="l00096"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5df37b9c7e51b4309e5f3ca74a8b743c3b">00096</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5df37b9c7e51b4309e5f3ca74a8b743c3b">DTN_CANCEL_POLL</a>             = 13,
<a name="l00097"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d8ac916eaefdf27a024e85c5a71ef7caf">00097</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d8ac916eaefdf27a024e85c5a71ef7caf">DTN_CANCEL</a>                  = 14,
<a name="l00098"></a><a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d7f9ec4960a1d48ce448a1f7c2dfc0d5a">00098</a>     <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d7f9ec4960a1d48ce448a1f7c2dfc0d5a">DTN_SESSION_UPDATE</a>          = 15
<a name="l00099"></a>00099 } <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d" title="Type codes for api messages.">dtnapi_message_type_t</a>;
<a name="l00100"></a>00100 
<a name="l00104"></a>00104 <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="dtn__ipc_8c.html#c5707d2923063f6fe2bde512f525f72b" title="Type code to string conversion routine.">dtnipc_msgtoa</a>(u_int8_t type);
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 <span class="comment">/*</span>
<a name="l00107"></a>00107 <span class="comment"> * Initialize the handle structure and a new ipc session with the</span>
<a name="l00108"></a>00108 <span class="comment"> * daemon.</span>
<a name="l00109"></a>00109 <span class="comment"> *</span>
<a name="l00110"></a>00110 <span class="comment"> * Returns 0 on success, -1 on error.</span>
<a name="l00111"></a>00111 <span class="comment"> */</span>
<a name="l00112"></a>00112 <span class="keywordtype">int</span> <a class="code" href="dtn__ipc_8c.html#0a70871adbaca23a535c898f854be3a8">dtnipc_open</a>(<a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>* <a class="code" href="dtncat_8c.html#01daea96255bb21a8979b3b45f5bbb70">handle</a>);
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">/*</span>
<a name="l00115"></a>00115 <span class="comment"> * Clean up the handle. dtnipc_open must have already been called on</span>
<a name="l00116"></a>00116 <span class="comment"> * the handle.</span>
<a name="l00117"></a>00117 <span class="comment"> *</span>
<a name="l00118"></a>00118 <span class="comment"> * Returns 0 on success, -1 on error.</span>
<a name="l00119"></a>00119 <span class="comment"> */</span>
<a name="l00120"></a>00120 <span class="keywordtype">int</span> <a class="code" href="dtn__ipc_8c.html#ca3de731f1395d03269a608a915d7539">dtnipc_close</a>(<a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>* <a class="code" href="dtncat_8c.html#01daea96255bb21a8979b3b45f5bbb70">handle</a>);
<a name="l00121"></a>00121     
<a name="l00122"></a>00122 <span class="comment">/*</span>
<a name="l00123"></a>00123 <span class="comment"> * Send a message over the dtn ipc protocol.</span>
<a name="l00124"></a>00124 <span class="comment"> *</span>
<a name="l00125"></a>00125 <span class="comment"> * Returns 0 on success, -1 on error.</span>
<a name="l00126"></a>00126 <span class="comment"> */</span>
<a name="l00127"></a>00127 <span class="keywordtype">int</span> <a class="code" href="dtn__ipc_8c.html#0c513c4c8a2438b359d7b53cec93e491">dtnipc_send</a>(<a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>* <a class="code" href="dtncat_8c.html#01daea96255bb21a8979b3b45f5bbb70">handle</a>, <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d" title="Type codes for api messages.">dtnapi_message_type_t</a> type);
<a name="l00128"></a>00128 
<a name="l00129"></a>00129 <span class="comment">/*</span>
<a name="l00130"></a>00130 <span class="comment"> * Receive a message response on the ipc channel. May block if there</span>
<a name="l00131"></a>00131 <span class="comment"> * is no pending message.</span>
<a name="l00132"></a>00132 <span class="comment"> *</span>
<a name="l00133"></a>00133 <span class="comment"> * Sets status to the server-returned status code and returns the</span>
<a name="l00134"></a>00134 <span class="comment"> * length of any reply message on success, returns -1 on internal</span>
<a name="l00135"></a>00135 <span class="comment"> * error.</span>
<a name="l00136"></a>00136 <span class="comment"> */</span>
<a name="l00137"></a>00137 <span class="keywordtype">int</span> <a class="code" href="dtn__ipc_8c.html#92414569c9a91e622d91bfcb8d711045">dtnipc_recv</a>(<a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>* <a class="code" href="dtncat_8c.html#01daea96255bb21a8979b3b45f5bbb70">handle</a>, <span class="keywordtype">int</span>* status);
<a name="l00138"></a>00138 
<a name="l00144"></a>00144 <span class="keywordtype">int</span> <a class="code" href="dtn__ipc_8c.html#2e471ca046cc85566e16b9f60ef9937e" title="Send a message and wait for a response over the dtn ipc protocol.">dtnipc_send_recv</a>(<a class="code" href="structdtnipc__handle.html" title="State of a DTN IPC channel.">dtnipc_handle_t</a>* <a class="code" href="dtncat_8c.html#01daea96255bb21a8979b3b45f5bbb70">handle</a>, <a class="code" href="dtn__ipc_8h.html#c05301bf9560764f5e97fba507ef9e5d" title="Type codes for api messages.">dtnapi_message_type_t</a> type);
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 <span class="preprocessor">#ifdef  __cplusplus</span>
<a name="l00148"></a>00148 <span class="preprocessor"></span>}
<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
<a name="l00150"></a>00150 <span class="preprocessor"></span>
<a name="l00151"></a>00151 <span class="preprocessor">#endif </span><span class="comment">/* DTN_IPC_H */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Jan 30 09:26:55 2009 for DTN Reference Implementation by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>