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

udp_layer.hh
Go to the documentation of this file.
1
11 #pragma once
12
13 #include <arpa/inet.h>
14 #if !defined(LINUX)
15 #include <netdb.h>
16 #include <netinet/udp.h>
17 struct iphdr {
18 #if __BYTE_ORDER == __LITTLE_ENDIAN
19 u_int8_t ihl:4,
20 version:4;
21 #elif __BYTE_ORDER == __BIG_ENDIAN
22 u_int8_t version:4,
23 ihl:4;
24 #else
25 #error "Please fix <asm/byteorder.h>"
26 #endif
27 u_int8_t tos;
28 u_int16_t tot_len;
29 u_int16_t id;
30 u_int16_t frag_off;
31 u_int8_t ttl;
32 u_int8_t protocol;
33 u_int16_t check;
34 struct in_addr saddr;
35 struct in_addr daddr;
36 //The options start here.
37 };
38 #else // LINUX
39 #include <linux/ip.h>
40 #include <linux/udp.h>
41 #endif // LINUX
42
43 #include "t_layer.hh"
44 #include "Params.hh"
45
50 class udp_layer : public layer {
51 Params _params;
52 struct iphdr* _iphdr;
53 struct udphdr* _udphdr;
54 struct sockaddr_in _saddr;
55 struct sockaddr_in _daddr;
56
65 unsigned short inet_check_sum(const void *p_buffer, size_t p_header_length, const unsigned short p_initial_sum = 0);
66
67 public:
68
74 udp_layer(const std::string & p_type, const std::string & p_param);
78 virtual ~udp_layer() {}
79
87 virtual void send_data(OCTETSTRING& data, Params& params);
95 virtual void receive_data(OCTETSTRING& data, Params& info);
96 }; // End of class udp_layer
97
iphdr::tot_len
u_int16_t tot_len
Definition: udp_layer.hh:28
iphdr::version
u_int8_t version
Definition: udp_layer.hh:19
iphdr::ttl
u_int8_t ttl
Definition: udp_layer.hh:31
udp_layer
This class provides description of ITS UDP/IP protocol layer.
Definition: udp_layer.hh:50
iphdr::ihl
u_int8_t ihl
Definition: udp_layer.hh:19
layer
Forward declaration of TITAN class.
Definition: layer.hh:29
udp_layer::_params
Params _params
Definition: udp_layer.hh:51
iphdr::tos
u_int8_t tos
Definition: udp_layer.hh:27
iphdr
Definition: udp_layer.hh:17
udp_layer::~udp_layer
virtual ~udp_layer()
Default destructor.
Definition: udp_layer.hh:78
Params.hh
Header file for the parameter dictionary.
udp_layer::_iphdr
struct iphdr * _iphdr
Layer parameters.
Definition: udp_layer.hh:52
Params
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
iphdr::id
u_int16_t id
Definition: udp_layer.hh:29
udp_layer::_udphdr
struct udphdr * _udphdr
IP layer description.
Definition: udp_layer.hh:53
iphdr::saddr
struct in_addr saddr
Definition: udp_layer.hh:34
iphdr::check
u_int16_t check
Definition: udp_layer.hh:33
t_layer.hh
Header file for ITS abstract protocol layer definition.
iphdr::frag_off
u_int16_t frag_off
Definition: udp_layer.hh:30
iphdr::daddr
struct in_addr daddr
Definition: udp_layer.hh:35
iphdr::protocol
u_int8_t protocol
Definition: udp_layer.hh:32