Server Wait On Clients System - Full Internal Documentation  v1.7.4
Server Wait On Clients System.
internal.h
Go to the documentation of this file.
1 
14 #ifndef SWOCSERVERD_INTERNAL_H
15 #define SWOCSERVERD_INTERNAL_H
16 
17 #include <limits.h>
18 
19 /* Standard GNU AC_HEADER_STDBOOL ifdeffery. */
20 #ifdef HAVE_STDBOOL_H
21  #include <stdbool.h>
22 #else
23  #ifndef HAVE__BOOL
24  #ifdef __cplusplus /* clang-format off */
25  typedef bool _Bool; /* clang-format on */
26  #else
27  #define _Bool signed char
28  #endif
29  #endif
30  #define bool _Bool
31  #define false 0
32  #define true 1
33  #define __bool_true_false_are_defined 1
34 #endif
35 
36 #include <libmgec/mge-bstree.h>
37 #include <libmgec/mge-message.h>
38 #include <libmgec/mge-portability.h>
39 #include <swoc/libswoccommon.h>
40 
41 BEGIN_C_DECLS
42 
43 #define MAX_LISTEN_PORTS 10
44 #define MAX_EPOLL_EVENTS 64
49 struct comm_spec {
50  int portno;
51  int socketfd;
52 };
53 
54 extern int swsd_err;
55 extern char client[_POSIX_HOST_NAME_MAX];
56 extern int debug;
57 extern int end;
58 extern int cursockfd;
59 extern struct comm_spec *port_spec;
60 extern bool srv_blocked;
61 extern struct bstree *cli_locks, *cli_blocked, *port_sock;
62 
63 int swsd_validate_config(void);
64 
65 int prepare_sockets(void);
66 
67 int process_comms(void);
68 
69 int srv_end_req(struct mgemessage *msg, enum msg_arguments *msg_args);
70 
71 int srv_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
72 
73 int srv_cli_blocklist_req(struct mgemessage *msg, enum msg_arguments *msg_args);
74 
75 int srv_cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
76 
77 int srv_cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
78 
79 int srv_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
80 
81 int srv_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
82 
83 int srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
84 
85 int cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args);
86 
87 int cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
88 
89 int cli_srv_block_status_req(struct mgemessage *msg,
90  enum msg_arguments *msg_args);
91 
92 int srv_cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args);
93 
94 int cli_lock_req(struct mgemessage *msg, enum msg_arguments *msg_args);
95 
96 int cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args);
97 
98 int srv_reload_req(struct mgemessage *msg, enum msg_arguments *msg_args);
99 
100 int swsd_reload_config(void);
101 
102 int cli_status_req(struct mgemessage *msg, enum msg_arguments *msg_args);
103 
104 int cli_reset_req(struct mgemessage *msg, enum msg_arguments *msg_args);
105 
106 void id_req(struct mgemessage *msg, enum msg_arguments *msg_args);
107 
108 __attribute__((const)) const char *swocserverd_get_pkg_version(void);
109 
110 __attribute__((const)) const char *swocserverd_get_src_version(void);
111 
113 
115 
116 END_C_DECLS
117 
118 #endif /* ndef SWOCSERVERD_INTERNAL_H */
BEGIN_C_DECLS __attribute__((const)) const char *swocclient_get_pkg_version(void)
Get the git-describe based package version.
Definition: version.c:24
int srv_reload_req(struct mgemessage *msg, enum msg_arguments *msg_args)
swocserver request to reload config file.
Definition: request.c:90
int srv_cli_blocklist_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server client block list request.
Definition: request.c:212
int debug
Debug - 0 false, 1 true.
Definition: main.c:53
void swocserverd_print_pkg_version(void)
Print the package version string to stdout.
Definition: version.c:40
int srv_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests removal of server level blocking.
Definition: request.c:433
struct comm_spec * port_spec
Port / socket config mappings.
Definition: main.c:56
int swsd_validate_config(void)
Parse and validate the config file.
Definition: validateconfig.c:34
struct bstree * port_sock
Port / socket actual mappings.
Definition: main.c:60
int srv_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests server level blocking.
Definition: request.c:406
void swocserverd_print_src_version(void)
Print the source version string to stdout.
Definition: version.c:49
int swsd_err
swoc daemon error number.
Definition: main.c:51
int cursockfd
Socket file descriptor in use.
Definition: main.c:55
msg_arguments
enum specifying error status of arguments.
Definition: libswoccommon.h:63
int portno
Port number.
Definition: internal.h:50
int srv_end_req(struct mgemessage *msg, enum msg_arguments *msg_args)
swocserver requesting the daemon to terminate.
Definition: request.c:55
int srv_cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client to be blocked.
Definition: request.c:312
int swsd_reload_config(void)
Reload the config file.
Definition: request.c:118
int cli_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Status request from client.
Definition: request.c:710
int prepare_sockets(void)
Prepare all sockets.
Definition: comms.c:60
int srv_cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client to be unblocked.
Definition: request.c:360
#define _Bool
Definition: internal.h:27
int srv_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server status request.
Definition: request.c:145
int end
End pending.
Definition: main.c:54
int socketfd
Socket file descriptor.
Definition: internal.h:51
int cli_srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client requests status of server level blocking.
Definition: request.c:585
Map sockets to ports.
Definition: internal.h:49
int cli_unblock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client unblock further locks request.
Definition: request.c:540
int process_comms(void)
Wait and then process communications.
Definition: comms.c:158
int srv_block_status_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests status of server level blocking.
Definition: request.c:461
int cli_lock_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client lock request.
Definition: request.c:598
bool srv_blocked
Server is blocked?
Definition: main.c:57
int srv_cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server requests client lock release.
Definition: request.c:264
int cli_reset_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Reset request from client.
Definition: request.c:767
char client[_POSIX_HOST_NAME_MAX]
Client name.
Definition: main.c:52
int cli_block_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Client block further locks request.
Definition: request.c:491
struct bstree * cli_locks
Clients and locks.
Definition: main.c:58
Internal header file for Server Wait on Client common library.
int cli_rel_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Release request from client.
Definition: request.c:664
struct bstree * cli_blocked
Blocked client list.
Definition: main.c:59
void id_req(struct mgemessage *msg, enum msg_arguments *msg_args)
Server or client submits id.
Definition: request.c:814