Commit bd17c801 authored by garciay's avatar garciay
Browse files

Start tests on GeoNetworking codecs

parent 2bd2ce74
#include "LibItsGeoNetworking_encdecDeclarations.hh"
#include "GeoNetworkingCodec.hh"
#include "loggers.hh"
namespace LibItsGeoNetworking__EncdecDeclarations {
/****************************************************
* @desc External function to encode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingReq(LibItsGeoNetworking__TestSystem::GeoNetworkingReq const& p_geoNetworkingReq)
{
loggers::loggers::log("fx__enc__GeoNetworkingReq");
GeoNetworkingCodec codec;
OCTETSTRING os;
const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu & pdu = p_geoNetworkingReq.msgOut();
codec.encode(pdu, os);
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a GeoNetworkingReq type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingReq(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingReq");
return -1;
}
/****************************************************
* @desc External function to encode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__GeoNetworkingInd(LibItsGeoNetworking__TestSystem::GeoNetworkingInd const& p)
{
loggers::loggers::log("fx__enc__GeoNetworkingInd");
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a GeoNetworkingInd type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__GeoNetworkingInd(BITSTRING& b, LibItsGeoNetworking__TestSystem::GeoNetworkingInd& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingInd");
return -1;
}
/****************************************************
* @desc External function to encode a GeoNetworkingPdu type
* @param value to encode
......@@ -8,7 +61,8 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
****************************************************/
BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu const& p)
{
return int2bit(0,8);
loggers::loggers::log("fx__enc__GeoNetworkingPdu");
return int2bit(0,8);
}
/****************************************************
......@@ -19,6 +73,7 @@ BITSTRING fx__enc__GeoNetworkingPdu(LibItsGeoNetworking__TypesAndValues::GeoNetw
INTEGER fx__dec__GeoNetworkingPdu(BITSTRING& b, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& p)
{
loggers::loggers::log("fx__dec__GeoNetworkingPdu");
return -1;
}
......@@ -29,6 +84,7 @@ INTEGER fx__dec__GeoNetworkingPdu(BITSTRING& b, LibItsGeoNetworking__TypesAndVal
****************************************************/
BITSTRING fx__enc__Payload(const LibItsGeoNetworking__TypesAndValues::Payload& p)
{
loggers::loggers::log("fx__enc__Payload");
return int2bit(0,8);
}
......
#include "GeoNetworkingCodec.hh"
#include "loggers.hh"
int GeoNetworkingCodec::encode (const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg, OCTETSTRING& data)
{
TTCN_Buffer encoding_buffer;
loggers::loggers::log("GeoNetworkingCodec::encode");
for(int i = 0; i < msg.get_count(); i++) {
loggers::loggers::log("GeoNetworkingCodec::encode: processing %s\n", msg.fld_name(i));
msg.encode(*msg.fld_descr(i), encoding_buffer, TTCN_EncDec::CT_RAW);
loggers::loggers::log_to_hexa(&encoding_buffer);
}
data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
return 0;
}
int GeoNetworkingCodec::decode (const OCTETSTRING& data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu& msg)
{
loggers::loggers::log("fx__enc__GeoNetworkingReq");
return 0;
}
#ifndef GNCODEC_H
#define GNCODEC_H
#include "GeoNetworking_Types.hh"
#include "Codec.h"
class GeoNetworkingCodec : public Codec<LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu> {
public:
virtual int encode (const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu&, OCTETSTRING& data);
virtual int decode (const OCTETSTRING& data, LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu&);
};
#endif
#ifndef GNTYPES_H
#define GNTYPES_H
#include "LibItsGeoNetworking_TypesAndValues.hh"
#endif
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_any
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
LogFile := "../logs/%e.%h-%r.%s"
FileMask := LOG_ALL | MATCHING | DEBUG
ConsoleMask := LOG_ALL | MATCHING | DEBUG
LogSourceInfo := Stack
LogEntityName:= Yes
LogEventTypes:= Yes
#TimeStampFormat := DateTime
[TESTPORT_PARAMETERS]
# In this section you can specify parameters that are passed to Test Ports.
[EXECUTE]
TestCodec_GeoNetworking.tc_GeoNetReq_BroadcastPacket
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
KillTimer := 10.0
TCPPort := 0
LocalAddress := 127.0.0.1
TCPPort := 12000
NumHCs := 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment