Commit b8fc4b4f authored by garciay's avatar garciay
Browse files

STF525: Doxygen help support

parent 86d329de
#include "Asn1cEncDec.hh"
#include "loggers.hh"
// basic types
void titan2asn1c(const INTEGER& t, long& a)
{
if(t.is_native()){
a = (int)t;
}else{
long long int n = t.get_long_long_val();
if(n >= LONG_MIN && n <= LONG_MAX){
a = (long)n;
}else{
// TODO: what to do here?
}
}
}
void titan2asn1c(const INTEGER& t, unsigned long& a)
{
if(t.is_native()){
int n = (int)t;
if(n >= 0) {
a = (unsigned)n;
}else{
// TODO: what to do here?
}
}else{
long long int n = t.get_long_long_val();
if(n >= 0 && n <= (long long int)ULONG_MAX){
a = (unsigned long)n;
}else{
// TODO: what to do here?
}
}
}
void titan2asn1c(const INTEGER& t, INTEGER_t& a) {
if(t.is_native()){
asn_long2INTEGER(&a, (int)t);
}else{
long long int n = t.get_long_long_val();
if(n >= LONG_MIN && n <= LONG_MAX){
asn_long2INTEGER(&a, (long)n);
}else if(n <= (long long int)ULONG_MAX){
asn_ulong2INTEGER(&a, (unsigned long)n);
}else{
// TODO: what to do here?
}
}
}
INTEGER asn1c2titan(const INTEGER_t& a) {
long n;
unsigned long un;
INTEGER i;
if( 0 == asn_INTEGER2long(&a, &n)) {
i.set_long_long_val((long long int)n);
}else if( 0 == asn_INTEGER2ulong(&a, &un)) {
i.set_long_long_val((long long int)un);
}else{
//TODO: What to do?
}
return i;
}
INTEGER asn1c2titan(long n)
{
INTEGER i;
i.set_long_long_val(n);
return i;
}
INTEGER asn1c2titan(unsigned long n)
{
INTEGER i;
i.set_long_long_val(n);
return i;
}
void titan2asn1c(const BOOLEAN& t, BOOLEAN_t& a) {
a = ((boolean)t) ? 0xFF : 0x00;
}
BOOLEAN asn1c2titan(const BOOLEAN_t& a) {
return BOOLEAN(!!a);
}
void titan2asn1c(const OCTETSTRING& t, OCTET_STRING_t& a) {
OCTET_STRING_fromBuf(&a, (const char*)(const unsigned char*)t, t.lengthof());
}
OCTETSTRING asn1c2titan(const OCTET_STRING_t& a) {
return OCTETSTRING(a.size, a.buf);
}
void titan2asn1c(const BITSTRING& t, BIT_STRING_t& a) {
int buf_size = (t.lengthof()+7)/8;
OCTET_STRING_fromBuf((OCTET_STRING_t*)&a, (const char*)(const unsigned char*)t, buf_size);
a.bits_unused = (buf_size*8) - t.lengthof();
}
BITSTRING asn1c2titan(const BIT_STRING_t& a) {
return BITSTRING(a.size*8 - a.bits_unused, a.buf);
}
//// basic types
//void titan2asn1c(const INTEGER& t, long& a)
//{
// if(t.is_native()){
// a = (int)t;
// }else{
// long long int n = t.get_long_long_val();
// if(n >= LONG_MIN && n <= LONG_MAX){
// a = (long)n;
// }else{
// // TODO: what to do here?
// }
// }
//}
//
//void titan2asn1c(const INTEGER& t, unsigned long& a)
//{
// if(t.is_native()){
// int n = (int)t;
// if(n >= 0) {
// a = (unsigned)n;
// }else{
// // TODO: what to do here?
// }
// }else{
// long long int n = t.get_long_long_val();
// if(n >= 0 && n <= (long long int)ULONG_MAX){
// a = (unsigned long)n;
// }else{
// // TODO: what to do here?
// }
// }
//}
//
//void titan2asn1c(const INTEGER& t, INTEGER_t& a) {
// if(t.is_native()){
// asn_long2INTEGER(&a, (int)t);
// }else{
// long long int n = t.get_long_long_val();
// if(n >= LONG_MIN && n <= LONG_MAX){
// asn_long2INTEGER(&a, (long)n);
// }else if(n <= (long long int)ULONG_MAX){
// asn_ulong2INTEGER(&a, (unsigned long)n);
// }else{
// // TODO: what to do here?
// }
// }
//}
//
//INTEGER asn1c2titan(const INTEGER_t& a) {
// long n;
// unsigned long un;
// INTEGER i;
//
// if( 0 == asn_INTEGER2long(&a, &n)) {
// i.set_long_long_val((long long int)n);
// }else if( 0 == asn_INTEGER2ulong(&a, &un)) {
// i.set_long_long_val((long long int)un);
// }else{
// //TODO: What to do?
// }
// return i;
//}
//
//INTEGER asn1c2titan(long n)
//{
// INTEGER i;
// i.set_long_long_val(n);
// return i;
//}
//
//INTEGER asn1c2titan(unsigned long n)
//{
// INTEGER i;
// i.set_long_long_val(n);
// return i;
//}
//
//void titan2asn1c(const BOOLEAN& t, BOOLEAN_t& a) {
// a = ((boolean)t) ? 0xFF : 0x00;
//}
//
//BOOLEAN asn1c2titan(const BOOLEAN_t& a) {
// return BOOLEAN(!!a);
//}
//
//void titan2asn1c(const OCTETSTRING& t, OCTET_STRING_t& a) {
// OCTET_STRING_fromBuf(&a, (const char*)(const unsigned char*)t, t.lengthof());
//}
//
//OCTETSTRING asn1c2titan(const OCTET_STRING_t& a) {
// return OCTETSTRING(a.size, a.buf);
//}
//
//void titan2asn1c(const BITSTRING& t, BIT_STRING_t& a) {
// int buf_size = (t.lengthof()+7)/8;
// OCTET_STRING_fromBuf((OCTET_STRING_t*)&a, (const char*)(const unsigned char*)t, buf_size);
// a.bits_unused = (buf_size*8) - t.lengthof();
//}
//BITSTRING asn1c2titan(const BIT_STRING_t& a) {
// return BITSTRING(a.size*8 - a.bits_unused, a.buf);
//}
extern "C" int asn1c_collect_encoded_data(const void *buffer, size_t size, void *application_specific_key)
......
#ifndef ASN1CENCDEC_HH
#define ASN1CENCDEC_HH
#pragma once
// include titan headers
#include "TTCN3.hh"
......@@ -19,70 +18,67 @@ extern "C" {
#undef OPTIONAL
#endif
template<typename TT, typename TA>
TT asn1c2titan(const TA& a) {
// default implementation:
return TT(a);
}
// basic types
void titan2asn1c(const INTEGER& t, long& a);
void titan2asn1c(const INTEGER& t, unsigned long& a);
void titan2asn1c(const INTEGER& t, INTEGER_t& a);
void titan2asn1c(const BOOLEAN& t, BOOLEAN_t& a);
void titan2asn1c(const OCTETSTRING& t, OCTET_STRING_t& a);
void titan2asn1c(const BITSTRING& t, BIT_STRING_t& a);
INTEGER asn1c2titan(const INTEGER_t&);
INTEGER asn1c2titan(long);
OCTETSTRING asn1c2titan(const OCTET_STRING_t&);
BITSTRING asn1c2titan(const BIT_STRING_t&);
// template for optional value
template <typename TT, typename TA>
OPTIONAL<TT> asn1c2titan_opt(const TA * pa) {
if(pa) {
return OPTIONAL<TT>(asn1c2titan(*pa));
}
return OPTIONAL<TT>(OMIT_VALUE);
}
template <typename TT, typename TA>
void titan2asn1c_opt(const OPTIONAL<TT> & ot, TA *& a){
if(ot.is_present()){
a = new TA;
titan2asn1c((const TT&)ot, *a);
}else{
a = NULL;
}
}
template<typename T, typename TS, typename TA>
void titan2asn1c_seq(const TS& t, TA& a){
a.list.array = (T**)calloc(t.n_elem(), sizeof(void*));
a.list.count = t.n_elem();
a.list.size = sizeof(void*)*a.list.count;
for (int i = 0; i < t.n_elem(); i++){
a.list.array[i] = (T*)malloc(sizeof(T));
titan2asn1c(t[i], *a.list.array[i]);
}
}
template<typename TS, typename TA>
TS asn1c2titan_seq(const TA& a)
{
TS t;
t.set_size(a.list.count);
for (int i = 0; i < a.list.count; i++){
t[i] = asn1c2titan(*a.list.array[i]);
}
return t;
}
//template<typename TT, typename TA>
//TT asn1c2titan(const TA& a) {
// // default implementation:
// return TT(a);
//}
//
//// basic types
//void titan2asn1c(const INTEGER& t, long& a);
//void titan2asn1c(const INTEGER& t, unsigned long& a);
//void titan2asn1c(const INTEGER& t, INTEGER_t& a);
//void titan2asn1c(const BOOLEAN& t, BOOLEAN_t& a);
//void titan2asn1c(const OCTETSTRING& t, OCTET_STRING_t& a);
//void titan2asn1c(const BITSTRING& t, BIT_STRING_t& a);
//
//INTEGER asn1c2titan(const INTEGER_t&);
//INTEGER asn1c2titan(long);
//OCTETSTRING asn1c2titan(const OCTET_STRING_t&);
//BITSTRING asn1c2titan(const BIT_STRING_t&);
//
//// template for optional value
//template <typename TT, typename TA>
//OPTIONAL<TT> asn1c2titan_opt(const TA * pa) {
// if(pa) {
// return OPTIONAL<TT>(asn1c2titan(*pa));
// }
// return OPTIONAL<TT>(OMIT_VALUE);
//}
//
//template <typename TT, typename TA>
//void titan2asn1c_opt(const OPTIONAL<TT> & ot, TA *& a){
// if(ot.is_present()){
// a = new TA;
// titan2asn1c((const TT&)ot, *a);
// }else{
// a = NULL;
// }
//}
//
//template<typename T, typename TS, typename TA>
//void titan2asn1c_seq(const TS& t, TA& a){
// a.list.array = (T**)calloc(t.n_elem(), sizeof(void*));
// a.list.count = t.n_elem();
// a.list.size = sizeof(void*)*a.list.count;
// for (int i = 0; i < t.n_elem(); i++){
// a.list.array[i] = (T*)malloc(sizeof(T));
// titan2asn1c(t[i], *a.list.array[i]);
// }
//}
//
//template<typename TS, typename TA>
//TS asn1c2titan_seq(const TA& a)
//{
// TS t;
// t.set_size(a.list.count);
// for (int i = 0; i < a.list.count; i++){
// t[i] = asn1c2titan(*a.list.array[i]);
// }
// return t;
//}
int asn1c_per2ber(asn_TYPE_descriptor_t &td, const TTCN_Buffer & per, TTCN_Buffer & ber, void** ctx );
int asn1c_ber2per(asn_TYPE_descriptor_t &td, const TTCN_Buffer & ber, TTCN_Buffer & per, void** ctx );
// int asn1c_oer2xer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & oer, TTCN_Buffer & xer, void** ctx );
// int asn1c_xer2oer(asn_TYPE_descriptor_t &td, const TTCN_Buffer & xer, TTCN_Buffer & oer, void** ctx );
#endif
This diff is collapsed.
#ifndef ITS_ContainerCodec_HH
#define ITS_ContainerCodec_HH
#include "Asn1cEncDec.hh"
#include "ITS_Container.hh"
// ItsPduHeader
struct ItsPduHeader;
void titan2asn1c(const ITS__Container::ItsPduHeader&, ItsPduHeader&);
ITS__Container::ItsPduHeader asn1c2titan(const ItsPduHeader& a);
// ReferencePosition
struct ReferencePosition;
void titan2asn1c(const ITS__Container::ReferencePosition&, ReferencePosition& a);
ITS__Container::ReferencePosition asn1c2titan(const ReferencePosition& a);
// VehicleRole
void titan2asn1c(const ITS__Container::VehicleRole&, long& a);
//template <>
//ITS__Container::VehicleRole asn1c2titan<ITS__Container::VehicleRole>(const long& a);
//PathHistory
struct PathHistory;
void titan2asn1c(const ITS__Container::PathHistory&, PathHistory& a);
ITS__Container::PathHistory asn1c2titan(const PathHistory& a);
// ProtectedCommunicationZonesRSU
struct ProtectedCommunicationZonesRSU;
void titan2asn1c(const ITS__Container::ProtectedCommunicationZonesRSU&, ProtectedCommunicationZonesRSU&);
ITS__Container::ProtectedCommunicationZonesRSU asn1c2titan(const ProtectedCommunicationZonesRSU&);
// Heading
struct Heading;
void titan2asn1c(const ITS__Container::Heading&, Heading& a);
ITS__Container::Heading asn1c2titan(const Heading& a);
// Speed
struct Speed;
void titan2asn1c(const ITS__Container::Speed&, Speed& a);
ITS__Container::Speed asn1c2titan(const Speed& a);
// VehicleLength
struct VehicleLength;
void titan2asn1c(const ITS__Container::VehicleLength&, VehicleLength& a);
ITS__Container::VehicleLength asn1c2titan(const VehicleLength& a);
// LongitudinalAcceleration
struct LongitudinalAcceleration;
void titan2asn1c(const ITS__Container::LongitudinalAcceleration&, LongitudinalAcceleration& a);
ITS__Container::LongitudinalAcceleration asn1c2titan(const LongitudinalAcceleration& a);
// Curvature
struct Curvature;
void titan2asn1c(const ITS__Container::Curvature&, Curvature& a);
ITS__Container::Curvature asn1c2titan(const Curvature& a);
// YawRate
struct YawRate;
void titan2asn1c(const ITS__Container::YawRate&, YawRate& a);
ITS__Container::YawRate asn1c2titan(const YawRate& a);
// SteeringWheelAngle
struct SteeringWheelAngle;
void titan2asn1c(const ITS__Container::SteeringWheelAngle&, SteeringWheelAngle& a);
ITS__Container::SteeringWheelAngle asn1c2titan(const SteeringWheelAngle& a);
// LateralAcceleration
struct LateralAcceleration;
void titan2asn1c(const ITS__Container::LateralAcceleration&, LateralAcceleration& a);
ITS__Container::LateralAcceleration asn1c2titan(const LateralAcceleration& a);
// VerticalAcceleration
struct VerticalAcceleration;
void titan2asn1c(const ITS__Container::VerticalAcceleration&, VerticalAcceleration& a);
ITS__Container::VerticalAcceleration asn1c2titan(const VerticalAcceleration& a);
// CenDsrcTollingZone
struct CenDsrcTollingZone;
void titan2asn1c(const ITS__Container::CenDsrcTollingZone&, CenDsrcTollingZone& a);
ITS__Container::CenDsrcTollingZone asn1c2titan(const CenDsrcTollingZone& a);
// DriveDirection
void titan2asn1c(const ITS__Container::DriveDirection&, long& a);
// CurvatureCalculationMode
void titan2asn1c(const ITS__Container::CurvatureCalculationMode&, long&);
// DangerousGoodsBasic
void titan2asn1c(const ITS__Container::DangerousGoodsBasic&, long& a);
// CauseCode
struct CauseCode;
void titan2asn1c(const ITS__Container::CauseCode&, CauseCode& a);
ITS__Container::CauseCode asn1c2titan(const CauseCode& a);
// TrafficRule
void titan2asn1c(const ITS__Container::TrafficRule&t, long& a);
// PtActivation
struct PtActivation;
void titan2asn1c(const ITS__Container::PtActivation&t, PtActivation& a);
ITS__Container::PtActivation asn1c2titan(const PtActivation& a);
//ClosedLanes
struct ClosedLanes;
void titan2asn1c(const ITS__Container::ClosedLanes&t, ClosedLanes& a);
ITS__Container::ClosedLanes asn1c2titan(const ClosedLanes& a);
// PosConfidenceEllipse
struct PosConfidenceEllipse;
void titan2asn1c(const ITS__Container::PosConfidenceEllipse&t, PosConfidenceEllipse& a);
ITS__Container::PosConfidenceEllipse asn1c2titan(const PosConfidenceEllipse& a);
struct Altitude;
void titan2asn1c(const ITS__Container::Altitude&t, Altitude& a);
ITS__Container::Altitude asn1c2titan(const Altitude& a);
/*
struct TYPE;
void titan2asn1c(const ITS__Container::TYPE&t, TYPE& a);
ITS__Container::TYPE asn1c2titan(const TYPE& a);
*/
#endif
//#ifndef ITS_ContainerCodec_HH
//#define ITS_ContainerCodec_HH
//
//#include "Asn1cEncDec.hh"
//#include "ITS_Container.hh"
//
//// ItsPduHeader
//struct ItsPduHeader;
//void titan2asn1c(const ITS__Container::ItsPduHeader&, ItsPduHeader&);
//ITS__Container::ItsPduHeader asn1c2titan(const ItsPduHeader& a);
//
//// ReferencePosition
//struct ReferencePosition;
//void titan2asn1c(const ITS__Container::ReferencePosition&, ReferencePosition& a);
//ITS__Container::ReferencePosition asn1c2titan(const ReferencePosition& a);
//
//// VehicleRole
//void titan2asn1c(const ITS__Container::VehicleRole&, long& a);
////template <>
////ITS__Container::VehicleRole asn1c2titan<ITS__Container::VehicleRole>(const long& a);
//
////PathHistory
//struct PathHistory;
//void titan2asn1c(const ITS__Container::PathHistory&, PathHistory& a);
//ITS__Container::PathHistory asn1c2titan(const PathHistory& a);
//
//// ProtectedCommunicationZonesRSU
//struct ProtectedCommunicationZonesRSU;
//void titan2asn1c(const ITS__Container::ProtectedCommunicationZonesRSU&, ProtectedCommunicationZonesRSU&);
//ITS__Container::ProtectedCommunicationZonesRSU asn1c2titan(const ProtectedCommunicationZonesRSU&);
//
//// Heading
//struct Heading;
//void titan2asn1c(const ITS__Container::Heading&, Heading& a);
//ITS__Container::Heading asn1c2titan(const Heading& a);
//
//// Speed
//struct Speed;
//void titan2asn1c(const ITS__Container::Speed&, Speed& a);
//ITS__Container::Speed asn1c2titan(const Speed& a);
//
//// VehicleLength
//struct VehicleLength;
//void titan2asn1c(const ITS__Container::VehicleLength&, VehicleLength& a);
//ITS__Container::VehicleLength asn1c2titan(const VehicleLength& a);
//
//// LongitudinalAcceleration
//struct LongitudinalAcceleration;
//void titan2asn1c(const ITS__Container::LongitudinalAcceleration&, LongitudinalAcceleration& a);
//ITS__Container::LongitudinalAcceleration asn1c2titan(const LongitudinalAcceleration& a);
//
//// Curvature
//struct Curvature;
//void titan2asn1c(const ITS__Container::Curvature&, Curvature& a);
//ITS__Container::Curvature asn1c2titan(const Curvature& a);
//
//// YawRate
//struct YawRate;
//void titan2asn1c(const ITS__Container::YawRate&, YawRate& a);
//ITS__Container::YawRate asn1c2titan(const YawRate& a);
//
//// SteeringWheelAngle
//struct SteeringWheelAngle;
//void titan2asn1c(const ITS__Container::SteeringWheelAngle&, SteeringWheelAngle& a);
//ITS__Container::SteeringWheelAngle asn1c2titan(const SteeringWheelAngle& a);
//
//// LateralAcceleration
//struct LateralAcceleration;
//void titan2asn1c(const ITS__Container::LateralAcceleration&, LateralAcceleration& a);
//ITS__Container::LateralAcceleration asn1c2titan(const LateralAcceleration& a);
//
//// VerticalAcceleration
//struct VerticalAcceleration;
//void titan2asn1c(const ITS__Container::VerticalAcceleration&, VerticalAcceleration& a);
//ITS__Container::VerticalAcceleration asn1c2titan(const VerticalAcceleration& a);
//
//// CenDsrcTollingZone
//struct CenDsrcTollingZone;
//void titan2asn1c(const ITS__Container::CenDsrcTollingZone&, CenDsrcTollingZone& a);
//ITS__Container::CenDsrcTollingZone asn1c2titan(const CenDsrcTollingZone& a);
//
//// DriveDirection
//void titan2asn1c(const ITS__Container::DriveDirection&, long& a);
//
//// CurvatureCalculationMode
//void titan2asn1c(const ITS__Container::CurvatureCalculationMode&, long&);
//
//// DangerousGoodsBasic
//void titan2asn1c(const ITS__Container::DangerousGoodsBasic&, long& a);
//
//// CauseCode
//struct CauseCode;
//void titan2asn1c(const ITS__Container::CauseCode&, CauseCode& a);
//ITS__Container::CauseCode asn1c2titan(const CauseCode& a);
//
//// TrafficRule
//void titan2asn1c(const ITS__Container::TrafficRule&t, long& a);
//
//// PtActivation
//struct PtActivation;
//void titan2asn1c(const ITS__Container::PtActivation&t, PtActivation& a);
//ITS__Container::PtActivation asn1c2titan(const PtActivation& a);
//
////ClosedLanes
//struct ClosedLanes;
//void titan2asn1c(const ITS__Container::ClosedLanes&t, ClosedLanes& a);
//ITS__Container::ClosedLanes asn1c2titan(const ClosedLanes& a);
//
//// PosConfidenceEllipse
//struct PosConfidenceEllipse;
//void titan2asn1c(const ITS__Container::PosConfidenceEllipse&t, PosConfidenceEllipse& a);
//ITS__Container::PosConfidenceEllipse asn1c2titan(const PosConfidenceEllipse& a);
//
//struct Altitude;
//void titan2asn1c(const ITS__Container::Altitude&t, Altitude& a);
//ITS__Container::Altitude asn1c2titan(const Altitude& a);
//
//
//
///*
//struct TYPE;
//void titan2asn1c(const ITS__Container::TYPE&t, TYPE& a);
//ITS__Container::TYPE asn1c2titan(const TYPE& a);
//*/
//
//#endif