GeoNetworkingCodec.hh
Go to the documentation of this file.
#ifndef GNCODEC_H
#define GNCODEC_H
#include "Codec.hh"
#include "Params.hh"
class Base_Type;
class TTCN_Typedescriptor_t;
class TTCN_Buffer;
namespace LibItsGeoNetworking__TypesAndValues {
class GeoNetworkingPdu;
class GnNonSecuredPacket;
class HeaderTST;
class ExtendedHeader;
class DecodedPayload;
};
namespace LibItsSecurity__TypesAndValues {
class SecuredMessage;
};
struct Encoding_Context {
unsigned char next_header;
unsigned char header_type;
unsigned int length_position;
unsigned int length;
Encoding_Context() { next_header = 0xff; header_type = 0xff; length_position = -1; length = -1; }
};
//typedef struct Encoding_Context Encoding_Context;
struct Decoding_Context {
unsigned char next_header;
unsigned char header_type;
unsigned char header_sub_type;
unsigned char traffic_class;
unsigned int lifetime;
unsigned int length;
std::string payload;
Decoding_Context() : payload() { next_header = 0xff; header_type = 0xff; header_sub_type = 0xff; lifetime = 0; length = -1; }
};
//typedef struct Decoding_Context Decoding_Context;
class GeoNetworkingCodec : public Codec<LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu> {
Encoding_Context _ec;
Decoding_Context _dc;
int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);
int encode_extendedHeader(const LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& encoding_buffer);
int decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer);
int decode_headerTST(LibItsGeoNetworking__TypesAndValues::HeaderTST& u, TTCN_Buffer& decoding_buffer);
int decode_extendedHeader(LibItsGeoNetworking__TypesAndValues::ExtendedHeader& u, TTCN_Buffer& decodin_buffer);
public:
explicit GeoNetworkingCodec() : Codec<LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu>(), _ec(), _dc() { };
virtual ~GeoNetworkingCodec() { };
virtual int encode (const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg, OCTETSTRING& data);
virtual int decode (const OCTETSTRING& data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg, Params* params = NULL);
int encode (const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket& p_gnNonSecuredPacket, OCTETSTRING& data); // TODO Duplicate code with virtual encode, to be enhanced
};
#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