#include <senf/Socket/Protocols/Raw/LinuxPacketSocketProtocol.hh>
Public Member Functions | |
unsigned | available () const |
Return (maximum) number of bytes available for reading without < blocking. More... | |
Public Member Functions inherited from senf::SocketProtocol | |
virtual SocketPolicyBase const & | policy () const =0 |
Access the policy instance. 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... | |
Definition at line 67 of file LinuxPacketSocketProtocol.hh.
|
virtual |
Return (maximum) number of bytes available for reading without < blocking.
This member will check in a (very, sigh) protocol dependent way, how many bytes may be read from a socket in a single (non-blocking) read operation. If the socket does not support reading (viz. NotReadablePolicy is set), this member should always return 0
.
Depending on the protocol, it may not be possible to return a good value. In this case, an upper bound may be returned (e.g.: When reading from a socket which returns ethernet frames, returning 1500 from available() is ok). However, this should only be done as a last resort. Also beware, that this number should not be too large since the socket layer will always need to allocate that number of bytes for the data to be read.
Implements senf::SocketProtocol.
Definition at line 126 of file LinuxPacketSocketProtocol.cc.