fixed: gcc8 compile issues
[opensg.git] / Source / Base / Network / Socket / OSGPointMCastConnection.h
blobf29581a9503dd466c4dc529153523ebbdd64cd7f
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
40 #ifndef _POINTMCASTCONNECTION_H_
41 #define _POINTMCASTCONNECTION_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 //---------------------------------------------------------------------------
47 // Includes
48 //---------------------------------------------------------------------------
50 #include <string>
51 #include <map>
53 #include "OSGBaseDef.h"
54 #include "OSGBaseTypes.h"
55 #include "OSGPointSockConnection.h"
56 #include "OSGTime.h"
57 #include "OSGDgramSocket.h"
58 #include "OSGDgram.h"
59 #include "OSGDgramQueue.h"
61 OSG_BEGIN_NAMESPACE
63 /*! \ingroup GrpBaseNetwork
64 \ingroup GrpBaseNetworkSockets
65 \ingroup GrpLibOSGBase
68 class OSG_BASE_DLLMAPPING PointMCastConnection : public PointSockConnection
70 /*========================== PUBLIC =================================*/
71 public:
73 /*---------------------------------------------------------------------*/
74 /*! \name Constructors */
75 /*! \{ */
77 PointMCastConnection ( void );
78 virtual ~PointMCastConnection ( void );
80 /*! \} */
81 /*---------------------------------------------------------------------*/
82 /*! \name type info */
83 /*! \{ */
85 virtual const ConnectionType *getType (void);
87 /*! \} */
88 /*---------------------------------------------------------------------*/
89 /*! \name connection */
90 /*! \{ */
92 virtual Channel connectGroup(const std::string &address,
93 Time timeout=-1 );
94 virtual void disconnect ( void );
95 virtual Channel acceptGroup ( Time timeout=-1 );
97 /*! \} */
98 /*---------------------------------------------------------------------*/
99 /*! \name synchronisation */
100 /*! \{ */
102 virtual bool wait (Time timeout) OSG_THROW (ReadError);
104 /*! \} */
105 /*---------------------------------------------------------------------*/
106 /*! \name channel handling */
107 /*! \{ */
109 virtual Channel selectChannel (Time timeout=-1) OSG_THROW (ReadError);
111 /*! \} */
112 /*---------------------------------------------------------------------*/
113 /*! \name create */
114 /*! \{ */
116 static PointConnection *create(void);
118 /*! \} */
120 /*========================= PROTECTED ===============================*/
121 protected:
123 /*---------------------------------------------------------------------*/
124 /*! \name Types */
125 /*! \{ */
127 /*! \nohierarchy
130 struct SocketBufferHeader {
131 UInt32 size;
134 /*! \} */
135 /*---------------------------------------------------------------------*/
136 /*! \name IO Implementation */
137 /*! \{ */
139 virtual void read (MemoryHandle mem, UInt32 size);
140 virtual void readBuffer (void) OSG_THROW (ReadError);
142 /*! \} */
143 /*---------------------------------------------------------------------*/
144 /*! \name members */
145 /*! \{ */
147 DgramSocket _mcastSocket;
148 DgramSocket _responseSocket;
149 BaseThreadRefPtr _recvQueueThread;
150 bool _recvQueueThreadRunning;
151 bool _recvQueueThreadStop;
152 UInt16 _seqNumber;
153 SocketAddress _mcastAddress;
154 DgramQueue _queue;
155 DgramQueue _free;
156 LockRefPtr _lock;
157 SocketAddress _sender;
158 SocketAddress _ackDestination;
159 Dgram *_lastDgram;
160 UInt32 _lastDgramPos;
161 bool _initialized;
162 std::map<SocketAddress,UInt16> _combineAck;
163 UInt16 _maxAck;
165 /*! \} */
167 /*========================== PRIVATE ================================*/
168 private:
170 /*---------------------------------------------------------------------*/
171 /*! \name private helpers */
172 /*! \{ */
174 bool recvNextDgram (Dgram *dgram );
175 void combineAck (Dgram *dgram,SocketAddress from);
176 static void recvQueueThread( void *arg );
177 bool recvQueue ( void );
178 void initialize ( void );
180 /*! \} */
181 /*---------------------------------------------------------------------*/
182 /*! \name static type */
183 /*! \{ */
185 static ConnectionType _type;
187 /*! \} */
189 typedef PointSockConnection Inherited;
191 // prohibit default functions (move to 'public' if you need one)
192 PointMCastConnection(const PointMCastConnection &source);
193 PointMCastConnection& operator =(const PointMCastConnection &source);
196 //---------------------------------------------------------------------------
197 // Exported Types
198 //---------------------------------------------------------------------------
200 // class pointer
202 typedef PointMCastConnection *PointMCastConnectionP;
204 OSG_END_NAMESPACE
206 #endif /* _GROUPMCASTCONNECTION_H_ */