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

GeoNetworkingCodec.hh
Go to the documentation of this file.
1 #ifndef GNCODEC_H
2 #define GNCODEC_H
3
4 #include "Codec.hh"
5 #include "Params.hh"
6
7 class Base_Type;
8 class TTCN_Typedescriptor_t;
9 class TTCN_Buffer;
10
11 namespace LibItsGeoNetworking__TypesAndValues {
12 class GeoNetworkingPdu;
13 class GnNonSecuredPacket;
14 class HeaderTST;
15 class ExtendedHeader;
16 class DecodedPayload;
17 };
18
19 namespace LibItsSecurity__TypesAndValues {
20 class SecuredMessage;
21 };
22
23 struct Encoding_Context {
24 unsigned char next_header;
25 unsigned char header_type;
26 unsigned int length_position;
27 unsigned int length;
28
29 Encoding_Context() { next_header = 0xff; header_type = 0xff; length_position = -1; length = -1; }
30 };
31 //typedef struct Encoding_Context Encoding_Context;
32
33 struct Decoding_Context {
34 unsigned char next_header;
35 unsigned char header_type;
36 unsigned char header_sub_type;
37 unsigned char traffic_class;
38 unsigned int lifetime;
39 unsigned int length;
40 std::string payload;
41
42 Decoding_Context() : payload() { next_header = 0xff; header_type = 0xff; header_sub_type = 0xff; lifetime = 0; length = -1; }
43 };
44 //typedef struct Decoding_Context Decoding_Context;
45
46 class GeoNetworkingCodec : public Codec<LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu> {
47
48 Encoding_Context _ec;
49 Decoding_Context _dc;
50
51 int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);
52 int encode_extendedHeader(const LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& encoding_buffer);
53
54 int decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer);
55 int decode_headerTST(LibItsGeoNetworking__TypesAndValues::HeaderTST& u, TTCN_Buffer& decoding_buffer);
56 int decode_extendedHeader(LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& decodin_buffer);
57
58 public:
59 explicit GeoNetworkingCodec() : Codec<LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu>(), _ec(), _dc() { };
60 virtual ~GeoNetworkingCodec() { };
61
62 virtual int encode (const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg, OCTETSTRING& data);
63 virtual int decode (const OCTETSTRING& data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg, Params* params = NULL);
64
65 int encode (const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p_gnNonSecuredPacket, OCTETSTRING& data); // TODO Duplicate code with virtual encode, to be enhanced
66 };
67
68 #endif
Encoding_Context::length_position
unsigned int length_position
Definition: GeoNetworkingCodec.hh:26
Encoding_Context::header_type
unsigned char header_type
Definition: GeoNetworkingCodec.hh:25
GeoNetworkingCodec::_ec
Encoding_Context _ec
Definition: GeoNetworkingCodec.hh:48
LibItsGeoNetworking__TypesAndValues
Definition: geonetworking_layer.hh:32
GeoNetworkingCodec::GeoNetworkingCodec
GeoNetworkingCodec()
Definition: GeoNetworkingCodec.hh:59
LibItsSecurity__TypesAndValues
Definition: GeoNetworkingCodec.hh:19
Decoding_Context::next_header
unsigned char next_header
Definition: GeoNetworkingCodec.hh:34
Encoding_Context
Definition: GeoNetworkingCodec.hh:23
Decoding_Context::traffic_class
unsigned char traffic_class
Definition: GeoNetworkingCodec.hh:37
Decoding_Context
Definition: GeoNetworkingCodec.hh:33
Params.hh
Header file for the parameter dictionary.
Encoding_Context::next_header
unsigned char next_header
Definition: GeoNetworkingCodec.hh:24
Decoding_Context::payload
std::string payload
Definition: GeoNetworkingCodec.hh:40
Decoding_Context::length
unsigned int length
Definition: GeoNetworkingCodec.hh:39
Decoding_Context::Decoding_Context
Decoding_Context()
Definition: GeoNetworkingCodec.hh:42
Codec
Declare TITAN class.
Definition: Codec.hh:25
GeoNetworkingCodec::~GeoNetworkingCodec
virtual ~GeoNetworkingCodec()
Definition: GeoNetworkingCodec.hh:60
Decoding_Context::header_sub_type
unsigned char header_sub_type
Definition: GeoNetworkingCodec.hh:36
Params
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
Encoding_Context::length
unsigned int length
Definition: GeoNetworkingCodec.hh:27
GeoNetworkingCodec::_dc
Decoding_Context _dc
Definition: GeoNetworkingCodec.hh:49
Codec.hh
Header file for ITS abstract codec definition.
Encoding_Context::Encoding_Context
Encoding_Context()
Definition: GeoNetworkingCodec.hh:29
GeoNetworkingCodec
Definition: GeoNetworkingCodec.hh:46
Decoding_Context::header_type
unsigned char header_type
Definition: GeoNetworkingCodec.hh:35
Decoding_Context::lifetime
unsigned int lifetime
Definition: GeoNetworkingCodec.hh:38