HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_SocketGroup.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: NET_SocketGroup.h
7  *
8  * COMMENTS:
9  *
10  *
11  */
12 
13 #ifndef __NET_SOCKETGROUP_H__
14 #define __NET_SOCKETGROUP_H__
15 
16 #include "NET_API.h"
17 
18 #include <UT/UT_NonCopyable.h>
19 #include <UT/UT_SharedPtr.h>
20 #include <UT/UT_Signal.h>
21 #include <UT/UT_StringHolder.h>
22 
23 /// Interface for grouping sockets together. Typical use case is for web servers
24 /// where theres a group of server listener sockets.
26 {
27 public:
28  virtual ~NET_ISocketGroup();
29 
31 
32  /// The id of the socket group.
33  const UT_StringHolder& name() const { return myName; }
34 
35  /// @brief Request that the server shutdown immediatelly and all connections
36  /// be closed regardless if the connection has things to process.
37  virtual void requestFullShutdown() = 0;
38  /// @brief Request the server shutdown slowly and allow all connections
39  /// to be closed after they have processed whatever it is they need to.
40  virtual void requestGracefulShutdown() = 0;
41 
42 protected:
43  using creator_group_t
45 
47 
48  static UT_SharedPtr<NET_ISocketGroup> newSocketGroup(
49  const UT_StringHolder& name,
50  creator_group_t creator);
51  static UT_SharedPtr<NET_ISocketGroup> findSocketGroup(
52  const UT_StringRef& name);
53  static void shutdownAll();
54 
55  virtual void handleExit(const UT_SharedPtr<NET_ISocketGroup>& me) {}
56 
57 private:
58  friend class net_SocketGroupRegistry;
59  friend class NET_SubSystem;
60 
61  static void handleExit();
62 
63  UT_StringHolder myName;
64 };
65 
66 #endif // __NET_SOCKETGROUP_H__
67 
#define NET_API
Definition: NET_API.h:9
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
UT_SharedPtr< NET_ISocketGroup >(*)(const UT_StringHolder &) creator_group_t
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual void handleExit(const UT_SharedPtr< NET_ISocketGroup > &me)