xorp

WinRtmPipe Class Reference

WinRtmPipe class opens a routing socket and forwards data arriving on the socket to WinRtmPipeObservers. More...

#include <windows_rtm_pipe.hh>

List of all members.

Public Member Functions

 WinRtmPipe (EventLoop &eventloop)
int start (int af, string &error_msg)
 Start the routing socket operation for a given address family.
int stop (string &error_msg)
 Stop the routing socket operation.
bool is_open () const
 Test if the routing socket is open.
ssize_t write (const void *data, size_t nbytes)
 Write data to routing socket.
uint32_t seqno () const
 Get the sequence number for next message written into the kernel.
pid_t pid () const
 Get the cached process identifier value.
int force_read (string &error_msg)
 Force socket to read data.

Private Types

typedef list
< WinRtmPipeObserver * > 
ObserverList

Private Member Functions

void io_event (XorpFd fd, IoEventType type)
 Read data available for WinRtmPipe and invoke WinRtmPipeObserver::routing_socket_data() on all observers of routing socket.
WinRtmPipeoperator= (const WinRtmPipe &)
 WinRtmPipe (const WinRtmPipe &)

Private Attributes

EventLoop_eventloop
XorpFd _fd
ObserverList _ol
uint16_t _seqno
uint16_t _instance_no

Static Private Attributes

static const size_t ROUTING_SOCKET_BYTES = 8*1024
static uint16_t _instance_cnt = 0
static pid_t _pid = getpid()

Friends

class WinRtmPipePlumber

Detailed Description

WinRtmPipe class opens a routing socket and forwards data arriving on the socket to WinRtmPipeObservers.

The WinRtmPipe hooks itself into the EventLoop and activity usually happens asynchronously.


Member Function Documentation

int WinRtmPipe::force_read ( string &  error_msg)

Force socket to read data.

This usually is performed after writing a request that the kernel will answer (e.g., after writing a route lookup). Use sparingly, with caution, and at your own risk.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
bool WinRtmPipe::is_open ( ) const [inline]

Test if the routing socket is open.

This method is needed because WinRtmPipe may fail to open routing socket during startup.

Returns:
true if the routing socket is open, otherwise false.
pid_t WinRtmPipe::pid ( ) const [inline]

Get the cached process identifier value.

Returns:
the cached process identifier value.
uint32_t WinRtmPipe::seqno ( ) const [inline]

Get the sequence number for next message written into the kernel.

The sequence number is derived from the instance number of this routing socket and a 16-bit counter.

Returns:
the sequence number for the next message written into the kernel.
int WinRtmPipe::start ( int  af,
string &  error_msg 
)

Start the routing socket operation for a given address family.

Parameters:
afthe address family.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int WinRtmPipe::stop ( string &  error_msg)

Stop the routing socket operation.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
ssize_t WinRtmPipe::write ( const void *  data,
size_t  nbytes 
)

Write data to routing socket.

This method also updates the sequence number associated with this routing socket.

Returns:
the number of bytes which were written, or -1 if error.

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