Loading ccsrc/Protocols/GeoNetworking/decoding_context.cc 0 → 100644 +24 −0 Original line number Diff line number Diff line #pragma once #include "decoding_context.hh" void decoding_context::reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; } unsigned char decoding_context::get_next_header() { return _next_header; }; void decoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; unsigned char decoding_context::get_header_type() { return _header_type; }; void decoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; unsigned char decoding_context::get_header_sub_type() { return _header_sub_type; }; void decoding_context::set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; unsigned char decoding_context::get_traffic_class() { return _traffic_class; }; void decoding_context::set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; unsigned int decoding_context::get_lifetime() { return _lifetime; }; void decoding_context::set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; unsigned int decoding_context::get_length() { return _length; }; void decoding_context::set_length(const unsigned int p_length) { _length = p_length; }; ccsrc/Protocols/GeoNetworking/decoding_context.hh +13 −19 Original line number Diff line number Diff line Loading @@ -13,25 +13,19 @@ class decoding_context { public: explicit decoding_context() { reset(); }; ~decoding_context(){}; inline void reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; }; void reset(); public: inline unsigned char get_next_header() { return _next_header; }; inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; inline unsigned char get_header_type() { return _header_type; }; inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; inline unsigned char get_header_sub_type() { return _header_sub_type; }; inline void set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; inline unsigned char get_traffic_class() { return _traffic_class; }; inline void set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; inline unsigned int get_lifetime() { return _lifetime; }; inline void set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; inline unsigned int get_length() { return _length; }; inline void set_length(const unsigned int p_length) { _length = p_length; }; unsigned char get_next_header(); void set_next_header(const unsigned char p_next_header); unsigned char get_header_type(); void set_header_type(const unsigned char p_header_type); unsigned char get_header_sub_type(); void set_header_sub_type(const unsigned char p_header_sub_type); unsigned char get_traffic_class(); void set_traffic_class(const unsigned char p_traffic_class); unsigned int get_lifetime(); void set_lifetime(const unsigned int p_lifetime); unsigned int get_length(); void set_length(const unsigned int p_length); }; // End of class decoding_context ccsrc/Protocols/GeoNetworking/encoding_context.cc 0 → 100644 +23 −0 Original line number Diff line number Diff line #pragma once #include "encoding_context.hh" void encoding_context::reset() { _basic_header = 0xff; _next_header = 0xff; _header_type = 0xff; _length_position = -1; _length = -1; } unsigned char encoding_context::get_basic_header() { return _basic_header; }; void encoding_context::set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; unsigned char encoding_context::get_next_header() { return _next_header; }; void encoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; unsigned char encoding_context::get_header_type() { return _header_type; }; void encoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; unsigned int encoding_context::get_length_position() { return _length_position; }; void encoding_context::set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; unsigned int encoding_context::get_length() { return _length; }; void encoding_context::set_length(const unsigned int p_length) { _length = p_length; }; ccsrc/Protocols/GeoNetworking/encoding_context.hh +11 −17 Original line number Diff line number Diff line Loading @@ -11,23 +11,17 @@ class encoding_context { public: explicit encoding_context() { reset(); } inline void reset() { _basic_header = 0xff; _next_header = 0xff; _header_type = 0xff; _length_position = -1; _length = -1; } void reset(); public: inline unsigned char get_basic_header() { return _basic_header; }; inline void set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; inline unsigned char get_next_header() { return _next_header; }; inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; inline unsigned char get_header_type() { return _header_type; }; inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; inline unsigned int get_length_position() { return _length_position; }; inline void set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; inline unsigned int get_length() { return _length; }; inline void set_length(const unsigned int p_length) { _length = p_length; }; unsigned char get_basic_header(); void set_basic_header(const unsigned char p_basic_header); unsigned char get_next_header(); void set_next_header(const unsigned char p_next_header); unsigned char get_header_type(); void set_header_type(const unsigned char p_header_type); unsigned int get_length_position(); void set_length_position(const unsigned int p_length_position); unsigned int get_length(); void set_length(const unsigned int p_length); }; // End of class encoding_context ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc +9 −9 Original line number Diff line number Diff line Loading @@ -23,17 +23,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GeoNe data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), loggers::get_instance().log("geonetworking_codec::encode (1): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (1): after replace: ", data); } loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (1): After encoding: ", data); loggers::get_instance().log("<<< geonetworking_codec::encode"); loggers::get_instance().log("<<< geonetworking_codec::encode (1)"); return 0; } Loading @@ -46,17 +46,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GnNon data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), loggers::get_instance().log("geonetworking_codec::encode (2): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); loggers::get_instance().log_msg("geonetworking_codec::encode (2): rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (2): after replace: ", data); } loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (2): After encoding: ", data); loggers::get_instance().log("<<< geonetworking_codec::encode"); loggers::get_instance().log("<<< geonetworking_codec::encode (2)"); return 0; } Loading Loading
ccsrc/Protocols/GeoNetworking/decoding_context.cc 0 → 100644 +24 −0 Original line number Diff line number Diff line #pragma once #include "decoding_context.hh" void decoding_context::reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; } unsigned char decoding_context::get_next_header() { return _next_header; }; void decoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; unsigned char decoding_context::get_header_type() { return _header_type; }; void decoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; unsigned char decoding_context::get_header_sub_type() { return _header_sub_type; }; void decoding_context::set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; unsigned char decoding_context::get_traffic_class() { return _traffic_class; }; void decoding_context::set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; unsigned int decoding_context::get_lifetime() { return _lifetime; }; void decoding_context::set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; unsigned int decoding_context::get_length() { return _length; }; void decoding_context::set_length(const unsigned int p_length) { _length = p_length; };
ccsrc/Protocols/GeoNetworking/decoding_context.hh +13 −19 Original line number Diff line number Diff line Loading @@ -13,25 +13,19 @@ class decoding_context { public: explicit decoding_context() { reset(); }; ~decoding_context(){}; inline void reset() { _next_header = 0xff; _header_type = 0xff; _header_sub_type = 0xff; _lifetime = 0; _length = -1; }; void reset(); public: inline unsigned char get_next_header() { return _next_header; }; inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; inline unsigned char get_header_type() { return _header_type; }; inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; inline unsigned char get_header_sub_type() { return _header_sub_type; }; inline void set_header_sub_type(const unsigned char p_header_sub_type) { _header_sub_type = p_header_sub_type; }; inline unsigned char get_traffic_class() { return _traffic_class; }; inline void set_traffic_class(const unsigned char p_traffic_class) { _traffic_class = p_traffic_class; }; inline unsigned int get_lifetime() { return _lifetime; }; inline void set_lifetime(const unsigned int p_lifetime) { _lifetime = p_lifetime; }; inline unsigned int get_length() { return _length; }; inline void set_length(const unsigned int p_length) { _length = p_length; }; unsigned char get_next_header(); void set_next_header(const unsigned char p_next_header); unsigned char get_header_type(); void set_header_type(const unsigned char p_header_type); unsigned char get_header_sub_type(); void set_header_sub_type(const unsigned char p_header_sub_type); unsigned char get_traffic_class(); void set_traffic_class(const unsigned char p_traffic_class); unsigned int get_lifetime(); void set_lifetime(const unsigned int p_lifetime); unsigned int get_length(); void set_length(const unsigned int p_length); }; // End of class decoding_context
ccsrc/Protocols/GeoNetworking/encoding_context.cc 0 → 100644 +23 −0 Original line number Diff line number Diff line #pragma once #include "encoding_context.hh" void encoding_context::reset() { _basic_header = 0xff; _next_header = 0xff; _header_type = 0xff; _length_position = -1; _length = -1; } unsigned char encoding_context::get_basic_header() { return _basic_header; }; void encoding_context::set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; unsigned char encoding_context::get_next_header() { return _next_header; }; void encoding_context::set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; unsigned char encoding_context::get_header_type() { return _header_type; }; void encoding_context::set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; unsigned int encoding_context::get_length_position() { return _length_position; }; void encoding_context::set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; unsigned int encoding_context::get_length() { return _length; }; void encoding_context::set_length(const unsigned int p_length) { _length = p_length; };
ccsrc/Protocols/GeoNetworking/encoding_context.hh +11 −17 Original line number Diff line number Diff line Loading @@ -11,23 +11,17 @@ class encoding_context { public: explicit encoding_context() { reset(); } inline void reset() { _basic_header = 0xff; _next_header = 0xff; _header_type = 0xff; _length_position = -1; _length = -1; } void reset(); public: inline unsigned char get_basic_header() { return _basic_header; }; inline void set_basic_header(const unsigned char p_basic_header) { _basic_header = p_basic_header; }; inline unsigned char get_next_header() { return _next_header; }; inline void set_next_header(const unsigned char p_next_header) { _next_header = p_next_header; }; inline unsigned char get_header_type() { return _header_type; }; inline void set_header_type(const unsigned char p_header_type) { _header_type = p_header_type; }; inline unsigned int get_length_position() { return _length_position; }; inline void set_length_position(const unsigned int p_length_position) { _length_position = p_length_position; }; inline unsigned int get_length() { return _length; }; inline void set_length(const unsigned int p_length) { _length = p_length; }; unsigned char get_basic_header(); void set_basic_header(const unsigned char p_basic_header); unsigned char get_next_header(); void set_next_header(const unsigned char p_next_header); unsigned char get_header_type(); void set_header_type(const unsigned char p_header_type); unsigned int get_length_position(); void set_length_position(const unsigned int p_length_position); unsigned int get_length(); void set_length(const unsigned int p_length); }; // End of class encoding_context
ccsrc/Protocols/GeoNetworking/geonetworking_codec.cc +9 −9 Original line number Diff line number Diff line Loading @@ -23,17 +23,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GeoNe data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), loggers::get_instance().log("geonetworking_codec::encode (1): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (1): after replace: ", data); } loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (1): After encoding: ", data); loggers::get_instance().log("<<< geonetworking_codec::encode"); loggers::get_instance().log("<<< geonetworking_codec::encode (1)"); return 0; } Loading @@ -46,17 +46,17 @@ int geonetworking_codec::encode(const LibItsGeoNetworking__TypesAndValues::GnNon data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); // Overwrite the payload length if (_ec.get_length() != (unsigned int)-1) { loggers::get_instance().log("geonetworking_codec::encode: length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), loggers::get_instance().log("geonetworking_codec::encode (2): length=%d - plLength_position = %d - plLength = %d", data.lengthof(), _ec.get_length_position(), _ec.get_length()); unsigned char b[] = {(unsigned char)((_ec.get_length() & 0x0000FF00) >> 8), (unsigned char)_ec.get_length()}; OCTETSTRING rpl(sizeof(b), b); loggers::get_instance().log_msg("geonetworking_codec::encode: rpl=", rpl); loggers::get_instance().log_msg("geonetworking_codec::encode (2): rpl=", rpl); data = replace(data, _ec.get_length_position(), rpl.lengthof(), rpl); loggers::get_instance().log_msg("geonetworking_codec::encode: after replace: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (2): after replace: ", data); } loggers::get_instance().log_msg("geonetworking_codec::encode: After encoding: ", data); loggers::get_instance().log_msg("geonetworking_codec::encode (2): After encoding: ", data); loggers::get_instance().log("<<< geonetworking_codec::encode"); loggers::get_instance().log("<<< geonetworking_codec::encode (2)"); return 0; } Loading