00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _GROUPEID_HH
00022 #define _GROUPEID_HH
00023
00024 #ifndef _BOOLEAN_HH
00025 #include "Boolean.hh"
00026 #endif
00027
00028 #ifndef _NET_ADDRESS_HH
00029 #include "NetAddress.hh"
00030 #endif
00031
00032 const u_int8_t MAX_TTL = 255;
00033
00034 class Scope {
00035 public:
00036 Scope(u_int8_t ttl = 0, const char* publicKey = NULL);
00037 Scope(const Scope& orig);
00038 Scope& operator=(const Scope& rightSide);
00039 ~Scope();
00040
00041 u_int8_t ttl() const
00042 { return fTTL; }
00043
00044 const char* publicKey() const
00045 { return fPublicKey; }
00046 unsigned publicKeySize() const;
00047
00048 private:
00049 void assign(u_int8_t ttl, const char* publicKey);
00050 void clean();
00051
00052 u_int8_t fTTL;
00053 char* fPublicKey;
00054 };
00055
00056 class GroupEId {
00057 public:
00058 GroupEId(struct in_addr const& groupAddr,
00059 portNumBits portNum, Scope const& scope,
00060 unsigned numSuccessiveGroupAddrs = 1);
00061
00062 GroupEId(struct in_addr const& groupAddr,
00063 struct in_addr const& sourceFilterAddr,
00064 portNumBits portNum,
00065 unsigned numSuccessiveGroupAddrs = 1);
00066
00067 GroupEId();
00068
00069 struct in_addr const& groupAddress() const { return fGroupAddress; }
00070 struct in_addr const& sourceFilterAddress() const { return fSourceFilterAddress; }
00071
00072 Boolean isSSM() const;
00073
00074 unsigned numSuccessiveGroupAddrs() const {
00075
00076 return fNumSuccessiveGroupAddrs;
00077 }
00078
00079 portNumBits portNum() const { return fPortNum; }
00080
00081 const Scope& scope() const { return fScope; }
00082
00083 private:
00084 void init(struct in_addr const& groupAddr,
00085 struct in_addr const& sourceFilterAddr,
00086 portNumBits portNum,
00087 Scope const& scope,
00088 unsigned numSuccessiveGroupAddrs);
00089
00090 private:
00091 struct in_addr fGroupAddress;
00092 struct in_addr fSourceFilterAddress;
00093 unsigned fNumSuccessiveGroupAddrs;
00094 portNumBits fPortNum;
00095 Scope fScope;
00096 };
00097
00098 #endif