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 
12  class GeoNetworkingPdu;
13  class GnNonSecuredPacket;
14  class HeaderTST;
15  class ExtendedHeader;
16  class DecodedPayload;
17 };
18 
20  class SecuredMessage;
21 };
22 
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 
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 
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
unsigned int length_position
Definition: GeoNetworkingCodec.hh:26
unsigned char header_type
Definition: GeoNetworkingCodec.hh:25
Encoding_Context _ec
Definition: GeoNetworkingCodec.hh:48
Definition: geonetworking_layer.hh:32
GeoNetworkingCodec()
Definition: GeoNetworkingCodec.hh:59
Definition: GeoNetworkingCodec.hh:19
unsigned char next_header
Definition: GeoNetworkingCodec.hh:34
Definition: GeoNetworkingCodec.hh:23
unsigned char traffic_class
Definition: GeoNetworkingCodec.hh:37
Definition: GeoNetworkingCodec.hh:33
Header file for the parameter dictionary.
unsigned char next_header
Definition: GeoNetworkingCodec.hh:24
std::string payload
Definition: GeoNetworkingCodec.hh:40
unsigned int length
Definition: GeoNetworkingCodec.hh:39
Decoding_Context()
Definition: GeoNetworkingCodec.hh:42
Declare TITAN class.
Definition: Codec.hh:25
virtual ~GeoNetworkingCodec()
Definition: GeoNetworkingCodec.hh:60
unsigned char header_sub_type
Definition: GeoNetworkingCodec.hh:36
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
unsigned int length
Definition: GeoNetworkingCodec.hh:27
Decoding_Context _dc
Definition: GeoNetworkingCodec.hh:49
Header file for ITS abstract codec definition.
Encoding_Context()
Definition: GeoNetworkingCodec.hh:29
Definition: GeoNetworkingCodec.hh:46
unsigned char header_type
Definition: GeoNetworkingCodec.hh:35
unsigned int lifetime
Definition: GeoNetworkingCodec.hh:38