00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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;
00037
00039 static const int FAILED;
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
00076
00077
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