|
Pol
Revision:cb584c9
|
#include <wnsckt.h>
Public Types | |
| enum | option { none = 0, nonblocking = 1, reuseaddr = 2 } |
Public Member Functions | |
| Socket () | |
| Socket (SOCKET sock) | |
| Socket (Socket &sck) | |
| virtual | ~Socket () |
| bool | accept (SOCKET *s, unsigned int mstimeout) |
| bool | accept (Socket &newsocket) |
| void | close () |
| bool | connected () const |
| void | disable_nagle () |
| std::string | getpeername () const |
| SOCKET | handle () const |
| bool | is_local () const |
| bool | listen (unsigned short port) |
| bool | open (const char *ipaddr, unsigned short port) |
| unsigned | peek (void *vdest, unsigned len, unsigned int waitms) |
| struct sockaddr | peer_address () const |
| bool | recvbyte (unsigned char *byte, unsigned int waitms) |
| bool | recvdata (void *vdest, unsigned len, unsigned int waitms) |
| SOCKET | release_handle () |
| bool | select (unsigned int seconds, unsigned int useconds) |
| void | send (const void *data, unsigned length) |
| bool | send_nowait (const void *vdata, unsigned datalen, unsigned *nsent) |
| void | set_options (option opt) |
| void | setpeer (struct sockaddr peer) |
| void | setsocket (SOCKET sck) |
| void | takesocket (Socket &sck) |
| void | write (const std::string &str) |
Protected Member Functions | |
| void | apply_prebind_socket_options (SOCKET sck) |
| void | apply_socket_options (SOCKET sck) |
Private Member Functions | |
| void | HandleError () |
Private Attributes | |
| int | _options |
| struct sockaddr | _peer |
| SOCKET | _sck |
| Pol::Clib::Socket::Socket | ( | ) |
Definition at line 45 of file wnsckt.cpp.
References _peer, and Pol::Testing::dummy().
|
explicit |
Definition at line 59 of file wnsckt.cpp.
References _peer.
| Pol::Clib::Socket::Socket | ( | Socket & | sck | ) |
Definition at line 64 of file wnsckt.cpp.
References _peer, _sck, and INVALID_SOCKET.
|
virtual |
Definition at line 71 of file wnsckt.cpp.
References close().
| bool Pol::Clib::Socket::accept | ( | SOCKET * | s, |
| unsigned int | mstimeout | ||
| ) |
Definition at line 275 of file wnsckt.cpp.
References _sck, apply_socket_options(), and INVALID_SOCKET.
Referenced by Pol::Clib::SocketListener::accept(), and accept().
| bool Pol::Clib::Socket::accept | ( | Socket & | newsocket | ) |
Definition at line 290 of file wnsckt.cpp.
References _sck, accept(), apply_socket_options(), INVALID_SOCKET, setpeer(), and setsocket().
|
protected |
Definition at line 199 of file wnsckt.cpp.
References _options, Pol::Clib::decint(), INVALID_SOCKET, and reuseaddr.
Referenced by listen().
|
protected |
Definition at line 179 of file wnsckt.cpp.
References _options, Pol::Clib::decint(), and nonblocking.
| void Pol::Clib::Socket::close | ( | ) |
Definition at line 623 of file wnsckt.cpp.
References _sck, and INVALID_SOCKET.
Referenced by HandleError(), Pol::Core::http_readline(), listen(), Pol::Module::OSExecutorModule::mf_OpenConnection(), open(), peek(), Pol::Clib::readline(), recvbyte(), recvdata(), Pol::Network::AuxClientThread::run(), setsocket(), and ~Socket().
| bool Pol::Clib::Socket::connected | ( | ) | const |
Definition at line 308 of file wnsckt.cpp.
References _sck, and INVALID_SOCKET.
Referenced by Pol::Core::http_func(), Pol::Core::http_readline(), Pol::Module::HttpExecutorModule::mf_WriteHtml(), Pol::Module::HttpExecutorModule::mf_WriteHtmlRaw(), Pol::Clib::readline(), Pol::Clib::readstring(), recvbyte(), recvdata(), Pol::Network::AuxClientThread::run(), Pol::Core::send_binary(), and Pol::Network::AuxClientThread::transmit().
| void Pol::Clib::Socket::disable_nagle | ( | ) |
Definition at line 164 of file wnsckt.cpp.
References _sck, Pol::Clib::decint(), and INVALID_SOCKET.
Referenced by Pol::Core::UoClientThread::create().
| std::string Pol::Clib::Socket::getpeername | ( | ) | const |
Definition at line 92 of file wnsckt.cpp.
References _sck.
Referenced by Pol::Network::AuxClientThread::init(), is_local(), and Pol::Module::HttpExecutorModule::read_query_ip().
| SOCKET Pol::Clib::Socket::handle | ( | ) | const |
|
private |
Definition at line 314 of file wnsckt.cpp.
References close(), and INFO_PRINT.
Referenced by listen(), peek(), recvbyte(), recvdata(), send(), and send_nowait().
| bool Pol::Clib::Socket::is_local | ( | ) | const |
Definition at line 638 of file wnsckt.cpp.
References getpeername().
Referenced by Pol::Core::http_func().
| bool Pol::Clib::Socket::listen | ( | unsigned short | port | ) |
Definition at line 216 of file wnsckt.cpp.
References _sck, apply_prebind_socket_options(), apply_socket_options(), close(), HandleError(), and INVALID_SOCKET.
Referenced by Pol::Clib::SocketListener::SocketListener().
| bool Pol::Clib::Socket::open | ( | const char * | ipaddr, |
| unsigned short | port | ||
| ) |
Definition at line 125 of file wnsckt.cpp.
References _sck, close(), INFO_PRINT, and INVALID_SOCKET.
Referenced by Pol::Module::OSExecutorModule::mf_OpenConnection().
| unsigned Pol::Clib::Socket::peek | ( | void * | vdest, |
| unsigned | len, | ||
| unsigned int | waitms | ||
| ) |
Definition at line 493 of file wnsckt.cpp.
References _sck, close(), Pol::Clib::exit_signalled, HandleError(), INFO_PRINT, select(), SOCKET_ERRNO, and socket_errno.
| struct sockaddr Pol::Clib::Socket::peer_address | ( | ) | const |
Definition at line 107 of file wnsckt.cpp.
References _peer.
Referenced by Pol::Core::UoClientThread::create(), and Pol::Network::AuxClientThread::init().
| bool Pol::Clib::Socket::recvbyte | ( | unsigned char * | byte, |
| unsigned int | waitms | ||
| ) |
Definition at line 354 of file wnsckt.cpp.
References _sck, close(), connected(), Pol::Clib::exit_signalled, HandleError(), INFO_PRINT, select(), SOCKET_ERRNO, and socket_errno.
Referenced by Pol::Core::http_readline(), Pol::Clib::readline(), and Pol::Clib::readstring().
| bool Pol::Clib::Socket::recvdata | ( | void * | vdest, |
| unsigned | len, | ||
| unsigned int | waitms | ||
| ) |
Definition at line 417 of file wnsckt.cpp.
References _sck, close(), connected(), Pol::Clib::exit_signalled, HandleError(), INFO_PRINT, select(), SOCKET_ERRNO, and socket_errno.
| SOCKET Pol::Clib::Socket::release_handle | ( | ) |
Definition at line 117 of file wnsckt.cpp.
References _sck, and INVALID_SOCKET.
Referenced by Pol::Core::UoClientThread::create().
| bool Pol::Clib::Socket::select | ( | unsigned int | seconds, |
| unsigned int | useconds | ||
| ) |
Definition at line 250 of file wnsckt.cpp.
References _sck, Pol::Clib::exit_signalled, passert_r, SOCKET_ERRNO, and socket_errno.
Referenced by Pol::Clib::SocketListener::GetConnection(), peek(), recvbyte(), and recvdata().
| void Pol::Clib::Socket::send | ( | const void * | data, |
| unsigned | length | ||
| ) |
Definition at line 553 of file wnsckt.cpp.
References _sck, HandleError(), INFO_PRINT, SOCKET_ERRNO, and socket_errno.
Referenced by Pol::Core::http_writeline(), Pol::Core::send_binary(), send_nowait(), write(), and Pol::Clib::writeline().
| bool Pol::Clib::Socket::send_nowait | ( | const void * | vdata, |
| unsigned | datalen, | ||
| unsigned * | nsent | ||
| ) |
Definition at line 583 of file wnsckt.cpp.
References _sck, HandleError(), INFO_PRINT, send(), SOCKET_ERRNO, and socket_errno.
Referenced by Pol::Module::HttpExecutorModule::mf_WriteHtml(), and Pol::Module::HttpExecutorModule::mf_WriteHtmlRaw().
| void Pol::Clib::Socket::set_options | ( | option | opt | ) |
Definition at line 82 of file wnsckt.cpp.
References _options.
Referenced by Pol::Clib::SocketListener::SocketListener().
| void Pol::Clib::Socket::setpeer | ( | struct sockaddr | peer | ) |
| void Pol::Clib::Socket::setsocket | ( | SOCKET | sck | ) |
| void Pol::Clib::Socket::takesocket | ( | Socket & | sck | ) |
| void Pol::Clib::Socket::write | ( | const std::string & | str | ) |
Definition at line 617 of file wnsckt.cpp.
References send().
|
private |
Definition at line 75 of file wnsckt.h.
Referenced by apply_prebind_socket_options(), apply_socket_options(), and set_options().
|
private |
Definition at line 76 of file wnsckt.h.
Referenced by peer_address(), setpeer(), and Socket().
|
private |
Definition at line 73 of file wnsckt.h.
Referenced by accept(), close(), connected(), disable_nagle(), getpeername(), handle(), listen(), open(), peek(), recvbyte(), recvdata(), release_handle(), select(), send(), send_nowait(), setsocket(), and Socket().