In file framerecv.hh:

namespace diag class frameRecv

Class for receiving frame broadcast data

Inheritance:


Public Methods

explicit frameRecv (int QoS = 1)
Default constructor.
~frameRecv ()
Destructor.
bool open (const char* mcast_addr, const char* interface = 0, int port = frameXmitPort)
Open function.
bool open (int port = frameXmitPort)
Open function.
void close ()
Close function.
bool purge ()
Purge function.
int receive (char*& data, int maxlen, unsigned int* sequence = 0, unsigned int* timestamp = 0, unsigned int* duration = 0)
receive function.
const char* logmsg ()
log message function.
void clearlog ()
clear log function.
void logging (bool set = true)
turn log on function.
void setmaxlog (int max = 25)
Maximum log messages function.

Documentation

Class for receiving frame broadcast data. This class implements the broadcast receiver. A code example can be found in 'rcvtest.cc'.

explicit frameRecv(int QoS = 1)
Constructs a broadcast receiver. An optional parameter specifies the quality of service: 0 - up to 30% retransmission; 1 - 10% retransmission; 2 - 3% retransmission. The QoS limit is determined by averaging over the retransmission of the last few data buffers. This allows for higher burst retransmission, but enforces a limit of the averaged retransmission.

Returns:
void
Parameters:
qos - quality of service

~frameRecv()
Destructs the broadcast receiver.
Returns:
void

bool open(const char* mcast_addr, const char* interface = 0, int port = frameXmitPort)
Opens the conenction to the transmitter. If no multicast address is supplied, the function will listen to UDP/IP broadcast transmission at the specified port. Otherwise, it tries to join the specified multicast group at the given interface. If the interface is obmitted, the default interface will be used. In general, one can use the subnet address as the interface address argument. The function will then go through the list of all local interfaces and determine the closest match.

Returns:
true if successful
Parameters:
mcast_addr - multicast address
interface - interface or subnet used by multicast
port - port number to listen

bool open(int port = frameXmitPort)
Opens the conenction to the transmitter. Uses UDP/IP broadcast.
Returns:
true if successful
Parameters:
port - port number

void close()
Closes the conenction.
Returns:
void

bool purge()
Purges the receiver. This function will empty the receiver socket buffer and put the data into an internal buffer. Returns true if there is data in the internal buffer. This function only checks if at least one packet was received. There is no guarantee that a full data buffer was received.
Returns:
true if data pending

int receive(char*& data, int maxlen, unsigned int* sequence = 0, unsigned int* timestamp = 0, unsigned int* duration = 0)
Gets a data buffer. If the supplied data buffer is 0, the function allocates a new memory buffer upon return. Upon success the function returns the length of the received data. A value between -10 and -1 indicates a connection or memory allocation error, whereas a value below <10 indicates that the preallocated memory buffer is too small. In this case the negative of the needed length is returned.

Returns:
length of received data, if successful; <0 if failed
Parameters:
data - data array
maxlen - maximum length of data array (in bytes)
sequence - sender sequence number (return)
timestamp - time stamp of data array (return)
duration - time length of data array (return)

const char* logmsg()
log message function.
Returns:
log messages

void clearlog()
Clear old log messages.

void logging(bool set = true)
turn log on function.
Parameters:
set - true = on

void setmaxlog(int max = 25)
Set maximum number of log messages.
Parameters:
max - Maximum messages


This class has no child classes.
Author:
Written August 1999 by Daniel Sigg
Version:
2.0

alphabetic index hierarchy of classes


Please send questions and comments to sigg_d@ligo-wa.caltech.edu


generated by doc++