xorp

XrlPort Class Reference

Helper class which encapsulates XRL socket service. More...

#include <xrl_port.hh>

Inheritance diagram for XrlPort:
ServiceBase CallbackSafeObject BugCatcher NONCOPYABLE

List of all members.

Public Member Functions

 XrlPort (IO *io, EventLoop &eventloop, XrlRouter &xrl_router, const string &ssname, const string &ifname, const string &vifname, const IPv4 &local_addr, const uint16_t local_port, const IPv4 &all_nodes_addr)
 Begin creation of the broadcast/multicast socket.
int startup ()
 Start the port binding.
int shutdown ()
 Shutdown the port binding.
bool send_to (const IPv4 &dst_addr, const uint16_t dst_port, const vector< uint8_t > &payload)
 Send packet.
string socket_server () const
string ifname () const
string vifname () const
IPv4 local_address () const
uint16_t local_port () const
string sockid () const
IPv4 all_nodes_address () const

Private Member Functions

bool startup_socket ()
bool request_udp_open_bind_broadcast ()
void udp_open_bind_broadcast_cb (const XrlError &e, const string *psid)
bool request_tos ()
void tos_cb (const XrlError &xrl_error)
void socket_setup_complete ()
bool request_reuseport ()
void reuseport_cb (const XrlError &e)
bool request_onesbcast (const bool enabled)
void onesbcast_cb (const XrlError &e)
bool request_close ()
void close_cb (const XrlError &xrl_error)
void send_cb (const XrlError &xrl_error)

Private Attributes

IO_io
EventLoop_eventloop
XrlRouter_xrl_router
string _ss
string _ifname
string _vifname
IPv4 _local_addr
uint16_t _local_port
IPv4 _all_nodes_addr
bool _pending
string _sockid
bool _is_undirected_broadcast

Detailed Description

Helper class which encapsulates XRL socket service.

Deals with setting the specific XRL socket options that OLSR needs to send/receive broadcast/multicast control traffic to the all-nodes address.


Constructor & Destructor Documentation

XrlPort::XrlPort ( IO io,
EventLoop eventloop,
XrlRouter xrl_router,
const string &  ssname,
const string &  ifname,
const string &  vifname,
const IPv4 local_addr,
const uint16_t  local_port,
const IPv4 all_nodes_addr 
)

Begin creation of the broadcast/multicast socket.

Parameters:
iopointer to parent object
eventloopprocess-wide event loop
xrl_routerprocess-wide XRL router
ssnamename of XRL target containing socket server; usually this is the FEA.
ifnameinterface to listen on
vifnamevif to listen on
local_addraddress to listen on
local_portport to listen on
all_nodes_addraddress to send to

Member Function Documentation

IPv4 XrlPort::all_nodes_address ( ) const [inline]
Returns:
the address to which this socket transmits.
string XrlPort::ifname ( ) const [inline]
Returns:
the name of the interface to which this socket is bound.
IPv4 XrlPort::local_address ( ) const [inline]
Returns:
the address to which this socket is bound.
uint16_t XrlPort::local_port ( ) const [inline]
Returns:
the port to which this socket is bound.
bool XrlPort::send_to ( const IPv4 dst_addr,
const uint16_t  dst_port,
const vector< uint8_t > &  payload 
)

Send packet.

Status of instance must be running, and should not be pending.

Parameters:
dst_addraddress to send packet.
dst_portport to send packet to.
payloadvector containing paylaod of packet to be sent.
Returns:
false on immediately detectable failure, true otherwise.
int XrlPort::shutdown ( ) [virtual]

Shutdown the port binding.

Sends request to close socket and transitions into SERVICE_SHUTTING_DOWN state. When socket is closed transition to SERVICE_SHUTDOWN occurs.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

string XrlPort::socket_server ( ) const [inline]
Returns:
the name of the socket server in use.
string XrlPort::sockid ( ) const [inline]
Returns:
the socket server's socket identifier, if service status is RUNNING; otherwise undefined.
int XrlPort::startup ( ) [virtual]

Start the port binding.

Sends request to FEA for socket server for address and then attempts to instantiate socket with socket server. If both operations are successful, instance status transitions to SERVICE_RUNNING. Otherwise, it transitions to failed.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

string XrlPort::vifname ( ) const [inline]
Returns:
the name of the vif to which this socket is bound.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations