Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGGroupMCastConnection.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 
00040 #ifndef _GROUPMCASTCONNECTION_H_
00041 #define _GROUPMCASTCONNECTION_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045 
00046 //---------------------------------------------------------------------------
00047 //  Includes
00048 //---------------------------------------------------------------------------
00049 
00050 #include <string>
00051 #include <OSGBase.h>
00052 #include <OSGBaseTypes.h>
00053 #include <OSGGroupSockConnection.h>
00054 #include <OSGTime.h>
00055 #include <OSGStreamSocket.h>
00056 #include <OSGDgramQueue.h>
00057 
00058 OSG_BEGIN_NAMESPACE
00059 
00060 class PointMCastConnection;
00061 
00062 class OSG_BASE_DLLMAPPING GroupMCastConnection : 
00063     public GroupSockConnection
00064 {
00065     /*==========================  PUBLIC  =================================*/
00066   public:
00067 
00068     /*---------------------------------------------------------------------*/
00072              GroupMCastConnection ( void );
00073     virtual ~GroupMCastConnection ( void ); 
00074 
00076     /*---------------------------------------------------------------------*/
00080     virtual const ConnectionType *getType (void);
00081 
00083     /*---------------------------------------------------------------------*/
00087     virtual Channel     connectPoint(const std::string &address,
00088                                            Time        timeout=-1 );
00089     virtual void        disconnect  (      Channel     channel    );
00090     virtual Channel     acceptPoint (      Time        timeout=-1 );
00091 
00093     /*---------------------------------------------------------------------*/
00097     virtual void setParams(const std::string &params);
00098 
00100     /*---------------------------------------------------------------------*/
00104     static GroupConnection *create(void);
00105 
00108     /*=========================  PROTECTED  ===============================*/
00109   protected:
00110 
00111     /*---------------------------------------------------------------------*/
00115     struct SocketBufferHeader {
00116         UInt32 size;
00117     };
00118 
00120     /*---------------------------------------------------------------------*/
00124     DgramSocket                _mcastSocket;
00125     SocketAddress              _mcastAddress;
00126     BaseThread                *_sendQueueThread;
00127     bool                       _sendQueueThreadRunning;
00128     bool                       _sendQueueThreadStop;
00129     DgramQueue                 _queue;
00130     DgramQueue                 _free;
00131     Lock                      *_lock;
00132     UInt16                     _seqNumber;
00133     UInt32                     _receivers;
00134     UInt32                     _windowSize;
00135     std::vector<SocketAddress> _receiver;
00136     std::vector<SocketAddress> _waitFor;
00137     bool                       _initialized;
00138 
00140     /*---------------------------------------------------------------------*/
00144     virtual void write            (MemoryHandle mem, UInt32 size);
00145     virtual void writeBuffer      (void);
00146 
00148     /*---------------------------------------------------------------------*/
00152     virtual bool wait  (Time timeout) throw (ReadError);
00153     virtual void signal(void        ) throw (WriteError);
00154     
00157     /*==========================  PRIVATE  ================================*/
00158   private:
00159 
00160     friend class PointMCastConnection;
00161     
00162     /*---------------------------------------------------------------------*/
00166            bool checkChannels     ( void      );
00167     static void sendQueueThread   ( void *arg );
00168            bool sendQueue         ( void      );
00169            void initialize        ( void      );
00170 
00172     /*---------------------------------------------------------------------*/
00176     static ConnectionType _type;
00177 
00180     typedef GroupSockConnection Inherited;
00181 
00182     // prohibit default functions (move to 'public' if you need one)
00183     GroupMCastConnection(const GroupMCastConnection &source);
00184     GroupMCastConnection& operator =(const GroupMCastConnection &source);
00185 };
00186 
00187 //---------------------------------------------------------------------------
00188 //   Exported Types
00189 //---------------------------------------------------------------------------
00190 
00191 // class pointer
00192 
00193 typedef GroupMCastConnection *GroupMCastConnectionP;
00194 
00195 OSG_END_NAMESPACE
00196 
00197 #define OSG_GROUPMCASTCONNECTION_HEADER_CVSID "@(#)$Id: $"
00198 
00199 #endif /* _GROUPMCASTCONNECTION_H_ */

Generated on Thu Aug 25 04:06:00 2005 for OpenSG by  doxygen 1.4.3