groupsock/include/GroupEId.hh

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "multikit" Multicast Application Shell
00017 // Copyright (c) 1996-2008, Live Networks, Inc.  All rights reserved
00018 // "Group Endpoint Id"
00019 // C++ header
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       // used for a 'source-independent multicast' group
00062   GroupEId(struct in_addr const& groupAddr,
00063            struct in_addr const& sourceFilterAddr,
00064            portNumBits portNum,
00065            unsigned numSuccessiveGroupAddrs = 1);
00066       // used for a 'source-specific multicast' group
00067   GroupEId(); // used only as a temp constructor prior to initialization
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     // could be >1 for hier encoding
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

Generated on Tue Oct 7 15:38:08 2008 for live by  doxygen 1.5.2