Protocol facet providing basic BSD socket functionality. More...
#include <senf/Socket/Protocols/BSDSocketProtocol.hh>
Inherits senf::SocketProtocol.
Inherited by senf::ConnectedRawV4SocketProtocol, senf::ConnectedRawV6SocketProtocol, senf::ConnectedUDPv4SocketProtocol, senf::ConnectedUDPv6SocketProtocol, senf::ConnectedUNDatagramSocketProtocol, senf::PacketSocketProtocol, senf::RawV4SocketProtocol, senf::RawV6SocketProtocol, senf::TapSocketProtocol, senf::TCPv4SocketProtocol, senf::TCPv6SocketProtocol, senf::UDPv4SocketProtocol, senf::UDPv6SocketProtocol, and senf::UNDatagramSocketProtocol.
Public Member Functions | |
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::SocketProtocol | |
virtual SocketPolicyBase const & | policy () const =0 |
Access the policy instance. More... | |
virtual unsigned | available () const =0 |
Return (maximum) number of bytes available for reading without < blocking. More... | |
virtual bool | eof () const =0 |
Check for end-of-file condition. More... | |
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 |
Additional Inherited Members | |
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... | |
Protocol facet providing basic BSD socket functionality.
BSDSocketProtocol provides the basic BSD socket API as shared by all BSD sockets.
Definition at line 37 of file BSDSocketProtocol.hh.
void senf::BSDSocketProtocol::attachSocketFilter | ( | ::sock_filter(&) | filter[N] | ) |
void senf::BSDSocketProtocol::detachSocketFilter | ( | ) |
Definition at line 120 of file BSDSocketProtocol.cc.
int senf::BSDSocketProtocol::error | ( | ) | const |
Get and clear pending socket error.
This call will get and clear a pending socket error. This includes asynchronous errors received via the network (e.g. via ICMP).
Definition at line 72 of file BSDSocketProtocol.cc.
std::pair< bool, unsigned > senf::BSDSocketProtocol::linger | ( | ) | const |
Return current linger status.
The value is returned in an std:pair. the first element is true
, if linger is active. The second value is the linger timeout in seconds.
Definition at line 33 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::linger | ( | bool | enable, |
unsigned | timeout = 0 |
||
) | const |
Change linger status.
If linger is enabled, the timeout value specifies, how long to wait before returning while data is unsent in seconds. If this value is 0, a close() might wait forever.
[in] | enable | true to activate linger |
[in] | timeout | linger timeout in seconds |
Definition at line 44 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::mtuDiscovery | ( | int | mode | ) | const |
Definition at line 136 of file BSDSocketProtocol.cc.
boost::uint8_t senf::BSDSocketProtocol::priority | ( | ) | const |
Get packet priority assigned to outgoing packets.
This call will return the priority value assigned to packets sent via this socket. Depending on the protocol, this value may also be placed inside the packet headers (for IPv4, this is the TOS value).
Definition at line 54 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::priority | ( | boost::uint8_t | value | ) | const |
Set packet priority (e.g. TOS)
Changes the packet queueing priority. Additionally may set protocol specific options. For IPv4 sockets, it sets the TOS field.
[in] | value | new socket priority |
Definition at line 64 of file BSDSocketProtocol.cc.
unsigned senf::BSDSocketProtocol::rcvbuf | ( | ) | const |
Check receive buffer size.
Linux doubles the buffer size internally when changing it to cater for additional space needed by the linux kernel. This call will therefore return only half the value reported by the kernel.
Definition at line 82 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::rcvbuf | ( | unsigned | size | ) | const |
Change receive buffer size.
[in] | size | new receive buffer size |
Definition at line 94 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::rcvLowat | ( | unsigned | lowWat | ) | const |
Definition at line 150 of file BSDSocketProtocol.cc.
unsigned senf::BSDSocketProtocol::sndbuf | ( | ) | const |
Check send buffer size.
Linux doubles the buffer size internally when changing it to cater for additional space needed by the linux kernel. This call will therefore return only half the value reported by the kernel.
Definition at line 101 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::sndbuf | ( | unsigned | size | ) | const |
Change size of send buffer.
[in] | size | new send buffer size |
Definition at line 113 of file BSDSocketProtocol.cc.
void senf::BSDSocketProtocol::sndLowat | ( | unsigned | lowWat | ) | const |
Definition at line 143 of file BSDSocketProtocol.cc.