A Discrete-Event Network Simulator
API
inet-socket-address.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2005 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20
21#ifndef INET_SOCKET_ADDRESS_H
22#define INET_SOCKET_ADDRESS_H
23
24#include "ns3/address.h"
25#include "ipv4-address.h"
26#include <stdint.h>
27
28namespace ns3 {
29
30
41{
42public:
47 InetSocketAddress (Ipv4Address ipv4, uint16_t port);
59 InetSocketAddress (uint16_t port);
64 InetSocketAddress (const char *ipv4, uint16_t port);
70 InetSocketAddress (const char *ipv4);
74 uint16_t GetPort (void) const;
78 Ipv4Address GetIpv4 (void) const;
82 uint8_t GetTos (void) const;
83
87 void SetPort (uint16_t port);
95 void SetTos (uint8_t tos);
96
101 static bool IsMatchingType (const Address &address);
102
107 operator Address () const;
108
117private:
122 Address ConvertTo (void) const;
123
129 static uint8_t GetType (void);
131 uint16_t m_port;
132 uint8_t m_tos;
133};
134
135} // namespace ns3
136
137
138#endif /* INET_SOCKET_ADDRESS_H */
a polymophic address class
Definition: address.h:91
an Inet address class
void SetPort(uint16_t port)
uint8_t GetTos(void) const
uint16_t GetPort(void) const
void SetIpv4(Ipv4Address address)
Ipv4Address GetIpv4(void) const
static bool IsMatchingType(const Address &address)
InetSocketAddress(Ipv4Address ipv4, uint16_t port)
Ipv4Address m_ipv4
the IPv4 address
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
static uint8_t GetType(void)
Get the underlying address type (automatically assigned).
Address ConvertTo(void) const
Convert to an Address type.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
uint16_t port
Definition: dsdv-manet.cc:45
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.