<!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_errno.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main 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> <h1>dtn_errno.c</h1><a href="dtn__errno_8c.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 2007 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">#include <stdio.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="dtn__errno_8h.html">dtn_errno.h</a>"</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="comment">//----------------------------------------------------------------------</span> <a name="l00021"></a>00021 <span class="keywordtype">char</span>* <a name="l00022"></a><a class="code" href="dtn__errno_8h.html#1b23d549407e59e3ce2a1c32e3885b1d">00022</a> <a class="code" href="dtn__errno_8c.html#1b23d549407e59e3ce2a1c32e3885b1d" title="Get a string value associated with the dtn error code.">dtn_strerror</a>(<span class="keywordtype">int</span> err) <a name="l00023"></a>00023 { <a name="l00024"></a>00024 <span class="keywordflow">switch</span>(err) { <a name="l00025"></a>00025 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#3723251cb5d056b6ace3e22561da1e11" title="DTN API error codes.">DTN_SUCCESS</a>: <span class="keywordflow">return</span> <span class="stringliteral">"success"</span>; <a name="l00026"></a>00026 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#8db3fceccf291cdfc226b9bea2316346">DTN_EINVAL</a>: <span class="keywordflow">return</span> <span class="stringliteral">"invalid argument"</span>; <a name="l00027"></a>00027 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#2121e3f0d822e257e8d2e843a3524ef0">DTN_EXDR</a>: <span class="keywordflow">return</span> <span class="stringliteral">"error in xdr routines"</span>; <a name="l00028"></a>00028 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#b4ae5bb2a6256b2dac33962e688584de">DTN_ECOMM</a>: <span class="keywordflow">return</span> <span class="stringliteral">"error in ipc communication"</span>; <a name="l00029"></a>00029 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#90d533511e71475815cbbebd2ff74e7d">DTN_ECONNECT</a>: <span class="keywordflow">return</span> <span class="stringliteral">"error connecting to server"</span>; <a name="l00030"></a>00030 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#35b24187121ca003154518bba0a35e75">DTN_ETIMEOUT</a>: <span class="keywordflow">return</span> <span class="stringliteral">"operation timed out"</span>; <a name="l00031"></a>00031 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#dfbc45377fa7c17b849e79a015975a79">DTN_ESIZE</a>: <span class="keywordflow">return</span> <span class="stringliteral">"payload too large"</span>; <a name="l00032"></a>00032 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#58a067b3ff3eba74fc55d6d7e7866d5a">DTN_ENOTFOUND</a>: <span class="keywordflow">return</span> <span class="stringliteral">"not found"</span>; <a name="l00033"></a>00033 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#951a074861ce082706b57c300413042b">DTN_EINTERNAL</a>: <span class="keywordflow">return</span> <span class="stringliteral">"internal error"</span>; <a name="l00034"></a>00034 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#a2e25b980431aabe8f0c208ae97bf295">DTN_EINPOLL</a>: <span class="keywordflow">return</span> <span class="stringliteral">"illegal operation called after dtn_poll"</span>; <a name="l00035"></a>00035 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#a76777ac1a395f962da37788ced6fc47">DTN_EBUSY</a>: <span class="keywordflow">return</span> <span class="stringliteral">"registration already in use"</span>; <a name="l00036"></a>00036 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#6841c2297bba5c4fd8b69ac2e4b1975d">DTN_EVERSION</a>: <span class="keywordflow">return</span> <span class="stringliteral">"ipc version mismatch"</span>; <a name="l00037"></a>00037 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#821d437975e7fec44cb53b89adf7e80a">DTN_EMSGTYPE</a>: <span class="keywordflow">return</span> <span class="stringliteral">"unknown ipc message type"</span>; <a name="l00038"></a>00038 <span class="keywordflow">case</span> <a class="code" href="dtn__errno_8h.html#03f2f10c4e3ceeaa48f397c0d42b2b1a">DTN_ENOSPACE</a>: <span class="keywordflow">return</span> <span class="stringliteral">"no storage space"</span>; <a name="l00039"></a>00039 <span class="keywordflow">case</span> -1: <span class="keywordflow">return</span> <span class="stringliteral">"(invalid error code -1)"</span>; <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">// there's a small race condition here in case there are two</span> <a name="l00043"></a>00043 <span class="comment">// simultaneous calls that will clobber the same buffer, but this</span> <a name="l00044"></a>00044 <span class="comment">// should be rare and the worst that happens is that the output</span> <a name="l00045"></a>00045 <span class="comment">// string is garbled</span> <a name="l00046"></a>00046 <span class="keyword">static</span> <span class="keywordtype">char</span> <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>[128]; <a name="l00047"></a>00047 snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">"(unknown error %d)"</span>, err); <a name="l00048"></a>00048 <span class="keywordflow">return</span> buf; <a name="l00049"></a>00049 } <a name="l00050"></a>00050 </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:44 2008 for DTN Reference Implementation by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>