OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Namespaces | Macros
rel_mcast.h File Reference
#include "normApi.h"
#include "protoDefs.h"
#include "protoDebug.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <util/coTypes.h>
Include dependency graph for rel_mcast.h:

Go to the source code of this file.

Classes

class  opencover::Rel_Mcast
 

Namespaces

 opencover
 

Macros

#define DEBUG_LVL   0
 
#define MCAST_ADDR   "224.223.222.221"
 
#define MCAST_PORT   23232
 
#define MCAST_IFACE   "eth0"
 
#define SND_BUFFER_SPACE   1000000
 
#define RCV_BUFFER_SPACE   1000000
 
#define MTU_SIZE   1500
 
#define BLOCK_SIZE   4
 
#define NUM_PARITY   0
 
#define NORM_TTL   1
 
#define CACHE_MAX_SIZE   100000000
 
#define CACHE_MIN_NUM   1
 
#define CACHE_MAX_NUM   128
 
#define TX_MBPS   1000
 
#define BACKOFF_FACTOR   0.0
 
#define SOCK_BUFFER_SIZE   512000
 
#define READ_TIMEOUT_SEC   30
 
#define WRITE_TIMEOUT_MSEC   500
 
#define RETRY_TIMEOUT   100
 
#define MAX_LENGTH   1000000
 

Macro Definition Documentation

#define BACKOFF_FACTOR   0.0
#define BLOCK_SIZE   4
#define CACHE_MAX_NUM   128
#define CACHE_MAX_SIZE   100000000
#define CACHE_MIN_NUM   1
#define DEBUG_LVL   0

Reliable Multicast via NORM (NACK-Oriented Reliable Multicast) ******

  • Filename: rel_mcast.h * Author: Alex Velazquez * Created: 2011-03-31 * Adjustable settings of the NORM protocol: ***************************
    • Description: Var.name: Set with: * (coconfig + .cpp) * ------------------------------------------------------——— * Debug level debugLevel setDebugLevel(int) * Multicast address mcastAddr constructor (has default) * Multicast port mcastPort constructor (has default) * Multicast interface mcastIface constructor * MTU mtu setMTU(int) * TTL ttl setTTL(int) * Loopback behavior lback setLoopback(bool) * Group size groupSize server's constructor * Send buffer space sndBufferSpace setBufferSpace(unsigned int) * Receive buffer space rcvBufferSpace setBufferSpace(unsigned int) * Block size blockSize setBlocksAndParity(int,int) * Parity numParity setBlocksAndParity(int,int) * Max cache bytes txCacheSize setTxCacheBounds(int,int,int) * Min cache num txCacheMin setTxCacheBounds(int,int,int) * Max cache num txCacheMax setTxCacheBounds(int,int,int) * TX Rate txRate setTransferRate(int) * Backoff factor backoffFactor setBackoffFactor(double) * UDP sock.buff.size sockBufferSize setSockBufferSize(int) * Read timeout (sec) readTimeoutSec setTimeout(int) * Write timeout (ms) writeTimeoutMsec setTimeout(int) * Retry timeout (us) retryTimeout setRetryTimeout(int) * Max obj length (B) maxLength setMaxLength(int) * Example covise configuration file: **********************************

<?xml version="1.0"?>

<COCONFIG version="1"> <GLOBAL> <COVER> <MultiPC>

<SyncMode value="MULTICAST">

<Multicast> <debugLevel value="0"> <mcastAddr value="224.223.222.221"> <mcastPort value="23232"> <mtu value="1500"> <ttl value="1"> <lback value="off"> <sndBufferSpace value="1000000"> <rcvBufferSpace value="1000000"> <blockSize value="4"> <numParity value="0"> <txCacheSize value="100000000"> <txCacheMin value="1"> <txCacheMax value="128"> <txRate value="1000"> <backoffFactor value="0.0"> <sockBufferSize value="512000"> <readTimeoutSec value="30"> <writeTimeoutMsec value="500"> <retryTimeout value="100"> <maxLength value="1000000"> </Multicast>

</MultiPC> </COVER> </GLOBAL> </COCONFIG> Creating server/client instances: ***********************************

1) Server (master):

Determine server's parameters int numClients = 1; // Number of clients char *addr = "224.223.222.221"; // Any Class-D IP address int port = 23232; // Any valid port number

Call server's constructor (could also call Rel_Mcast(true, numClients) for default addr/port) multicast = new Rel_Mcast(true, numClients, addr, port);

Set any non-default settings (advanced) e.g. multicast->setTimeout(1000); // Write timeout etc....

Initialize the server (may fail if the addr/port is invalid or in use) if (multicast->init() != Rel_Mcast::RM_OK) delete multicast;

Write a multicast message multicast->write_mcast("Testing 123", 12);

Clean up by calling destructor sleep(10); delete multicast;

2) Clients (slaves):

Determine client's parameters int clientID = 1; // Any integer greater than 0 and unique among clients char *addr = "224.223.222.221"; // Any Class-D IP address int port = 23232; // Any valid port number

Call client's constructor (could also call Rel_Mcast(clientID) to choose default addr/port) multicast = new Rel_Mcast(clientID, addr, port);

Set any non-default settings (advanced) e.g. multicast->setTimeout(20); // Read timeout etc....

Initialize the client (may fail if the addr/port is invalid or in use) if ( multicast->init() != Rel_Mcast::RM_OK ) delete multicast;

Receive an incoming multicast char *buffer = new char[12]; multicast->read_mcast(buffer, 12); printf("Received: %d\n", buffer);

Clean up by calling destructor delete multicast;

#define MAX_LENGTH   1000000
#define MCAST_ADDR   "224.223.222.221"
#define MCAST_IFACE   "eth0"
#define MCAST_PORT   23232
#define MTU_SIZE   1500
#define NORM_TTL   1
#define NUM_PARITY   0
#define RCV_BUFFER_SPACE   1000000
#define READ_TIMEOUT_SEC   30
#define RETRY_TIMEOUT   100
#define SND_BUFFER_SPACE   1000000
#define SOCK_BUFFER_SIZE   512000
#define TX_MBPS   1000
#define WRITE_TIMEOUT_MSEC   500