libradar_stp::RSTPClientMCIf Class Reference

#include <rstpclientmcif.h>

List of all members.

Public Types

typedef void(*) CBFUNCDATA (void *, const std::string &, const std::string &)
typedef void(*) CBFUNCERR (void *, const std::string &)

Public Member Functions

int addConnection ()
RSTPClientIfconnection (int conn_id)
const RSTPClientIfconnection (int conn_id) const
bool start ()
bool quit ()
void setDataCallback (CBFUNCDATA func, void *arg=0)
void setErrorCallback (CBFUNCERR func, void *arg=0)
void setRepeatCheckEnabled (bool enabled=true)
void setRepeatCheckDBSize (int size=200)
bool loadFile (const std::string &filename)
bool readConfig (std::istream &confin)
void setRedundantPeerModeEnabled (bool enabled=true)
void setRedundantPeerModeMaxTicks (int ticks=10)
void eventRedundantPeerModeTick ()

Static Public Member Functions

static void _data_cb (void *arg, const std::string &stream, const std::string &data)
static void _error_cb (void *arg, const std::string &msg)


Detailed Description

This class provides a high-level interface to the redundant RSTP client which allows for multiple connections to be made from one client program. It is a recommended interface for library clients.

To use: configure the client by adding at least one server and one stream, set the data callback, perform any other configuration required, and then call start()


Member Function Documentation

int RSTPClientMCIf::addConnection (  ) 

Returns:
Connection ID of the new connection / redundant client. In the case of an error will return -1.
Adds a connection / redundant client, which may then be accessed with connection(). Warning: If you add a connection after calling start(), you must start() it manually using the connection() accessor.

RSTPClientIf & RSTPClientMCIf::connection ( int  conn_id  ) 

Parameters:
conn_id The ID number of the connection to access.
Returns:
Reference to the RSTPClientIf object for the requested connection.
This is an accessor/mutator

void RSTPClientMCIf::eventRedundantPeerModeTick (  ) 

Call this function once every second or so in Redundant Peer Mode from a separate thread to generate ticks.

bool RSTPClientMCIf::loadFile ( const std::string &  filename  ) 

Parameters:
filename The name of the configuration file to load
See also:
Client configuration file documentation
Load client configuration from a file.

bool RSTPClientMCIf::quit (  ) 

Precondition:
start() has been called.
Postcondition:
The RSTP client has been stopped.
Stops the redundant clients and does the necessary housekeeping.

bool RSTPClientMCIf::readConfig ( std::istream &  confin  ) 

Parameters:
confin The istream for the configuration data
Load client configuration from a std::istream

void RSTPClientMCIf::setDataCallback ( CBFUNCDATA  func,
void *  arg = 0 
)

Parameters:
func The callback function
arg Optional argument to send to callback function
Set a callback function and optional argument to be called whenever data is received. The first string is the stream ID. The actual data is stored in the last string.

void RSTPClientMCIf::setErrorCallback ( CBFUNCERR  func,
void *  arg = 0 
)

Parameters:
func The callback function
arg Optional argument to send to callback function
Set a callback function and optional argument to be called whenever an error must be reported. The string argument will be an error message.

void RSTPClientMCIf::setRedundantPeerModeEnabled ( bool  enabled = true  ) 

Parameters:
enabled Set to true to enable this feature
Redundant Peer Mode is a special mode which allows two peer RSTP nodes to establish two connections in a redundant loop, but only transmit one copy of each data message. This feature is implemented at the RSTPClientMCIf level. When enabled, the client will expect to receive each individual data message/product an even number of times. If any message is received an odd number of times before the eventRedundantPeerModeTick() event is sent the number of times set with setRedundantPeerModeMaxTicks(), then this message will be sent to the data callback, to be relayed downstream.

In practice, this feature would be used with one upstream/client connection to a remote peer and one upstream connection to a local data source relay node. One downstream connection would feed the local data source relay node, and another would feed the remote peer node. Then, in practice, any differences in the incoming data would be transmitted to both the remote and local nodes, and the site which had not received the message will now have it.

In summary, the caveats to watch out for are: (1) There must be an even number of upstream connections in the RSTPClientMCIf, and (2) each upstream node should be relaying the exact same datastream.

void RSTPClientMCIf::setRedundantPeerModeMaxTicks ( int  ticks = 10  ) 

Parameters:
ticks The maximum number of ticks before differences are relayed
Set the number of times eventRedundantPeerModeTick() must be called before a difference in upstream streams should be sent downstream. Set this lower to minimize local system resource usage, and higher to save network bandwidth. A value of 10 makes a lot of sense, however, there must be some skew between the peered sites to meet timing constraints (if both operate simulataneously, they may both transmit the same message at the same time and double bandwidth consumption).

void RSTPClientMCIf::setRepeatCheckDBSize ( int  size = 200  ) 

Parameters:
size Number of signatures to save
Set the size of the repeat check database.

void RSTPClientMCIf::setRepeatCheckEnabled ( bool  enabled = true  ) 

Parameters:
enabled True to enable repeat checking
Enable or disable repeated data checking. Useful when configuring redundant links. Default: off.

bool RSTPClientMCIf::start (  ) 

Precondition:
All clients must be configured before calling this function.
Postcondition:
The redundant clients are running.
Call this to start the redundant clients, which will cause each to connect to its first configured server


The documentation for this class was generated from the following files:
Generated on Tue Jul 1 20:25:26 2008 for libradar_stp by  doxygen 1.4.7