#include <lliosocket.h>
| Public Types | |
| typedef boost::shared_ptr< LLSocket > | ptr_t | 
| Reference counted shared pointers to sockets. | |
| STREAM_TCP | |
| DATAGRAM_UDP | |
| PORT_INVALID = (U16)-1 | |
| PORT_EPHEMERAL = 0 | |
| enum | EType { STREAM_TCP, DATAGRAM_UDP } | 
| Type of socket to create.  More... | |
| enum | { PORT_INVALID = (U16)-1, PORT_EPHEMERAL = 0 } | 
| Anonymous enumeration to help identify ports.  More... | |
| Public Member Functions | |
| bool | blockingConnect (const LLHost &host) | 
| Perform a blocking connect to a host. Do not use in production. | |
| U16 | getPort () const | 
| Get the type of socket Get the port. | |
| apr_socket_t * | getSocket () const | 
| Get the apr socket implementation. | |
| ~LLSocket () | |
| Do not call this directly. | |
| Static Public Member Functions | |
| static ptr_t | create (apr_pool_t *pool, EType type, U16 port=PORT_EPHEMERAL) | 
| Create a socket. | |
| static ptr_t | create (apr_socket_t *socket, apr_pool_t *pool) | 
| Create a LLSocket when you already have an apr socket. | |
| Protected Member Functions | |
| LLSocket (apr_socket_t *socket, apr_pool_t *pool) | |
| Protected constructor since should only make sockets with one of the two create()calls. | |
| void | setOptions () | 
| Set default socket options. | |
| Protected Attributes | |
| apr_socket_t * | mSocket | 
| apr_pool_t * | mPool | 
| U16 | mPort | 
An instance of this class represents a single socket over it's entire life - from uninitialized, to connected, to a listening socket depending on it's purpose. This class simplifies our access into the socket interface by only providing stream/tcp and datagram/udp sockets - the only types we are interested in, since those are the only properly supported by all of our platforms.
Definition at line 63 of file lliosocket.h.
| typedef boost::shared_ptr<LLSocket> LLSocket::ptr_t | 
| anonymous enum | 
| enum LLSocket::EType | 
| LLSocket::LLSocket | ( | apr_socket_t * | socket, | |
| apr_pool_t * | pool | |||
| ) |  [protected] | 
Protected constructor since should only make sockets with one of the two create() calls. 
Definition at line 207 of file lliosocket.cpp.
References LLMemType::MTYPE_IO_TCP.
Referenced by create().
| LLSocket::~LLSocket | ( | ) | 
Do not call this directly.
Definition at line 215 of file lliosocket.cpp.
References mPool, mSocket, and LLMemType::MTYPE_IO_TCP.
| bool LLSocket::blockingConnect | ( | const LLHost & | host | ) | 
Perform a blocking connect to a host. Do not use in production.
| host | The host to connect this socket to. | 
Definition at line 185 of file lliosocket.cpp.
References LLHost::getIPString(), LLHost::getPort(), ll_apr_warn_status(), MAXADDRSTR, mPool, mSocket, NULL, and setOptions().
| LLSocket::ptr_t LLSocket::create | ( | apr_socket_t * | socket, | |
| apr_pool_t * | pool | |||
| ) |  [static] | 
Create a LLSocket when you already have an apr socket.
This method assumes an ephemeral port. This is typically used by calls which spawn a socket such as a call to accept() as in the server socket. This call should not fail if you have a valid apr socket. Because of the nature of how accept() works, you are expected to create a new pool for the socket, use that pool for the accept, and pass it in here where it will be bound with the socket and destroyed at the same time. 
| socket | The apr socket to use | |
| pool | The pool used to create the socket. *NOTE: The pool passed in will be DESTROYED. | 
Definition at line 170 of file lliosocket.cpp.
References LLSocket(), LLMemType::MTYPE_IO_TCP, and PORT_EPHEMERAL.
| LLSocket::ptr_t LLSocket::create | ( | apr_pool_t * | pool, | |
| EType | type, | |||
| U16 | port = PORT_EPHEMERAL | |||
| ) |  [static] | 
Create a socket.
This is the call you would use if you intend to create a listen socket. If you intend the socket to be known to external clients without prior port notification, do not use PORT_EPHEMERAL.
| pool | The apr pool to use. A child pool will be created and associated with the socket. | |
| type | The type of socket to create | |
| port | The port for the socket | 
Definition at line 72 of file lliosocket.cpp.
References DATAGRAM_UDP, ll_apr_warn_status(), LL_DEFAULT_LISTEN_BACKLOG, lldebugs, llendl, LLSocket(), LLMemType::MTYPE_IO_TCP, NULL, PORT_EPHEMERAL, and STREAM_TCP.
Referenced by LLIOHTTPServer::create(), tut::pipe_and_pump_fitness::pipe_and_pump_fitness(), LLIOServerSocket::process_impl(), and LLVoiceClient::stateMachine().
| U16 LLSocket::getPort | ( | ) | const  [inline] | 
Get the type of socket Get the port.
This will return PORT_EPHEMERAL if bind was never called.
Definition at line 144 of file lliosocket.h.
References mPort.
| apr_socket_t* LLSocket::getSocket | ( | ) | const  [inline] | 
Get the apr socket implementation.
Definition at line 151 of file lliosocket.h.
References mSocket.
| void LLSocket::setOptions | ( | ) |  [protected] | 
Set default socket options.
Definition at line 230 of file lliosocket.cpp.
References ll_apr_warn_status(), LL_RECV_BUFFER_SIZE, LL_SEND_BUFFER_SIZE, mSocket, and LLMemType::MTYPE_IO_TCP.
Referenced by blockingConnect().
| apr_pool_t* LLSocket::mPool  [protected] | 
| U16 LLSocket::mPort  [protected] | 
| apr_socket_t* LLSocket::mSocket  [protected] | 
Definition at line 173 of file lliosocket.h.
Referenced by blockingConnect(), getSocket(), setOptions(), and ~LLSocket().
 1.4.7
 1.4.7