Free Electron
Server.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __netsignal_Server_h__
8 #define __netsignal_Server_h__
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 class FE_DL_EXPORT ServerI:
15  public Component,
16  public CastableAs<ServerI>
17 {
18  public:
19 virtual void addLayout(sp<Layout> spLayout) = 0;
20 virtual void start(sp<SignalerI> spSignalerI,
21  unsigned short a_port,
22  sp<Layout> spPollLayout,
23  Socket::Transport transport=Socket::e_tcp,
24  String ioPriority="normal") = 0;
25 virtual void stop(void) = 0;
26 
27 };
28 
29 /** Serves signaling
30 
31  @ingroup netsignal
32 
33  see @ref network_design
34  */
35 class BSDServer : public ServerI
36 {
37  public:
38  BSDServer(void);
39 virtual ~BSDServer(void);
40 
41  /** Add a layout. Only signals of layouts that are added will
42  be sent to the Clients. All addLayout calls must be made
43  before start() is called. */
44 virtual void addLayout(sp<Layout> spLayout);
45  /** Start the server. @em server_addr is to specify the
46  listening port. @em spPollLayout specifies the layout upon
47  which listen polling checks and dead connection cleanup will
48  happen. Note that signal
49  transmission is not associated with this polling, but happens
50  automatically in a child thread.
51  */
52 virtual void start(sp<SignalerI> spSignalerI, unsigned short a_port,
53  sp<Layout> spPollLayout,
54  Socket::Transport transport=Socket::e_tcp,
55  String ioPriority="normal");
56  /** Stop the server.
57  */
58 virtual void stop(void);
59 
60  private:
61  sp<SocketHandler> m_spSocketHandler;
62  sp<SignalerI> m_spSignaler;
63  sp<Layout> m_spPollLayout;
64  bool m_operating;
65  std::list<sp<Layout> > m_layouts;
66 };
67 
68 } /* namespace ext */
69 } /* namespace fe */
70 
71 #endif /* __netsignal_Server_h__ */
72 
kernel
Definition: namespace.dox:3
Serves signaling.
Definition: Server.h:35
Automatically reference-counted string container.
Definition: String.h:128