debian: Update build depends
[senf.git] / Socket / Protocols / INet / INet6Address.hh
index 436d5fe..9e34707 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institute for Open Communication Systems (FOKUS) 
-// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -35,6 +35,7 @@
 #include "../../../Utils/safe_bool.hh"
 #include "../../../Utils/Tags.hh"
 #include "INet4Address.hh"
+#include "../AddressExceptions.hh"
 
 //#include "INet6Address.mpp"
 #include "INet6Address.ih"
@@ -70,7 +71,7 @@ namespace senf {
         <table class="senf">
         <tr><th>Prefix</th>                  <th>Description</th>                        <th>Definition</th> <th>Note</th></tr>
         <tr><td><tt>::/96</tt></td>          <td>IPv4 compatible IPv6 address</td>       <td>RFC4291</td>    <td>deprecated</td></tr>
-        <tr><td><tt>::ffff:0:0/96</tt></td>  <td>IPv6 mapped IPv4 address</td>           <td>RFC4291</td>    <td></td></tr>
+        <tr><td><tt>\::ffff:0:0/96</tt></td>  <td>IPv6 mapped IPv4 address</td>           <td>RFC4291</td>    <td></td></tr>
         <tr><td><tt>2000::/3</tt></td>       <td>Global unicast addresses</td>           <td>RFC3587</td>    <td>only noted, not defined</td></tr>
         <tr><td><tt>2001:db8::/32</tt></td>  <td>Documentation-only prefix</td>          <td>RFC3849</td>    <td></td></tr>
         <tr><td><tt>2002::/16</tt></td>      <td>6to4 addressing</td>                    <td>RFC3056</td>    <td></td></tr>
@@ -84,8 +85,31 @@ namespace senf {
         <tr><td><tt>ff70::/12</tt></td>      <td>Multicast address with embedded RP</td> <td>RFC3956</td>    <td></td></tr>
         </table>
 
-        The INet6Address class is based on \c boost::array and is built as a fixed-size sequence of
-        16 bytes.
+        The following statements all create the same INet6 address
+        <code>2001:db8::a0b1:1a2b:3dff:fe4e:5f00</code>:
+        \code
+        \\ Used to construct constant INet6 addresses
+        INet6Address(0x2001u,0xDB8u,0x0u,0xA0B1u 0x1A2Bu,0x3DFFu,0xFE4Eu,0x5F00u)
+
+        // Construct INet6 address from it's string representation
+        INet6Address::from_string("2001:db8::a0b1:1a2b:3dff:fe4e:5f00")
+
+        // Construct an INet6 address from raw data. 'from_data' takes an arbitrary iterator (e.g. a
+        // pointer) as argument. Here we use a fixed array but normally you will need this to build
+        // an INet6 address in a packet parser
+        char rawBytes[] = { 0x20, 0x01, 0x0D, 0xB8, 0x00, 0x00, 0xA0, 0xB1,
+                            0x1a, 0x2b, 0x3d, 0xff, 0xfe, 0x4e, 0xff, 0x00 };
+        INet6Address::from_data(rawBytes)
+        \endcode
+
+        Since INet6Address class is based on \c boost::array and is built as a fixed-size sequence
+        of 16 bytes, you can access the raw data bytes of the address (in network byte order) using
+        \c begin(), \c end() or \c operator[]
+        \code
+        INet6Address ina = ...;
+        Packet::iterator i = ...;
+        std::copy(ina.begin(), ina.end(), i); // Copies 16 bytes
+        \endcode
 
         \see CheckINet6Network \n INet6Network
         \ingroup addr_group
@@ -148,7 +172,7 @@ namespace senf {
                                              \attention This call may block if \a s represents a
                                                  hostname which must be looked up via some network
                                                  protocol like DNS or NIS
-                                             \throws SyntaxException if the address cannot be
+                                             \throws AddressSyntaxException if the address cannot be
                                                  converted for some reason
                                              \param[in] s Address literal or hostname 
                                              \param[in] resolve If this is set to \c ResolveINet4,
@@ -236,18 +260,6 @@ namespace senf {
 
         ///@}
 
-        /** \brief Base-class for INet6Address exceptions */
-        struct AddressException : public std::exception {};
-
-        /** \brief Invalid INet4 address syntax */
-        struct SyntaxException : public AddressException
-        { virtual char const * what() const throw() 
-                { return "invalid INet6 address syntax"; } };
-
-        /** \brief Resolver failure */
-        struct UnknownHostnameException : public AddressException
-        { virtual char const * what() const throw() 
-                { return "failed to resolve INet6 hostname"; } };
     };
 
     /** \brief Output INet6Address instance as it's string representation