<!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: RIBDTLV.h 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>RIBDTLV.h</h1><a href="RIBDTLV_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 2007 Baylor University</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 _PROPHET_RIBD_TLV_H</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _PROPHET_RIBD_TLV_H</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="BaseTLV_8h.html">BaseTLV.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="prophet_2Dictionary_8h.html">Dictionary.h</a>"</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="keyword">namespace </span>prophet <a name="l00024"></a>00024 { <a name="l00025"></a>00025 <a name="l00026"></a><a class="code" href="classprophet_1_1RIBDTLV.html">00026</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1RIBDTLV.html">RIBDTLV</a> : <span class="keyword">public</span> <a class="code" href="classprophet_1_1BaseTLV.html" title="The Prophet I-D (March 2006) dictates five bytecodes for router state exchange messages...">BaseTLV</a> <a name="l00027"></a>00027 { <a name="l00028"></a>00028 <span class="keyword">public</span>: <a name="l00039"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html">00039</a> <span class="keyword">struct </span><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html" title="Routing Information Base Dictionary TLV p.">RIBDTLVHeader</a> { <a name="l00040"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#7e973119937426ec51581346eaa0d893">00040</a> u_int8_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#7e973119937426ec51581346eaa0d893" title="defined as 0xA0">type</a>; <a name="l00041"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#89a63585e45d8212ea3e727523d27c52">00041</a> u_int8_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#89a63585e45d8212ea3e727523d27c52" title="TBD.">flags</a>; <a name="l00042"></a>00042 <a name="l00046"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#88bce088c07fa1aa92fa15f06a1ea14f">00046</a> u_int16_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#88bce088c07fa1aa92fa15f06a1ea14f" title="Length of the TLV in octets, including the TLV header and any nested TLVs.">length</a>; <a name="l00047"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#c63ec92076569045ba86dccdcb4096b7">00047</a> u_int16_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#c63ec92076569045ba86dccdcb4096b7" title="Number of entries in the database.">entry_count</a>; <a name="l00048"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#814bc44f1b7f569abc32bc5ff482cd72">00048</a> u_int16_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html#814bc44f1b7f569abc32bc5ff482cd72">unused__</a>; <a name="l00049"></a>00049 } __attribute__((<a class="code" href="classprophet_1_1RIBDTLV.html#141040c9f8d80842585f85778473172f" title="Routing Information Base Dictionary TLV p.">packed</a>)); <a name="l00050"></a>00050 <a name="l00055"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html">00055</a> <span class="keyword">struct </span><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html" title="Routing Address String (entry in RIBD above) p.">RoutingAddressString</a> { <a name="l00063"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#4867d857340fbdc4b5004dfc2a3df51f">00063</a> u_int16_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#4867d857340fbdc4b5004dfc2a3df51f" title="16 bit identifier that is constant for the duration of a session.">string_id</a>; <a name="l00064"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#704a55c844d9090887addcb7f885bf94">00064</a> u_int8_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#704a55c844d9090887addcb7f885bf94" title="Length of Address String.">length</a>; <a name="l00065"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#ab165e243c77323a77e4d8a06a44ac4c">00065</a> u_int8_t <a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#ab165e243c77323a77e4d8a06a44ac4c">unused__</a>; <a name="l00066"></a><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#ab006316583f2ae6310af91023fce749">00066</a> u_char <a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html#ab006316583f2ae6310af91023fce749">ra_string</a>[0]; <a name="l00067"></a>00067 } __attribute__((<a class="code" href="classprophet_1_1RIBDTLV.html#141040c9f8d80842585f85778473172f" title="Routing Information Base Dictionary TLV p.">packed</a>)); <a name="l00068"></a>00068 <a name="l00069"></a><a class="code" href="classprophet_1_1RIBDTLV.html#0462e2f66d58cf097d5d759e9d3d2e27">00069</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1RIBDTLV.html#0462e2f66d58cf097d5d759e9d3d2e27">RIBDTLVHeaderSize</a> = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structprophet_1_1RIBDTLV_1_1RIBDTLVHeader.html" title="Routing Information Base Dictionary TLV p.">RIBDTLVHeader</a>); <a name="l00070"></a>00070 <a name="l00071"></a><a class="code" href="classprophet_1_1RIBDTLV.html#557314304a9645a753d24f5580dbd61c">00071</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1RIBDTLV.html#557314304a9645a753d24f5580dbd61c">RoutingAddressStringSize</a> = <a name="l00072"></a>00072 <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structprophet_1_1RIBDTLV_1_1RoutingAddressString.html" title="Routing Address String (entry in RIBD above) p.">RoutingAddressString</a>); <a name="l00073"></a>00073 <a name="l00077"></a>00077 <a class="code" href="classprophet_1_1RIBDTLV.html#21d749e043b5c6ee6787418475ccd740" title="Constructor.">RIBDTLV</a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1Dictionary.html" title="Utility class to facilitate converting to and from routing string (endpoint ID) and...">Dictionary</a>& <a class="code" href="classprophet_1_1RIBDTLV.html#f61522c27a15c1321df154b44392459b" title="Accessor.">ribd</a>); <a name="l00078"></a>00078 <a name="l00082"></a><a class="code" href="classprophet_1_1RIBDTLV.html#df4593224fd3598f2aecb8272fbb1258">00082</a> <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1RIBDTLV.html#df4593224fd3598f2aecb8272fbb1258" title="Destructor.">~RIBDTLV</a>() {} <a name="l00083"></a>00083 <a name="l00087"></a>00087 <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1RIBDTLV.html#9b26b15fa1b5286d40b7eba91a8d39e6" title="Virtual from BaseTLV.">serialize</a>(u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>) <span class="keyword">const</span>; <a name="l00088"></a>00088 <a name="l00092"></a>00092 <span class="keyword">const</span> <a class="code" href="classprophet_1_1Dictionary.html" title="Utility class to facilitate converting to and from routing string (endpoint ID) and...">Dictionary</a>& <a class="code" href="classprophet_1_1RIBDTLV.html#f61522c27a15c1321df154b44392459b" title="Accessor.">ribd</a>(<span class="keyword">const</span> std::string& sender, <a name="l00093"></a>00093 <span class="keyword">const</span> std::string& receiver); <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="keyword">protected</span>: <a name="l00096"></a><a class="code" href="classprophet_1_1RIBDTLV.html#3e792ea418b7f8f0a460fb5ab3ab1607">00096</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="structprophet_1_1TLVFactory.html">TLVFactory</a><<a class="code" href="classprophet_1_1RIBDTLV.html">RIBDTLV</a>>; <a name="l00097"></a>00097 <a name="l00101"></a>00101 <a class="code" href="classprophet_1_1RIBDTLV.html#21d749e043b5c6ee6787418475ccd740" title="Constructor.">RIBDTLV</a>(); <a name="l00102"></a>00102 <a name="l00107"></a>00107 <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1RIBDTLV.html#cb9d5d3a603d208a7c4d880e4b8cb7a7" title="Serialize destination ID out to buffer bp, size len, using struct RoutingAddressString;...">write_ras_entry</a>(u_int16_t sid, <span class="keyword">const</span> std::string& dest_id, <a name="l00108"></a>00108 u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>) <span class="keyword">const</span>; <a name="l00109"></a>00109 <a name="l00114"></a>00114 <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1RIBDTLV.html#9d4063bccf8158d2b46d84689bc5739d" title="Deserialize RoutingAddressString struct from transport into memory, setting *sid...">read_ras_entry</a>(u_int16_t* sid, std::string& dest_id, <a name="l00115"></a>00115 <span class="keyword">const</span> u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>); <a name="l00116"></a>00116 <a name="l00120"></a>00120 <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1RIBDTLV.html#e5e6e89ef24b6bfa3c5d0ee0c97f3f55" title="Virtual from BaseTLV.">deserialize</a>(<span class="keyword">const</span> u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>); <a name="l00121"></a>00121 <a name="l00122"></a><a class="code" href="classprophet_1_1RIBDTLV.html#5aab54c6e1a12bb1846b2a3f299d1ff6">00122</a> <a class="code" href="classprophet_1_1Dictionary.html" title="Utility class to facilitate converting to and from routing string (endpoint ID) and...">Dictionary</a> <a class="code" href="classprophet_1_1RIBDTLV.html#5aab54c6e1a12bb1846b2a3f299d1ff6" title="mapping from destination id string to numeric id (sid)">ribd_</a>; <a name="l00123"></a>00123 <a name="l00124"></a>00124 <a name="l00125"></a>00125 }; <span class="comment">// class RIBDTLV</span> <a name="l00126"></a>00126 <a name="l00127"></a>00127 }; <span class="comment">// namespace prophet</span> <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="preprocessor">#endif // _PROPHET_RIBD_TLV_H</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:46 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>