Crypto++
|
socket-based implementation of NetworkSource More...
#include <socketft.h>
Public Member Functions | |
SocketSource (socket_t s=INVALID_SOCKET, bool pumpAll=false, BufferedTransformation *attachment=NULL) | |
unsigned int | GetMaxWaitObjectCount () const |
void | GetWaitObjects (WaitObjectContainer &container, CallStack const &callStack) |
bool | SourceExhausted () const |
void | SetAutoSignalPropagation (int propagation) |
int | GetAutoSignalPropagation () const |
lword | GetMaxBytesPerSecond () const |
void | SetMaxBytesPerSecond (lword v) |
lword | ComputeCurrentTransceiveLimit () |
double | TimeToNextTransceive () |
void | NoteTransceive (lword size) |
bool | GetOwnership () const |
void | SetOwnership (bool own) |
operator socket_t () | |
socket_t | GetSocket () const |
void | AttachSocket (socket_t s, bool own=false) |
socket_t | DetachSocket () |
void | CloseSocket () |
void | Create (int nType=SOCK_STREAM) |
void | Bind (unsigned int port, const char *addr=NULL) |
void | Bind (const sockaddr *psa, socklen_t saLen) |
void | Listen (int backlog=5) |
bool | Connect (const char *addr, unsigned int port) |
bool | Connect (const sockaddr *psa, socklen_t saLen) |
bool | Accept (Socket &s, sockaddr *psa=NULL, socklen_t *psaLen=NULL) |
void | GetSockName (sockaddr *psa, socklen_t *psaLen) |
void | GetPeerName (sockaddr *psa, socklen_t *psaLen) |
unsigned int | Send (const byte *buf, size_t bufLen, int flags=0) |
unsigned int | Receive (byte *buf, size_t bufLen, int flags=0) |
void | ShutDown (int how=SD_SEND) |
void | IOCtl (long cmd, unsigned long *argp) |
bool | SendReady (const timeval *timeout) |
bool | ReceiveReady (const timeval *timeout) |
virtual void | HandleError (const char *operation) const |
void | CheckAndHandleError_int (const char *operation, int result) const |
void | CheckAndHandleError (const char *operation, socket_t result) const |
void | CheckAndHandleError (const char *operation, BOOL result) const |
void | CheckAndHandleError (const char *operation, bool result) const |
NONBLOCKING SOURCE | |
size_t | GeneralPump2 (lword &byteCount, bool blockingOutput=true, unsigned long maxTime=INFINITE_TIME, bool checkDelimiter=false, byte delimiter='\n') |
pump up to maxSize bytes using at most maxTime milliseconds | |
lword | GeneralPump (lword maxSize=LWORD_MAX, unsigned long maxTime=INFINITE_TIME, bool checkDelimiter=false, byte delimiter='\n') |
lword | TimedPump (unsigned long maxTime) |
lword | PumpLine (byte delimiter='\n', lword maxSize=1024) |
size_t | Pump2 (lword &byteCount, bool blocking=true) |
size_t | PumpMessages2 (unsigned int &messageCount, bool blocking=true) |
Static Public Member Functions | |
static unsigned int | PortNameToNumber (const char *name, const char *protocol="tcp") |
look up the port number given its name, returns 0 if not found | |
static void | StartSockets () |
start Windows Sockets 2 | |
static void | ShutdownSockets () |
calls WSACleanup for Windows Sockets | |
static int | GetLastError () |
returns errno or WSAGetLastError | |
static void | SetLastError (int errorCode) |
sets errno or calls WSASetLastError | |
Protected Member Functions | |
size_t | DoPump (lword &byteCount, bool blockingOutput, unsigned long maxTime, bool checkDelimiter, byte delimiter) |
const NetworkReceiver & | GetReceiver () const |
bool | BlockedBySpeedLimit () const |
virtual void | SocketChanged () |
Protected Attributes | |
socket_t | m_s |
bool | m_own |
socket-based implementation of NetworkSource
unsigned int NetworkSource::GetMaxWaitObjectCount | ( | ) | const [inherited] |
GetWaitObjects() must be called despite the 0 return from GetMaxWaitObjectCount(); the 0 is because the ScheduleEvent() method is used instead of adding a wait object
Reimplemented from LimitedBandwidth.
Definition at line 235 of file network.cpp.
References Waitable::GetMaxWaitObjectCount().
size_t NonblockingSource::GeneralPump2 | ( | lword & | byteCount, |
bool | blockingOutput = true , |
||
unsigned long | maxTime = INFINITE_TIME , |
||
bool | checkDelimiter = false , |
||
byte | delimiter = '\n' |
||
) | [inherited] |
pump up to maxSize bytes using at most maxTime milliseconds
If checkDelimiter is true, pump up to delimiter, which itself is not extracted or pumped.
Definition at line 76 of file network.cpp.
References INFINITE_TIME.