Server Wait On Clients System - Full Internal Documentation  v1.7.4
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 
23 BEGIN_C_DECLS
24 
25 extern int pollint;
26 extern int ssh;
27 extern char server[];
28 extern int srvportno;
29 extern int sshportno;
30 extern 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 
68 int swcom_validate_config(void);
69 
70 int prep_recv_sock(int *sockfd, int *portno);
71 
72 int init_conn(int *sockfd, int *portno, const char *srv);
73 
74 int est_connect(int *sfd, const char *serv, int *portno, struct addrinfo *hints,
75  enum comms_mode *mode);
76 
77 int listen_sock(const int *sfd);
78 
79 int close_sock(const int *sockfd);
80 
81 void parse_msg(struct mgemessage *msg, enum msg_arguments *msg_args,
82  enum msg_source *msg_src, enum msg_request *msg_req);
83 
84 int send_outgoing_msg(const char *outgoing_msg, size_t outgoing_msg_length,
85  int *newsockfd);
86 
87 int exch_msg(const char *outgoing_msg, size_t om_length,
88  struct mgemessage *msg);
89 
90 int open_ssh_tunnel(void);
91 
92 int 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 
102 END_C_DECLS
103 
104 #endif /* ndef LIBSWOCCOMMON_H */
Definition: libswoccommon.h:54
Definition: libswoccommon.h:55
msg_request
enum identifying the message request.
Definition: libswoccommon.h:45
int swcom_validate_config(void)
Parse and validate the config file.
Definition: validateconfig.c:50
Definition: libswoccommon.h:63
Definition: libswoccommon.h:42
Definition: libswoccommon.h:51
int exch_msg(const char *outgoing_msg, size_t om_length, struct mgemessage *msg)
Exchange messages.
Definition: messages.c:131
Definition: libswoccommon.h:63
Definition: libswoccommon.h:47
Definition: libswoccommon.h:58
Definition: libswoccommon.h:59
msg_arguments
enum specifying error status of arguments.
Definition: libswoccommon.h:63
char sshuser[]
Server username for SSH.
Definition: validateconfig.c:43
int close_sock(const int *sockfd)
Close TCP socket.
Definition: tcp.c:211
Definition: libswoccommon.h:46
Definition: libswoccommon.h:50
Definition: libswoccommon.h:42
int init_conn(int *sockfd, int *portno, const char *srv)
Initiate TCP stream socket connection.
Definition: tcp.c:72
msg_source
enum identifying the source of a message.
Definition: libswoccommon.h:42
Definition: libswoccommon.h:57
void libswoccommon_print_pkg_version(void)
Print the package version string to stdout.
Definition: version.c:41
Definition: libswoccommon.h:52
Definition: libswoccommon.h:53
int listen_sock(const int *sfd)
Set TCP socket to listen.
Definition: tcp.c:183
char server[]
Server name.
Definition: validateconfig.c:40
int sshportno
Local port to use if using SSH.
Definition: validateconfig.c:42
int close_ssh_tunnel(void)
Disconnect and close an SSH session.
Definition: ssh.c:127
Definition: libswoccommon.h:66
Definition: libswoccommon.h:66
int prep_recv_sock(int *sockfd, int *portno)
Prepare TCP socket to receive connections.
Definition: tcp.c:34
int open_ssh_tunnel(void)
Establish SSH connection.
Definition: ssh.c:53
Definition: libswoccommon.h:56
Definition: libswoccommon.h:42
BEGIN_C_DECLS int pollint
Polling interval.
Definition: validateconfig.c:38
int srvportno
Server port number.
Definition: validateconfig.c:41
comms_mode
enum indentify send or receive mode.
Definition: libswoccommon.h:66
void libswoccommon_print_src_version(void)
Print the source version string to stdout.
Definition: version.c:50
int ssh
Use SSH false == 0, true == 1.
Definition: validateconfig.c:39
Definition: libswoccommon.h:48
__attribute__((const)) const char *libswoccommon_get_pkg_version(void)
Get the git-describe based package version.
Definition: version.c:24
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
Definition: libswoccommon.h:42
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
Definition: libswoccommon.h:49
int send_outgoing_msg(const char *outgoing_msg, size_t outgoing_msg_length, int *newsockfd)
Send a message.
Definition: messages.c:104