Abstract_Socket Class Referenceabstract

`#include <Abstract_Socket.hh>`

## Classes

struct | as_client_struct

## Protected Types

enum | TCP_STATES { CLOSED, LISTEN, ESTABLISHED, CLOSE_WAIT, FIN_WAIT }
enum | READING_STATES { STATE_DONT_RECEIVE, STATE_WAIT_FOR_RECEIVE_CALLBACK, STATE_BLOCK_FOR_SENDING, STATE_DONT_CLOSE, STATE_NORMAL }

## Protected Member Functions

| Abstract_Socket ()
| Abstract_Socket (const char *testport_type, const char *testport_name)
virtual | ~Abstract_Socket ()
bool | parameter_set (const char *parameter_name, const char *parameter_value)
void | map_user ()
void | unmap_user ()
void | get_host_id (const char *hostName, struct sockaddr_in *addr)
int | open_listen_port (const struct sockaddr_in &localAddr)
int | open_listen_port (const char *localHostname, const char *localServicename)
void | close_listen_port ()
virtual void | listen_port_opened (int port_number)
int | open_client_connection (const struct sockaddr_in &new_remote_addr, const struct sockaddr_in &new_local_addr)
int | open_client_connection (const char *remoteHostname, const char *remoteService, const char *localHostname, const char *localService)
virtual void | client_connection_opened (int client_id)
void | Handle_Socket_Event (int fd, boolean is_readable, boolean is_writable, boolean is_error)
void | Handle_Timeout_Event (double)
void | send_outgoing (const unsigned char *message_buffer, int length, int client_id=-1)
void | send_shutdown (int client_id=-1)
bool | get_nagling () const
bool | get_use_non_blocking_socket () const
bool | get_server_mode () const
bool | get_socket_debugging () const
bool | get_halt_on_connection_reset () const
bool | get_use_connection_ASPs () const
bool | get_handle_half_close () const
int | get_socket_fd () const
int | get_listen_fd () const
int | set_non_block_mode (int fd, bool enable_nonblock)
bool | increase_send_buffer (int fd, int &old_size, int &new_size)
const char * | get_local_host_name ()
unsigned int | get_local_port_number ()
const char * | get_remote_host_name ()
unsigned int | get_remote_port_number ()
const struct sockaddr_in & | get_remote_addr ()
const struct sockaddr_in & | get_local_addr ()
const int & | get_ai_family () const
void | set_ai_family (int parameter_value)
bool | get_ttcn_buffer_usercontrol () const
void | set_nagling (bool parameter_value)
void | set_server_mode (bool parameter_value)
void | set_handle_half_close (bool parameter_value)
void | set_socket_debugging (bool parameter_value)
void | set_halt_on_connection_reset (bool parameter_value)
void | set_ttcn_buffer_usercontrol (bool parameter_value)
virtual void | message_incoming (const unsigned char *message_buffer, int length, int client_id=-1)=0
virtual void | Add_Fd_Read_Handler (int fd)=0
virtual void | Add_Fd_Write_Handler (int fd)=0
virtual void | Remove_Fd_Read_Handler (int fd)=0
virtual void | Remove_Fd_Write_Handler (int fd)=0
virtual void | Remove_Fd_All_Handlers (int fd)=0
virtual void | Handler_Uninstall ()=0
virtual void | Timer_Set_Handler (double call_interval, boolean is_timeout=TRUE, boolean call_anyway=TRUE, boolean is_periodic=TRUE)=0
virtual const PacketHeaderDescr * | Get_Header_Descriptor () const
void | log_debug (const char *fmt,...) const __attribute__((__format__(__printf__
void void | log_warning (const char *fmt,...) const __attribute__((__format__(__printf__
void void void | log_error (const char *fmt,...) const __attribute__((__format__(__printf__
void | log_hex (const char *prompt, const unsigned char *msg, size_t length) const
virtual int | receive_message_on_fd (int client_id)
virtual int | send_message_on_fd (int client_id, const unsigned char *message_buffer, int message_length)
virtual int | send_message_on_nonblocking_fd (int client_id, const unsigned char *message_buffer, int message_length)
virtual void | peer_connected (int client_id, sockaddr_in &remote_addr)
virtual void | peer_connected (int, const char *, const int)
virtual void | peer_disconnected (int client_id)
virtual void | peer_half_closed (int client_id)
virtual void | report_error (int client_id, int msg_length, int sent_length, const unsigned char *msg, const char *error_text)
virtual void | report_unsent (int client_id, int msg_length, int sent_length, const unsigned char *msg, const char *error_text)
virtual const char * | local_port_name ()
virtual const char * | remote_address_name ()
virtual const char * | local_address_name ()
virtual const char * | remote_port_name ()
virtual const char * | ai_family_name ()
virtual const char * | use_connection_ASPs_name ()
virtual const char * | halt_on_connection_reset_name ()
virtual const char * | client_TCP_reconnect_name ()
virtual const char * | TCP_reconnect_attempts_name ()
virtual const char * | TCP_reconnect_delay_name ()
virtual const char * | server_mode_name ()
virtual const char * | socket_debugging_name ()
virtual const char * | nagling_name ()
virtual const char * | use_non_blocking_socket_name ()
virtual const char * | server_backlog_name ()
void * | get_user_data (int client_id)
void | set_user_data (int client_id, void *uptr)
virtual bool | add_user_data (int client_id)
virtual bool | remove_user_data (int client_id)
virtual void | remove_client (int client_id)
virtual void | remove_all_clients ()
virtual bool | user_all_mandatory_configparameters_present ()
TTCN_Buffer * | get_buffer (int client_id)
as_client_struct * | peer_list_add_peer (int client_id)
void | peer_list_remove_peer (int client_id)
void | peer_list_reset_peer ()
as_client_struct * | get_peer (int client_id, bool no_error=false) const
int | peer_list_get_length () const
int | peer_list_get_nr_of_peers () const
int | peer_list_get_last_peer () const
int | peer_list_get_first_peer () const

## Protected Attributes

const char * | test_port_type
const char * | test_port_name
void void void | __noreturn__

## Private Member Functions

void | handle_message (int client_id=-1)
void | all_mandatory_configparameters_present ()
void | peer_list_resize_list (int client_id)

## Private Attributes

bool | halt_on_connection_reset_set
bool | halt_on_connection_reset
bool | client_TCP_reconnect
int | TCP_reconnect_attempts
int | TCP_reconnect_delay
bool | server_mode
bool | use_connection_ASPs
bool | handle_half_close
bool | socket_debugging
bool | nagling
bool | use_non_blocking_socket
bool | ttcn_buffer_usercontrol
char * | local_host_name
unsigned int | local_port_number
char * | remote_host_name
unsigned int | remote_port_number
int | ai_family
struct sockaddr_in | remoteAddr
struct sockaddr_in | localAddr
int | server_backlog
int | deadlock_counter
int | listen_fd
int | peer_list_length
as_client_struct ** | peer_list_root

## Member Enumeration Documentation

## READING_STATES

enum Abstract_Socket::READING_STATES

protected

Enumerator
STATE_DONT_RECEIVE |
STATE_WAIT_FOR_RECEIVE_CALLBACK |
STATE_BLOCK_FOR_SENDING |
STATE_DONT_CLOSE |
STATE_NORMAL |

## TCP_STATES

enum Abstract_Socket::TCP_STATES

protected

Enumerator
CLOSED |
LISTEN |
ESTABLISHED |
CLOSE_WAIT |
FIN_WAIT |

## Constructor & Destructor Documentation

## Abstract_Socket() [1/2]

Abstract_Socket::Abstract_Socket | ( |  | ) |

protected

## Abstract_Socket() [2/2]

Abstract_Socket::Abstract_Socket | ( | const char * | testport_type,
|  | const char * | testport_name
| ) |  |

protected

## ~Abstract_Socket()

Abstract_Socket::~Abstract_Socket | ( |  | ) |

protectedvirtual

## Member Function Documentation

## Add_Fd_Read_Handler()

virtual void Abstract_Socket::Add_Fd_Read_Handler | ( | int | fd | ) |

protectedpure virtual

## Add_Fd_Write_Handler()

virtual void Abstract_Socket::Add_Fd_Write_Handler | ( | int | fd | ) |

protectedpure virtual

## add_user_data()

bool Abstract_Socket::add_user_data | ( | int | client_id | ) |

protectedvirtual

## ai_family_name()

const char * Abstract_Socket::ai_family_name | ( |  | ) |

protectedvirtual

## all_mandatory_configparameters_present()

void Abstract_Socket::all_mandatory_configparameters_present | ( |  | ) |

private

## client_connection_opened()

void Abstract_Socket::client_connection_opened | ( | int | client_id | ) |

protectedvirtual

## client_TCP_reconnect_name()

const char * Abstract_Socket::client_TCP_reconnect_name | ( |  | ) |

protectedvirtual

## close_listen_port()

void Abstract_Socket::close_listen_port | ( |  | ) |

protected

## get_ai_family()

const int& Abstract_Socket::get_ai_family | ( |  | ) | const

inlineprotected

## get_buffer()

TTCN_Buffer* Abstract_Socket::get_buffer | ( | int | client_id | ) |

inlineprotected

## get_halt_on_connection_reset()

bool Abstract_Socket::get_halt_on_connection_reset | ( |  | ) | const

inlineprotected

## get_handle_half_close()

bool Abstract_Socket::get_handle_half_close | ( |  | ) | const

inlineprotected

## Get_Header_Descriptor()

const PacketHeaderDescr * Abstract_Socket::Get_Header_Descriptor | ( |  | ) | const

protectedvirtual

## get_host_id()

void Abstract_Socket::get_host_id | ( | const char * | hostName,
|  | struct sockaddr_in * | addr
| ) |  |

protected

## get_listen_fd()

int Abstract_Socket::get_listen_fd | ( |  | ) | const

inlineprotected

## get_local_addr()

const struct sockaddr_in& Abstract_Socket::get_local_addr | ( |  | ) |

inlineprotected

## get_local_host_name()

const char* Abstract_Socket::get_local_host_name | ( |  | ) |

inlineprotected

## get_local_port_number()

unsigned int Abstract_Socket::get_local_port_number | ( |  | ) |

inlineprotected

## get_nagling()

bool Abstract_Socket::get_nagling | ( |  | ) | const

inlineprotected

## get_peer()

Abstract_Socket::as_client_struct * Abstract_Socket::get_peer | ( | int | client_id,
|  | bool | no_error = `false`
| ) |  | const

protected

## get_remote_addr()

const struct sockaddr_in& Abstract_Socket::get_remote_addr | ( |  | ) |

inlineprotected

## get_remote_host_name()

const char* Abstract_Socket::get_remote_host_name | ( |  | ) |

inlineprotected

## get_remote_port_number()

unsigned int Abstract_Socket::get_remote_port_number | ( |  | ) |

inlineprotected

## get_server_mode()

bool Abstract_Socket::get_server_mode | ( |  | ) | const

inlineprotected

## get_socket_debugging()

bool Abstract_Socket::get_socket_debugging | ( |  | ) | const

inlineprotected

## get_socket_fd()

int Abstract_Socket::get_socket_fd | ( |  | ) | const

protected

## get_ttcn_buffer_usercontrol()

bool Abstract_Socket::get_ttcn_buffer_usercontrol | ( |  | ) | const

inlineprotected

## get_use_connection_ASPs()

bool Abstract_Socket::get_use_connection_ASPs | ( |  | ) | const

inlineprotected

## get_use_non_blocking_socket()

bool Abstract_Socket::get_use_non_blocking_socket | ( |  | ) | const

inlineprotected

## get_user_data()

void* Abstract_Socket::get_user_data | ( | int | client_id | ) |

inlineprotected

## halt_on_connection_reset_name()

const char * Abstract_Socket::halt_on_connection_reset_name | ( |  | ) |

protectedvirtual

## handle_message()

void Abstract_Socket::handle_message | ( | int | client_id = `-1` | ) |

private

## Handle_Socket_Event()

void Abstract_Socket::Handle_Socket_Event | ( | int | fd,
|  | boolean | is_readable,
|  | boolean | is_writable,
|  | boolean | is_error
| ) |  |

protected

## Handle_Timeout_Event()

void Abstract_Socket::Handle_Timeout_Event | ( | double |  | ) |

inlineprotected

## Handler_Uninstall()

virtual void Abstract_Socket::Handler_Uninstall | ( |  | ) |

protectedpure virtual

## increase_send_buffer()

bool Abstract_Socket::increase_send_buffer | ( | int | fd,
|  | int & | old_size,
|  | int & | new_size
| ) |  |

protected

## listen_port_opened()

void Abstract_Socket::listen_port_opened | ( | int | port_number | ) |

protectedvirtual

## local_address_name()

const char * Abstract_Socket::local_address_name | ( |  | ) |

protectedvirtual

## local_port_name()

const char * Abstract_Socket::local_port_name | ( |  | ) |

protectedvirtual

## log_debug()

void Abstract_Socket::log_debug | ( | const char * | fmt,
|  |  | ...
| ) |  | const

protected

## log_error()

void Abstract_Socket::log_error | ( | const char * | fmt,
|  |  | ...
| ) |  | const

protected

## log_hex()

void Abstract_Socket::log_hex | ( | const char * | prompt,
|  | const unsigned char * | msg,
|  | size_t | length
| ) |  | const

protected

## log_warning()

void Abstract_Socket::log_warning | ( | const char * | fmt,
|  |  | ...
| ) |  | const

protected

## map_user()

void Abstract_Socket::map_user | ( |  | ) |

protected

## message_incoming()

virtual void Abstract_Socket::message_incoming | ( | const unsigned char * | message_buffer,
|  | int | length,
|  | int | client_id = `-1`
| ) |  |

protectedpure virtual

## nagling_name()

const char * Abstract_Socket::nagling_name | ( |  | ) |

protectedvirtual

## open_client_connection() [1/2]

int Abstract_Socket::open_client_connection | ( | const struct sockaddr_in & | new_remote_addr,
|  | const struct sockaddr_in & | new_local_addr
| ) |  |

protected

## open_client_connection() [2/2]

int Abstract_Socket::open_client_connection | ( | const char * | remoteHostname,
|  | const char * | remoteService,
|  | const char * | localHostname,
|  | const char * | localService
| ) |  |

protected

## open_listen_port() [1/2]

int Abstract_Socket::open_listen_port | ( | const struct sockaddr_in & | localAddr | ) |

protected

## open_listen_port() [2/2]

int Abstract_Socket::open_listen_port | ( | const char * | localHostname,
|  | const char * | localServicename
| ) |  |

protected

## parameter_set()

bool Abstract_Socket::parameter_set | ( | const char * | parameter_name,
|  | const char * | parameter_value
| ) |  |

protected

## peer_connected() [1/2]

void Abstract_Socket::peer_connected | ( | int | client_id,
|  | sockaddr_in & | remote_addr
| ) |  |

protectedvirtual

## peer_connected() [2/2]

virtual void Abstract_Socket::peer_connected | ( | int | ,
|  | const char * | ,
|  | const int |
| ) |  |

inlineprotectedvirtual

## peer_disconnected()

void Abstract_Socket::peer_disconnected | ( | int | client_id | ) |

protectedvirtual

## peer_half_closed()

void Abstract_Socket::peer_half_closed | ( | int | client_id | ) |

protectedvirtual

## peer_list_add_peer()

Abstract_Socket::as_client_struct * Abstract_Socket::peer_list_add_peer | ( | int | client_id | ) |

protected

## peer_list_get_first_peer()

int Abstract_Socket::peer_list_get_first_peer | ( |  | ) | const

protected

## peer_list_get_last_peer()

int Abstract_Socket::peer_list_get_last_peer | ( |  | ) | const

protected

## peer_list_get_length()

int Abstract_Socket::peer_list_get_length | ( |  | ) | const

inlineprotected

## peer_list_get_nr_of_peers()

int Abstract_Socket::peer_list_get_nr_of_peers | ( |  | ) | const

protected

## peer_list_remove_peer()

void Abstract_Socket::peer_list_remove_peer | ( | int | client_id | ) |

protected

## peer_list_reset_peer()

void Abstract_Socket::peer_list_reset_peer | ( |  | ) |

protected

## peer_list_resize_list()

void Abstract_Socket::peer_list_resize_list | ( | int | client_id | ) |

private

## receive_message_on_fd()

int Abstract_Socket::receive_message_on_fd | ( | int | client_id | ) |

protectedvirtual

## remote_address_name()

const char * Abstract_Socket::remote_address_name | ( |  | ) |

protectedvirtual

## remote_port_name()

const char * Abstract_Socket::remote_port_name | ( |  | ) |

protectedvirtual

## remove_all_clients()

void Abstract_Socket::remove_all_clients | ( |  | ) |

protectedvirtual

## remove_client()

void Abstract_Socket::remove_client | ( | int | client_id | ) |

protectedvirtual

## Remove_Fd_All_Handlers()

virtual void Abstract_Socket::Remove_Fd_All_Handlers | ( | int | fd | ) |

protectedpure virtual

## Remove_Fd_Read_Handler()

virtual void Abstract_Socket::Remove_Fd_Read_Handler | ( | int | fd | ) |

protectedpure virtual

## Remove_Fd_Write_Handler()

virtual void Abstract_Socket::Remove_Fd_Write_Handler | ( | int | fd | ) |

protectedpure virtual

## remove_user_data()

bool Abstract_Socket::remove_user_data | ( | int | client_id | ) |

protectedvirtual

## report_error()

void Abstract_Socket::report_error | ( | int | client_id,
|  | int | msg_length,
|  | int | sent_length,
|  | const unsigned char * | msg,
|  | const char * | error_text
| ) |  |

protectedvirtual

## report_unsent()

void Abstract_Socket::report_unsent | ( | int | client_id,
|  | int | msg_length,
|  | int | sent_length,
|  | const unsigned char * | msg,
|  | const char * | error_text
| ) |  |

protectedvirtual

## send_message_on_fd()

int Abstract_Socket::send_message_on_fd | ( | int | client_id,
|  | const unsigned char * | message_buffer,
|  | int | message_length
| ) |  |

protectedvirtual

## send_message_on_nonblocking_fd()

int Abstract_Socket::send_message_on_nonblocking_fd | ( | int | client_id,
|  | const unsigned char * | message_buffer,
|  | int | message_length
| ) |  |

protectedvirtual

## send_outgoing()

void Abstract_Socket::send_outgoing | ( | const unsigned char * | message_buffer,
|  | int | length,
|  | int | client_id = `-1`
| ) |  |

protected

## send_shutdown()

void Abstract_Socket::send_shutdown | ( | int | client_id = `-1` | ) |

protected

## server_backlog_name()

const char * Abstract_Socket::server_backlog_name | ( |  | ) |

protectedvirtual

## server_mode_name()

const char * Abstract_Socket::server_mode_name | ( |  | ) |

protectedvirtual

## set_ai_family()

void Abstract_Socket::set_ai_family | ( | int | parameter_value | ) |

inlineprotected

## set_halt_on_connection_reset()

void Abstract_Socket::set_halt_on_connection_reset | ( | bool | parameter_value | ) |

inlineprotected

## set_handle_half_close()

void Abstract_Socket::set_handle_half_close | ( | bool | parameter_value | ) |

inlineprotected

## set_nagling()

void Abstract_Socket::set_nagling | ( | bool | parameter_value | ) |

inlineprotected

## set_non_block_mode()

int Abstract_Socket::set_non_block_mode | ( | int | fd,
|  | bool | enable_nonblock
| ) |  |

protected

## set_server_mode()

void Abstract_Socket::set_server_mode | ( | bool | parameter_value | ) |

inlineprotected

## set_socket_debugging()

void Abstract_Socket::set_socket_debugging | ( | bool | parameter_value | ) |

inlineprotected

## set_ttcn_buffer_usercontrol()

void Abstract_Socket::set_ttcn_buffer_usercontrol | ( | bool | parameter_value | ) |

inlineprotected

## set_user_data()

void Abstract_Socket::set_user_data | ( | int | client_id,
|  | void * | uptr
| ) |  |

inlineprotected

## socket_debugging_name()

const char * Abstract_Socket::socket_debugging_name | ( |  | ) |

protectedvirtual

## TCP_reconnect_attempts_name()

const char * Abstract_Socket::TCP_reconnect_attempts_name | ( |  | ) |

protectedvirtual

## TCP_reconnect_delay_name()

const char * Abstract_Socket::TCP_reconnect_delay_name | ( |  | ) |

protectedvirtual

## Timer_Set_Handler()

virtual void Abstract_Socket::Timer_Set_Handler | ( | double | call_interval,
|  | boolean | is_timeout = `TRUE`,
|  | boolean | call_anyway = `TRUE`,
|  | boolean | is_periodic = `TRUE`
| ) |  |

protectedpure virtual

## unmap_user()

void Abstract_Socket::unmap_user | ( |  | ) |

protected

## use_connection_ASPs_name()

const char * Abstract_Socket::use_connection_ASPs_name | ( |  | ) |

protectedvirtual

## use_non_blocking_socket_name()

const char * Abstract_Socket::use_non_blocking_socket_name | ( |  | ) |

protectedvirtual

## user_all_mandatory_configparameters_present()

bool Abstract_Socket::user_all_mandatory_configparameters_present | ( |  | ) |

protectedvirtual

## Member Data Documentation

## __noreturn__

void void void Abstract_Socket::__noreturn__

protected

## ai_family

int Abstract_Socket::ai_family

private

## client_TCP_reconnect

bool Abstract_Socket::client_TCP_reconnect

private

## deadlock_counter

int Abstract_Socket::deadlock_counter

private

## halt_on_connection_reset

bool Abstract_Socket::halt_on_connection_reset

private

## halt_on_connection_reset_set

bool Abstract_Socket::halt_on_connection_reset_set

private

## handle_half_close

bool Abstract_Socket::handle_half_close

private

## listen_fd

int Abstract_Socket::listen_fd

private

## local_host_name

char* Abstract_Socket::local_host_name

private

## local_port_number

unsigned int Abstract_Socket::local_port_number

private

## localAddr

struct sockaddr_in Abstract_Socket::localAddr

private

## nagling

bool Abstract_Socket::nagling

private

## peer_list_length

int Abstract_Socket::peer_list_length

private

## peer_list_root

as_client_struct** Abstract_Socket::peer_list_root

private

## remote_host_name

char* Abstract_Socket::remote_host_name

private

## remote_port_number

unsigned int Abstract_Socket::remote_port_number

private

## remoteAddr

struct sockaddr_in Abstract_Socket::remoteAddr

private

## server_backlog

int Abstract_Socket::server_backlog

private

## server_mode

bool Abstract_Socket::server_mode

private

## socket_debugging

bool Abstract_Socket::socket_debugging

private

## TCP_reconnect_attempts

int Abstract_Socket::TCP_reconnect_attempts

private

## TCP_reconnect_delay

int Abstract_Socket::TCP_reconnect_delay

private

## test_port_name

const char* Abstract_Socket::test_port_name

protected

## test_port_type

const char* Abstract_Socket::test_port_type

protected

## ttcn_buffer_usercontrol

bool Abstract_Socket::ttcn_buffer_usercontrol

private

## use_connection_ASPs

bool Abstract_Socket::use_connection_ASPs

private

## use_non_blocking_socket

bool Abstract_Socket::use_non_blocking_socket

private

The documentation for this class was generated from the following files:

- /home/vagrant/TriesAndDelete/etsi_its/framework/include/Abstract_Socket.hh
- /home/vagrant/TriesAndDelete/etsi_its/framework/src/Abstract_Socket.cc