'ODTONE - Open Dot Twenty One'

PrevUpHomeNext

Class user

odtone::sap::user

Synopsis

// In header: </home/carlos/Projectos/odtone/inc/odtone/sap/user.hpp>


class user : public odtone::sap::sap {
public:
  // member classes/structs/unions

  struct config {
    // construct/copy/destruct
    config();

    // public data members
    std::string id;
    uint port;
    ip_address mihf_address;
    uint mihf_port;
    size_t buffer_length;
  };
  // construct/copy/destruct
  user(const mih::config &, boost::asio::io_service &, const handler &);
  user(boost::asio::io_service &, const handler &, const config & = config());
  ~user();

  // public member functions
  template<typename CompletionHandler> 
    void async_send(mih::message &, CompletionHandler);

  // private member functions
  void async_send_(mih::message &, handler &&);
  void recv_handler(buffer< uint8 > &, size_t, 
                    const boost::system::error_code &);
  void send_handler(mih::frame_vla &, handler &, 
                    const boost::system::error_code &);
  void get_handler(uint, handler &);
};

Description

MIH-User SAP I/O Service

This module handles the comunication between MIH-User SAP and its local the MIHF. After being initialized, and in order to run this service, it must be invoked the run() method of the boost::asio::io_service associated.

user public construct/copy/destruct

  1. user(const mih::config & cfg, boost::asio::io_service & io, const handler & h);

    Construct a MIH-User SAP I/O Service. The defined callback is invoked when a request message is received The signature of the callback is: void(odtone::mih::message&, const boost::system::error_code&).

    Parameters:

    cfg

    Configuration parameters.

    h

    Message processing handler.

    io

    The io_service object that Link SAP I/O Service will use to dispatch handlers for any asynchronous operations performed on the socket.

  2. user(boost::asio::io_service & io, const handler & h, 
         const config & cfg = config());

    Construct a MIH-User SAP I/O Service. The defined callback is invoked when a request message is received The signature of the callback is: void(odtone::mih::message&, const boost::system::error_code&).

    Parameters:

    cfg

    Configuration parameters.

    h

    Message processing handler.

    io

    The io_service object that Link SAP I/O Service will use to dispatch handlers for any asynchronous operations performed on the socket.

  3. ~user();

    Destruct a MIH-User SAP I/O Service.

user public member functions

  1. template<typename CompletionHandler> 
      void async_send(mih::message & pm, CompletionHandler h);

    Asynchronously send a MIH message to the local MIHF. After sending the message, the callback is called to report the success or failure in delivering the message to the local MIHF. This method retuns immediately.

    Parameters:

    h

    Response handler function.

    pm

    MIH message to send.

user private member functions

  1. void async_send_(mih::message & msg, handler && h);

    Asynchronously send a MIH message to the local MIHF. After sending the message, the callback is called to report the success or failure in delivering the message to the local MIHF. This method retuns immediately.

    Parameters:

    h

    Response handler function.

    msg

    MIH message to send.

  2. void recv_handler(buffer< uint8 > & buff, size_t rbytes, 
                      const boost::system::error_code & ec);

    Received message callback. This function is executed to process the received messages. If this is a valid message, the message is dispatched to the handler defined by the user.

    Parameters:

    buff

    Message byte buffer.

    ec

    Error code.

    rbytes

    Size of the message.

  3. void send_handler(mih::frame_vla & fm, handler & h, 
                      const boost::system::error_code & ec);

    Sent message handler. After sending the message, this function is called to report the success or failure in delivering the message to the local MIHF.

    Parameters:

    ec

    Error code.

    fm

    MIH message sent.

    h

    Message handler.

  4. void get_handler(uint tid, handler & h);

    Get the message handler function of the message.

    Parameters:

    h

    Reference to the message handler.

    tid

    Transaction ID of the message.


PrevUpHomeNext