Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAVERNnet_mcast_c.hxx

00001 /******************************************************************
00002  * CAVERNsoft
00003  * Copyright (C) 1994-2000 Electronic Visualization Laboratory,
00004  * all rights reserved
00005  * By Jason Leigh, Yong-joo Cho, Naveen Krishnaprasad, Chris Scharver,
00006  * Stuart Bailey, Atul Nayak, Shalini Venkataraman 
00007  * University of Illinois at Chicago
00008  * 
00009  * This publication and its text and code may not be copied for commercial 
00010  * use without the express written permission of the University of Illinois
00011  * at Chicago.
00012  * The contributors disclaim any representation of warranty: use this
00013  * code at your own risk.
00014  * Direct questions, comments etc to cavern@evl.uic.edu
00015  ******************************************************************/
00016 
00017 #ifndef _CAVERNPLUS_CAVERNPLUS_MCAST_CLASS
00018 #define _CAVERNPLUS_CAVERNPLUS_MCAST_CLASS
00019 
00020 #include "CAVERNnet_socketbase_c.hxx"
00021 
00022 #ifdef __sgi 
00023 extern int h_errno;
00024 extern int errno;
00025 #endif
00026 
00030 class CAVERNnet_mcast_c : public CAVERNnet_socketbase_c {
00031 
00032 public:
00033 
00035 
00036         static const int OK/* = 1*/;
00037 
00039         static const int FAILED/* = 0*/;
00041 
00042         static const int maxTTL;
00043 
00044         CAVERNnet_mcast_c();
00045 
00047 #ifdef WIN32
00048         void close()
00049                 {::closesocket (sockfd);}
00050 #else
00051         void close()
00052                 {::close (sockfd);}
00053 #endif
00054 
00055         int init(char *mcastGroup, int port, int mttl = CAVERNnet_mcast_c::maxTTL);
00056 
00058         int send(char *, int);
00059 
00061         int receive(char *, int);
00062 
00064         void printInfo();
00065 
00067         void makeNonBlocking();
00068 
00070         unsigned long getReceiveIP();
00071 
00073         void getReceiveIP(char *clientIP);
00074 
00075         /* Get the IP address of the mcast group. This shouldn't
00076          * be anything you'd forget since you needed a number in the 1st
00077          * place to start, but it's provided here for completeness.
00078          */
00079 
00081 
00082 
00083         unsigned long getSelfIP();
00085         void getSelfIP(char *ip);
00087         unsigned long getSendIP();
00089         void getSendIP(char *ip);
00091         unsigned short getSelfPort();
00093         unsigned short getSendPort();
00095         unsigned short getReceivePort();
00097 
00105         void enableInstrumentation();
00106 
00114         void disableInstrumentation();
00115 
00116 private:
00117 
00118         int enableInstr;
00119         int sockfd;
00120         struct sockaddr_in receiveAddress, sendAddress;
00121         struct ip_mreq mreq;
00122         char ttl;
00123 
00124 };
00125 #endif

Generated at Mon Jul 2 14:24:42 2001 for CAVERNsoft by doxygen1.2.8-20010617 written by Dimitri van Heesch, © 1997-2001