A Discrete-Event Network Simulator
API
packet-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) 2007 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 #ifndef PACKET_SOCKET_ADDRESS_H
21 #define PACKET_SOCKET_ADDRESS_H
22 
23 #include "ns3/ptr.h"
24 #include "ns3/address.h"
25 #include "mac48-address.h"
26 #include "mac64-address.h"
27 #include "ns3/net-device.h"
28 
29 namespace ns3 {
30 
31 class NetDevice;
32 
39 {
40 public:
42 
47  void SetProtocol (uint16_t protocol);
48 
52  void SetAllDevices (void);
53 
58  void SetSingleDevice (uint32_t device);
59 
64  void SetPhysicalAddress (const Address address);
65 
70  uint16_t GetProtocol (void) const;
71 
76  uint32_t GetSingleDevice (void) const;
77 
82  bool IsSingleDevice (void) const;
83 
88  Address GetPhysicalAddress (void) const;
89 
95  operator Address () const;
96 
104 
109  static bool IsMatchingType (const Address &address);
110 private:
111 
116  static uint8_t GetType (void);
117 
122  Address ConvertTo (void) const;
123 
124  uint16_t m_protocol;
126  uint32_t m_device;
128 };
129 
130 
131 } // namespace ns3
132 
133 #endif /* PACKET_SOCKET_ADDRESS_H */
Address ConvertTo(void) const
Convert an instance of this class to a polymorphic Address instance.
an address for a packet socket
static bool IsMatchingType(const Address &address)
void SetAllDevices(void)
Set the address to match all the outgoing NetDevice.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
a polymophic address class
Definition: address.h:90
bool IsSingleDevice(void) const
Checks if the address is bound to a specified NetDevice.
uint16_t GetProtocol(void) const
Get the protocol.
uint32_t m_device
Outgoing NetDevice index.
static uint8_t GetType(void)
Return the Type of address.
uint32_t GetSingleDevice(void) const
Get the device this address is bound to.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
address
Definition: first.py:37
Address m_address
Destination address.
void SetProtocol(uint16_t protocol)
Set the protocol.
static PacketSocketAddress ConvertFrom(const Address &address)
Address GetPhysicalAddress(void) const
Get the destination address.
bool m_isSingleDevice
True if directed to a specific outgoing NetDevice.