Raw Packet-Socket access (Linux) More...
#include <senf/Socket/Protocols/Raw/PacketSocketHandle.hh>
Constructors | |
void | init_client (SocketType type=RawSocket, int protocol=-1) const |
Create packet socket. More... | |
Additional Inherited Members | |
Public Types inherited from senf::ConcreteSocketProtocol< Packet_Policy, PacketSocketProtocol > | |
typedef Packet_Policy | Policy |
The protocols policy. More... | |
Public Types inherited from senf::LinuxPacketSocketProtocol | |
enum | SocketType { RawSocket, DatagramSocket } |
Public Member Functions inherited from senf::ConcreteSocketProtocol< Packet_Policy, PacketSocketProtocol > | |
Policy const & | policy () const |
Access the policy instance. More... | |
~ConcreteSocketProtocol ()=0 | |
Public Member Functions inherited from senf::SocketProtocol | |
virtual void | close () |
Close socket. More... | |
virtual void | terminate () const |
Forcibly close socket. More... | |
virtual void | state (SocketStateMap &map, unsigned lod) const |
Return socket state information. More... | |
int | fd () const |
Get file descriptor. More... | |
SocketProtocol () | |
virtual | ~SocketProtocol ()=0 |
Public Member Functions inherited from senf::DatagramSocketProtocol | |
void | timestamp (struct timespec *spec) const |
Return packet timestamp of last packet. More... | |
ClockService::clock_type | timestamp () const |
Return packet timestamp of last packet. More... | |
Public Member Functions inherited from senf::BSDSocketProtocol | |
std::pair< bool, unsigned > | linger () const |
Return current linger status. More... | |
void | linger (bool enable, unsigned timeout=0) const |
Change linger status. More... | |
boost::uint8_t | priority () const |
Get packet priority assigned to outgoing packets. More... | |
void | priority (boost::uint8_t value) const |
Set packet priority (e.g. TOS) More... | |
int | error () const |
Get and clear pending socket error. More... | |
unsigned | rcvbuf () const |
Check receive buffer size. More... | |
void | rcvbuf (unsigned size) const |
Change receive buffer size. More... | |
unsigned | sndbuf () const |
Check send buffer size. More... | |
void | sndbuf (unsigned size) const |
Change size of send buffer. More... | |
template<unsigned short N> | |
void | attachSocketFilter (::sock_filter(&filter)[N]) |
void | detachSocketFilter () |
void | mtuDiscovery (int mode) const |
void | rcvLowat (unsigned lowWat) const |
void | sndLowat (unsigned lowWat) const |
Public Member Functions inherited from senf::LinuxPacketSocketProtocol | |
void | mcAdd (std::string const &interface, MACAddress const &address) const |
Enable reception of a multicast group. More... | |
void | mcDrop (std::string const &interface, MACAddress const &address) const |
Disable reception of a multicast group. More... | |
void | promisc (std::string const &interface, bool mode) const |
enable/disable promiscuous mode More... | |
unsigned | rxQueueDropped () const |
packets dropped by kernel since last call More... | |
unsigned | txWrongFormat () const |
packets dropped by kernel due to wrong format (too large) since last call More... | |
bool | eof () const |
Check for end-of-file condition. More... | |
Public Member Functions inherited from senf::ReadableLinuxPacketProtocol | |
unsigned | available () const |
Return (maximum) number of bytes available for reading without < blocking. More... | |
Protected Member Functions inherited from senf::ConcreteSocketProtocol< Packet_Policy, PacketSocketProtocol > | |
ClientSocketHandle< Policy > | clientHandle () const |
Get client handle for associated socket. More... | |
ServerSocketHandle< Policy > | serverHandle () const |
Get server handle for associated socket. More... | |
Protected Member Functions inherited from senf::SocketProtocol | |
FileHandle | fh () const |
Get a FileHandle for this instance. More... | |
void | fd (int) const |
Initialize file descriptor. More... | |
Protected Member Functions inherited from senf::LinuxPacketSocketProtocol | |
void | init_packetSocket (SocketType type, int protocol) const |
Raw Packet-Socket access (Linux)
The PacketSocketProtocol provides access to the linux packet socket API. This API gives access to the low level network packets. The packet socket allows read() and write() operations. The PacketSocketProtocol has no concept of a server socket.
This class is utilized as the protocol class of the ProtocolClientSocketHandle via the Socket Handle typedefs above.
Definition at line 69 of file PacketSocketHandle.hh.
void senf::PacketSocketProtocol::init_client | ( | SocketType | type = RawSocket , |
int | protocol = -1 |
||
) | const |
Create packet socket.
The new socket will receive all packets of the given IEEE 802.3 protocol. The socket will receive all packets, if protocol is -1.
If type is RawSocket
, the packet will include the link-level header (the Ethernet header). Sent packets must already include a well formed ll header.
If type is DatagramSocket
, the link level header will not be part of the packet data. The ll header will be removed from received packets and a correct ll header will be created on sent packets.
[in] | type | socket type |
[in] | protocol | IEEE 802.3 protocol number |
Definition at line 34 of file PacketSocketHandle.cc.