A Discrete-Event Network Simulator
API
ns3::PacketSocketAddress Class Reference

an address for a packet socket More...

#include "packet-socket-address.h"

+ Collaboration diagram for ns3::PacketSocketAddress:

Public Member Functions

 PacketSocketAddress ()
 
Address GetPhysicalAddress (void) const
 Get the destination address. More...
 
uint16_t GetProtocol (void) const
 Get the protocol. More...
 
uint32_t GetSingleDevice (void) const
 Get the device this address is bound to. More...
 
bool IsSingleDevice (void) const
 Checks if the address is bound to a specified NetDevice. More...
 
 operator Address () const
 
void SetAllDevices (void)
 Set the address to match all the outgoing NetDevice. More...
 
void SetPhysicalAddress (const Address address)
 Set the destination address. More...
 
void SetProtocol (uint16_t protocol)
 Set the protocol. More...
 
void SetSingleDevice (uint32_t device)
 Set the address to match only a specified NetDevice. More...
 

Static Public Member Functions

static PacketSocketAddress ConvertFrom (const Address &address)
 
static bool IsMatchingType (const Address &address)
 

Private Member Functions

Address ConvertTo (void) const
 Convert an instance of this class to a polymorphic Address instance. More...
 

Static Private Member Functions

static uint8_t GetType (void)
 Return the Type of address. More...
 

Private Attributes

Address m_address
 Destination address. More...
 
uint32_t m_device
 Outgoing NetDevice index. More...
 
bool m_isSingleDevice
 True if directed to a specific outgoing NetDevice. More...
 
uint16_t m_protocol
 Protocol. More...
 

Detailed Description

an address for a packet socket

Definition at line 38 of file packet-socket-address.h.

Constructor & Destructor Documentation

◆ PacketSocketAddress()

ns3::PacketSocketAddress::PacketSocketAddress ( )

Definition at line 28 of file packet-socket-address.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ ConvertFrom()

PacketSocketAddress ns3::PacketSocketAddress::ConvertFrom ( const Address address)
static
Parameters
addressa polymorphic address
Returns
an Address Convert a polymorphic address to an Mac48Address instance. The conversion performs a type check.

Definition at line 106 of file packet-socket-address.cc.

References first::address, ns3::Address::CopyAllFrom(), IsMatchingType(), ns3::Address::MAX_SIZE, NS_ASSERT, NS_LOG_FUNCTION, SetAllDevices(), SetPhysicalAddress(), SetProtocol(), and SetSingleDevice().

Referenced by ns3::PacketSocket::Bind(), ns3::PacketSocket::GetTxAvailable(), ns3::PacketSocketServer::HandleRead(), ns3::PacketSocketClient::Send(), and ns3::PacketSocket::SendTo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ConvertTo()

Address ns3::PacketSocketAddress::ConvertTo ( void  ) const
private

Convert an instance of this class to a polymorphic Address instance.

Returns
a new Address instance

Definition at line 90 of file packet-socket-address.cc.

References first::address, ns3::Address::CopyAllTo(), GetType(), m_address, m_device, m_isSingleDevice, m_protocol, ns3::Address::MAX_SIZE, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetPhysicalAddress()

Address ns3::PacketSocketAddress::GetPhysicalAddress ( void  ) const

Get the destination address.

Returns
The destination address

Definition at line 78 of file packet-socket-address.cc.

References m_address, and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::SendTo().

+ Here is the caller graph for this function:

◆ GetProtocol()

uint16_t ns3::PacketSocketAddress::GetProtocol ( void  ) const

Get the protocol.

Returns
the protocol

Definition at line 60 of file packet-socket-address.cc.

References m_protocol, and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::SendTo().

+ Here is the caller graph for this function:

◆ GetSingleDevice()

uint32_t ns3::PacketSocketAddress::GetSingleDevice ( void  ) const

Get the device this address is bound to.

Returns
the device index

Definition at line 72 of file packet-socket-address.cc.

References m_device, and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::GetMinMtu(), and ns3::PacketSocket::SendTo().

+ Here is the caller graph for this function:

◆ GetType()

uint8_t ns3::PacketSocketAddress::GetType ( void  )
staticprivate

Return the Type of address.

Returns
type of address

Definition at line 144 of file packet-socket-address.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().

Referenced by ConvertTo(), and IsMatchingType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMatchingType()

bool ns3::PacketSocketAddress::IsMatchingType ( const Address address)
static
Parameters
addressaddress to test
Returns
true if the address matches, false otherwise.

Definition at line 138 of file packet-socket-address.cc.

References first::address, GetType(), and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::Bind(), ns3::PacketSocket::Connect(), ConvertFrom(), ns3::PacketSocketServer::HandleRead(), ns3::PacketSocket::SendTo(), and ns3::OnOffApplication::StartApplication().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsSingleDevice()

bool ns3::PacketSocketAddress::IsSingleDevice ( void  ) const

Checks if the address is bound to a specified NetDevice.

Returns
true if the address is bound to a NetDevice

Definition at line 66 of file packet-socket-address.cc.

References m_isSingleDevice, and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::GetMinMtu(), and ns3::PacketSocket::SendTo().

+ Here is the caller graph for this function:

◆ operator Address()

ns3::PacketSocketAddress::operator Address ( ) const
Returns
a new Address instance

Convert an instance of this class to a polymorphic Address instance.

Definition at line 84 of file packet-socket-address.cc.

◆ SetAllDevices()

void ns3::PacketSocketAddress::SetAllDevices ( void  )

Set the address to match all the outgoing NetDevice.

Definition at line 39 of file packet-socket-address.cc.

References m_device, m_isSingleDevice, and NS_LOG_FUNCTION.

Referenced by ConvertFrom(), and ns3::PacketSocket::GetSockName().

+ Here is the caller graph for this function:

◆ SetPhysicalAddress()

void ns3::PacketSocketAddress::SetPhysicalAddress ( const Address  address)

◆ SetProtocol()

◆ SetSingleDevice()

Member Data Documentation

◆ m_address

Address ns3::PacketSocketAddress::m_address
private

Destination address.

Definition at line 127 of file packet-socket-address.h.

Referenced by ConvertTo(), GetPhysicalAddress(), and SetPhysicalAddress().

◆ m_device

uint32_t ns3::PacketSocketAddress::m_device
private

Outgoing NetDevice index.

Definition at line 126 of file packet-socket-address.h.

Referenced by ConvertTo(), GetSingleDevice(), SetAllDevices(), and SetSingleDevice().

◆ m_isSingleDevice

bool ns3::PacketSocketAddress::m_isSingleDevice
private

True if directed to a specific outgoing NetDevice.

Definition at line 125 of file packet-socket-address.h.

Referenced by ConvertTo(), IsSingleDevice(), SetAllDevices(), and SetSingleDevice().

◆ m_protocol

uint16_t ns3::PacketSocketAddress::m_protocol
private

Protocol.

Definition at line 124 of file packet-socket-address.h.

Referenced by ConvertTo(), GetProtocol(), and SetProtocol().


The documentation for this class was generated from the following files: