A Discrete-Event Network Simulator
API
inet-socket-address.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #ifndef INET_SOCKET_ADDRESS_H
21 #define INET_SOCKET_ADDRESS_H
22 
23 #include "ipv4-address.h"
24 
25 #include "ns3/address.h"
26 
27 #include <stdint.h>
28 
29 namespace ns3
30 {
31 
42 {
43  public:
60  InetSocketAddress(uint16_t port);
65  InetSocketAddress(const char* ipv4, uint16_t port);
71  InetSocketAddress(const char* ipv4);
75  uint16_t GetPort() const;
79  Ipv4Address GetIpv4() const;
83  uint8_t GetTos() const;
84 
88  void SetPort(uint16_t port);
96  void SetTos(uint8_t tos);
97 
102  static bool IsMatchingType(const Address& address);
103 
108  operator Address() const;
109 
118 
123  Address ConvertTo() const;
124 
125  private:
131  static uint8_t GetType();
133  uint16_t m_port;
134  uint8_t m_tos;
135 };
136 
137 } // namespace ns3
138 
139 #endif /* INET_SOCKET_ADDRESS_H */
a polymophic address class
Definition: address.h:101
an Inet address class
void SetPort(uint16_t port)
static uint8_t GetType()
Get the underlying address type (automatically assigned).
Address ConvertTo() const
Convert to an Address type.
void SetIpv4(Ipv4Address address)
static bool IsMatchingType(const Address &address)
InetSocketAddress(Ipv4Address ipv4, uint16_t port)
Ipv4Address m_ipv4
the IPv4 address
Ipv4Address GetIpv4() const
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
uint16_t port
Definition: dsdv-manet.cc:44
address
Definition: first.py:47
Every class exported by the ns3 library is enclosed in the ns3 namespace.