Server Wait On Clients System - Full Internal Documentation v1.6.3
Server Wait On Clients System.
Loading...
Searching...
No Matches
internal.h
Go to the documentation of this file.
1
14/* **********************************************************************
15 * *
16 * Changelog *
17 * *
18 * Date Author Version Description *
19 * *
20 * 19/11/2016 MG 1.0.0 First release. *
21 * 17/12/2016 MG 1.0.1 Re-distribute over libswoccommon and *
22 * libswocserver. *
23 * 13/02/2017 MG 1.0.2 Implement config file reload *
24 * functionality in daemon. *
25 * 22/04/2017 MG 1.0.3 Change to use new bstree struct. *
26 * 04/06/2017 MG 1.0.4 Use more meaningful name for client *
27 * lock bstree. *
28 * 07/06/2017 MG 1.0.5 Implement epoll controlled use of *
29 * multiple ports. *
30 * 14/09/2017 MG 1.0.6 Change 'force unlock' to just 'unlock'. *
31 * 29/10/2017 MG 1.0.7 Remove references to TLS. Security now *
32 * implemented from client side via SSH *
33 * tunnelling. *
34 * 17/11/2017 MG 1.0.8 Add Doxygen comments. *
35 * Add SPDX license tag. *
36 * 10/05/2018 MG 1.0.9 Add support for blocked clients list. *
37 * Add server client block and unblock. *
38 * Add server block and unblock. *
39 * 18/05/2018 MG 1.0.10 Add client show server block status. *
40 * 22/05/2018 MG 1.0.11 Change from swocserverd.h to internal.h *
41 * 05/08/2018 MG 1.0.12 Remove spurious include of sys/types.h *
42 * 25/08/2018 MG 1.0.13 Add prototype for swsd_reload_config. *
43 * 18/05/2019 MG 1.0.14 Merge sub-projects into one. *
44 * 08/11/2019 MG 1.0.15 Use standard GNU ifdeffery around use *
45 * of AC_HEADER_STDBOOL. *
46 * 14/03/2020 MG 1.0.16 Add support for id_req. *
47 * 10/10/2021 MG 1.0.17 Use newly internalised common header. *
48 * 08/12/2021 MG 1.0.18 Tighten SPDX tag. *
49 * *
50 ************************************************************************
51 */
52
53#ifndef SWOCSERVERD_INTERNAL_H
54#define SWOCSERVERD_INTERNAL_H
55
56#include <limits.h>
57
58/* Standard GNU AC_HEADER_STDBOOL ifdeffery. */
59#ifdef HAVE_STDBOOL_H
60 #include <stdbool.h>
61#else
62 #ifndef HAVE__BOOL
63 #ifdef __cplusplus /* clang-format off */
64 typedef bool _Bool; /* clang-format on */
65 #else
66 #define _Bool signed char
67 #endif
68 #endif
69 #define bool _Bool
70 #define false 0
71 #define true 1
72 #define __bool_true_false_are_defined 1
73#endif
74
75#include <bstree.h>
76#include <libswoccommon.h>
77#include <mgemessage.h>
78#include <portability.h>
79
80BEGIN_C_DECLS
81
82#define MAX_LISTEN_PORTS 10
83#define MAX_EPOLL_EVENTS 64
88struct comm_spec {
89 int portno;
91};
92
93extern int swsd_err;
94extern char client[_POSIX_HOST_NAME_MAX];
95extern int debug;
96extern int end;
97extern int cursockfd;
98extern struct comm_spec *port_spec;
99extern bool srv_blocked;
100extern struct bstree *cli_locks, *cli_blocked, *port_sock;
101
102int swsd_validate_config(void);
103
104int prepare_sockets(void);
105
106int process_comms(void);
107
108int srv_end_req(struct mgemessage *msg, enum msg_arguments *msg_args);
109
110int srv_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
111
112int srv_cli_blocklist_req(struct mgemessage *msg, enum msg_arguments *msg_args);
113
114int srv_cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
115
116int srv_cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
117
118int srv_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
119
120int srv_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
121
122int srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
123
124int cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
125
126int cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
127
128int cli_srv_block_status_req(struct mgemessage *msg,
129 enum msg_arguments *msg_args);
130
131int srv_cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args);
132
133int cli_lock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
134
135int cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args);
136
137int srv_reload_req(struct mgemessage *msg, enum msg_arguments *msg_args);
138
139int swsd_reload_config(void);
140
141int cli_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
142
143int cli_reset_req(struct mgemessage *msg, enum msg_arguments *msg_args);
144
145void id_req(struct mgemessage *msg, enum msg_arguments *msg_args);
146
148
150
152
154
155END_C_DECLS
156
157#endif /* ndef SWOCSERVERD_INTERNAL_H */
158
Internal header file for Server Wait on Client common library.
msg_arguments
enum specifying error status of arguments.
Definition: libswoccommon.h:91
int srv_reload_req(struct mgemessage *msg, enum msg_arguments *msg_args)
swocserver request to reload config file.
Definition: request.c:151
int cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client block further locks request.
Definition: request.c:550
int cli_reset_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Reset request from client.
Definition: request.c:812
int cli_srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client requests status of server level blocking.
Definition: request.c:644
int srv_cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client lock release.
Definition: request.c:325
int srv_cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client to be unblocked.
Definition: request.c:419
void id_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server or client submits id.
Definition: request.c:859
struct bstree * cli_blocked
Definition: internal.h:100
int swsd_validate_config(void)
Parse and validate the config file.
Definition: validateconfig.c:63
int srv_cli_blocklist_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server client block list request.
Definition: request.c:273
bool srv_blocked
Server is blocked?
Definition: main.c:114
char client[_POSIX_HOST_NAME_MAX]
Client name.
Definition: main.c:109
char * swocserverd_get_src_version(void)
Get the source version.
Definition: version.c:50
int cli_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Status request from client.
Definition: request.c:755
int srv_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server status request.
Definition: request.c:206
struct bstree * cli_locks
Clients and locks.
Definition: main.c:115
struct comm_spec * port_spec
Port / socket config mappings.
Definition: main.c:113
int srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests status of server level blocking.
Definition: request.c:520
int cursockfd
Socket file descriptor in use.
Definition: main.c:112
int swsd_reload_config(void)
Reload the config file.
Definition: request.c:179
struct bstree * port_sock
Definition: internal.h:100
int srv_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests server level blocking.
Definition: request.c:465
int srv_cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client to be blocked.
Definition: request.c:371
int cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client unblock further locks request.
Definition: request.c:599
char * swocserverd_get_pkg_version(void)
Get the git-describe based package version.
Definition: version.c:41
int cli_lock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client lock request.
Definition: request.c:657
int srv_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests removal of server level blocking.
Definition: request.c:492
int end
End pending.
Definition: main.c:111
int debug
Debug - 0 false, 1 true.
Definition: main.c:110
void swocserverd_print_src_version(void)
Print the source version string to stdout.
Definition: version.c:67
int cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Release request from client.
Definition: request.c:711
int srv_end_req(struct mgemessage *msg, enum msg_arguments *msg_args)
swocserver requesting the daemon to terminate.
Definition: request.c:116
void swocserverd_print_pkg_version(void)
Print the package version string to stdout.
Definition: version.c:58
int swsd_err
swoc daemon error number.
Definition: main.c:108
#define _Bool
Definition: internal.h:66
int process_comms(void)
Wait and then process communications.
Definition: comms.c:216
int prepare_sockets(void)
Prepare all sockets.
Definition: comms.c:118
Map sockets to ports.
Definition: internal.h:88
int socketfd
Socket file descriptor.
Definition: internal.h:90
int portno
Port number.
Definition: internal.h:89