OpenCOVER
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

namespace  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

◆ BACKOFF_FACTOR

#define BACKOFF_FACTOR   0.0

◆ BLOCK_SIZE

#define BLOCK_SIZE   4

◆ CACHE_MAX_NUM

#define CACHE_MAX_NUM   128

◆ CACHE_MAX_SIZE

#define CACHE_MAX_SIZE   100000000

◆ CACHE_MIN_NUM

#define CACHE_MIN_NUM   1

◆ DEBUG_LVL

#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;

◆ MAX_LENGTH

#define MAX_LENGTH   1000000

◆ MCAST_ADDR

#define MCAST_ADDR   "224.223.222.221"

◆ MCAST_IFACE

#define MCAST_IFACE   "eth0"

◆ MCAST_PORT

#define MCAST_PORT   23232

◆ MTU_SIZE

#define MTU_SIZE   1500

◆ NORM_TTL

#define NORM_TTL   1

◆ NUM_PARITY

#define NUM_PARITY   0

◆ RCV_BUFFER_SPACE

#define RCV_BUFFER_SPACE   1000000

◆ READ_TIMEOUT_SEC

#define READ_TIMEOUT_SEC   30

◆ RETRY_TIMEOUT

#define RETRY_TIMEOUT   100

◆ SND_BUFFER_SPACE

#define SND_BUFFER_SPACE   1000000

◆ SOCK_BUFFER_SIZE

#define SOCK_BUFFER_SIZE   512000

◆ TX_MBPS

#define TX_MBPS   1000

◆ WRITE_TIMEOUT_MSEC

#define WRITE_TIMEOUT_MSEC   500