diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02665.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02665.html | 1553 |
1 files changed, 1553 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02665.html b/docs/doxygen/nel/a02665.html new file mode 100644 index 00000000..6f768eb2 --- /dev/null +++ b/docs/doxygen/nel/a02665.html @@ -0,0 +1,1553 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLNET::CInetAddress class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLNET::CInetAddress Class Reference</h1><code>#include <<a class="el" href="a05811.html">inet_address.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Internet address (IP + port). The structure sockaddr_in is internally in network byte order <p> +<dl compact><dt><b><a class="el" href="todo.html#_todo000050">Todo:</a></b></dt><dd>cado: Test big/little endian transfers to check if byte ordering is ok.</dd></dl> +<dl compact><dt><b>Author:</b></dt><dd>Olivier Cado <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05811.html#l00064">64</a> of file <a class="el" href="a05811.html">inet_address.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa0">asIPString</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns IP address and port as a string. (ex: "195.68.21.195:80"). <a href="#NLNET_1_1CInetAddressa0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa1">asString</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns hostname and port as a string. (ex: "www.nevrax.org:80 (195.68.21.195)"). <a href="#NLNET_1_1CInetAddressa1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa2">CInetAddress</a> (const <a class="el" href="a02665.html">CInetAddress</a> &other)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Copy constructor. <a href="#NLNET_1_1CInetAddressa2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa3">CInetAddress</a> (const std::string &hostNameAndPort)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa4">CInetAddress</a> (const std::string &hostName, <a class="el" href="a04558.html#a9">uint16</a> port)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Alternate constructor (calls <a class="el" href="a02665.html#NLNET_1_1CInetAddressa15">setByName()</a>). <a href="#NLNET_1_1CInetAddressa4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa5">CInetAddress</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Default Constructor. The address is set to INADDR_ANY. <a href="#NLNET_1_1CInetAddressa5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const std::string & </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa6">hostName</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns hostname. (ex: "www.nevrax.org"). <a href="#NLNET_1_1CInetAddressa6"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa7">internalIPAddress</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns internal IP address. <a href="#NLNET_1_1CInetAddressa7"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa8">internalNetAddress</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the internal network address (it s the network address for example 192.168.0.0 for a C class). <a href="#NLNET_1_1CInetAddressa8"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns readable IP address. (ex: "195.68.21.195"). <a href="#NLNET_1_1CInetAddressa9"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa10">is127001</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if this <a class="el" href="a02665.html">CInetAddress</a> is 127.0.0.1. <a href="#NLNET_1_1CInetAddressa10"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa11">isValid</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns if object (address and port) is valid. <a href="#NLNET_1_1CInetAddressa11"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02665.html">CInetAddress</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa12">operator=</a> (const <a class="el" href="a02665.html">CInetAddress</a> &other)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Assignment operator. <a href="#NLNET_1_1CInetAddressa12"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a9">uint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa13">port</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns port. <a href="#NLNET_1_1CInetAddressa13"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa14">serial</a> (<a class="el" href="a02270.html">NLMISC::IStream</a> &<a class="el" href="a04223.html#a626">s</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Serialize. <a href="#NLNET_1_1CInetAddressa14"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02665.html">CInetAddress</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa15">setByName</a> (const std::string &hostname)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Resolves a name. <a href="#NLNET_1_1CInetAddressa15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa16">setNameAndPort</a> (const std::string &hostNameAndPort)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets hostname and port (ex: www.nevrax.com:80). <a href="#NLNET_1_1CInetAddressa16"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa17">setPort</a> (<a class="el" href="a04558.html#a9">uint16</a> port)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets port. <a href="#NLNET_1_1CInetAddressa17"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa18">setSockAddr</a> (const sockaddr_in *saddr)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const sockaddr_in * </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa19">sockAddr</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns internal socket address (read only). <a href="#NLNET_1_1CInetAddressa19"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressa20">~CInetAddress</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#NLNET_1_1CInetAddressa20"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02665.html">CInetAddress</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddresse0">localAddresses</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02665.html">CInetAddress</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddresse1">localHost</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a <a class="el" href="a02665.html">CInetAddress</a> object with local host address, port=0. <a href="#NLNET_1_1CInetAddresse1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Public Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddresss0">RetrieveNames</a> = false</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">If true, <a class="el" href="a02665.html#NLNET_1_1CInetAddressa18">setSockAddr()</a> always tries to retrieve the host name from the address. <a href="#NLNET_1_1CInetAddresss0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressb0">CInetAddress</a> (const in_addr *ip)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor with ip address, port=0. <a href="#NLNET_1_1CInetAddressb0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressd0">init</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>sockaddr_in * </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a></td></tr> + +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressn0">operator<</a> (const <a class="el" href="a02665.html">CInetAddress</a> &a1, const <a class="el" href="a02665.html">CInetAddress</a> &a2)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Comparison < operator. <a href="#NLNET_1_1CInetAddressn0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02665.html#NLNET_1_1CInetAddressn1">operator==</a> (const <a class="el" href="a02665.html">CInetAddress</a> &a1, const <a class="el" href="a02665.html">CInetAddress</a> &a2)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Comparison == operator. <a href="#NLNET_1_1CInetAddressn1"></a><br><br></td></tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLNET_1_1CInetAddressa5" doxytag="NLNET::CInetAddress::CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::CInetAddress </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Default Constructor. The address is set to INADDR_ANY. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00064">64</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05810.html#l00180">init()</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00467">localAddresses()</a>, and <a class="el" href="a05810.html#l00447">localHost()</a>. +<p> +<div class="fragment"><pre>00065 { +00066 <a class="code" href="a02665.html#NLNET_1_1CInetAddressd0">init</a>(); +00067 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_port = 0; <span class="comment">// same as htons(0)</span> +00068 memset( &<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr, 0, <span class="keyword">sizeof</span>(in_addr) ); <span class="comment">// same as htonl(INADDR_ANY)</span> +00069 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa4" doxytag="NLNET::CInetAddress::CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::CInetAddress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>hostName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>port</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Alternate constructor (calls <a class="el" href="a02665.html#NLNET_1_1CInetAddressa15">setByName()</a>). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00098">98</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00180">init()</a>, <a class="el" href="a05810.html#l00224">setByName()</a>, <a class="el" href="a05810.html#l00262">setPort()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>00099 { +00100 <a class="code" href="a02665.html#NLNET_1_1CInetAddressd0">init</a>(); +00101 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa17">setPort</a>( port ); +00102 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa15">setByName</a>( hostName ); +00103 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa3" doxytag="NLNET::CInetAddress::CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::CInetAddress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>hostNameAndPort</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Alternate constructor (calls <a class="el" href="a02665.html#NLNET_1_1CInetAddressa15">setByName()</a>) example: <a class="el" href="a02665.html">CInetAddress</a>("www.nevrax.com:80") +<p> +Definition at line <a class="el" href="a05810.html#l00109">109</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00180">init()</a>, and <a class="el" href="a05810.html#l00204">setNameAndPort()</a>. +<p> +<div class="fragment"><pre>00110 { +00111 <a class="code" href="a02665.html#NLNET_1_1CInetAddressd0">init</a>(); +00112 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa16">setNameAndPort</a>( hostNameAndPort ); +00113 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa2" doxytag="NLNET::CInetAddress::CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::CInetAddress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>other</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Copy constructor. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00119">119</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>, <a class="el" href="a05811.html#l00162">_SockAddr</a>, <a class="el" href="a05811.html#l00163">_Valid</a>, and <a class="el" href="a05810.html#l00180">init()</a>. +<p> +<div class="fragment"><pre>00120 { +00121 <a class="code" href="a02665.html#NLNET_1_1CInetAddressd0">init</a>(); +00122 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a>; +00123 memcpy( _SockAddr, other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>, <span class="keyword">sizeof</span>( *_SockAddr ) ); +00124 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a>; +00125 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa20" doxytag="NLNET::CInetAddress::~CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::~<a class="el" href="a02665.html">CInetAddress</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Destructor. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00195">195</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>. +<p> +<div class="fragment"><pre>00196 { +00197 <span class="keyword">delete</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>; +00198 <span class="comment">// _Valid = false;</span> +00199 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressb0" doxytag="NLNET::CInetAddress::CInetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CInetAddress::CInetAddress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const in_addr * </td> + <td class="mdname1" valign="top" nowrap> <em>ip</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [protected]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor with ip address, port=0. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00075">75</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>, <a class="el" href="a05811.html#l00162">_SockAddr</a>, <a class="el" href="a05811.html#l00163">_Valid</a>, <a class="el" href="a05810.html#l00180">init()</a>, and <a class="el" href="a05810.html#l00355">ipAddress()</a>. +<p> +<div class="fragment"><pre>00076 { +00077 <a class="code" href="a02665.html#NLNET_1_1CInetAddressd0">init</a>(); +00078 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_port = 0; +00079 memcpy( &<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr, ip, <span class="keyword">sizeof</span>(in_addr) ); +00080 +00081 <span class="comment">// get the host name to be displayed</span> +00082 hostent *phostent = gethostbyaddr( (<span class="keywordtype">char</span>*)&ip->s_addr, 4, AF_INET ); +00083 <span class="keywordflow">if</span> ( phostent == NULL ) +00084 { +00085 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = <a class="code" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a>(); +00086 } +00087 <span class="keywordflow">else</span> +00088 { +00089 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = string( phostent->h_name ); +00090 } +00091 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = <span class="keyword">true</span>; +00092 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CInetAddressa0" doxytag="NLNET::CInetAddress::asIPString" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string NLNET::CInetAddress::asIPString </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns IP address and port as a string. (ex: "195.68.21.195:80"). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00397">397</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00355">ipAddress()</a>, <a class="el" href="a05810.html#l00376">port()</a>, and <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>. +<p> +Referenced by <a class="el" href="a05962.html#l00338">NLNET::CLoginServer::init()</a>, <a class="el" href="a05962.html#l00467">NLNET::NLMISC_DYNVARIABLE()</a>, <a class="el" href="a05810.html#l00409">serial()</a>, and <a class="el" href="a05962.html#l00244">NLNET::setListenAddress()</a>. +<p> +<div class="fragment"><pre>00398 { +00399 <span class="comment">// stringstream ss;</span> +00400 <span class="comment">// ss << ipAddress() << ":" << port();</span> +00401 <span class="comment">// return ss.str();</span> +00402 <span class="keywordflow">return</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a>() + <span class="stringliteral">":"</span> + <a class="code" href="a05378.html#a244">NLMISC::toString</a>(<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>()); +00403 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa1" doxytag="NLNET::CInetAddress::asString" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string NLNET::CInetAddress::asString </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns hostname and port as a string. (ex: "www.nevrax.org:80 (195.68.21.195)"). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00385">385</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00367">hostName()</a>, <a class="el" href="a05810.html#l00355">ipAddress()</a>, <a class="el" href="a05810.html#l00376">port()</a>, and <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>. +<p> +Referenced by <a class="el" href="a06643.html#l00086">NLNET::CUdpSock::bind()</a>, <a class="el" href="a06650.html#l00262">NLNET::cbServerAskUniversalTime()</a>, <a class="el" href="a05962.html#l00181">NLNET::cbShardValidation()</a>, <a class="el" href="a06487.html#l00101">NLNET::CTcpSock::disconnect()</a>, <a class="el" href="a05662.html#l00058">NLNET::CDummyTcpSock::disconnect()</a>, <a class="el" href="a06089.html#l00285">NLNET::CNamingClient::info()</a>, <a class="el" href="a05913.html#l00076">NLNET::CListenSock::init()</a>, <a class="el" href="a06089.html#l00501">NLNET::CNamingClient::lookupAndConnect()</a>, <a class="el" href="a06364.html#l00419">NLNET::IService::main()</a>, <a class="el" href="a06643.html#l00156">NLNET::CUdpSock::receive()</a>, <a class="el" href="a05514.html#l00386">NLNET::CNonBlockingBufSock::receivePart()</a>, <a class="el" href="a05670.html#l00086">NLNET::sendEMailCommand()</a>, and <a class="el" href="a06645.html#l00857">NLNET::CUnifiedNetwork::update()</a>. +<p> +<div class="fragment"><pre>00386 { +00387 <span class="comment">// stringstream ss;</span> +00388 <span class="comment">// ss << hostName() << ":" << port() << " (" << ipAddress() << ")";</span> +00389 <span class="comment">// return ss.str();</span> +00390 <span class="keywordflow">return</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressa6">hostName</a>() + <span class="stringliteral">":"</span> + <a class="code" href="a05378.html#a244">NLMISC::toString</a>(<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>()) + <span class="stringliteral">" ("</span> + <a class="code" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a>() + <span class="stringliteral">")"</span>; +00391 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa6" doxytag="NLNET::CInetAddress::hostName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const string & NLNET::CInetAddress::hostName </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns hostname. (ex: "www.nevrax.org"). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00367">367</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00385">asString()</a>. +<p> +<div class="fragment"><pre>00368 { +00369 <span class="keywordflow">return</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a>; +00370 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressd0" doxytag="NLNET::CInetAddress::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CInetAddress::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00180">180</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05811.html#l00163">_Valid</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00064">CInetAddress()</a>. +<p> +<div class="fragment"><pre>00181 { +00182 CSock::initNetwork(); +00183 +00184 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = <span class="keyword">false</span>; +00185 +00186 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a> = <span class="keyword">new</span> sockaddr_in; +00187 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_family = AF_INET; +00188 memset( <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_zero, 0, 8 ); +00189 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa7" doxytag="NLNET::CInetAddress::internalIPAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLNET::CInetAddress::internalIPAddress </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns internal IP address. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00315">315</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00320">internalNetAddress()</a>, and <a class="el" href="a05810.html#l00503">is127001()</a>. +<p> +<div class="fragment"><pre>00316 { +00317 <span class="keywordflow">return</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.s_addr; +00318 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa8" doxytag="NLNET::CInetAddress::internalNetAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLNET::CInetAddress::internalNetAddress </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the internal network address (it s the network address for example 192.168.0.0 for a C class). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00320">320</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00315">internalIPAddress()</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00321 { +00322 <a class="code" href="a04558.html#a11">uint32</a> ip = <a class="code" href="a02665.html#NLNET_1_1CInetAddressa7">internalIPAddress</a>(); +00323 <span class="keywordflow">if</span> ((ip&0x00000080) == 0) +00324 { +00325 <span class="comment">// A class</span> +00326 <span class="keywordflow">return</span> ip & 0x000000FF; +00327 } +00328 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((ip&0x00000040) == 0) +00329 { +00330 <span class="comment">// B class</span> +00331 <span class="keywordflow">return</span> ip & 0x0000FFFF; +00332 } +00333 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((ip&0x00000020) == 0) +00334 { +00335 <span class="comment">// C class</span> +00336 <span class="keywordflow">return</span> ip & 0x00FFFFFF; +00337 } +00338 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((ip&0x00000010) == 0) +00339 { +00340 <span class="comment">// D class</span> +00341 <span class="keywordflow">return</span> ip & 0xFFFFFFFF; +00342 } +00343 <span class="keywordflow">else</span> +00344 { +00345 <span class="keywordflow">return</span> ip; +00346 } +00347 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa9" doxytag="NLNET::CInetAddress::ipAddress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> string NLNET::CInetAddress::ipAddress </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns readable IP address. (ex: "195.68.21.195"). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00355">355</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00397">asIPString()</a>, <a class="el" href="a05810.html#l00385">asString()</a>, <a class="el" href="a05810.html#l00075">CInetAddress()</a>, <a class="el" href="a05810.html#l00447">localHost()</a>, and <a class="el" href="a05810.html#l00272">setSockAddr()</a>. +<p> +<div class="fragment"><pre>00356 { +00357 <span class="comment">/*stringstream ss; // or use inet_ntoa</span> +00358 <span class="comment"> ss << inet_ntoa ( _SockAddr->sin_addr );</span> +00359 <span class="comment"> return ss.str();*/</span> +00360 <span class="keywordflow">return</span> string( inet_ntoa( <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr ) ); +00361 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa10" doxytag="NLNET::CInetAddress::is127001" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CInetAddress::is127001 </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if this <a class="el" href="a02665.html">CInetAddress</a> is 127.0.0.1. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00503">503</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00315">internalIPAddress()</a>. +<p> +<div class="fragment"><pre>00504 { +00505 <span class="keywordflow">return</span> (<a class="code" href="a02665.html#NLNET_1_1CInetAddressa7">internalIPAddress</a> () == htonl(0x7F000001)); +00506 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa11" doxytag="NLNET::CInetAddress::isValid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLNET::CInetAddress::isValid </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns if object (address and port) is valid. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00297">297</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05811.html#l00163">_Valid</a>. +<p> +Referenced by <a class="el" href="a06645.html#l00479">NLNET::CUnifiedNetwork::init()</a>, and <a class="el" href="a06645.html#l00857">NLNET::CUnifiedNetwork::update()</a>. +<p> +<div class="fragment"><pre>00298 { +00299 <span class="keywordflow">return</span> ( <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> && <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_port!=0 ); <span class="comment">// same as ntohs(0)</span> +00300 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddresse0" doxytag="NLNET::CInetAddress::localAddresses" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector< <a class="el" href="a02665.html">CInetAddress</a> > NLNET::CInetAddress::localAddresses </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the list of the local host addresses (with port=0) (especially useful if the host is multihomed) +<p> +Definition at line <a class="el" href="a05810.html#l00467">467</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00064">CInetAddress()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00468 { +00469 <span class="comment">// 1. Get local host name</span> +00470 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> maxlength = 80; +00471 <span class="keywordtype">char</span> localhost [maxlength]; +00472 <span class="keywordflow">if</span> ( gethostname( localhost, maxlength ) == SOCKET_ERROR ) +00473 { +00474 <span class="keywordflow">throw</span> ESocket( <span class="stringliteral">"Unable to get local hostname"</span> ); +00475 } +00476 +00477 <span class="comment">// 2. Get address list</span> +00478 vector<CInetAddress> vect; +00479 +00480 <a class="code" href="a04558.html#a15">uint</a> i = 0; +00481 <span class="keywordflow">do</span> +00482 { +00483 hostent *phostent = gethostbyname( localhost ); +00484 <span class="keywordflow">if</span> ( phostent == NULL ) +00485 <span class="keywordflow">throw</span> ESocket( (string(<span class="stringliteral">"Hostname resolution failed for "</span>)+string(localhost)).c_str() ); +00486 +00487 <span class="keywordflow">if</span> (phostent->h_addr_list[i] == 0) +00488 <span class="keywordflow">break</span>; +00489 +00490 vect.push_back( <a class="code" href="a02665.html#NLNET_1_1CInetAddressa5">CInetAddress</a>( (<span class="keyword">const</span> in_addr*)(phostent->h_addr_list[i]) ) ); +00491 i++; +00492 } +00493 <span class="keywordflow">while</span> (<span class="keyword">true</span>); +00494 +00495 <span class="keywordflow">if</span>(vect.empty()) +00496 { +00497 <span class="keywordflow">throw</span> ESocket( (string(<span class="stringliteral">"No network card detected for "</span>)+string(localhost)).c_str() ); +00498 } +00499 +00500 <span class="keywordflow">return</span> vect; +00501 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddresse1" doxytag="NLNET::CInetAddress::localHost" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02665.html">CInetAddress</a> NLNET::CInetAddress::localHost </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates a <a class="el" href="a02665.html">CInetAddress</a> object with local host address, port=0. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00447">447</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00064">CInetAddress()</a>, <a class="el" href="a05810.html#l00355">ipAddress()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00448 { +00449 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> maxlength = 80; +00450 <span class="keywordtype">char</span> localhost [maxlength]; +00451 <span class="keywordflow">if</span> ( gethostname( localhost, maxlength ) != 0 ) +00452 <span class="keywordflow">throw</span> ESocket( <span class="stringliteral">"Unable to get local hostname"</span> ); +00453 <a class="code" href="a02665.html">CInetAddress</a> localaddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddressa5">CInetAddress</a>( string(localhost) ); +00454 +00455 <span class="keywordflow">if</span> ( localaddr.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a>() == <span class="stringliteral">"127.0.0.1"</span> ) +00456 { +00457 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"LNETL0: No network card detected! using localhost (127.0.0.1)"</span>); +00458 } +00459 +00460 <span class="keywordflow">return</span> localaddr; +00461 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa12" doxytag="NLNET::CInetAddress::operator=" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02665.html">CInetAddress</a> & NLNET::CInetAddress::operator= </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>other</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Assignment operator. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00131">131</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>, <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05811.html#l00163">_Valid</a>. +<p> +<div class="fragment"><pre>00132 { +00133 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a>; +00134 memcpy( _SockAddr, other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>, <span class="keyword">sizeof</span>( *_SockAddr ) ); +00135 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = other.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a>; +00136 <span class="keywordflow">return</span> *<span class="keyword">this</span>; +00137 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa13" doxytag="NLNET::CInetAddress::port" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a9">uint16</a> NLNET::CInetAddress::port </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns port. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00376">376</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00397">asIPString()</a>, <a class="el" href="a05810.html#l00385">asString()</a>, and <a class="el" href="a05810.html#l00153">NLNET::operator<()</a>. +<p> +<div class="fragment"><pre>00377 { +00378 <span class="keywordflow">return</span> ntohs( <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_port ); +00379 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa14" doxytag="NLNET::CInetAddress::serial" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CInetAddress::serial </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02270.html">NLMISC::IStream</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>s</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Serialize. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00409">409</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, <a class="el" href="a05811.html#l00163">_Valid</a>, <a class="el" href="a05810.html#l00397">asIPString()</a>, <a class="el" href="a06463.html#l00064">NLMISC::IStream::isReading()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05979.html#l00420">NLMISC::CMemStream::serial()</a>, <a class="el" href="a05810.html#l00204">setNameAndPort()</a>, <a class="el" href="a05810.html#l00272">setSockAddr()</a>, <a class="el" href="a05979.html#l00116">NLMISC::CMemStream::stringMode()</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +<div class="fragment"><pre>00410 { +00411 <a class="code" href="a02271.html">NLMISC::CMemStream</a> *ms = dynamic_cast<NLMISC::CMemStream*>(&<a class="code" href="a04223.html#a626">s</a>); +00412 <span class="keywordflow">if</span> ( ms && ms-><a class="code" href="a02271.html#NLMISC_1_1CStringStreama49">stringMode</a>() ) +00413 { +00414 <span class="comment">// String stream</span> +00415 string addrs; +00416 <span class="keywordflow">if</span> ( ms-><a class="code" href="a02270.html#NLMISC_1_1IStreama0">isReading</a>() ) +00417 { +00418 ms-><a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>( addrs ); +00419 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa16">setNameAndPort</a>( addrs ); +00420 } +00421 <span class="keywordflow">else</span> +00422 { +00423 addrs = <a class="code" href="a02665.html#NLNET_1_1CInetAddressa0">asIPString</a>(); +00424 ms-><a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a>( addrs ); +00425 } +00426 <a class="code" href="a04223.html#a626">s</a>.serial( _Valid ); +00427 } +00428 <span class="keywordflow">else</span> +00429 { +00430 <span class="comment">// Binary stream</span> +00431 <a class="code" href="a04223.html#a626">s</a>.serialBuffer( (<a class="code" href="a04558.html#a7">uint8</a>*)_SockAddr, <span class="keyword">sizeof</span>(*_SockAddr) ); <span class="comment">// this is possible only because the contents of _SockAddr is platform-independant !</span> +00432 <a class="code" href="a04223.html#a626">s</a>.serial( _Valid ); +00433 +00434 <span class="keywordflow">if</span>(<a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a>) +00435 { +00436 <span class="comment">// retreive the fullname</span> +00437 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa18">setSockAddr</a> (_SockAddr); +00438 } +00439 +00440 } +00441 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa15" doxytag="NLNET::CInetAddress::setByName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02665.html">CInetAddress</a> & NLNET::CInetAddress::setByName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>hostname</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Resolves a name. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00224">224</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>, <a class="el" href="a05811.html#l00162">_SockAddr</a>, <a class="el" href="a05811.html#l00163">_Valid</a>, and <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00098">CInetAddress()</a>, and <a class="el" href="a05810.html#l00204">setNameAndPort()</a>. +<p> +<div class="fragment"><pre>00225 { +00226 <span class="comment">// Try to convert directly for addresses such as a.b.c.d</span> +00227 in_addr iaddr; +00228 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00229 <span class="preprocessor"></span> iaddr.S_un.S_addr = inet_addr( hostName.c_str() ); +00230 <span class="keywordflow">if</span> ( iaddr.S_un.S_addr == INADDR_NONE ) +00231 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00232 <span class="preprocessor"></span> iaddr.s_addr = inet_addr( hostName.c_str() ); +00233 <span class="keywordflow">if</span> ( iaddr.s_addr == INADDR_NONE ) +00234 <span class="preprocessor">#endif</span> +00235 <span class="preprocessor"></span> { +00236 +00237 <span class="comment">// Otherwise use the traditional DNS look-up</span> +00238 hostent *phostent = gethostbyname( hostName.c_str() ); +00239 <span class="keywordflow">if</span> ( phostent == NULL ) +00240 { +00241 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = <span class="keyword">false</span>; +00242 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"LNETL0: Network error: resolution of hostname '%s' failed"</span>, hostName.c_str() ); +00243 <span class="comment">// return *this;</span> +00244 <span class="keywordflow">throw</span> ESocket( (string(<span class="stringliteral">"Hostname resolution failed for "</span>)+hostName).c_str() ); +00245 } +00246 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = string( phostent->h_name ); +00247 memcpy( &<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr, phostent->h_addr, <span class="keyword">sizeof</span>(in_addr) ); +00248 } +00249 <span class="keywordflow">else</span> +00250 { +00251 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = hostName; +00252 memcpy( &<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr, &iaddr, <span class="keyword">sizeof</span>(iaddr) ); +00253 } +00254 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = <span class="keyword">true</span>; +00255 <span class="keywordflow">return</span> *<span class="keyword">this</span>; +00256 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa16" doxytag="NLNET::CInetAddress::setNameAndPort" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CInetAddress::setNameAndPort </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>hostNameAndPort</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets hostname and port (ex: www.nevrax.com:80). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00204">204</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05810.html#l00224">setByName()</a>, <a class="el" href="a05810.html#l00262">setPort()</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00109">CInetAddress()</a>, and <a class="el" href="a05810.html#l00409">serial()</a>. +<p> +<div class="fragment"><pre>00205 { +00206 <a class="code" href="a04558.html#a11">uint32</a> pos = hostNameAndPort.find_first_of (<span class="charliteral">':'</span>); +00207 <span class="keywordflow">if</span> (pos != string::npos) +00208 { +00209 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa17">setPort</a>( atoi(hostNameAndPort.substr(pos + 1).c_str()) ); +00210 } +00211 <span class="keywordflow">else</span> +00212 { +00213 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa17">setPort</a>( 0 ); +00214 } +00215 +00216 <span class="comment">// if pos == -1, it will copy all the string</span> +00217 <a class="code" href="a02665.html#NLNET_1_1CInetAddressa15">setByName</a>( hostNameAndPort.substr (0, pos) ); +00218 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa17" doxytag="NLNET::CInetAddress::setPort" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CInetAddress::setPort </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>port</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets port. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00262">262</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00098">CInetAddress()</a>, <a class="el" href="a05913.html#l00076">NLNET::CListenSock::init()</a>, and <a class="el" href="a05810.html#l00204">setNameAndPort()</a>. +<p> +<div class="fragment"><pre>00263 { +00264 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_port = htons( port ); +00265 +00266 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa18" doxytag="NLNET::CInetAddress::setSockAddr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CInetAddress::setSockAddr </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const sockaddr_in * </td> + <td class="mdname1" valign="top" nowrap> <em>saddr</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets internal socket address directly (contents is copied). It also retrieves the host name if <a class="el" href="a02665.html#NLNET_1_1CInetAddresss0">CInetAddress::RetrieveNames</a> is true. +<p> +Definition at line <a class="el" href="a05810.html#l00272">272</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00161">_HostName</a>, <a class="el" href="a05811.html#l00162">_SockAddr</a>, <a class="el" href="a05811.html#l00163">_Valid</a>, and <a class="el" href="a05810.html#l00355">ipAddress()</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00409">serial()</a>. +<p> +<div class="fragment"><pre>00273 { +00274 memcpy( _SockAddr, saddr, <span class="keyword">sizeof</span>(*saddr) ); +00275 +00276 <span class="comment">// Get host name</span> +00277 <span class="comment">// Warning: when it can't find it, it take more than 4 seconds</span> +00278 <span class="keywordflow">if</span> ( CInetAddress::RetrieveNames ) +00279 { +00280 hostent *phostent = gethostbyaddr( (<span class="keywordtype">char</span>*)&saddr->sin_addr.s_addr, 4, AF_INET ); +00281 <span class="keywordflow">if</span> ( phostent == NULL ) +00282 { +00283 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = <a class="code" href="a02665.html#NLNET_1_1CInetAddressa9">ipAddress</a>(); +00284 } +00285 <span class="keywordflow">else</span> +00286 { +00287 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr0">_HostName</a> = string( phostent->h_name ); +00288 } +00289 } +00290 <a class="code" href="a02665.html#NLNET_1_1CInetAddressr2">_Valid</a> = <span class="keyword">true</span>; +00291 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressa19" doxytag="NLNET::CInetAddress::sockAddr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const sockaddr_in * NLNET::CInetAddress::sockAddr </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns internal socket address (read only). +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00306">306</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +References <a class="el" href="a05811.html#l00162">_SockAddr</a>. +<p> +Referenced by <a class="el" href="a06643.html#l00086">NLNET::CUdpSock::bind()</a>. +<p> +<div class="fragment"><pre>00307 { +00308 <span class="keywordflow">return</span> <a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>; +00309 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CInetAddressn0" doxytag="NLNET::CInetAddress::operator<" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool operator< </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>a1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>a2</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Comparison < operator. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00153">153</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +<div class="fragment"><pre>00154 { +00155 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00156 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.S_un.S_addr == a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.S_un.S_addr ) +00157 { +00158 <span class="keywordflow">return</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>() < a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>() ); +00159 } +00160 <span class="keywordflow">else</span> +00161 { +00162 <span class="keywordflow">return</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.S_un.S_addr < a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.S_un.S_addr ); +00163 } +00164 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00165 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.s_addr == a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.s_addr ) +00166 { +00167 <span class="keywordflow">return</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>() < a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressa13">port</a>() ); +00168 } +00169 <span class="keywordflow">else</span> +00170 { +00171 <span class="keywordflow">return</span> ( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.s_addr < a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>->sin_addr.s_addr ); +00172 } +00173 <span class="preprocessor">#endif </span> +00174 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressn1" doxytag="NLNET::CInetAddress::operator==" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool operator== </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>a1</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>a2</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Comparison == operator. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00143">143</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. +<p> +<div class="fragment"><pre>00144 { +00145 <span class="comment">// Compares the sockaddr structure except the last 8 bytes equal to zero.</span> +00146 <span class="keywordflow">return</span> ( memcmp( a1.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>, a2.<a class="code" href="a02665.html#NLNET_1_1CInetAddressr1">_SockAddr</a>, <span class="keyword">sizeof</span>(sockaddr_in)-8 ) == 0 ); +00147 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLNET_1_1CInetAddressr0" doxytag="NLNET::CInetAddress::_HostName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::string <a class="el" href="a02665.html#NLNET_1_1CInetAddressr0">NLNET::CInetAddress::_HostName</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05811.html#l00161">161</a> of file <a class="el" href="a05811.html">inet_address.h</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00075">CInetAddress()</a>, <a class="el" href="a05810.html#l00367">hostName()</a>, <a class="el" href="a05810.html#l00131">operator=()</a>, <a class="el" href="a05810.html#l00224">setByName()</a>, and <a class="el" href="a05810.html#l00272">setSockAddr()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressr1" doxytag="NLNET::CInetAddress::_SockAddr" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> sockaddr_in* <a class="el" href="a02665.html#NLNET_1_1CInetAddressr1">NLNET::CInetAddress::_SockAddr</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05811.html#l00162">162</a> of file <a class="el" href="a05811.html">inet_address.h</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00064">CInetAddress()</a>, <a class="el" href="a05810.html#l00180">init()</a>, <a class="el" href="a05810.html#l00315">internalIPAddress()</a>, <a class="el" href="a05810.html#l00355">ipAddress()</a>, <a class="el" href="a05810.html#l00297">isValid()</a>, <a class="el" href="a05810.html#l00153">NLNET::operator<()</a>, <a class="el" href="a05810.html#l00131">operator=()</a>, <a class="el" href="a05810.html#l00143">NLNET::operator==()</a>, <a class="el" href="a05810.html#l00376">port()</a>, <a class="el" href="a05810.html#l00409">serial()</a>, <a class="el" href="a05810.html#l00224">setByName()</a>, <a class="el" href="a05810.html#l00262">setPort()</a>, <a class="el" href="a05810.html#l00272">setSockAddr()</a>, <a class="el" href="a05810.html#l00306">sockAddr()</a>, and <a class="el" href="a05810.html#l00195">~CInetAddress()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddressr2" doxytag="NLNET::CInetAddress::_Valid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02665.html#NLNET_1_1CInetAddressr2">NLNET::CInetAddress::_Valid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05811.html#l00163">163</a> of file <a class="el" href="a05811.html">inet_address.h</a>. +<p> +Referenced by <a class="el" href="a05810.html#l00075">CInetAddress()</a>, <a class="el" href="a05810.html#l00180">init()</a>, <a class="el" href="a05810.html#l00297">isValid()</a>, <a class="el" href="a05810.html#l00131">operator=()</a>, <a class="el" href="a05810.html#l00409">serial()</a>, <a class="el" href="a05810.html#l00224">setByName()</a>, and <a class="el" href="a05810.html#l00272">setSockAddr()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CInetAddresss0" doxytag="NLNET::CInetAddress::RetrieveNames" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a02665.html#NLNET_1_1CInetAddresss0">NLNET::CInetAddress::RetrieveNames</a> = false<code> [static]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +If true, <a class="el" href="a02665.html#NLNET_1_1CInetAddressa18">setSockAddr()</a> always tries to retrieve the host name from the address. +<p> + +<p> +Definition at line <a class="el" href="a05810.html#l00058">58</a> of file <a class="el" href="a05810.html">inet_address.cpp</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05811.html">inet_address.h</a><li><a class="el" href="a05810.html">inet_address.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:57:36 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |