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

raw_socket_layer.hh
Go to the documentation of this file.
1
11 #pragma once
12
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #if !defined(LINUX)
16 #include <netdb.h>
17 #else // LINUX
18 #include <netinet/ether.h> // Used for raw sockets
19 #include <net/ethernet.h> // Used for raw sockets
20 #include <linux/if_packet.h> // Used for raw sockets
21 #endif // LINUX
22 #include <netinet/in.h>
23 #include <netinet/udp.h>
24 #include <netinet/tcp.h>
25 #include <arpa/inet.h>
26 #include <net/if.h> // Used for raw sockets
27
28 #include "t_layer.hh"
29 #include "Params.hh"
30
31 class OCTETSTRING;
32 class PORT;
33
38 class raw_socket_layer : public layer, public PORT {
39 Params _params;
40 int _socket;
41 std::string _time_key;
42 struct ifreq _if_interface;
43 struct ifreq _if_mac_addr;
44 std::vector<unsigned char> _mac_src;
45 std::vector<unsigned char> _mac_bc;
46 std::vector<unsigned char> _eth_type;
47
48 public:
49
56 raw_socket_layer(const std::string& p_type, const std::string& param);
61 virtual ~raw_socket_layer();
62
71 virtual void send_data(OCTETSTRING& data, Params& params);
79 virtual void receive_data(OCTETSTRING& data, Params& info);
80
81 void Handle_Fd_Event_Readable(int fd);
82 }; // End of class raw_socket_layer
83
raw_socket_layer::~raw_socket_layer
virtual ~raw_socket_layer()
Default destructor.
Definition: raw_socket_layer.cc:87
raw_socket_layer::Handle_Fd_Event_Readable
void Handle_Fd_Event_Readable(int fd)
Definition: raw_socket_layer.cc:133
layer
Forward declaration of TITAN class.
Definition: layer.hh:29
raw_socket_layer::_if_interface
struct ifreq _if_interface
Definition: raw_socket_layer.hh:42
raw_socket_layer::_mac_bc
std::vector< unsigned char > _mac_bc
MAC address.
Definition: raw_socket_layer.hh:45
raw_socket_layer
Definition: raw_socket_layer.hh:38
raw_socket_layer::_if_mac_addr
struct ifreq _if_mac_addr
NIC interface description.
Definition: raw_socket_layer.hh:43
raw_socket_layer::_eth_type
std::vector< unsigned char > _eth_type
MAC broadcast address.
Definition: raw_socket_layer.hh:46
raw_socket_layer::raw_socket_layer
raw_socket_layer(const std::string &p_type, const std::string &param)
Ethernet type.
Definition: raw_socket_layer.cc:15
raw_socket_layer::receive_data
virtual void receive_data(OCTETSTRING &data, Params &info)
Receive bytes formated data from the lower layers.
Definition: raw_socket_layer.cc:125
Params.hh
Header file for the parameter dictionary.
raw_socket_layer::send_data
virtual void send_data(OCTETSTRING &data, Params &params)
Send bytes formated data to the lower layers.
Definition: raw_socket_layer.cc:95
Params
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
raw_socket_layer::_socket
int _socket
Layer parameters.
Definition: raw_socket_layer.hh:40
raw_socket_layer::_params
Params _params
Definition: raw_socket_layer.hh:39
raw_socket_layer::_mac_src
std::vector< unsigned char > _mac_src
NIC interface description.
Definition: raw_socket_layer.hh:44
raw_socket_layer::_time_key
std::string _time_key
Socket identifier.
Definition: raw_socket_layer.hh:41
t_layer.hh
Header file for ITS abstract protocol layer definition.