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

OSGPointMCastConnection.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 _POINTMCASTCONNECTION_H_
00041 #define _POINTMCASTCONNECTION_H_
00042 #ifdef __sgi
00043 #pragma once
00044 #endif
00045 
00046 //---------------------------------------------------------------------------
00047 //  Includes
00048 //---------------------------------------------------------------------------
00049 
00050 #include <string>
00051 #include <map>
00052 #include <OSGBase.h>
00053 #include <OSGBaseTypes.h>
00054 #include <OSGPointSockConnection.h>
00055 #include <OSGTime.h>
00056 #include <OSGDgramSocket.h>
00057 #include <OSGDgram.h>
00058 #include <OSGDgramQueue.h>
00059 
00060 OSG_BEGIN_NAMESPACE
00061 
00062 class OSG_BASE_DLLMAPPING PointMCastConnection : public PointSockConnection
00063 {
00064     /*==========================  PUBLIC  =================================*/
00065   public:
00066 
00067     /*---------------------------------------------------------------------*/
00071              PointMCastConnection ( void );
00072     virtual ~PointMCastConnection ( void ); 
00073 
00075     /*---------------------------------------------------------------------*/
00079     virtual const ConnectionType *getType (void);
00080 
00082     /*---------------------------------------------------------------------*/
00086     virtual Channel     connectGroup(const std::string &address,
00087                                            Time        timeout=-1 );
00088     virtual void        disconnect  (      void                   );
00089     virtual Channel     acceptGroup (      Time        timeout=-1 );
00090 
00092     /*---------------------------------------------------------------------*/
00096     virtual bool wait  (Time timeout) throw (ReadError);
00097 
00099     /*---------------------------------------------------------------------*/
00103     virtual Channel selectChannel (Time timeout=-1) throw (ReadError);
00104 
00106     /*---------------------------------------------------------------------*/
00110     static PointConnection *create(void);
00111 
00114     /*=========================  PROTECTED  ===============================*/
00115   protected:
00116 
00117     /*---------------------------------------------------------------------*/
00121     struct SocketBufferHeader {
00122         UInt32 size;
00123     };
00124 
00126     /*---------------------------------------------------------------------*/
00130     virtual void read             (MemoryHandle mem, UInt32 size);
00131     virtual void readBuffer       (void);
00132 
00134     /*---------------------------------------------------------------------*/
00138     DgramSocket                    _mcastSocket;
00139     DgramSocket                    _responseSocket;
00140     BaseThread                    *_recvQueueThread;
00141     bool                           _recvQueueThreadRunning;
00142     bool                           _recvQueueThreadStop;
00143     UInt16                         _seqNumber;
00144     SocketAddress                  _mcastAddress;
00145     DgramQueue                     _queue;
00146     DgramQueue                     _free;
00147     Lock                          *_lock;
00148     SocketAddress                  _sender;
00149     SocketAddress                  _ackDestination;
00150     Dgram                         *_lastDgram;
00151     UInt32                         _lastDgramPos;
00152     bool                           _initialized;
00153     std::map<SocketAddress,UInt16> _combineAck;
00154     UInt16                         _maxAck;
00155 
00158     /*==========================  PRIVATE  ================================*/
00159   private:
00160 
00161     /*---------------------------------------------------------------------*/
00165            bool recvNextDgram  (Dgram *dgram                   );
00166            void combineAck     (Dgram *dgram,SocketAddress from);
00167     static void recvQueueThread( void *arg                     );
00168            bool recvQueue      ( void                          );
00169            void initialize     ( void                          );
00170 
00172     /*---------------------------------------------------------------------*/
00176     static ConnectionType _type;
00177 
00180     typedef PointSockConnection Inherited;
00181 
00182     // prohibit default functions (move to 'public' if you need one)
00183     PointMCastConnection(const PointMCastConnection &source);
00184     PointMCastConnection& operator =(const PointMCastConnection &source);
00185 };
00186 
00187 //---------------------------------------------------------------------------
00188 //   Exported Types
00189 //---------------------------------------------------------------------------
00190 
00191 // class pointer
00192 
00193 typedef PointMCastConnection *PointMCastConnectionP;
00194 
00195 OSG_END_NAMESPACE
00196 
00197 #define OSG_GROUPMCASTCONNECTION_HEADER_CVSID "@(#)$Id: $"
00198 
00199 #endif /* _GROUPMCASTCONNECTION_H_ */

Generated on Thu Aug 25 04:08:33 2005 for OpenSG by  doxygen 1.4.3