A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
inet6-socket-address.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2008 Louis Pasteur University
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18 */
19
20#ifndef INET6_SOCKET_ADDRESS_H
21#define INET6_SOCKET_ADDRESS_H
22
23#include "ipv6-address.h"
24
25#include "ns3/address.h"
26
27#include <stdint.h>
28
29namespace ns3
30{
31
32/**
33 * \ingroup address
34 * \class Inet6SocketAddress
35 * \brief An Inet6 address class.
36 */
38{
39 public:
40 /**
41 * \brief Constructor.
42 * \param ipv6 the IPv6 address
43 * \param port the port
44 */
45 Inet6SocketAddress(Ipv6Address ipv6, uint16_t port);
46
47 /**
48 * \brief Constructor (the port is set to zero).
49 * \param ipv6 the IPv6 address
50 */
52
53 /**
54 * \brief Constructor (the address is set to "any").
55 * \param port the port
56 */
57 Inet6SocketAddress(uint16_t port);
58
59 /**
60 * \brief Constructor.
61 * \param ipv6 string which represents an IPv6 address
62 * \param port the port
63 */
64 Inet6SocketAddress(const char* ipv6, uint16_t port);
65
66 /**
67 * \brief Constructor.
68 * \param ipv6 string which represents an IPv6 address
69 */
70 Inet6SocketAddress(const char* ipv6);
71
72 /**
73 * \brief Get the port.
74 * \return the port
75 */
76 uint16_t GetPort() const;
77
78 /**
79 * \brief Set the port
80 * \param port the port
81 */
82 void SetPort(uint16_t port);
83
84 /**
85 * \brief Get the IPv6 address.
86 * \return the IPv6 address
87 */
88 Ipv6Address GetIpv6() const;
89
90 /**
91 * \brief Set the IPv6 address.
92 * \param ipv6 the address
93 */
94 void SetIpv6(Ipv6Address ipv6);
95
96 /**
97 * \brief If the address match.
98 * \param addr the address to test
99 * \return true if the address match, false otherwise
100 */
101 static bool IsMatchingType(const Address& addr);
102
103 /**
104 * \brief Get an Address instance which represents this
105 * Inet6SocketAddress instance.
106 */
107 operator Address() const;
108
109 /**
110 * \brief Convert the address to a InetSocketAddress.
111 * \param addr the address to convert
112 * \return an Inet6SocketAddress instance corresponding to address
113 */
114 static Inet6SocketAddress ConvertFrom(const Address& addr);
115
116 /**
117 * \brief Convert to Address.
118 * \return Address instance
119 */
120 Address ConvertTo() const;
121
122 private:
123 /**
124 * \brief Get the type.
125 * \return the type of Inet6SocketAddress
126 */
127 static uint8_t GetType();
128
129 /**
130 * \brief The IPv6 address.
131 */
133
134 /**
135 * \brief The port.
136 */
137 uint16_t m_port;
138};
139
140} /* namespace ns3 */
141
142#endif /* INET6_SOCKET_ADDRESS_H */
a polymophic address class
Definition: address.h:101
An Inet6 address class.
static uint8_t GetType()
Get the type.
void SetPort(uint16_t port)
Set the port.
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
uint16_t GetPort() const
Get the port.
void SetIpv6(Ipv6Address ipv6)
Set the IPv6 address.
static bool IsMatchingType(const Address &addr)
If the address match.
Ipv6Address GetIpv6() const
Get the IPv6 address.
Address ConvertTo() const
Convert to Address.
Ipv6Address m_ipv6
The IPv6 address.
Describes an IPv6 address.
Definition: ipv6-address.h:49
uint16_t port
Definition: dsdv-manet.cc:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.