Server Wait On Clients System - Full Internal Documentation v1.7.2
Server Wait On Clients System.
libswoccommon.h
Go to the documentation of this file.
1
14#ifndef LIBSWOCCOMMON_H
15#define LIBSWOCCOMMON_H
16
17#include <netdb.h>
18#include <sys/types.h>
19
20#include <libmgec/mge-message.h>
21#include <libmgec/mge-portability.h>
22
23BEGIN_C_DECLS
24
25extern int pollint;
26extern int ssh;
27extern char server[];
28extern int srvportno;
29extern int sshportno;
30extern char sshuser[];
31
33#define SOCK_BUF_SIZE 256
34
36#define SOCK_Q_LEN 10
37
39#define SSH_CHAN_POLL_TIMEOUT 10000
40
43
60};
61
64
67
68int swcom_validate_config(void);
69
70int prep_recv_sock(int *sockfd, int *portno);
71
72int init_conn(int *sockfd, int *portno, const char *srv);
73
74int est_connect(int *sfd, const char *serv, int *portno, struct addrinfo *hints,
75 enum comms_mode *mode);
76
77int listen_sock(const int *sfd);
78
79int close_sock(const int *sockfd);
80
81void parse_msg(struct mgemessage *msg, enum msg_arguments *msg_args,
82 enum msg_source *msg_src, enum msg_request *msg_req);
83
84int send_outgoing_msg(const char *outgoing_msg, size_t outgoing_msg_length,
85 int *newsockfd);
86
87int exch_msg(const char *outgoing_msg, size_t om_length,
88 struct mgemessage *msg);
89
90int open_ssh_tunnel(void);
91
92int close_ssh_tunnel(void);
93
94__attribute__((const)) const char *libswoccommon_get_pkg_version(void);
95
96__attribute__((const)) const char *libswoccommon_get_src_version(void);
97
99
101
102END_C_DECLS
103
104#endif /* ndef LIBSWOCCOMMON_H */
msg_arguments
enum specifying error status of arguments.
Definition: libswoccommon.h:63
@ args_ok
Definition: libswoccommon.h:63
@ args_err
Definition: libswoccommon.h:63
int ssh
Use SSH false == 0, true == 1.
Definition: validateconfig.c:39
BEGIN_C_DECLS int pollint
Polling interval.
Definition: validateconfig.c:38
comms_mode
enum indentify send or receive mode.
Definition: libswoccommon.h:66
@ recv_mode
Definition: libswoccommon.h:66
@ send_mode
Definition: libswoccommon.h:66
msg_request
enum identifying the message request.
Definition: libswoccommon.h:45
@ swocstatus
Definition: libswoccommon.h:57
@ swocallow
Definition: libswoccommon.h:46
@ swocid
Definition: libswoccommon.h:52
@ swocblock
Definition: libswoccommon.h:47
@ swoclock
Definition: libswoccommon.h:53
@ swocreload
Definition: libswoccommon.h:55
@ swocrelease
Definition: libswoccommon.h:54
@ swocblocklist
Definition: libswoccommon.h:48
@ req_err
Definition: libswoccommon.h:59
@ swocunblock
Definition: libswoccommon.h:58
@ swocdisallow
Definition: libswoccommon.h:50
@ swocreset
Definition: libswoccommon.h:56
@ swocend
Definition: libswoccommon.h:51
@ swocblockstatus
Definition: libswoccommon.h:49
void parse_msg(struct mgemessage *msg, enum msg_arguments *msg_args, enum msg_source *msg_src, enum msg_request *msg_req)
Parse a message.
Definition: messages.c:44
void libswoccommon_print_src_version(void)
Print the source version string to stdout.
Definition: version.c:50
int srvportno
Server port number.
Definition: validateconfig.c:41
int sshportno
Local port to use if using SSH.
Definition: validateconfig.c:42
int est_connect(int *sfd, const char *serv, int *portno, struct addrinfo *hints, enum comms_mode *mode)
Establish send or receive connection.
Definition: tcp.c:100
int prep_recv_sock(int *sockfd, int *portno)
Prepare TCP socket to receive connections.
Definition: tcp.c:34
int close_sock(const int *sockfd)
Close TCP socket.
Definition: tcp.c:211
int open_ssh_tunnel(void)
Establish SSH connection.
Definition: ssh.c:53
char server[]
Server name.
Definition: validateconfig.c:40
char sshuser[]
Server username for SSH.
Definition: validateconfig.c:43
int init_conn(int *sockfd, int *portno, const char *srv)
Initiate TCP stream socket connection.
Definition: tcp.c:72
int swcom_validate_config(void)
Parse and validate the config file.
Definition: validateconfig.c:50
int exch_msg(const char *outgoing_msg, size_t om_length, struct mgemessage *msg)
Exchange messages.
Definition: messages.c:131
msg_source
enum identifying the source of a message.
Definition: libswoccommon.h:42
@ src_err
Definition: libswoccommon.h:42
@ swocserver
Definition: libswoccommon.h:42
@ swocserverd
Definition: libswoccommon.h:42
@ swocclient
Definition: libswoccommon.h:42
int listen_sock(const int *sfd)
Set TCP socket to listen.
Definition: tcp.c:183
__attribute__((const)) const char *libswoccommon_get_pkg_version(void)
Get the git-describe based package version.
Definition: version.c:24
int close_ssh_tunnel(void)
Disconnect and close an SSH session.
Definition: ssh.c:127
int send_outgoing_msg(const char *outgoing_msg, size_t outgoing_msg_length, int *newsockfd)
Send a message.
Definition: messages.c:104
void libswoccommon_print_pkg_version(void)
Print the package version string to stdout.
Definition: version.c:41