libradar_stp::RSTPClientIf Class Reference

#include <rstpclientif.h>

List of all members.

Public Types

typedef void(*) CBFUNC (void *, const std::string &, const std::string &)
typedef void(*) CBFUNC3 (void *, const std::string &)

Public Member Functions

void addStream (const std::string &stream)
void addServer (const std::string &addr, unsigned short port, unsigned int timeout=1000, const std::string &login="", const std::string &pass="")
void start ()
void quit ()
void setDataCallback (CBFUNC func, void *arg=0)
void setErrorCallback (CBFUNC3 func, void *arg=0)
bool loadFile (const std::string &filename)
bool readConfig (std::istream &fin, bool have_client_head=false)

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. It is the recommended interface for all RSTP 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

void RSTPClientIf::addServer ( const std::string &  addr,
unsigned short  port,
unsigned int  timeout = 1000,
const std::string &  login = "",
const std::string &  pass = "" 
)

Parameters:
addr Host address
port Host TCP/IP port
login Authentication credential: login/user name (if required)
pass Authentication credential: password (if required)
Add a server to the redundant connections list. This function must be called once.

void RSTPClientIf::addStream ( const std::string &  stream  ) 

Parameters:
stream The stream identifier/name to add (typically a short abbreviation)
Requests the data stream named stream

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

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

void RSTPClientIf::quit (  ) 

Precondition:
The client is currently running.
Postcondition:
The client is stopped.
Stops the client and does the necessary housekeeping.

bool RSTPClientIf::readConfig ( std::istream &  fin,
bool  have_client_head = false 
)

Parameters:
fin istream with config data
have_client_head Mostly for internal use. True if client header already read.
Load client configuration from a std::istream

void RSTPClientIf::setDataCallback ( CBFUNC  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.

void RSTPClientIf::setErrorCallback ( CBFUNC3  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 RSTPClientIf::start (  ) 

Precondition:
The client must be configured before calling this function.
Postcondition:
The redundant client is running.
Call this to start the redundant client, which will cause it to connect to the 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