diff --git a/ccsrc/Framework/include/oer_codec.hh b/ccsrc/Framework/include/oer_codec.hh deleted file mode 100644 index 51a32cd1c5ec5cb62d86d67d3a84d6f2b0389045..0000000000000000000000000000000000000000 --- a/ccsrc/Framework/include/oer_codec.hh +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "params.hh" - -class OCTETSTRING; -class CHARSTRING; -class BITSTRING; - -struct asn_TYPE_descriptor_s; -class asn1_recode_oer { -protected: - int xer2oer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int oer2xer(const asn_TYPE_descriptor_s &td, TTCN_Buffer &buf); - int recode(const asn_TYPE_descriptor_s &td, int from, int to, TTCN_Buffer &buf); -}; - -template <typename TPDU> class oer_codec : public asn1_recode_oer { -public: - virtual int encode(const TPDU &msg, BITSTRING &bits) = 0; - virtual int decode(const BITSTRING &bits, TPDU &msg) = 0; - -protected: - inline int _decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg) { - TTCN_Buffer buf(bit2oct(p_data)); - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - int rc = oer2xer(td, buf); - if (rc > 0) { - msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); - rc = buf.get_len(); - } - return rc; - } - inline int _encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data) { - int rc = -1; - TTCN_Buffer buf; - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); - if (buf.get_len() > 0) { - rc = xer2oer(td, buf); - if (rc > 0) { - p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); - } - } - return rc; - } -}; - -#endif diff --git a/ccsrc/Framework/include/per_codec.hh b/ccsrc/Framework/include/per_codec.hh deleted file mode 100644 index 077d74ad549b648d3deccc599e6039cb496a76eb..0000000000000000000000000000000000000000 --- a/ccsrc/Framework/include/per_codec.hh +++ /dev/null @@ -1,50 +0,0 @@ -/*! - * \file per_codec.hh - * \brief Header file for TITAN message to ASN.1 PER message codec. - * \author ETSI STF525 - * \copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * \version 0.1 - */ -#pragma once - -#include "asn1_recode_per.hh" -#include "params.hh" - -class BITSTRING; //! Forward declaration of TITAN class -class TTCN_Typedescriptor_t; //! Forward declaration of TITAN class - -struct asn_TYPE_descriptor_s; //! Declare asn1c class - -/*! - * \class per_codec - * \brief This class provides the interface for all ASN.1 PER codecs. - * \remark This class uses asn1c external tool - */ -template <typename TPDU> class per_codec : public asn1_recode_per { -public: //! \publicsection - /*! - * \fn int encode(const TPDU& p_message, BITSTRING& p_bitstring); - * \brief Encode TITAN message into ASN.1 PER message - * \param[in] p_message The PDU message to encode - * \param[out] p_bitstring The encoded PDU message in bit string format - * \pure - */ - virtual int encode(const TPDU &p_message, BITSTRING &p_bitstring) = 0; - /*! - * \fn int decode(const BITSTRING& p_bitstring, TPDU& p_message); - * \brief Decode ASN.1 PER message into TITAN message - * \param[in] p_bitstring The network message in bit string format to decode - * \param[out] p_message The PDU message - * \pure - */ - virtual int decode(const BITSTRING &p_bitstring, TPDU &p_message) = 0; - -protected: //! \protectedsection - int _decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg); - int _encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data); -}; // End of class per_codec - -#include "per_codec.t.hh" diff --git a/ccsrc/Framework/include/per_codec.t.hh b/ccsrc/Framework/include/per_codec.t.hh deleted file mode 100644 index 6973dc6d7c32a9b8252ae75681081d66cd23e498..0000000000000000000000000000000000000000 --- a/ccsrc/Framework/include/per_codec.t.hh +++ /dev/null @@ -1,26 +0,0 @@ -#include <TTCN3.hh> - -template <class TPDU> int per_codec<TPDU>::_decode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const BITSTRING &p_data, TPDU &msg) { - TTCN_Buffer buf(bit2oct(p_data)); - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - int rc = per2ber(td, buf); - if (rc > 0) { - msg.decode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ACCEPT_ALL); - rc = buf.get_len(); - } - return rc; -} - -template <class TPDU> int per_codec<TPDU>::_encode(const TTCN_Typedescriptor_t &ttcn, const asn_TYPE_descriptor_s &td, const TPDU &msg, BITSTRING &p_data) { - int rc = -1; - TTCN_Buffer buf; - TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING); - msg.encode(ttcn, buf, TTCN_EncDec::CT_BER, BER_ENCODE_DER); - if (buf.get_len() > 0) { - rc = ber2per(td, buf); - if (rc > 0) { - p_data = oct2bit(OCTETSTRING(buf.get_len(), buf.get_data())); - } - } - return rc; -}