<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ucommon: ucommon/socket.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.6.3 --> <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>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>ucommon/socket.h</h1><a href="a00198.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.</span> <a name="l00002"></a>00002 <span class="comment">//</span> <a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span> <a name="l00004"></a>00004 <span class="comment">//</span> <a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span> <a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published</span> <a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span> <a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment">//</span> <a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment">//</span> <a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span> <a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.</span> <a name="l00017"></a>00017 <a name="l00026"></a>00026 <span class="preprocessor">#ifndef _UCOMMON_SOCKET_H_</span> <a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_SOCKET_H_</span> <a name="l00028"></a>00028 <span class="preprocessor"></span> <a name="l00029"></a>00029 <span class="preprocessor">#ifndef _UCOMMON_TIMERS_H_</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00203.html" title="Realtime timers and timer queues.">ucommon/timers.h</a>></span> <a name="l00031"></a>00031 <span class="preprocessor">#endif</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="preprocessor">#ifndef _UCOMMON_LINKED_H_</span> <a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00188.html" title="Linked objects, lists, templates, and containers.">ucommon/linked.h</a>></span> <a name="l00035"></a>00035 <span class="preprocessor">#endif</span> <a name="l00036"></a>00036 <span class="preprocessor"></span> <a name="l00037"></a>00037 <span class="preprocessor">#ifndef _UCOMMON_STRING_H_</span> <a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00201.html" title="A common string class and character string support functions.">ucommon/string.h</a>></span> <a name="l00039"></a>00039 <span class="preprocessor">#endif</span> <a name="l00040"></a>00040 <span class="preprocessor"></span> <a name="l00041"></a>00041 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> { <a name="l00042"></a>00042 <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>; <a name="l00043"></a>00043 } <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="preprocessor">#ifdef _MSWINDOWS_</span> <a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_RDWR SD_BOTH</span> <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_WR SD_SEND</span> <a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_RD SD_RECV</span> <a name="l00049"></a>00049 <span class="preprocessor"></span><span class="preprocessor">#else</span> <a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#include <unistd.h></span> <a name="l00051"></a>00051 <span class="preprocessor">#include <sys/socket.h></span> <a name="l00052"></a>00052 <span class="preprocessor">#include <net/if.h></span> <a name="l00053"></a>00053 <span class="preprocessor">#include <netinet/in.h></span> <a name="l00054"></a>00054 <span class="preprocessor">#include <netdb.h></span> <a name="l00055"></a>00055 <span class="preprocessor">#endif</span> <a name="l00056"></a>00056 <span class="preprocessor"></span> <a name="l00057"></a>00057 <span class="preprocessor">#include <errno.h></span> <a name="l00058"></a>00058 <span class="preprocessor">#include <stdio.h></span> <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="preprocessor">#ifndef IPTOS_LOWDELAY</span> <a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWDELAY 0x10</span> <a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_THROUGHPUT 0x08</span> <a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_RELIABILITY 0x04</span> <a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_MINCOST 0x02</span> <a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00066"></a>00066 <span class="preprocessor"></span> <a name="l00067"></a>00067 <span class="preprocessor">#ifdef AF_UNSPEC</span> <a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_FAMILY AF_UNSPEC</span> <a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#else</span> <a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_FAMILY AF_INET</span> <a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00072"></a>00072 <span class="preprocessor"></span> <a name="l00073"></a>00073 <span class="keyword">struct </span><a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>; <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="keyword">typedef</span> <span class="keyword">struct </span>sockaddr *sockaddr_t; <a name="l00076"></a>00076 <a name="l00080"></a><a class="code" href="a00012.html">00080</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">hostaddr_internet</a> <a name="l00081"></a>00081 { <a name="l00082"></a>00082 <span class="keyword">union</span> <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <span class="keyword">struct </span>in_addr ipv4; <a name="l00085"></a>00085 <span class="preprocessor">#ifdef AF_INET6</span> <a name="l00086"></a>00086 <span class="preprocessor"></span> <span class="keyword">struct </span>in6_addr ipv6; <a name="l00087"></a>00087 <span class="preprocessor">#endif</span> <a name="l00088"></a>00088 <span class="preprocessor"></span> }; <a name="l00089"></a>00089 } <a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a>; <a name="l00090"></a>00090 <a name="l00091"></a>00091 <span class="preprocessor">#if defined(AF_INET6) || defined(__CYGWIN__)</span> <a name="l00092"></a>00092 <span class="preprocessor"></span> <a name="l00099"></a><a class="code" href="a00013.html">00099</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> <a name="l00100"></a>00100 { <a name="l00101"></a>00101 <span class="keyword">union </span>{ <a name="l00102"></a>00102 <span class="preprocessor">#ifdef AF_INET6</span> <a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keyword">struct </span>sockaddr_in6 ipv6; <a name="l00104"></a>00104 <span class="preprocessor">#endif</span> <a name="l00105"></a>00105 <span class="preprocessor"></span> <span class="keyword">struct </span>sockaddr_in ipv4; <a name="l00106"></a>00106 <span class="keyword">struct </span>sockaddr address; <a name="l00107"></a>00107 }; <a name="l00108"></a>00108 } <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">inetsockaddr_t</a>; <a name="l00109"></a>00109 <span class="preprocessor">#else</span> <a name="l00110"></a>00110 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> <a name="l00111"></a>00111 { <a name="l00112"></a>00112 <span class="keyword">union </span>{ <a name="l00113"></a>00113 <span class="keyword">struct </span>sockaddr_in ipv4; <a name="l00114"></a>00114 <span class="keyword">struct </span>sockaddr address; <a name="l00115"></a>00115 }; <a name="l00116"></a>00116 } <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">inetsockaddr_t</a>; <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="keyword">struct </span>sockaddr_storage <a name="l00119"></a>00119 { <a name="l00120"></a>00120 <span class="preprocessor">#ifdef AF_UNIX</span> <a name="l00121"></a>00121 <span class="preprocessor"></span> <span class="keywordtype">char</span> sa_data[128]; <a name="l00122"></a>00122 <span class="preprocessor">#else</span> <a name="l00123"></a>00123 <span class="preprocessor"></span> <span class="keywordtype">char</span> sa_data[<span class="keyword">sizeof</span>(<span class="keyword">struct </span>sockaddr_in)]; <a name="l00124"></a>00124 <span class="preprocessor">#endif</span> <a name="l00125"></a>00125 <span class="preprocessor"></span>}; <a name="l00126"></a>00126 <span class="preprocessor">#endif</span> <a name="l00127"></a>00127 <span class="preprocessor"></span> <a name="l00128"></a>00128 <span class="preprocessor">#ifndef SOCK_DCCP</span> <a name="l00129"></a>00129 <span class="preprocessor"></span><span class="preprocessor">#define SOCK_DCCP 6</span> <a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00131"></a>00131 <span class="preprocessor"></span> <a name="l00132"></a>00132 <span class="preprocessor">#ifndef IPPROTO_DCCP</span> <a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_DCCP 23</span> <a name="l00134"></a>00134 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00135"></a>00135 <span class="preprocessor"></span> <a name="l00136"></a>00136 <span class="preprocessor">#ifndef SOL_DCCP</span> <a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#define SOL_DCCP 269</span> <a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00139"></a>00139 <span class="preprocessor"></span> <a name="l00140"></a>00140 <span class="preprocessor">#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12</span> <a name="l00141"></a>00141 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_CCID 13</span> <a name="l00142"></a>00142 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_TX_CCID 14</span> <a name="l00143"></a>00143 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_RX_CCID 15</span> <a name="l00144"></a>00144 <span class="preprocessor"></span> <a name="l00145"></a>00145 NAMESPACE_UCOMMON <a name="l00146"></a>00146 <a name="l00156"></a><a class="code" href="a00033.html">00156</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a> : <span class="keyword">public</span> <a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> <a name="l00157"></a>00157 { <a name="l00158"></a>00158 <span class="keyword">protected</span>: <a name="l00159"></a>00159 <span class="keywordtype">int</span> family; <a name="l00160"></a>00160 <a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> netmask, network; <a name="l00161"></a>00161 <span class="keywordtype">char</span> name[16]; <a name="l00162"></a>00162 <span class="keywordtype">unsigned</span> getMask(<span class="keyword">const</span> <span class="keywordtype">char</span> *cp) <span class="keyword">const</span>; <a name="l00163"></a>00163 <a name="l00164"></a>00164 <span class="keyword">public</span>: <a name="l00168"></a><a class="code" href="a00033.html#ae029e27920915c6695e277d3823092ef">00168</a> <span class="keyword">typedef</span> <a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> <a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>; <a name="l00169"></a>00169 <a name="l00173"></a>00173 <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>(); <a name="l00174"></a>00174 <a name="l00181"></a>00181 <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00182"></a>00182 <a name="l00188"></a>00188 <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>(<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> **<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00189"></a>00189 <a name="l00196"></a>00196 <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>(<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> **<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> *name); <a name="l00197"></a>00197 <a name="l00202"></a>00202 <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>(<span class="keyword">const</span> <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a>& existing); <a name="l00203"></a>00203 <a name="l00210"></a>00210 <span class="keyword">static</span> <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a> *find(<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> *<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address); <a name="l00211"></a>00211 <a name="l00219"></a>00219 <span class="keyword">static</span> <a class="code" href="a00033.html" title="A class to hold internet segment routing rules.">cidr</a> *container(<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> *<a class="code" href="a00067.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address); <a name="l00220"></a>00220 <a name="l00228"></a><a class="code" href="a00033.html#aff033b837959d7bfd1714c4e2817fbdf">00228</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *getName(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00229"></a>00229 <span class="keyword"> </span>{<span class="keywordflow">return</span> name;}; <a name="l00230"></a>00230 <a name="l00235"></a><a class="code" href="a00033.html#a74dbe3991f625e9eb25f0997c89960a7">00235</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> getFamily(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00236"></a>00236 <span class="keyword"> </span>{<span class="keywordflow">return</span> family;}; <a name="l00237"></a>00237 <a name="l00242"></a><a class="code" href="a00033.html#ab61cecf80f6975052b26dcbbec91bc81">00242</a> <span class="keyword">inline</span> <a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getNetwork(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00243"></a>00243 <span class="keyword"> </span>{<span class="keywordflow">return</span> network;}; <a name="l00244"></a>00244 <a name="l00249"></a><a class="code" href="a00033.html#a7c37d643afcdeac3ee4612336f9a7c99">00249</a> <span class="keyword">inline</span> <a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getNetmask(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00250"></a>00250 <span class="keyword"> </span>{<span class="keywordflow">return</span> netmask;}; <a name="l00251"></a>00251 <a name="l00256"></a>00256 <a class="code" href="a00012.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getBroadcast(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00257"></a>00257 <a name="l00262"></a>00262 <span class="keywordtype">unsigned</span> getMask(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00263"></a>00263 <a name="l00268"></a>00268 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00148.html" title="A copy-on-write string class that operates by reference count.">string</a>); <a name="l00269"></a>00269 <a name="l00275"></a>00275 <span class="keywordtype">bool</span> <a class="code" href="a00067.html#a547fea98923615a1e58c8bcbe4515ebb" title="Search to see if we are a member of a specific list.">isMember</a>(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address) <span class="keyword">const</span>; <a name="l00276"></a>00276 <a name="l00282"></a><a class="code" href="a00033.html#a000c9ff4aacd14b7b896cb0bc17b5ec5">00282</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address)<span class="keyword"> const</span> <a name="l00283"></a>00283 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00067.html#a547fea98923615a1e58c8bcbe4515ebb" title="Search to see if we are a member of a specific list.">isMember</a>(address);}; <a name="l00284"></a>00284 <a name="l00290"></a><a class="code" href="a00033.html#a145f399c15a05d182e83c969fbfc7575">00290</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address)<span class="keyword"> const</span> <a name="l00291"></a>00291 <span class="keyword"> </span>{<span class="keywordflow">return</span> !<a class="code" href="a00067.html#a547fea98923615a1e58c8bcbe4515ebb" title="Search to see if we are a member of a specific list.">isMember</a>(address);}; <a name="l00292"></a>00292 }; <a name="l00293"></a>00293 <a name="l00301"></a><a class="code" href="a00140.html">00301</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a> <a name="l00302"></a>00302 { <a name="l00303"></a>00303 <span class="keyword">protected</span>: <a name="l00304"></a>00304 socket_t so; <a name="l00305"></a>00305 <span class="keywordtype">int</span> ioerr; <a name="l00306"></a>00306 <a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> iowait; <a name="l00307"></a>00307 <a name="l00308"></a>00308 <span class="keyword">public</span>: <a name="l00317"></a>00317 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *getaddress(<span class="keyword">const</span> <span class="keywordtype">char</span> *host, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0); <a name="l00318"></a>00318 <a name="l00324"></a>00324 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00208.html#a8df8e4b667d68be02961ff0d4cd84224" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l00325"></a>00325 <a name="l00331"></a><a class="code" href="a00140.html#a6462ee1ecac78717d60763defea25166">00331</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span> *set_t; <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> masksize; <a name="l00334"></a>00334 <a name="l00343"></a><a class="code" href="a00141.html">00343</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00141.html" title="A generic socket address class.">address</a> <a name="l00344"></a>00344 { <a name="l00345"></a>00345 <span class="keyword">protected</span>: <a name="l00346"></a>00346 <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list; <a name="l00347"></a>00347 <a name="l00348"></a>00348 <span class="keyword">public</span>: <a name="l00359"></a>00359 <a class="code" href="a00141.html" title="A generic socket address class.">address</a>(<span class="keywordtype">int</span> family, <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0); <a name="l00360"></a>00360 <a name="l00373"></a>00373 address(<span class="keywordtype">int</span> family, <span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL); <a name="l00374"></a>00374 <a name="l00381"></a>00381 address(<span class="keyword">const</span> <span class="keywordtype">char</span> *host, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> type = SOCK_STREAM); <a name="l00382"></a>00382 <a name="l00390"></a>00390 address(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keywordtype">unsigned</span> service = 0); <a name="l00391"></a>00391 <a name="l00395"></a>00395 address(); <a name="l00396"></a>00396 <a name="l00401"></a>00401 address(<span class="keyword">const</span> address& reference); <a name="l00402"></a>00402 <a name="l00406"></a>00406 ~address(); <a name="l00407"></a>00407 <a name="l00412"></a>00412 <span class="keyword">struct </span>sockaddr *getAddr(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00413"></a>00413 <a name="l00419"></a>00419 <span class="keyword">struct </span>sockaddr *<span class="keyword">get</span>(<span class="keywordtype">int</span> family) <span class="keyword">const</span>; <a name="l00420"></a>00420 <a name="l00425"></a>00425 <span class="keywordtype">int</span> getfamily(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00426"></a>00426 <a name="l00431"></a>00431 <span class="keyword">struct </span>sockaddr *find(<span class="keyword">struct</span> sockaddr *<a class="code" href="a00208.html#a460b5a6386de45c6263462b541a9c357" title="A convenience function to convert a socket address list into a socket address.">addr</a>) <span class="keyword">const</span>; <a name="l00432"></a>00432 <a name="l00437"></a><a class="code" href="a00141.html#adf008e2e2233bbccc99d0e51f4bca1b3">00437</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *getList(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00438"></a>00438 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;}; <a name="l00439"></a>00439 <a name="l00444"></a><a class="code" href="a00141.html#afa49802b18f7d85dbd70595d5b69fdf2">00444</a> <span class="keyword">inline</span> operator struct addrinfo *()<span class="keyword"> const</span> <a name="l00445"></a>00445 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;}; <a name="l00446"></a>00446 <a name="l00451"></a><a class="code" href="a00141.html#aec320f6b19befa5bd83635ba8c729652">00451</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *operator*()<span class="keyword"> const</span> <a name="l00452"></a>00452 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;}; <a name="l00453"></a>00453 <a name="l00458"></a><a class="code" href="a00141.html#a2803a3cec91cf0abb9d44d3290d28b81">00458</a> <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span> <a name="l00459"></a>00459 <span class="keyword"> </span>{<span class="keywordflow">return</span> list != NULL;}; <a name="l00460"></a>00460 <a name="l00465"></a><a class="code" href="a00141.html#ac9640a48f282eedd07abc8606a81c452">00465</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span> <a name="l00466"></a>00466 <span class="keyword"> </span>{<span class="keywordflow">return</span> list == NULL;}; <a name="l00467"></a>00467 <a name="l00472"></a><a class="code" href="a00141.html#a7a12322b6ea3d249f56b619c2db35049">00472</a> <span class="keyword">inline</span> operator struct sockaddr *()<span class="keyword"> const</span> <a name="l00473"></a>00473 <span class="keyword"> </span>{<span class="keywordflow">return</span> getAddr();}; <a name="l00474"></a>00474 <a name="l00478"></a>00478 <span class="keywordtype">void</span> clear(<span class="keywordtype">void</span>); <a name="l00479"></a>00479 <a name="l00486"></a>00486 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL, <span class="keywordtype">int</span> type = SOCK_STREAM); <a name="l00487"></a>00487 <a name="l00494"></a>00494 <span class="keywordtype">void</span> <a class="code" href="a00208.html#a0a43af474b84d87df26aa4998bcebb02" title="Add a linked object onto a stack of linked objects.">add</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL, <span class="keywordtype">int</span> type = SOCK_STREAM); <a name="l00495"></a>00495 <a name="l00503"></a>00503 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> family, <span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0); <a name="l00504"></a>00504 <a name="l00509"></a>00509 <span class="keywordtype">void</span> <a class="code" href="a00208.html#a0a43af474b84d87df26aa4998bcebb02" title="Add a linked object onto a stack of linked objects.">add</a>(sockaddr *address); <a name="l00510"></a>00510 <a name="l00516"></a>00516 <span class="keywordtype">unsigned</span> insert(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address); <a name="l00517"></a>00517 <a name="l00523"></a>00523 <span class="keywordtype">unsigned</span> <span class="keyword">remove</span>(<span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address); <a name="l00524"></a>00524 <a name="l00530"></a>00530 <span class="keywordtype">bool</span> <span class="keyword">remove</span>(<span class="keyword">struct </span>sockaddr *address); <a name="l00531"></a>00531 <a name="l00538"></a>00538 <span class="keywordtype">bool</span> insert(<span class="keyword">struct</span> sockaddr *address); <a name="l00539"></a>00539 <a name="l00545"></a>00545 <span class="keywordtype">void</span> <a class="code" href="a00208.html#aa948d5926268ce79c22778bd81cc6ed9" title="Convenience function to access object copy.">copy</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address); <a name="l00546"></a>00546 <a name="l00551"></a>00551 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">struct </span>sockaddr *address); <a name="l00552"></a>00552 <a name="l00558"></a>00558 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keywordtype">unsigned</span> service = 0); <a name="l00559"></a>00559 <a name="l00565"></a>00565 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr *<a class="code" href="a00208.html#a8048c8716eafab6b193a59529650db5c" title="Convenience function to duplicate object pointer to heap.">dup</a>(<span class="keyword">struct</span> sockaddr *address); <a name="l00566"></a>00566 <a name="l00572"></a>00572 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr_in *ipv4(<span class="keyword">struct</span> sockaddr *address); <a name="l00573"></a>00573 <a name="l00574"></a>00574 <span class="preprocessor">#ifdef AF_INET6</span> <a name="l00575"></a>00575 <span class="preprocessor"></span> <a name="l00580"></a>00580 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr_in6 *ipv6(<span class="keyword">struct</span> sockaddr *address); <a name="l00581"></a>00581 <span class="preprocessor">#endif</span> <a name="l00582"></a>00582 <span class="preprocessor"></span> }; <a name="l00583"></a>00583 <a name="l00584"></a>00584 <span class="keyword">friend</span> <span class="keyword">class </span>address; <a name="l00585"></a>00585 <a name="l00589"></a>00589 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(); <a name="l00590"></a>00590 <a name="l00595"></a>00595 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(<span class="keyword">const</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& existing); <a name="l00596"></a>00596 <a name="l00601"></a>00601 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l00602"></a>00602 <a name="l00608"></a>00608 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address); <a name="l00609"></a>00609 <a name="l00616"></a>00616 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(<span class="keywordtype">int</span> family, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol = 0); <a name="l00617"></a>00617 <a name="l00627"></a>00627 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *port, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0); <a name="l00628"></a>00628 <a name="l00632"></a>00632 <span class="keyword">virtual</span> ~<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(); <a name="l00633"></a>00633 <a name="l00637"></a>00637 <span class="keywordtype">void</span> cancel(<span class="keywordtype">void</span>); <a name="l00638"></a>00638 <a name="l00643"></a>00643 <span class="keyword">static</span> <span class="keywordtype">void</span> cancel(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l00644"></a>00644 <a name="l00648"></a>00648 <span class="keywordtype">void</span> <a class="code" href="a00208.html#a8df8e4b667d68be02961ff0d4cd84224" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(<span class="keywordtype">void</span>); <a name="l00649"></a>00649 <a name="l00653"></a><a class="code" href="a00140.html#a13572bd97949faec1c0c18808f29fdd6">00653</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> err(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00654"></a>00654 <span class="keyword"> </span>{<span class="keywordflow">return</span> ioerr;} <a name="l00655"></a>00655 <a name="l00661"></a>00661 <span class="keywordtype">bool</span> isPending(<span class="keywordtype">unsigned</span> value) <span class="keyword">const</span>; <a name="l00662"></a>00662 <a name="l00667"></a>00667 <span class="keywordtype">bool</span> isConnected(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00668"></a>00668 <a name="l00675"></a>00675 <span class="keywordtype">bool</span> waitPending(<a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0) <span class="keyword">const</span>; <a name="l00676"></a>00676 <a name="l00681"></a><a class="code" href="a00140.html#aa76ff5e3a618cb181538b95fd95a7c9f">00681</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> nodelay(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00682"></a>00682 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00140.html#aa76ff5e3a618cb181538b95fd95a7c9f" title="Set nodelay option for tcp socket.">nodelay</a>(so);}; <a name="l00683"></a>00683 <a name="l00691"></a>00691 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="a00208.html#a5c50c87fd1eb5b1ac93dffa0ee6f9af5" title="Convenience function to wait on a barrier.">wait</a>(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0); <a name="l00692"></a>00692 <a name="l00699"></a>00699 <span class="keywordtype">bool</span> waitSending(<a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0) <span class="keyword">const</span>; <a name="l00700"></a>00700 <a name="l00705"></a><a class="code" href="a00140.html#a6b65f392128da6dc2cd1075355dbb1e1">00705</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getPending(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00706"></a>00706 <span class="keyword"> </span>{<span class="keywordflow">return</span> pending(so);}; <a name="l00707"></a>00707 <a name="l00713"></a><a class="code" href="a00140.html#a25eec044bc5256598b0e62c0e1ecd52d">00713</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> broadcast(<span class="keywordtype">bool</span> enable) <a name="l00714"></a>00714 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a25eec044bc5256598b0e62c0e1ecd52d" title="Set socket for unicast mode broadcasts.">broadcast</a>(so, enable);}; <a name="l00715"></a>00715 <a name="l00721"></a><a class="code" href="a00140.html#a926f38308b4f3c722850de3e6f8e63fb">00721</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> keepalive(<span class="keywordtype">bool</span> enable) <a name="l00722"></a>00722 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a926f38308b4f3c722850de3e6f8e63fb" title="Set socket for keepalive packets.">keepalive</a>(so, enable);}; <a name="l00723"></a>00723 <a name="l00729"></a><a class="code" href="a00140.html#a715720b26448ebf57604bfbc731cc85b">00729</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> blocking(<span class="keywordtype">bool</span> enable) <a name="l00730"></a>00730 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a715720b26448ebf57604bfbc731cc85b" title="Set socket blocking I/O mode.">blocking</a>(so, enable);}; <a name="l00731"></a>00731 <a name="l00737"></a><a class="code" href="a00140.html#a796be21401708e57c87e4b9a5324e147">00737</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> multicast(<span class="keywordtype">unsigned</span> ttl = 1) <a name="l00738"></a>00738 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a796be21401708e57c87e4b9a5324e147" title="Set multicast mode and multicast broadcast range.">multicast</a>(so, ttl);}; <a name="l00739"></a>00739 <a name="l00745"></a><a class="code" href="a00140.html#aa28f3e878b5f9669d68366f13b7b38f7">00745</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> loopback(<span class="keywordtype">bool</span> enable) <a name="l00746"></a>00746 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#aa28f3e878b5f9669d68366f13b7b38f7" title="Set loopback to read multicast packets we broadcast.">loopback</a>(so, enable);}; <a name="l00747"></a>00747 <a name="l00752"></a><a class="code" href="a00140.html#a7c4c2b94e8c1496f38b60248153428a9">00752</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> getError(<span class="keywordtype">void</span>) <a name="l00753"></a>00753 {<span class="keywordflow">return</span> error(so);}; <a name="l00754"></a>00754 <a name="l00760"></a><a class="code" href="a00140.html#a0900cd6d7a82cf1608791fbafea679c0">00760</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> ttl(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> time) <a name="l00761"></a>00761 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a0900cd6d7a82cf1608791fbafea679c0" title="Set the time to live before packets expire.">ttl</a>(so, time);}; <a name="l00762"></a>00762 <a name="l00768"></a><a class="code" href="a00140.html#a533b863372a3efe014573e94c0532a43">00768</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> sendsize(<span class="keywordtype">unsigned</span> size) <a name="l00769"></a>00769 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a533b863372a3efe014573e94c0532a43" title="Set the size of the socket send buffer.">sendsize</a>(so, size);}; <a name="l00770"></a>00770 <a name="l00776"></a><a class="code" href="a00140.html#a59f2cfe60e83e3c4c067a277406041b6">00776</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> sendwait(<span class="keywordtype">unsigned</span> size) <a name="l00777"></a>00777 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a59f2cfe60e83e3c4c067a277406041b6" title="Set the size to wait before sending.">sendwait</a>(so, size);}; <a name="l00778"></a>00778 <a name="l00779"></a>00779 <a name="l00785"></a><a class="code" href="a00140.html#a0d61ce8a80c6cdf164f44e97d19b2e2a">00785</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> recvsize(<span class="keywordtype">unsigned</span> size) <a name="l00786"></a>00786 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a0d61ce8a80c6cdf164f44e97d19b2e2a" title="Set the size of the socket receive buffer.">recvsize</a>(so, size);}; <a name="l00787"></a>00787 <a name="l00793"></a>00793 <span class="keyword">static</span> <span class="keywordtype">int</span> gettype(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l00794"></a>00794 <a name="l00801"></a>00801 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> segsize(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size = 0); <a name="l00802"></a>00802 <a name="l00809"></a>00809 <span class="keyword">static</span> <span class="keywordtype">bool</span> setccid(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, uint8_t ccid); <a name="l00810"></a>00810 <a name="l00815"></a><a class="code" href="a00140.html#a30310656626c23c9b42493a95129f984">00815</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> gettype(<span class="keywordtype">void</span>) <a name="l00816"></a>00816 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a30310656626c23c9b42493a95129f984" title="Get the type of a socket.">gettype</a>(so);}; <a name="l00817"></a>00817 <a name="l00823"></a><a class="code" href="a00140.html#a5864add5a29537aa1768f075b784b4d1">00823</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> segsize(<span class="keywordtype">unsigned</span> size) <a name="l00824"></a>00824 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a5864add5a29537aa1768f075b784b4d1" title="Set segment size and get mtu of a socket.">segsize</a>(so, size);}; <a name="l00825"></a>00825 <a name="l00831"></a><a class="code" href="a00140.html#aff663e54e71e359a915bda03eef041bb">00831</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> setccid(uint8_t ccid) <a name="l00832"></a>00832 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#aff663e54e71e359a915bda03eef041bb" title="Set ccid of dccp socket.">setccid</a>(so, ccid);}; <a name="l00833"></a>00833 <a name="l00842"></a><a class="code" href="a00140.html#a538dbeb31ee7f88a788aedbeb79aed5e">00842</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> tos(<span class="keywordtype">int</span> type) <a name="l00843"></a>00843 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#a538dbeb31ee7f88a788aedbeb79aed5e" title="Set the type of service field of outgoing packets.">tos</a>(so, type);}; <a name="l00844"></a>00844 <a name="l00851"></a><a class="code" href="a00140.html#ad435aaa7584b533f91016df05541c554">00851</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> priority(<span class="keywordtype">int</span> scheduling) <a name="l00852"></a>00852 {<span class="keywordflow">return</span> <a class="code" href="a00140.html#ad435aaa7584b533f91016df05541c554" title="Set packet priority, 0 to 6 unless privileged.">priority</a>(so, scheduling);}; <a name="l00853"></a>00853 <a name="l00857"></a><a class="code" href="a00140.html#a57b410957e1d068ef35717a49343a4f0">00857</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> shutdown(<span class="keywordtype">void</span>) <a name="l00858"></a>00858 {::shutdown(so, SHUT_RDWR);}; <a name="l00859"></a>00859 <a name="l00867"></a>00867 <span class="keywordtype">int</span> connectto(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l00868"></a>00868 <a name="l00875"></a>00875 <span class="keywordtype">int</span> disconnect(<span class="keywordtype">void</span>); <a name="l00876"></a>00876 <a name="l00882"></a>00882 <span class="keywordtype">int</span> join(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l00883"></a>00883 <a name="l00889"></a>00889 <span class="keywordtype">int</span> drop(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l00890"></a>00890 <a name="l00896"></a>00896 <span class="keywordtype">int</span> <a class="code" href="a00208.html#a5c50c87fd1eb5b1ac93dffa0ee6f9af5" title="Convenience function to wait on a barrier.">wait</a>(<a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = Timer::inf); <a name="l00897"></a>00897 <a name="l00904"></a>00904 <span class="keywordtype">size_t</span> peek(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number) <span class="keyword">const</span>; <a name="l00905"></a>00905 <a name="l00913"></a>00913 <span class="keywordtype">size_t</span> readfrom(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct</span> sockaddr_storage *address = NULL); <a name="l00914"></a>00914 <a name="l00922"></a>00922 <span class="keywordtype">size_t</span> writeto(<span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct</span> sockaddr *address = NULL); <a name="l00923"></a>00923 <a name="l00936"></a>00936 <span class="keywordtype">size_t</span> readline(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size); <a name="l00937"></a>00937 <a name="l00943"></a>00943 <span class="keywordtype">size_t</span> printf(<span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...) __PRINTF(2,3); <a name="l00944"></a>00944 <a name="l00956"></a>00956 <span class="keywordtype">size_t</span> readline(<span class="keywordtype">string</span>& buffer); <a name="l00957"></a>00957 <a name="l00969"></a>00969 static ssize_t readline(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size, <a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = <a class="code" href="a00162.html" title="Timer class to use when scheduling realtime events.">Timer</a>::inf); <a name="l00970"></a>00970 <a name="l00977"></a>00977 static ssize_t printf(socket_t socket, const <span class="keywordtype">char</span> *format, ...) __PRINTF(2,3); <a name="l00978"></a>00978 <a name="l00986"></a>00986 <span class="keywordtype">size_t</span> writes(const <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00987"></a>00987 <a name="l00992"></a>00992 operator <span class="keywordtype">bool</span>(); <a name="l00993"></a>00993 <a name="l00998"></a>00998 <span class="keywordtype">bool</span> operator!() const; <a name="l00999"></a>00999 <a name="l01005"></a>01005 <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& operator=(socket_t socket); <a name="l01006"></a>01006 <a name="l01011"></a><a class="code" href="a00140.html#a052529d07ea8d602b84f6dc6e13059cf">01011</a> inline operator socket_t()<span class="keyword"> const</span> <a name="l01012"></a>01012 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;}; <a name="l01013"></a>01013 <a name="l01018"></a><a class="code" href="a00140.html#a14c3ced56f4e1f47f810894fa05d904d">01018</a> <span class="keyword">inline</span> socket_t operator*()<span class="keyword"> const</span> <a name="l01019"></a>01019 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;}; <a name="l01020"></a>01020 <a name="l01027"></a>01027 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> pending(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01028"></a>01028 <a name="l01035"></a>01035 <span class="keyword">static</span> <span class="keywordtype">int</span> sendsize(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size); <a name="l01036"></a>01036 <a name="l01043"></a>01043 <span class="keyword">static</span> <span class="keywordtype">int</span> sendwait(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size); <a name="l01044"></a>01044 <a name="l01051"></a>01051 <span class="keyword">static</span> <span class="keywordtype">int</span> recvsize(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size); <a name="l01052"></a>01052 <a name="l01061"></a>01061 <span class="keyword">static</span> <span class="keywordtype">int</span> connectto(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l01062"></a>01062 <a name="l01068"></a>01068 <span class="keyword">static</span> <span class="keywordtype">int</span> disconnect(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01069"></a>01069 <a name="l01076"></a>01076 <span class="keyword">static</span> <span class="keywordtype">int</span> drop(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l01077"></a>01077 <a name="l01084"></a>01084 <span class="keyword">static</span> <span class="keywordtype">int</span> join(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list); <a name="l01085"></a>01085 <a name="l01091"></a>01091 <span class="keyword">static</span> <span class="keywordtype">int</span> error(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01092"></a>01092 <a name="l01099"></a>01099 <span class="keyword">static</span> <span class="keywordtype">int</span> multicast(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> ttl = 1); <a name="l01100"></a>01100 <a name="l01107"></a>01107 <span class="keyword">static</span> <span class="keywordtype">int</span> loopback(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable); <a name="l01108"></a>01108 <a name="l01115"></a>01115 <span class="keyword">static</span> <span class="keywordtype">int</span> blocking(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable); <a name="l01116"></a>01116 <a name="l01123"></a>01123 <span class="keyword">static</span> <span class="keywordtype">int</span> keepalive(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable); <a name="l01124"></a>01124 <a name="l01131"></a>01131 <span class="keyword">static</span> <span class="keywordtype">int</span> broadcast(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable); <a name="l01132"></a>01132 <a name="l01138"></a>01138 <span class="keyword">static</span> <span class="keywordtype">int</span> nodelay(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01139"></a>01139 <a name="l01146"></a>01146 <span class="keyword">static</span> <span class="keywordtype">int</span> priority(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">int</span> scheduling); <a name="l01147"></a>01147 <a name="l01154"></a>01154 <span class="keyword">static</span> <span class="keywordtype">int</span> tos(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">int</span> type); <a name="l01155"></a>01155 <a name="l01162"></a>01162 <span class="keyword">static</span> <span class="keywordtype">int</span> ttl(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> time); <a name="l01163"></a>01163 <a name="l01168"></a>01168 <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01169"></a>01169 <a name="l01175"></a><a class="code" href="a00140.html#aa3ffa90d3e4c9ee4b50873979f90827e">01175</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(<span class="keyword">struct</span> sockaddr_storage& <a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01176"></a>01176 {<span class="keywordflow">return</span> ((<span class="keyword">struct</span> sockaddr *)&address)->sa_family;}; <a name="l01177"></a>01177 <a name="l01183"></a><a class="code" href="a00140.html#a0fb6bb5f80627133e1ca023ce61bb4ce">01183</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(<span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>& <a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01184"></a>01184 {<span class="keywordflow">return</span> address.address.sa_family;}; <a name="l01185"></a>01185 <a name="l01195"></a>01195 <span class="keyword">static</span> ssize_t recvfrom(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> sockaddr_storage *address = NULL); <a name="l01196"></a>01196 <a name="l01206"></a>01206 <span class="keyword">static</span> ssize_t sendto(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> sockaddr *address = NULL); <a name="l01207"></a>01207 <a name="l01217"></a><a class="code" href="a00140.html#ab7c7951de1b1851679e59e840782daab">01217</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t replyto(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01218"></a>01218 {<span class="keywordflow">return</span> sendto(socket, buffer, size, flags, (<span class="keyword">struct</span> sockaddr *)address);}; <a name="l01219"></a>01219 <a name="l01229"></a><a class="code" href="a00140.html#acce8ff3b9bc97dab0c68260571d87954">01229</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t sendinet(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags, <span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01230"></a>01230 {<span class="keywordflow">return</span> sendto(socket, buffer, size, flags, (<span class="keyword">struct</span> sockaddr *)address);}; <a name="l01231"></a>01231 <a name="l01241"></a>01241 <span class="keyword">static</span> ssize_t recvinet(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address = NULL); <a name="l01242"></a>01242 <a name="l01251"></a>01251 <span class="keyword">static</span> <span class="keywordtype">int</span> bindto(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> protocol = 0); <a name="l01252"></a>01252 <a name="l01260"></a>01260 <span class="keyword">static</span> <span class="keywordtype">int</span> listento(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">int</span> backlog = 5); <a name="l01261"></a>01261 <a name="l01268"></a>01268 <span class="keyword">static</span> <span class="keywordtype">int</span> bindto(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr *address); <a name="l01269"></a>01269 <a name="l01276"></a>01276 <span class="keyword">static</span> socket_t acceptfrom(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address = NULL); <a name="l01277"></a>01277 <a name="l01285"></a>01285 <span class="keyword">static</span> socket_t create(<span class="keywordtype">int</span> family, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol); <a name="l01286"></a>01286 <a name="l01294"></a>01294 <span class="keyword">static</span> socket_t create(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol); <a name="l01295"></a>01295 <a name="l01305"></a>01305 <span class="keyword">static</span> socket_t create(<span class="keyword">const</span> <span class="keywordtype">char</span> *iface, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0); <a name="l01306"></a>01306 <a name="l01312"></a>01312 <span class="keyword">static</span> socket_t create(<a class="code" href="a00141.html" title="A generic socket address class.">Socket::address</a> &address); <a name="l01313"></a>01313 <a name="l01318"></a>01318 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00208.html#a8df8e4b667d68be02961ff0d4cd84224" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>); <a name="l01319"></a>01319 <a name="l01328"></a><a class="code" href="a00140.html#a6b076da48b05265e5bf70f3dd92ac42a">01328</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> writeto(<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keyword">struct</span> sockaddr *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01329"></a>01329 {<span class="keywordflow">return</span> socket.<a class="code" href="a00140.html#a2f2ef63b14839b0c57b3a8b051b431d7" title="Write data to the socket send buffer.">writeto</a>(buffer, size, address);}; <a name="l01330"></a>01330 <a name="l01339"></a><a class="code" href="a00140.html#affa6687c4f13fb3d3ac43d87f2c4facd">01339</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">size_t</span> readfrom(<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01340"></a>01340 {<span class="keywordflow">return</span> socket.<a class="code" href="a00140.html#aa4506e5b9179f45b484f2e8e134f20a3" title="Read data from the socket receive buffer.">readfrom</a>(buffer, size, address);}; <a name="l01341"></a>01341 <a name="l01347"></a><a class="code" href="a00140.html#a4d31ab5c02164bc284fa64122e50f602">01347</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> connectto(<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <a class="code" href="a00141.html" title="A generic socket address class.">Socket::address</a> &<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01348"></a>01348 {socket.<a class="code" href="a00140.html#a5a227ad13bd0962642f2f8cd727d6d6a" title="Connect our socket to a remote host from an address list.">connectto</a>(address);}; <a name="l01349"></a>01349 <a name="l01354"></a><a class="code" href="a00140.html#af6e5bbf0385c1f69a5e0c5d53b2eb394">01354</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> disconnect(<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>) <a name="l01355"></a>01355 {socket.<a class="code" href="a00140.html#a5483d360a10debe3ad439fe84be66153" title="Disconnect a connected socket.">disconnect</a>();}; <a name="l01356"></a>01356 <a name="l01363"></a><a class="code" href="a00140.html#a8f0e92b4cd863362c46e0a27d11bf83a">01363</a> <span class="keyword">inline</span> <span class="keyword">static</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a> acceptfrom(<a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01364"></a>01364 {<span class="keywordflow">return</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a>(<a class="code" href="a00140.html#a8f0e92b4cd863362c46e0a27d11bf83a" title="Accept connection through socket.">acceptfrom</a>(socket.so, address));}; <a name="l01365"></a>01365 <a name="l01373"></a>01373 <span class="keyword">static</span> <span class="keywordtype">char</span> *gethostname(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size); <a name="l01374"></a>01374 <a name="l01382"></a>01382 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *gethint(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *hint); <a name="l01383"></a>01383 <a name="l01394"></a>01394 <span class="keyword">static</span> socklen_t getaddr(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service); <a name="l01395"></a>01395 <a name="l01401"></a>01401 <span class="keyword">static</span> socklen_t getlen(<span class="keyword">struct</span> sockaddr *address); <a name="l01402"></a>01402 <a name="l01410"></a>01410 <span class="keyword">static</span> <span class="keywordtype">bool</span> equal(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2); <a name="l01411"></a>01411 <a name="l01418"></a>01418 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00208.html#aa948d5926268ce79c22778bd81cc6ed9" title="Convenience function to access object copy.">copy</a>(<span class="keyword">struct</span> sockaddr *target, <span class="keyword">struct</span> sockaddr *origin); <a name="l01419"></a>01419 <a name="l01426"></a><a class="code" href="a00140.html#aab407b6618ba23ee474927d5d063f806">01426</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> store(<span class="keyword">struct</span> sockaddr_storage *storage, <span class="keyword">struct</span> sockaddr *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01427"></a>01427 {<span class="keywordflow">return</span> <a class="code" href="a00208.html#aa948d5926268ce79c22778bd81cc6ed9" title="Convenience function to access object copy.">copy</a>((<span class="keyword">struct</span> sockaddr*)storage, address);}; <a name="l01428"></a>01428 <a name="l01435"></a>01435 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> store(<span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *storage, <span class="keyword">struct</span> sockaddr *address); <a name="l01436"></a>01436 <a name="l01444"></a>01444 <span class="keyword">static</span> <span class="keywordtype">bool</span> equalhost(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2); <a name="l01445"></a>01445 <a name="l01453"></a><a class="code" href="a00140.html#a1cacfe36507d40e64294762bec9c9837">01453</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> equalfrom(<span class="keyword">struct</span> sockaddr_storage *address1, <span class="keyword">struct</span> sockaddr_storage *address2) <a name="l01454"></a>01454 {<span class="keywordflow">return</span> equal((<span class="keyword">struct</span> sockaddr *)address1, (<span class="keyword">struct</span> sockaddr *)address2);}; <a name="l01455"></a>01455 <a name="l01463"></a><a class="code" href="a00140.html#a5a6e6af208c37cf9d612c72220e9d50a">01463</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> equalinet(<span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address1, <span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address2) <a name="l01464"></a>01464 {<span class="keywordflow">return</span> equal((<span class="keyword">struct</span> sockaddr *)address1, (<span class="keyword">struct</span> sockaddr *)address2);}; <a name="l01465"></a>01465 <a name="l01473"></a>01473 <span class="keyword">static</span> <span class="keywordtype">bool</span> subnet(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2); <a name="l01474"></a>01474 <a name="l01482"></a>01482 <span class="keyword">static</span> <span class="keywordtype">int</span> getinterface(<span class="keyword">struct</span> sockaddr *address, <span class="keyword">struct</span> sockaddr *destination); <a name="l01483"></a>01483 <a name="l01491"></a>01491 <span class="keyword">static</span> <span class="keywordtype">char</span> *getaddress(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">char</span> *buffer, socklen_t size); <a name="l01492"></a>01492 <a name="l01498"></a>01498 <span class="keyword">static</span> <span class="keywordtype">short</span> getservice(<span class="keyword">struct</span> sockaddr *address); <a name="l01499"></a>01499 <a name="l01505"></a><a class="code" href="a00140.html#a4faec96b1510a2e02cca84219fda57e1">01505</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">short</span> inetservice(<span class="keyword">struct</span> <a class="code" href="a00013.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>) <a name="l01506"></a>01506 {<span class="keywordflow">return</span> getservice((<span class="keyword">struct</span> sockaddr *)address);}; <a name="l01507"></a>01507 <a name="l01514"></a>01514 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> keyindex(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">unsigned</span> size); <a name="l01515"></a>01515 <a name="l01522"></a>01522 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> keyhost(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">unsigned</span> size); <a name="l01523"></a>01523 <a name="l01527"></a>01527 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00194.html#a5fc126f9a4406cb2d0d054488cf00809" title="Template function to initialize memory by invoking default constructor.">init</a>(<span class="keywordtype">void</span>); <a name="l01528"></a>01528 <a name="l01533"></a>01533 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00194.html#a5fc126f9a4406cb2d0d054488cf00809" title="Template function to initialize memory by invoking default constructor.">init</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *program); <a name="l01534"></a>01534 <a name="l01540"></a>01540 <span class="keyword">static</span> <span class="keywordtype">void</span> family(<span class="keywordtype">int</span> query); <a name="l01541"></a>01541 <a name="l01548"></a>01548 <span class="keyword">static</span> <span class="keywordtype">void</span> v4mapping(<span class="keywordtype">bool</span> enable); <a name="l01549"></a>01549 <a name="l01554"></a>01554 <span class="keyword">static</span> <span class="keywordtype">int</span> error(<span class="keywordtype">void</span>); <a name="l01555"></a>01555 <a name="l01564"></a>01564 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNull(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l01565"></a>01565 <a name="l01573"></a>01573 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNumeric(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l01574"></a>01574 <a name="l01583"></a>01583 <span class="keyword">static</span> <span class="keywordtype">int</span> getlocal(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address); <a name="l01584"></a>01584 <a name="l01593"></a>01593 <span class="keyword">static</span> <span class="keywordtype">int</span> getremote(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address); <a name="l01594"></a>01594 <a name="l01602"></a>01602 <span class="keyword">static</span> <span class="keywordtype">int</span> select(<span class="keywordtype">int</span> <a class="code" href="a00208.html#a76c25a471c75550616662fab96eea86b" title="Convenience function to return max of two objects.">max</a>, set_t read, set_t write, set_t error); <a name="l01603"></a>01603 <a name="l01612"></a>01612 <span class="keyword">static</span> <span class="keywordtype">int</span> select(<span class="keywordtype">int</span> <a class="code" href="a00208.html#a76c25a471c75550616662fab96eea86b" title="Convenience function to return max of two objects.">max</a>, set_t read, set_t write, set_t error, <a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout); <a name="l01613"></a>01613 <a name="l01618"></a>01618 <span class="keyword">static</span> set_t getmask(<span class="keywordtype">void</span>); <a name="l01619"></a>01619 <a name="l01624"></a>01624 <span class="keyword">static</span> <span class="keywordtype">void</span> clear(set_t mask); <a name="l01625"></a>01625 <a name="l01630"></a>01630 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00208.html#a8df8e4b667d68be02961ff0d4cd84224" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(set_t mask); <a name="l01631"></a>01631 <a name="l01637"></a>01637 <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, set_t mask); <a name="l01638"></a>01638 <a name="l01644"></a>01644 <span class="keyword">static</span> <span class="keywordtype">void</span> clear(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, set_t mask); <a name="l01645"></a>01645 <a name="l01652"></a>01652 <span class="keyword">static</span> <span class="keywordtype">bool</span> test(socket_t <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>, set_t mask); <a name="l01653"></a>01653 }; <a name="l01654"></a>01654 <a name="l01660"></a><a class="code" href="a00068.html">01660</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00068.html" title="A bound socket used to listen for inbound socket connections.">ListenSocket</a> : <span class="keyword">protected</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a> <a name="l01661"></a>01661 { <a name="l01662"></a>01662 <span class="keyword">public</span>: <a name="l01672"></a>01672 <a class="code" href="a00068.html" title="A bound socket used to listen for inbound socket connections.">ListenSocket</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">unsigned</span> backlog = 5, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0); <a name="l01673"></a>01673 <a name="l01684"></a>01684 <span class="keyword">static</span> socket_t <a class="code" href="a00140.html#ab4429c6415adf6180cad7ba6328f4ebf" title="Create a socket object unbound.">create</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">unsigned</span> backlog = 5, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0); <a name="l01685"></a>01685 <a name="l01691"></a>01691 socket_t accept(<span class="keyword">struct</span> sockaddr_storage *address = NULL) <span class="keyword">const</span>; <a name="l01692"></a>01692 <a name="l01698"></a><a class="code" href="a00068.html#a5b0eb097b487199cd00cdcd6a570adbd">01698</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> waitConnection(<a class="code" href="a00194.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = Timer::inf)<span class="keyword"> const</span> <a name="l01699"></a>01699 <span class="keyword"> </span>{<span class="keywordflow">return</span> Socket::waitPending(timeout);}; <a name="l01700"></a>01700 <a name="l01705"></a><a class="code" href="a00068.html#a8d495f0942321a4ce5aec10af0c9771a">01705</a> <span class="keyword">inline</span> <a class="code" href="a00140.html#a052529d07ea8d602b84f6dc6e13059cf" title="Get the socket descriptor by casting.">operator socket_t</a>()<span class="keyword"> const</span> <a name="l01706"></a>01706 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;}; <a name="l01707"></a>01707 <a name="l01712"></a><a class="code" href="a00068.html#ac96f1f17d672c69b1a69b9d235128077">01712</a> <span class="keyword">inline</span> socket_t <a class="code" href="a00140.html#a14c3ced56f4e1f47f810894fa05d904d" title="Get the socket descriptor by pointer reference.">operator*</a>()<span class="keyword"> const</span> <a name="l01713"></a>01713 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;}; <a name="l01714"></a>01714 <a name="l01719"></a><a class="code" href="a00068.html#a22a24b2b2ca2e53f1666517a1a5df977">01719</a> <span class="keyword">inline</span> socket_t getsocket(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l01720"></a>01720 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;}; <a name="l01721"></a>01721 <a name="l01722"></a>01722 }; <a name="l01723"></a>01723 <a name="l01729"></a><a class="code" href="a00152.html">01729</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00152.html" title="A generic tcp server class.">TCPServer</a> : <span class="keyword">public</span> <a class="code" href="a00068.html" title="A bound socket used to listen for inbound socket connections.">ListenSocket</a> <a name="l01730"></a>01730 { <a name="l01731"></a>01731 <span class="keyword">public</span>: <a name="l01739"></a>01739 <a class="code" href="a00152.html" title="A generic tcp server class.">TCPServer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00141.html" title="A generic socket address class.">address</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">unsigned</span> backlog = 5); <a name="l01740"></a>01740 }; <a name="l01741"></a>01741 <a name="l01745"></a>01745 __EXPORT <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00208.html#a0e5d07fb26c644d1dfad1476a5b3d07b" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_nextaddrinfo</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>); <a name="l01746"></a>01746 <a name="l01750"></a>01750 __EXPORT <span class="keyword">struct </span>sockaddr *<a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>); <a name="l01751"></a>01751 <a name="l01755"></a>01755 __EXPORT socket_t <a class="code" href="a00208.html#a3150ce1a9b0aed1a48f392b63e54876b" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrsock</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>); <a name="l01756"></a>01756 <a name="l01762"></a>01762 <span class="keyword">template</span> <> <a name="l01763"></a><a class="code" href="a00063.html">01763</a> <span class="keyword">class </span><a class="code" href="a00062.html" title="A smart pointer template for iterating linked lists.">linked_pointer</a><struct sockaddr> <a name="l01764"></a>01764 { <a name="l01765"></a>01765 <span class="keyword">private</span>: <a name="l01766"></a>01766 <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *ptr; <a name="l01767"></a>01767 <a name="l01768"></a>01768 <span class="keyword">public</span>: <a name="l01769"></a>01769 <span class="keyword">inline</span> <a class="code" href="a00062.html" title="A smart pointer template for iterating linked lists.">linked_pointer</a>(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list) <a name="l01770"></a>01770 {ptr = list;} <a name="l01771"></a>01771 <a name="l01772"></a>01772 <span class="keyword">inline</span> <a class="code" href="a00062.html" title="A smart pointer template for iterating linked lists.">linked_pointer</a>() <a name="l01773"></a>01773 {ptr = NULL;} <a name="l01774"></a>01774 <a name="l01775"></a>01775 <span class="keyword">inline</span> <a class="code" href="a00062.html" title="A smart pointer template for iterating linked lists.">linked_pointer</a>(<a class="code" href="a00141.html" title="A generic socket address class.">Socket::address</a>& list) <a name="l01776"></a>01776 {ptr = list.<a class="code" href="a00141.html#adf008e2e2233bbccc99d0e51f4bca1b3" title="Get the full socket address list from the object.">getList</a>();}; <a name="l01777"></a>01777 <a name="l01782"></a><a class="code" href="a00063.html#a7c191de41d983e84f6ca8f863cdd9ced">01782</a> <span class="keyword">inline</span> operator struct sockaddr *()<span class="keyword"> const</span> <a name="l01783"></a>01783 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01784"></a>01784 <a name="l01789"></a><a class="code" href="a00063.html#a828ddb920ef3ce4878481f2d6f72dee2">01789</a> <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr *operator*()<span class="keyword"> const</span> <a name="l01790"></a>01790 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01791"></a>01791 <a name="l01792"></a>01792 <span class="keyword">inline</span> operator struct sockaddr_in *()<span class="keyword"> const</span> <a name="l01793"></a>01793 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">struct</span> sockaddr_in *)<a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01794"></a>01794 <a name="l01795"></a>01795 <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr_in *in(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l01796"></a>01796 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">struct</span> sockaddr_in *)<a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01797"></a>01797 <a name="l01798"></a>01798 <span class="preprocessor">#ifdef AF_INET6</span> <a name="l01799"></a>01799 <span class="preprocessor"></span> <span class="keyword">inline</span> operator struct sockaddr_in6 *()<span class="keyword"> const</span> <a name="l01800"></a>01800 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">struct</span> sockaddr_in6 *)<a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01801"></a>01801 <a name="l01802"></a>01802 <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr_in6 *in6(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l01803"></a>01803 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">struct</span> sockaddr_in6 *)<a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01804"></a>01804 <span class="preprocessor">#endif</span> <a name="l01805"></a>01805 <span class="preprocessor"></span> <a name="l01809"></a><a class="code" href="a00063.html#ab7dee729bdaee921e20671c18530f849">01809</a> <span class="keyword">inline</span> socket_t operator()(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l01810"></a>01810 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00208.html#a3150ce1a9b0aed1a48f392b63e54876b" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrsock</a>(ptr);}; <a name="l01811"></a>01811 <a name="l01816"></a><a class="code" href="a00063.html#a45a94d5bb06870aa0c8e41e364f617d8">01816</a> <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span> <a name="l01817"></a>01817 <span class="keyword"> </span>{<span class="keywordflow">return</span> ptr != NULL;}; <a name="l01818"></a>01818 <a name="l01823"></a><a class="code" href="a00063.html#a4d94aa10795d39addc1a9ebb7e17dd66">01823</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<span class="keyword">struct</span> <a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list) <a name="l01824"></a>01824 {ptr = list;}; <a name="l01825"></a>01825 <a name="l01830"></a><a class="code" href="a00063.html#a5dfe5a9056dd2b3176d262cc8305ef98">01830</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> operator=(<a class="code" href="a00141.html" title="A generic socket address class.">Socket::address</a>& list) <a name="l01831"></a>01831 {ptr = list.<a class="code" href="a00141.html#adf008e2e2233bbccc99d0e51f4bca1b3" title="Get the full socket address list from the object.">getList</a>();}; <a name="l01832"></a>01832 <a name="l01837"></a><a class="code" href="a00063.html#ac8b50e0a0e7b80084f7c1577d71caf15">01837</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list) <a name="l01838"></a>01838 {ptr = list;}; <a name="l01839"></a>01839 <a name="l01844"></a><a class="code" href="a00063.html#afe4b5ea753bd0465595dc16dd60e8cf7">01844</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(<a class="code" href="a00141.html" title="A generic socket address class.">Socket::address</a>& list) <a name="l01845"></a>01845 {ptr = list.<a class="code" href="a00141.html#adf008e2e2233bbccc99d0e51f4bca1b3" title="Get the full socket address list from the object.">getList</a>();}; <a name="l01846"></a>01846 <a name="l01847"></a>01847 <a name="l01852"></a><a class="code" href="a00063.html#a2e68e47e6fc7ba1df2173e752aa7ee19">01852</a> <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr* operator->()<span class="keyword"> const</span> <a name="l01853"></a>01853 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00208.html#af7c144b60b84fc894849f5eefd967599" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_getaddrinfo</a>(ptr);}; <a name="l01854"></a>01854 <a name="l01859"></a><a class="code" href="a00063.html#aaed86cb039a065acdd82db8dcbfac8e8">01859</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span> <a name="l01860"></a>01860 <span class="keyword"> </span>{<span class="keywordflow">return</span> ptr == NULL;}; <a name="l01861"></a>01861 <a name="l01862"></a>01862 <span class="keyword">inline</span> <span class="keywordtype">void</span> next(<span class="keywordtype">void</span>) <a name="l01863"></a>01863 {ptr = <a class="code" href="a00208.html#a0e5d07fb26c644d1dfad1476a5b3d07b" title="Helper function for linked_pointer&lt;struct sockaddr&gt;.">_nextaddrinfo</a>(ptr);}; <a name="l01864"></a>01864 }; <a name="l01865"></a>01865 <a name="l01869"></a><a class="code" href="a00208.html#a7957cb2e582d016e409db449f3369655">01869</a> <span class="keyword">typedef</span> <a class="code" href="a00140.html" title="A generic socket base class.">Socket</a> <a class="code" href="a00140.html" title="A generic socket base class.">socket</a>; <a name="l01870"></a>01870 <a name="l01876"></a><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846">01876</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00208.html#a1c6e320bbe28f9f36560b564459de846" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>(<a class="code" href="a00141.html" title="A generic socket address class.">socket::address</a>& address) <a name="l01877"></a>01877 {<span class="keywordflow">return</span> address.<a class="code" href="a00141.html#adf008e2e2233bbccc99d0e51f4bca1b3" title="Get the full socket address list from the object.">getList</a>();} <a name="l01878"></a>01878 <a name="l01885"></a><a class="code" href="a00208.html#a460b5a6386de45c6263462b541a9c357">01885</a> <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr *<a class="code" href="a00208.html#a460b5a6386de45c6263462b541a9c357" title="A convenience function to convert a socket address list into a socket address.">addr</a>(<a class="code" href="a00141.html" title="A generic socket address class.">socket::address</a>& address) <a name="l01886"></a>01886 {<span class="keywordflow">return</span> address.<a class="code" href="a00141.html#a0481d1b4aff43f09638986f1c2877cd1" title="Get the first socket address in our address list.">getAddr</a>();} <a name="l01887"></a>01887 <a name="l01895"></a><a class="code" href="a00208.html#affb4ebc34459cfbe1d2965c178e52ee9">01895</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00208.html#affb4ebc34459cfbe1d2965c178e52ee9" title="Compare two socket addresses to see if equal.">eq</a>(<span class="keyword">struct</span> sockaddr *s1, <span class="keyword">struct</span> sockaddr *s2) <a name="l01896"></a>01896 {<span class="keywordflow">return</span> Socket::equal(s1, s2);} <a name="l01897"></a>01897 <a name="l01905"></a><a class="code" href="a00208.html#a4387118c92f750775190e6cf2f09bebd">01905</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00208.html#affb4ebc34459cfbe1d2965c178e52ee9" title="Compare two socket addresses to see if equal.">eq</a>(<span class="keyword">struct</span> sockaddr_storage *s1, <span class="keyword">struct</span> sockaddr_storage *s2) <a name="l01906"></a>01906 {<span class="keywordflow">return</span> Socket::equal((<span class="keyword">struct</span> sockaddr *)s1, (<span class="keyword">struct</span> sockaddr *)s2);} <a name="l01907"></a>01907 <a name="l01915"></a><a class="code" href="a00208.html#a7a44b0c73cbd6a3d8b914ef20e69c034">01915</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00208.html#a7a44b0c73cbd6a3d8b914ef20e69c034" title="Compare two host addresses to see if equal.">host_eq</a>(<span class="keyword">struct</span> sockaddr *s1, <span class="keyword">struct</span> sockaddr *s2) <a name="l01916"></a>01916 {<span class="keywordflow">return</span> Socket::equalhost(s1, s2);} <a name="l01917"></a>01917 <a name="l01918"></a>01918 <span class="comment">// to be depreciated...</span> <a name="l01919"></a>01919 <span class="keyword">inline</span> <span class="keywordtype">bool</span> ieq(<span class="keyword">struct</span> sockaddr *s1, <span class="keyword">struct</span> sockaddr *s2) <a name="l01920"></a>01920 {<span class="keywordflow">return</span> Socket::equalhost(s1, s2);} <a name="l01921"></a>01921 <a name="l01922"></a>01922 <a class="code" href="a00208.html#a9045ddbf2980f6330c065a6935f40161" title="A convenience type when mixing std::string in old compilers that are bad with namespaces...">String</a> str(Socket& so, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> size); <a name="l01923"></a>01923 <a name="l01924"></a>01924 <span class="keyword">typedef</span> TCPServer tcpserv_t; <a name="l01925"></a>01925 <a name="l01926"></a>01926 <a name="l01927"></a>01927 END_NAMESPACE <a name="l01928"></a>01928 <a name="l01929"></a>01929 <span class="preprocessor">#endif</span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Jul 14 16:38:57 2011 for ucommon by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>