ETSI STF525 / Internal Testing test suite This project provides an internal testing test suite and its associated Test Adapter/Codec

tcp_layer.hh
Go to the documentation of this file.
1
11 #pragma once
12
13 #include "t_layer.hh"
14
15 #include "Abstract_Socket.hh"
16
17 class PORT;
18
23 class tcp_layer : public SSL_Socket, public layer, public PORT {
24 Params _params;
25 int _client_id;
26 std::string _time_key;
27 bool _reconnect_on_send;
28
29 public:
30
36 tcp_layer(const std::string& p_type, const std::string& p_param);
41 virtual ~tcp_layer();
42
51 virtual void send_data(OCTETSTRING& data, Params& params);
59 virtual void receive_data(OCTETSTRING& data, Params& info);
60
69 virtual void message_incoming(const unsigned char* p_buffer, int p_length, int p_client_id = -1);
70
71 protected:
72 void Add_Fd_Read_Handler(int fd) { Handler_Add_Fd_Read(fd); };
73 void Add_Fd_Write_Handler(int fd) { Handler_Add_Fd_Write(fd); };
74 void Remove_Fd_Read_Handler(int fd) { Handler_Remove_Fd_Read(fd); };
75 void Remove_Fd_Write_Handler(int fd) { Handler_Remove_Fd_Write(fd); };
76 void Remove_Fd_All_Handlers(int fd) { Handler_Remove_Fd(fd); };
77 void Handler_Uninstall() { Uninstall_Handler(); }
78 void Timer_Set_Handler(double call_interval, boolean is_timeout = TRUE,
79 boolean call_anyway = TRUE, boolean is_periodic = TRUE) {
80 Handler_Set_Timer(call_interval, is_timeout, call_anyway, is_periodic);
81 };
82
83 const char* remote_address_name() { return Params::server.c_str(); };
84 const char* remote_port_name() { return Params::port.c_str(); };
85 const char* socket_debugging_name() { return Params::debug.c_str(); };
86 const char* ssl_use_ssl_name() { return Params::use_ssl.c_str(); };
87
88 void client_connection_opened(int p_client_id);
89 bool add_user_data(int p_client_id);
90 int send_message_on_fd(int p_client_id, const unsigned char * message_buffer, int length_of_message);
91 int send_message_on_nonblocking_fd(int client_id, const unsigned char * message_buffer, int length_of_message);
92 int receive_message_on_fd(int p_client_id);
93 void peer_disconnected(int p_client_id);
94
95 private:
96 void Handle_Fd_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error);
97 void Handle_Timeout(double time_since_last_call);
98 }; // End of class tcp_layer
99
tcp_layer::message_incoming
virtual void message_incoming(const unsigned char *p_buffer, int p_length, int p_client_id=-1)
Receive bytes formated data from the lower layers.
Definition: tcp_layer.cc:99
tcp_layer::send_message_on_fd
int send_message_on_fd(int p_client_id, const unsigned char *message_buffer, int length_of_message)
Definition: tcp_layer.cc:129
tcp_layer
Forward declaration of TITAN class.
Definition: tcp_layer.hh:23
tcp_layer::remote_port_name
const char * remote_port_name()
Definition: tcp_layer.hh:84
tcp_layer::send_data
virtual void send_data(OCTETSTRING &data, Params &params)
Send bytes formated data to the lower layers.
Definition: tcp_layer.cc:85
tcp_layer::Add_Fd_Read_Handler
void Add_Fd_Read_Handler(int fd)
Definition: tcp_layer.hh:72
tcp_layer::Handle_Timeout
void Handle_Timeout(double time_since_last_call)
Definition: tcp_layer.cc:78
tcp_layer::peer_disconnected
void peer_disconnected(int p_client_id)
Definition: tcp_layer.cc:171
tcp_layer::Remove_Fd_Read_Handler
void Remove_Fd_Read_Handler(int fd)
Definition: tcp_layer.hh:74
layer
Forward declaration of TITAN class.
Definition: layer.hh:29
tcp_layer::client_connection_opened
void client_connection_opened(int p_client_id)
Definition: tcp_layer.cc:112
tcp_layer::Remove_Fd_All_Handlers
void Remove_Fd_All_Handlers(int fd)
Definition: tcp_layer.hh:76
tcp_layer::_reconnect_on_send
bool _reconnect_on_send
Definition: tcp_layer.hh:27
tcp_layer::tcp_layer
tcp_layer(const std::string &p_type, const std::string &p_param)
Set to true if connection shall be done when sending data. Otherwise, connection is established by th...
Definition: tcp_layer.cc:14
tcp_layer::_params
Params _params
Definition: tcp_layer.hh:24
Params::use_ssl
static const std::string & use_ssl
Commsignia HTTP server port. Default: 80.
Definition: Params.hh:78
tcp_layer::ssl_use_ssl_name
const char * ssl_use_ssl_name()
Definition: tcp_layer.hh:86
Params::server
static const std::string & server
Commsignia antenna selector.
Definition: Params.hh:76
tcp_layer::socket_debugging_name
const char * socket_debugging_name()
Definition: tcp_layer.hh:85
tcp_layer::~tcp_layer
virtual ~tcp_layer()
Default destructor.
Definition: tcp_layer.cc:62
tcp_layer::_time_key
std::string _time_key
Connection identifier.
Definition: tcp_layer.hh:26
tcp_layer::Timer_Set_Handler
void Timer_Set_Handler(double call_interval, boolean is_timeout=TRUE, boolean call_anyway=TRUE, boolean is_periodic=TRUE)
Definition: tcp_layer.hh:78
Params
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
Params::debug
static const std::string & debug
Definition: Params.hh:24
tcp_layer::receive_message_on_fd
int receive_message_on_fd(int p_client_id)
Definition: tcp_layer.cc:157
tcp_layer::add_user_data
bool add_user_data(int p_client_id)
Definition: tcp_layer.cc:118
tcp_layer::send_message_on_nonblocking_fd
int send_message_on_nonblocking_fd(int client_id, const unsigned char *message_buffer, int length_of_message)
Definition: tcp_layer.cc:143
tcp_layer::Remove_Fd_Write_Handler
void Remove_Fd_Write_Handler(int fd)
Definition: tcp_layer.hh:75
tcp_layer::receive_data
virtual void receive_data(OCTETSTRING &data, Params &info)
Receive bytes formated data from the lower layers.
Definition: tcp_layer.cc:93
Params::port
static const std::string & port
HTTP server address (e.g. www.etsi.org)
Definition: Params.hh:77
tcp_layer::_client_id
int _client_id
Layer parameters.
Definition: tcp_layer.hh:25
tcp_layer::Handler_Uninstall
void Handler_Uninstall()
Definition: tcp_layer.hh:77
tcp_layer::Handle_Fd_Event
void Handle_Fd_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error)
Definition: tcp_layer.cc:71
Abstract_Socket.hh
tcp_layer::Add_Fd_Write_Handler
void Add_Fd_Write_Handler(int fd)
Definition: tcp_layer.hh:73
tcp_layer::remote_address_name
const char * remote_address_name()
Definition: tcp_layer.hh:83
t_layer.hh
Header file for ITS abstract protocol layer definition.