Commit fc84d434 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add framework

parent 974aab91
Loading
Loading
Loading
Loading
+61 −0
Original line number Diff line number Diff line
/*!
 * \file      codec.hh
 * \brief     Header file for ITS abstract codec definition.
 * \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 "params_ngap.hh"

class OCTETSTRING; //! Declare TITAN class
class CHARSTRING;  //! Declare TITAN class
class BITSTRING;   //! Declare TITAN class

/*!
 * \class codec
 * \brief  This class provides the interface for all ITS codecs, include UT and AC codecs
 * \abstract
 */
template <typename TPDUEnc, typename TPDUDec> class codec {
protected:
  params_ngap *_params; //! Reference to params stack
                       // \todo Use smart pointer std::unique_ptr<params>

public: //! \publicsection
  /*!
   * \fn codec();
   * \brief  Default constructor
   * \todo Remove logs
   */
  explicit codec() : _params(nullptr){};
  /*!
   * \fn ~codec();
   * \brief  Default destructor
   * \virtual
   * \todo Remove logs
   */
  virtual ~codec(){};
  /*!
   * \fn int encode(const TPDUEnc& msg, OCTETSTRING& data);
   * \brief  Encode typed message into an octet string
   * \param[in] p_message The typed message to be encoded
   * \param[out] p_data The encoding result
   * \return 0 on success, -1 otherwise
   * \pure
   */
  virtual int encode(const TPDUEnc &p_message, OCTETSTRING &p_data) = 0;
  /*!
   * \fn int decode(const OCTETSTRING& p_, TPDUDec& p_message, params_ngap* p_params = NULL);
   * \brief  Encode typed message into an octet string format
   * \param[in] p_data The message in its octet string
   * \param[out] p_message The decoded typed message
   * \return 0 on success, -1 otherwise
   * \pure
   */
  virtual int decode(const OCTETSTRING &p_, TPDUDec &p_message, params_ngap *p_params = NULL) = 0;
}; // End of class codec
+11 −0
Original line number Diff line number Diff line
#pragma once

#include "params_ngap.hh"

class OCTETSTRING; //! Forward declaration of TITAN class

class data_event_notifier {
public:
  virtual ~data_event_notifier() = default;
  virtual void update(OCTETSTRING &p_data, params_ngap &p_params) {};
}; // End of abstract class data_event_notifier
+19 −0
Original line number Diff line number Diff line
#pragma once

#include <vector>

#include "data_event_notifier.hh"

class OCTETSTRING; //! Forward declaration of TITAN class

class data_event_observer {
protected:
  std::vector<data_event_notifier *> _observers;

public:
  data_event_observer() : _observers() {};
  virtual ~data_event_observer() { _observers.clear(); };
  virtual void incoming_packet_observer_attach(data_event_notifier* p_observer) {};
  virtual void incoming_packet_observer_detach(data_event_notifier* p_observer) {};
  virtual void incoming_packet_notify(OCTETSTRING &p_data, params_ngap &p_params) {};
}; // End of abstract class data_event_observer
+37 −0
Original line number Diff line number Diff line
/*!
 * \file      params_ngap.hh
 * \brief     Header file for the parameter dictionary.
 * \author    ETSI TTF T033
 * \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 <map>
#include <string>
#include <vector>

#include "params.hh"

/*!
 * \class params_ngap
 * \brief This class provides basic functionalities for an ITS dictionary
 */
class params_ngap : public params {
public: //! \publicsection

  /*!
   * \brief Default constructor
   *        Create a new instance of the params_ngap class
   */
  params_ngap() : params() {};

  /*!
   * \brief Default destructor
   */
  virtual ~params_ngap(){};

}; // End of class params_ngap
+2 −0
Original line number Diff line number Diff line
sources := src/params_ngap.cc
includes += ./include
Loading