A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
29namespace ns3
30{
31
42{
43 public:
48 InetSocketAddress(Ipv4Address ipv4, uint16_t port);
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;
80
84 void SetPort(uint16_t port);
88 void SetIpv4(Ipv4Address address);
89
94 static bool IsMatchingType(const Address& address);
95
100 operator Address() const;
101
109 static InetSocketAddress ConvertFrom(const Address& address);
110
115 Address ConvertTo() const;
116
117 private:
123 static uint8_t GetType();
125 uint16_t m_port;
126};
127
128} // namespace ns3
129
130#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)
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.