src/node/inet6-socket-address.h
changeset 3852 9cf7ad0cac85
child 4761 8c0b3a413f4b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/node/inet6-socket-address.h	Fri Nov 07 11:36:15 2008 -0800
     1.3 @@ -0,0 +1,140 @@
     1.4 +/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
     1.5 +/*
     1.6 + * Copyright (c) 2007-2008 Louis Pasteur University
     1.7 + *
     1.8 + * This program is free software; you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License version 2 as
    1.10 + * published by the Free Software Foundation;
    1.11 + *
    1.12 + * This program is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 + * GNU General Public License for more details.
    1.16 + *
    1.17 + * You should have received a copy of the GNU General Public License
    1.18 + * along with this program; if not, write to the Free Software
    1.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.20 + *
    1.21 + * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
    1.22 + */
    1.23 +
    1.24 +#ifndef INET6_SOCKET_ADDRESS_H 
    1.25 +#define INET6_SOCKET_ADDRESS_H
    1.26 +
    1.27 +#include "address.h"
    1.28 +#include "ipv6-address.h"
    1.29 +#include <stdint.h>
    1.30 +
    1.31 +namespace ns3 {
    1.32 +
    1.33 +/**
    1.34 + * \class Inet6SocketAddress
    1.35 + * \brief An Inet6 address class.
    1.36 + */
    1.37 +class Inet6SocketAddress
    1.38 +{
    1.39 +  public:
    1.40 +    /**
    1.41 +     * \brief Constructor.
    1.42 +     * \param ipv6 the IPv6 address
    1.43 +     * \param port the port
    1.44 +     */
    1.45 +    Inet6SocketAddress (Ipv6Address ipv6, uint16_t port);
    1.46 +
    1.47 +    /**
    1.48 +     * \brief Constructor (the port is set to zero).
    1.49 +     * \param ipv6 the IPv6 address
    1.50 +     */
    1.51 +    Inet6SocketAddress (Ipv6Address ipv6);
    1.52 +
    1.53 +    /**
    1.54 +     * \brief Constructor (the address is set to "any").
    1.55 +     * \param port the port
    1.56 +     */
    1.57 +    Inet6SocketAddress (uint16_t port);
    1.58 +
    1.59 +    /**
    1.60 +     * \brief Constructor.
    1.61 +     * \param ipv6 string which represents an IPv6 address
    1.62 +     * \param port the port
    1.63 +     */
    1.64 +    Inet6SocketAddress (const char* ipv6, uint16_t port);
    1.65 +
    1.66 +    /**
    1.67 +     * \brief Constructor.
    1.68 +     * \param ipv6 string which represents an IPv6 address
    1.69 +     */
    1.70 +    Inet6SocketAddress (const char* ipv6);
    1.71 +
    1.72 +    /**
    1.73 +     * \brief Get the port.
    1.74 +     * \return the port
    1.75 +     */
    1.76 +    uint16_t GetPort (void) const;
    1.77 +
    1.78 +    /**
    1.79 +     * \brief Set the port
    1.80 +     * \param port the port
    1.81 +     */
    1.82 +    void SetPort (uint16_t port);
    1.83 +
    1.84 +    /**
    1.85 +     * \brief Get the IPv6 address.
    1.86 +     * \return the IPv6 address
    1.87 +     */
    1.88 +    Ipv6Address GetIpv6 (void) const;
    1.89 +
    1.90 +    /**
    1.91 +     * \brief Set the IPv6 address.
    1.92 +     * \param ipv6 the address
    1.93 +     */
    1.94 +    void SetIpv6 (Ipv6Address ipv6);
    1.95 +
    1.96 +    /**
    1.97 +     * \brief If the address match.
    1.98 +     * \param addr the address to test
    1.99 +     * \return true if the address match, false otherwise
   1.100 +     */
   1.101 +    static bool IsMatchingType (const Address &addr);
   1.102 +
   1.103 +    /**
   1.104 +     * \brief Get an Address instance which represents this
   1.105 +     * Inet6SocketAddress instance.
   1.106 +     */
   1.107 +    operator Address (void) const;
   1.108 +
   1.109 +    /**
   1.110 +     * \brief Convert the address to a InetSocketAddress.
   1.111 +     * \param addr the address to convert
   1.112 +     * \return an Inet6SocketAddress instance corresponding to address
   1.113 +     */
   1.114 +    static Inet6SocketAddress ConvertFrom (const Address &addr);
   1.115 +
   1.116 +  private:
   1.117 +    /**
   1.118 +     * \brief Convert to Address.
   1.119 +     * \return Address instance
   1.120 +     */
   1.121 +    Address ConvertTo (void) const;
   1.122 +
   1.123 +    /**
   1.124 +     * \brief Get the type.
   1.125 +     * \return the type of Inet6SocketAddress
   1.126 +     */
   1.127 +    static uint8_t GetType (void);
   1.128 +
   1.129 +    /**
   1.130 +     * \brief The IPv6 address.
   1.131 +     */
   1.132 +    Ipv6Address m_ipv6;
   1.133 +
   1.134 +    /**
   1.135 +     * \brief The port.
   1.136 +     */
   1.137 +    uint16_t m_port;
   1.138 +};
   1.139 +
   1.140 +} /* namespace ns3 */
   1.141 +
   1.142 +#endif /* INET6_SOCKET_ADDRESS_H */
   1.143 +