fixed: gcc8 compile issues
[opensg.git] / Source / Base / Network / Socket / OSGGroupSockConnection.h
blob86837d90c3ee0679a59c73b6addcaf55a976340b
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 _GROUPSOCKCONNECTION_H_
41 #define _GROUPSOCKCONNECTION_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 //---------------------------------------------------------------------------
47 // Includes
48 //---------------------------------------------------------------------------
50 #include <string>
52 #include "OSGBaseDef.h"
53 #include "OSGBaseTypes.h"
54 #include "OSGGroupConnection.h"
55 #include "OSGTime.h"
56 #include "OSGStreamSocket.h"
58 OSG_BEGIN_NAMESPACE
60 class PointSockConnection;
62 /*! \ingroup GrpBaseNetwork
63 \ingroup GrpBaseNetworkSockets
64 \ingroup GrpLibOSGBase
67 class OSG_BASE_DLLMAPPING GroupSockConnection : public GroupConnection
69 /*========================== PUBLIC =================================*/
70 public:
72 /*---------------------------------------------------------------------*/
73 /*! \name Constructors */
74 /*! \{ */
76 GroupSockConnection ( void );
77 virtual ~GroupSockConnection ( void );
79 /*! \} */
80 /*---------------------------------------------------------------------*/
81 /*! \name type info */
82 /*! \{ */
84 virtual const ConnectionType *getType (void);
86 /*! \} */
87 /*---------------------------------------------------------------------*/
88 /*! \name connection */
89 /*! \{ */
91 virtual Channel connectPoint(const std::string &address,
92 Time timeout=-1 );
93 virtual void disconnect ( Channel channel );
94 virtual Channel acceptPoint ( Time timeout=-1 );
95 virtual std::string bind (const std::string &interf );
97 /*! \} */
98 /*---------------------------------------------------------------------*/
99 /*! \name params */
100 /*! \{ */
102 virtual void setParams(const std::string &params);
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 GroupConnection *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);
141 virtual void write (MemoryHandle mem, UInt32 size);
142 virtual void writeBuffer (void);
144 /*! \} */
145 /*---------------------------------------------------------------------*/
146 /*! \name members */
147 /*! \{ */
149 StreamSocket _acceptSocket;
150 std::vector<StreamSocket> _sockets;
151 std::vector<SocketAddress> _remoteAddresses;
152 ChannelIndex _readIndex;
153 std::vector<UInt8> _socketReadBuffer;
154 std::vector<UInt8> _socketWriteBuffer;
156 /*! \} */
157 /*---------------------------------------------------------------------*/
158 /*! \name synchronisation */
159 /*! \{ */
161 virtual bool wait (Time timeout) OSG_THROW (ReadError );
162 virtual void signal(void ) OSG_THROW (WriteError);
164 /*! \} */
166 /*========================== PRIVATE ================================*/
167 private:
169 friend class PointSockConnection;
171 /*---------------------------------------------------------------------*/
172 /*! \name static type */
173 /*! \{ */
175 static ConnectionType _type;
177 /*! \} */
178 /*---------------------------------------------------------------------*/
179 /*! \name internal methods */
180 /*! \{ */
182 static bool connectSocket(StreamSocket &socket,
183 std::string address,
184 SocketAddress &destination,
185 Time timeout);
186 static bool acceptSocket (StreamSocket &accept,
187 StreamSocket &from,
188 SocketAddress &destination,
189 Time timeout);
191 /*! \} */
193 typedef GroupConnection Inherited;
195 // prohibit default functions (move to 'public' if you need one)
196 GroupSockConnection(const GroupSockConnection &source);
197 GroupSockConnection& operator =(const GroupSockConnection &source);
200 //---------------------------------------------------------------------------
201 // Exported Types
202 //---------------------------------------------------------------------------
204 // class pointer
206 typedef GroupSockConnection *GroupSockConnectionP;
208 OSG_END_NAMESPACE
210 #endif /* _GROUPSOCKCONNECTION_H_ */