udp_layer.hh
Go to the documentation of this file.
#pragma once
#include <arpa/inet.h>
#if !defined(LINUX)
#include <netdb.h>
#include <netinet/udp.h>
struct iphdr {
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int8_t ihl:4,
version:4;
#elif __BYTE_ORDER == __BIG_ENDIAN
u_int8_t version:4,
ihl:4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
u_int8_t tos;
u_int16_t tot_len;
u_int16_t id;
u_int16_t frag_off;
u_int8_t ttl;
u_int8_t protocol;
u_int16_t check;
struct in_addr saddr;
struct in_addr daddr;
//The options start here.
};
#else // LINUX
#include <linux/ip.h>
#include <linux/udp.h>
#endif // LINUX
#include "t_layer.hh"
#include "Params.hh"
class udp_layer : public layer {
Params _params;
struct iphdr* _iphdr;
struct udphdr* _udphdr;
struct sockaddr_in _saddr;
struct sockaddr_in _daddr;
unsigned short inet_check_sum(const void *p_buffer, size_t p_header_length, const unsigned short p_initial_sum = 0);
public:
udp_layer(const std::string & p_type, const std::string & p_param);
virtual ~udp_layer() {}
virtual void send_data(OCTETSTRING& data, Params& params);
virtual void receive_data(OCTETSTRING& data, Params& info);
}; // End of class udp_layer
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