A Discrete-Event Network Simulator
API
packet-socket-address.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 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 #ifndef PACKET_SOCKET_ADDRESS_H
20 #define PACKET_SOCKET_ADDRESS_H
21 
22 #include "mac48-address.h"
23 #include "mac64-address.h"
24 
25 #include "ns3/address.h"
26 #include "ns3/net-device.h"
27 #include "ns3/ptr.h"
28 
29 namespace ns3
30 {
31 
32 class NetDevice;
33 
40 {
41  public:
43 
48  void SetProtocol(uint16_t protocol);
49 
53  void SetAllDevices();
54 
59  void SetSingleDevice(uint32_t device);
60 
66 
71  uint16_t GetProtocol() const;
72 
77  uint32_t GetSingleDevice() const;
78 
83  bool IsSingleDevice() const;
84 
90 
96  operator Address() const;
97 
105 
110  Address ConvertTo() const;
111 
116  static bool IsMatchingType(const Address& address);
117 
118  private:
123  static uint8_t GetType();
124 
125  uint16_t m_protocol;
127  uint32_t m_device;
129 };
130 
131 } // namespace ns3
132 
133 #endif /* PACKET_SOCKET_ADDRESS_H */
a polymophic address class
Definition: address.h:101
an address for a packet socket
Address ConvertTo() const
Convert an instance of this class to a polymorphic Address instance.
uint32_t GetSingleDevice() const
Get the device this address is bound to.
bool IsSingleDevice() const
Checks if the address is bound to a specified NetDevice.
Address GetPhysicalAddress() const
Get the destination address.
Address m_address
Destination address.
uint32_t m_device
Outgoing NetDevice index.
void SetProtocol(uint16_t protocol)
Set the protocol.
static bool IsMatchingType(const Address &address)
void SetPhysicalAddress(const Address address)
Set the destination address.
bool m_isSingleDevice
True if directed to a specific outgoing NetDevice.
static PacketSocketAddress ConvertFrom(const Address &address)
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
static uint8_t GetType()
Return the Type of address.
void SetAllDevices()
Set the address to match all the outgoing NetDevice.
uint16_t GetProtocol() const
Get the protocol.
address
Definition: first.py:47
Every class exported by the ns3 library is enclosed in the ns3 namespace.