#include <senf/Socket/Protocols/Raw/LLAddressing.hh>
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 55 of file 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. |
|
std::string | interface () const |
Return interface name. |
|
unsigned | protocol () const |
Return address protocol (ethertype). |
|
unsigned | arptype () const |
Return the arptype field (ARP hardware type). |
|
PktType | pkttype () const |
Return type of packet. |
|
void | address (MACAddress const &addr) |
Change address. |
|
void | interface (std::string const &iface) |
Change interface. |
|
void | protocol (unsigned prot) |
Change protocol. |
|
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. |
|
Structors and default members |
|
LLSocketAddress () | |
Create empty address. |
|
LLSocketAddress (unsigned proto, std::string const &iface="") | |
Create address for bind() . |
|
LLSocketAddress (std::string const &iface) | |
Create address for bind() . |
|
LLSocketAddress (MACAddress const &addr, std::string const &iface="") | |
Create address valid to send raw packets. |
|
LLSocketAddress (LLSocketAddress const &other) | |
LLSocketAddress & | operator= (LLSocketAddress const &other) |
enum senf::LLSocketAddress:: | ||||
PktType | ||||
Valid pkttype() values.
These are the possible values returned by pkttype()
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 65 of file LLAddressing.hh.
senf::LLSocketAddress:: | ||||
LLSocketAddress | () | |||
Create empty address.
Definition at line 34 of file LLAddressing.cci.
senf::LLSocketAddress:: | ||||
LLSocketAddress | ( | unsigned | proto, | |
std::string const & |
iface = ""
|
) | ||
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 |
Definition at line 38 of file LLAddressing.cci.
senf::LLSocketAddress:: | ||||
LLSocketAddress | ( | std::string const & | iface | ) |
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. |
Definition at line 45 of file LLAddressing.cci.
senf::LLSocketAddress:: | ||||
LLSocketAddress | ( | MACAddress const & | addr, | |
std::string const & |
iface = ""
|
) | ||
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. |
Definition at line 51 of file LLAddressing.cci.
senf::LLSocketAddress:: | ||||
LLSocketAddress | ( | LLSocketAddress const & | other | ) |
Definition at line 59 of file LLAddressing.cci.
void senf::LLSocketAddress:: | ||||
address | ( | MACAddress const & | addr | ) |
Change address.
Definition at line 98 of file LLAddressing.cci.
senf::MACAddress senf::LLSocketAddress:: | ||||
address | () | |||
Return address.
Definition at line 92 of file LLAddressing.cci.
unsigned senf::LLSocketAddress:: | ||||
arptype | () | |||
Return the arptype field (ARP hardware type).
Definition at line 80 of file LLAddressing.cci.
void senf::LLSocketAddress:: | ||||
interface | ( | std::string const & | iface | ) |
Change interface.
UnknownInterfaceException | if iface is not a valid interface name. |
Definition at line 55 of file LLAddressing.cc.
std::string senf::LLSocketAddress:: | ||||
interface | () | |||
Return interface name.
Definition at line 43 of file LLAddressing.cc.
senf::LLSocketAddress & senf::LLSocketAddress:: | ||||
operator= | ( | LLSocketAddress const & | other | ) |
Definition at line 63 of file LLAddressing.cci.
senf::LLSocketAddress::PktType senf::LLSocketAddress:: | ||||
pkttype | () | |||
Return type of packet.
Definition at line 86 of file LLAddressing.cci.
void senf::LLSocketAddress:: | ||||
protocol | ( | unsigned | prot | ) |
Change protocol.
Definition at line 75 of file LLAddressing.cci.
unsigned senf::LLSocketAddress:: | ||||
protocol | () | |||
Return address protocol (ethertype).
Definition at line 69 of file LLAddressing.cci.
std::ostream & | ||||
operator<< | ( | std::ostream & | os, | |
LLSocketAddress const & | llAddr | ) | ||
Write link layer address.
short const senf::LLSocketAddress::addressFamily = AF_PACKET | ||||
[static] | ||||
Definition at line 59 of file LLAddressing.hh.