forked from OPENDAP/bes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnixSocket.h
82 lines (68 loc) · 2.49 KB
/
UnixSocket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// UnixSocket.h
// This file is part of bes, A C++ back-end server implementation framework
// for the OPeNDAP Data Access Protocol.
// Copyright (c) 2004-2009 University Corporation for Atmospheric Research
// Author: Patrick West <[email protected]> and Jose Garcia <[email protected]>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact University Corporation for Atmospheric Research at
// 3080 Center Green Drive, Boulder, CO 80301
// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
// Please read the full copyright statement in the file COPYRIGHT_UCAR.
//
// Authors:
// pwest Patrick West <[email protected]>
// jgarcia Jose Garcia <[email protected]>
#ifndef UnixSocket_h
#define UnixSocket_h 1
#include <string>
#include "Socket.h"
#define UNIX_SOCKET_BUFFER_SIZE 65535
class UnixSocket : public Socket
{
private:
std::string _unixSocket ;
std::string _tempSocket ;
public:
UnixSocket( const std::string &unixSocket )
: _unixSocket( unixSocket ),
_tempSocket( "" ) {}
UnixSocket( int socket,
struct sockaddr *addr )
: Socket( socket, addr ),
_unixSocket( "" ),
_tempSocket( "" ) {}
virtual ~UnixSocket() {}
virtual void connect() ;
virtual void close() ;
virtual void listen() ;
virtual unsigned int getRecvBufferSize()
{
return UNIX_SOCKET_BUFFER_SIZE ;
}
virtual unsigned int getSendBufferSize()
{
return UNIX_SOCKET_BUFFER_SIZE ;
}
virtual Socket * newSocket( int socket,
struct sockaddr *addr )
{
return new UnixSocket( socket, addr ) ;
}
virtual bool allowConnection() ;
virtual void dump( std::ostream &strm ) const ;
} ;
#endif // UnixSocket_h