'ODTONE - Open Dot Twenty One'

PrevUpHomeNext

Class link

odtone::sap::link

Synopsis

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


class link : public odtone::sap::sap {
public:
  // construct/copy/destruct
  link(const mih::config &, boost::asio::io_service &, 
       const default_handler &);
  ~link();

  // public member functions
  void async_send(mih::message &, const handler & = handler());

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

Description

Link SAP I/O Service.

This module handles the comunication between Link 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.

link public construct/copy/destruct

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

    Construct a Link 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. ~link();

    Destruct a Link SAP I/O Service.

link public member functions

  1. void async_send(mih::message & msg, const handler & h = handler());

    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.

link private member functions

  1. 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.

  2. void send_handler(mih::frame_vla & fm, const handler & h, size_t sbytes, 
                      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.

    sbytes

    Size of the message.


PrevUpHomeNext