blocxx
ServerSocketImpl.hpp
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright (C) 2005, Vintela, Inc. All rights reserved.
3* Copyright (C) 2006, Novell, Inc. All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7*
8* * Redistributions of source code must retain the above copyright notice,
9* this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of
14* Vintela, Inc.,
15* nor Novell, Inc.,
16* nor the names of its contributors or employees may be used to
17* endorse or promote products derived from this software without
18* specific prior written permission.
19*
20* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30* POSSIBILITY OF SUCH DAMAGE.
31*******************************************************************************/
32
33
42#ifndef BLOCXX_INETSERVERSOCKETIMPL_HPP_INCLUDE_GUARD_
43#define BLOCXX_INETSERVERSOCKETIMPL_HPP_INCLUDE_GUARD_
44#include "blocxx/BLOCXX_config.h"
46#include "blocxx/Socket.hpp"
48#include "blocxx/Types.hpp"
49#include "blocxx/File.hpp"
52#include "blocxx/SSLCtxMgr.hpp"
53
54// The classes and functions defined in this file are not meant for general
55// use, they are internal implementation details. They may change at any time.
56
57namespace BLOCXX_NAMESPACE
58{
59
60class BLOCXX_COMMON_API ServerSocketImpl : public SelectableIFC
61{
62public:
67 Socket accept(const Timeout& timeout);
68 void close();
69// unsigned long getLocalAddressRaw() { return m_localAddress; }
70// unsigned short getLocalPortRaw() { return m_localPort; }
71 SocketAddress getLocalAddress() { return m_localAddress; }
72 SocketHandle_t getfd() const { return m_sockfd; }
73
74
75 // this is deprecated, but we don't mark it so here because it's and impl.
76 void doListen(UInt16 port, SocketFlags::ESSLFlag isSSL, int queueSize=10,
77 const String& listenAddr = SocketAddress::ALL_LOCAL_ADDRESSES,
78 SocketFlags::EReuseAddrFlag reuseAddr = SocketFlags::E_REUSE_ADDR);
79
80 // listen for IPv4 protocol
81 void doListenIPv4(UInt16 port, int queueSize, const String& listenAddr);
82#ifdef BLOCXX_HAVE_IPV6
83 // listen for IPv6 protocol
84 void doListenIPv6(UInt16 port, int queueSize, const String& listenAddr);
85#endif
86 void doListen(UInt16 port, int queueSize=10,
87 const String& listenAddr = SocketAddress::ALL_LOCAL_ADDRESSES,
88 SocketFlags::EReuseAddrFlag reuseAddr = SocketFlags::E_REUSE_ADDR);
89
90#ifndef BLOCXX_WIN32
91 void doListenUDS(const String& filename, int queueSize=10,
92 bool reuseAddr = true);
93#endif
94
95 Select_t getSelectObj() const;
96private:
97 void fillAddrParms();
99// unsigned long m_localAddress;
100// unsigned short m_localPort;
106
107#ifdef BLOCXX_WIN32
108#pragma warning (push)
109#pragma warning (disable: 4251)
110#endif
111
113#if defined(BLOCXX_WIN32)
114#pragma warning (pop)
115 HANDLE m_event;
116 bool m_shuttingDown;
117#else
119#endif
120};
121
122} // end namespace BLOCXX_NAMESPACE
123
124#endif
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
Definition File.hpp:55
ServerSocketImpl & operator=(const ServerSocketImpl &arg)
ServerSocketImpl(const ServerSocketImpl &arg)
This String class is an abstract data type that represents as NULL terminated string of characters.
Definition String.hpp:67
A timeout can be absolute, which means that it will happen at the specified DateTime.
Definition Timeout.hpp:56
Taken from RFC 1321.