senf::BSDSocketProtocol Class Reference
[Protocol Facets]

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,
senf::UNDatagramSocketProtocol.

List of all members.


Detailed Description

Protocol facet providing basic BSD socket functionality.

BSDSocketProtocol provides the basic BSD socket API as shared by all BSD sockets.

Definition at line 45 of file BSDSocketProtocol.hh.


Public Member Functions

std::pair< bool, unsigned >  linger () const
  Return current linger status.
void  linger (bool enable, unsigned timeout=0) const
  Change linger status.
boost::uint8_t  priority () const
  Get packet priority assigned to outgoing packets.
void  priority (boost::uint8_t value) const
  Set packet priority (e.g. TOS).
int  error () const
  Get and clear pending socket error.
unsigned  rcvbuf () const
  Check receive buffer size.
void  rcvbuf (unsigned size) const
  Change receive buffer size.
unsigned  sndbuf () const
  Check send buffer size.
void  sndbuf (unsigned size) const
  Change size of send buffer.

Member Function Documentation

int senf::BSDSocketProtocol::
error ()

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 77 of file BSDSocketProtocol.cc.

void senf::BSDSocketProtocol::
linger ( bool  enable,
unsigned  timeout = 0 )

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.

Parameters:
[in]  enable  true to activate linger
[in]  timeout  linger timeout in seconds

Definition at line 49 of file BSDSocketProtocol.cc.

std::pair< bool, unsigned > senf::BSDSocketProtocol::
linger ()

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.

Returns:
linger state (enable disabled) and linger timeout

Definition at line 38 of file BSDSocketProtocol.cc.

void senf::BSDSocketProtocol::
priority ( boost::uint8_t  value )

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.

Parameters:
[in]  value  new socket priority

Definition at line 69 of file BSDSocketProtocol.cc.

boost::uint8_t senf::BSDSocketProtocol::
priority ()

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).

Returns:
current socket priority

Definition at line 59 of file BSDSocketProtocol.cc.

void senf::BSDSocketProtocol::
rcvbuf ( unsigned  size )

Change receive buffer size.

Parameters:
[in]  size  new receive buffer size

Definition at line 99 of file BSDSocketProtocol.cc.

unsigned senf::BSDSocketProtocol::
rcvbuf ()

Check receive buffer size.

Returns:
size of receive buffer in bytes

For internal use only.

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 87 of file BSDSocketProtocol.cc.

void senf::BSDSocketProtocol::
sndbuf ( unsigned  size )

Change size of send buffer.

Parameters:
[in]  size  new send buffer size

Definition at line 118 of file BSDSocketProtocol.cc.

unsigned senf::BSDSocketProtocol::
sndbuf ()

Check send buffer size.

Returns:
size of send buffer in bytes

For internal use only.

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 106 of file BSDSocketProtocol.cc.


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