Link local address. More...
#include <senf/Socket/Protocols/Raw/LLAddressing.hh>
Public Types | |
enum | PktType { Undefined = 0, Host = PACKET_HOST, Broadcast = PACKET_BROADCAST, Multicast = PACKET_MULTICAST, OtherHost = PACKET_OTHERHOST, Outgoing = PACKET_OUTGOING } |
Valid pkttype() values. More... | |
Public Member Functions | |
MACAddress | address () const |
Return address. More... | |
std::string | interface () const |
Return interface name. More... | |
unsigned | protocol () const |
Return address protocol (ethertype) More... | |
unsigned | arptype () const |
Return the arptype field (ARP hardware type) More... | |
PktType | pkttype () const |
Return type of packet. More... | |
void | address (MACAddress const &addr) |
Change address. More... | |
void | interface (std::string const &iface) |
Change interface. More... | |
void | protocol (unsigned prot) |
Change protocol. More... | |
Public Member Functions inherited from senf::BSDSocketAddress | |
bool | operator== (BSDSocketAddress const &other) const |
Compare two arbitrary addresses. More... | |
bool | operator< (BSDSocketAddress const &other) const |
Compare two arbitrary addresses. More... | |
bool | boolean_test () const |
Return true , if address is not empty. More... | |
short | family () const |
Return the address family. More... | |
struct sockaddr const * | sockaddr_p () const |
socklen_t | socklen () const |
socklen_t const * | socklen_p () const |
Public Member Functions inherited from senf::comparable_safe_bool< BSDSocketAddress > | |
operator bool_type () const | |
bool | operator! () const |
Static Public Attributes | |
static short const | addressFamily = AF_PACKET |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, LLSocketAddress const &llAddr) |
Write link layer address. More... | |
Related Functions inherited from senf::BSDSocketAddress | |
template<class Target > | |
Target & | sockaddr_cast (BSDSocketAddress &source) |
Safe socket address down-cast. More... | |
template<class Target > | |
Target const & | sockaddr_cast (BSDSocketAddress const &source) |
Safe socket address down-cast (const) More... | |
std::ostream & | operator<< (std::ostream &os, BSDSocketAddress const &addr) |
Output generic socket address. More... | |
Structors and default members | |
LLSocketAddress () | |
Create empty address. More... | |
LLSocketAddress (unsigned proto, std::string const &iface="") | |
Create address for bind() More... | |
LLSocketAddress (std::string const &iface) | |
Create address for bind() More... | |
LLSocketAddress (MACAddress const &addr, std::string const &iface="") | |
Create address valid to send raw packets. More... | |
LLSocketAddress (LLSocketAddress const &other) | |
LLSocketAddress & | operator= (LLSocketAddress const &other) |
Additional Inherited Members | |
Protected Types inherited from senf::safe_bool_base | |
typedef void(safe_bool_base::* | bool_type) () const |
Protected Member Functions inherited from senf::BSDSocketAddress | |
BSDSocketAddress (socklen_t len, short family) | |
BSDSocketAddress (BSDSocketAddress const &other) | |
BSDSocketAddress & | operator= (BSDSocketAddress const &other) |
struct sockaddr * | sockaddr_p () |
socklen_t * | socklen_p () |
void | socklen (socklen_t len) |
Protected Member Functions inherited from senf::comparable_safe_bool< BSDSocketAddress > | |
~comparable_safe_bool () | |
Protected Member Functions inherited from senf::safe_bool_base | |
void | this_type_does_not_support_comparisons () const |
safe_bool_base () | |
safe_bool_base (const safe_bool_base &) | |
safe_bool_base & | operator= (const safe_bool_base &) |
~safe_bool_base () | |
Link local address.
LLSocketAddress wraps the standard sockaddr_ll data type. An LLSocketAddress provides quite some information, only part of which is necessary for sending packets. The LLSocketAddress class only allows changing those fields which need to be changed. The other fields are read-only. They are filled by the operating system when receiving a packet
Definition at line 46 of file LLAddressing.hh.
Valid pkttype() values.
These are the possible values returned by pkttype()
Enumerator | |
---|---|
Undefined | |
Host | Packet destined for this host |
Broadcast | Packet sent to the broadcast address |
Multicast | Packet sent to a (link local) multicast address |
OtherHost | Packet sent to another host (promisc) |
Outgoing | Packet sent out from this host |
Definition at line 56 of file LLAddressing.hh.
senf::LLSocketAddress::LLSocketAddress | ( | ) |
Create empty address.
|
explicit |
Create address for bind()
This constructs an LLSocketAddress valid for calling PacketSocketHandle::bind() with.
[in] | proto | Protocol (Ethertype) to listen for |
[in] | iface | Interface name to bind to |
|
explicit |
Create address for bind()
This constructs an LLSocketAddress valid for calling PacketSocketHandle::bind()
with.
[in] | iface | Interface name to bind to |
UnknownInterfaceException | if iface is not a valid interface name. |
|
explicit |
Create address valid to send raw packets.
Addresses created with this constructor are valid for use with PacketSocketHandle::sendto()
on a SOCK_DGRAM
packet socket.
addr | Address to send data to |
iface | Interface to send packet from |
UnknownInterfaceException | if iface is not a valid interface name. |
senf::LLSocketAddress::LLSocketAddress | ( | LLSocketAddress const & | other | ) |
MACAddress senf::LLSocketAddress::address | ( | ) | const |
Return address.
void senf::LLSocketAddress::address | ( | MACAddress const & | addr | ) |
Change address.
unsigned senf::LLSocketAddress::arptype | ( | ) | const |
Return the arptype field (ARP hardware type)
std::string senf::LLSocketAddress::interface | ( | ) | const |
Return interface name.
Definition at line 34 of file LLAddressing.cc.
void senf::LLSocketAddress::interface | ( | std::string const & | iface | ) |
Change interface.
UnknownInterfaceException | if iface is not a valid interface name. |
Definition at line 46 of file LLAddressing.cc.
LLSocketAddress& senf::LLSocketAddress::operator= | ( | LLSocketAddress const & | other | ) |
PktType senf::LLSocketAddress::pkttype | ( | ) | const |
Return type of packet.
unsigned senf::LLSocketAddress::protocol | ( | ) | const |
Return address protocol (ethertype)
void senf::LLSocketAddress::protocol | ( | unsigned | prot | ) |
Change protocol.
|
related |
Write link layer address.
|
static |
Definition at line 50 of file LLAddressing.hh.