framexmit::frameSend Class Reference
[Frame multicast client/server]

#include <framesend.hh>

List of all members.

Public Member Functions

 frameSend (int maxBuffers=sndDefaultBuffers)
 frameSend (const char *addr, const char *interface=0, int port=frameXmitPort, int maxBuffers=sndDefaultBuffers)
 ~frameSend ()
bool open (const char *addr, const char *interface=0, int port=frameXmitPort)
bool open (int port=frameXmitPort)
void close ()
bool send (char *data, int len, bool *inUse=0, bool copy=false, unsigned int timestamp=0, unsigned int duration=0)
int skipped () const
bool isUsed (bool &inUse) const

Friends

void xmitDaemonCallback (frameSend &)
 task which runs the transmit daemon is a friend
bool compSeqeuence (const buffer &b, const retransmitpacket &p)
 frined: compare a buffer to a sequence # of a retransmit packet

Classes

class  buffer


Detailed Description

Class for broadcasting frame data. This class implements the broadcast transmitter. A code example can be found in 'sndtest.cc'.

brief Class for broadcasting frame data

Author:
Written August 1999 by Daniel Sigg
Version:
2.0

Constructor & Destructor Documentation

framexmit::frameSend::frameSend ( int  maxBuffers = sndDefaultBuffers  )  [inline, explicit]

Constructs a default broadcast transmitter.

Parameters:
maxBuffers maximum number of used buffers brief Default constructor.
Returns:
void

framexmit::frameSend::frameSend ( const char *  addr,
const char *  interface = 0,
int  port = frameXmitPort,
int  maxBuffers = sndDefaultBuffers 
) [inline, explicit]

Constructs a broadcast/multicast transmitter and connects it.

Parameters:
addr broadcast address/multicast group
interface interface or subnet used by multicast
port port number
maxBuffers maximum number of used buffers brief Constructor.
Returns:
void

framexmit::frameSend::~frameSend (  )  [inline]

Denstructs the broadcast transmitter. brief Destructor.

Returns:
void


Member Function Documentation

bool framexmit::frameSend::open ( const char *  addr,
const char *  interface = 0,
int  port = frameXmitPort 
)

Opens the conenction. If the specified addr is a multicast address, the transmitter will use UDP/IP multicast rather than UDP/IP broadcast. If multicast is used, an additional parameter specifes the interface which will be used. 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. brief Open function.

Parameters:
addr broadcast address
interface interface or subnet used by multicast
port port number
Returns:
true if successful

bool framexmit::frameSend::open ( int  port = frameXmitPort  )  [inline]

Opens the conenction. Uses UDP/IP broadcast. brief Open function.

Parameters:
port port number
Returns:
true if successful

void framexmit::frameSend::close (  ) 

Closes the conenction. brief Close function.

Returns:
void

bool framexmit::frameSend::send ( char *  data,
int  len,
bool *  inUse = 0,
bool  copy = false,
unsigned int  timestamp = 0,
unsigned int  duration = 0 
)

Broadcast a data buffer. This function will not block and return immediately. To assure that the data array stays valid until after it is transmitted, the caller can either request that the data array is copied, or supply a pointer to a boolean 'inUse' variable which will be set false by the transmitter after the buffer has been sent. The inUse variable should never be accessed directly, but rather through 'isUsed' function only.

The send fucntion works as follows:

1. The send function will NOT transmit the buffer by itself but rather put the buffer into a queue which is then managed by the xmitdaemon.

2. The send function will always return immediately and will NOT block until the buffer is sent.

3. If the buffer queue is full, the send function will remove all unsent buffers from it.

4. After a buffer is sent, it will stay in the queue for an additional time period (~3 sec) to allow retransmit. Then it will automatically be released.

5. There are basically two ways to deal with the problem of how long data in a buffer must be kept:

a. The send function copies the buffer (avoids buffer validity problems all together), or

b. The send function does not copy the buffer and the caller must keep the buffer valid until the xmitdaemon is done with it.

In the second case the caller MUST NOT delete or change the data in the buffer until it is no longer needed. To verify if the buffer is still in use, the caller can check the 'inUse' variable with th ehelp of the isUsed method.

brief Send function.

Parameters:
data data array
len length of data array (in bytes)
inUse pointer to in use variable (ignored if 0)
copy request a copy of the data to be used
timestamp time stamp of data array
duration time length of data array
Returns:
true if successful

int framexmit::frameSend::skipped (  )  const [inline]

Returns the total number of skipped output buffers. brief Skip function.

Returns:
skipped buffers

bool framexmit::frameSend::isUsed ( bool &  inUse  )  const [inline]

Returns true if variable is in use (MT safe). brief isUsed function.

Parameters:
inUse in use variable to be read
Returns:
in use value


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:22 2009 for dmt by  doxygen 1.5.4