#include <socket.h>
Public Types | |
enum | stype { TYPE_TCP, TYPE_UDP } |
enum | state { STATE_EMPTY, STATE_IN, STATE_DISCONNECT } |
Public Member Functions | |
Socket (string ip, int port, stype _t=TYPE_TCP) | |
~Socket () | |
bool | recv (string &rez) |
bool | send (void *data, int len) |
bool | send (const string *data) |
bool | send (const string data) |
bool | send2v (void **v_ptr, int *v_len) |
bool | send3v (void **v_ptr, int *v_len) |
void | listen (int in) |
Socket * | accept (void) |
state | state_refresh (void) |
int | get_fd (void) |
string | source_ip (void) |
Static Public Member Functions | |
static int | poll (list< Socket * > &s) |
Data Fields | |
int | fd |
Protected Member Functions | |
Socket (int _fd, string _ip, int _port, stype _t) | |
bool | _is_multicast (string ip) |
unsigned long | ip_to_number (string ip) |
Protected Attributes | |
string | ip |
int | port |
stype | type |
state | _state |
int | ttl |
unsigned short | ip_id |
bool | is_multicast |
Definition at line 25 of file socket.h.
enum Socket::stype |
enum Socket::state |
Socket::Socket | ( | string | ip, | |
int | port, | |||
stype | _t = TYPE_TCP | |||
) |
Definition at line 135 of file socket.cpp.
References _is_multicast(), _state, D, fd, flag, ip, is_multicast, memset(), port, STATE_EMPTY, t, type, TYPE_TCP, and TYPE_UDP.
Referenced by accept().
Socket::~Socket | ( | ) |
Socket::Socket | ( | int | _fd, | |
string | _ip, | |||
int | _port, | |||
stype | _t | |||
) | [protected] |
Definition at line 188 of file socket.cpp.
bool Socket::recv | ( | string & | rez | ) |
bool Socket::send | ( | void * | data, | |
int | len | |||
) |
Definition at line 311 of file socket.cpp.
References fd.
Referenced by Audio::process(), RTP_Stream::rtcp_send_sdes(), RTP_Stream::rtcp_send_sr(), and send().
bool Socket::send | ( | const string * | data | ) |
bool Socket::send | ( | const string | data | ) |
bool Socket::send2v | ( | void ** | v_ptr, | |
int * | v_len | |||
) |
bool Socket::send3v | ( | void ** | v_ptr, | |
int * | v_len | |||
) |
int Socket::poll | ( | list< Socket * > & | s | ) | [static] |
Definition at line 202 of file socket.cpp.
References D, fd, free(), malloc(), memset(), STATE_DISCONNECT, STATE_EMPTY, and STATE_IN.
Referenced by RTSP_Server::main().
void Socket::listen | ( | int | in | ) |
Socket * Socket::accept | ( | void | ) |
Definition at line 246 of file socket.cpp.
References D, fd, memset(), s, Socket(), and type.
Referenced by RTSP_Server::main().
state Socket::state_refresh | ( | void | ) | [inline] |
bool Socket::_is_multicast | ( | string | ip | ) | [protected] |
Definition at line 118 of file socket.cpp.
References a, and ip_to_number().
Referenced by Socket().
unsigned long Socket::ip_to_number | ( | string | ip | ) | [protected] |
Definition at line 106 of file socket.cpp.
References String::split().
Referenced by _is_multicast().
int Socket::fd |
string Socket::ip [protected] |
int Socket::port [protected] |
stype Socket::type [protected] |
state Socket::_state [protected] |
int Socket::ttl [protected] |
unsigned short Socket::ip_id [protected] |
bool Socket::is_multicast [protected] |