42 #ifndef LIBSWOCCOMMON_H
43 #define LIBSWOCCOMMON_H
46 #include <sys/types.h>
48 #include <mgemessage.h>
49 #include <portability.h>
61 #define SOCK_BUF_SIZE 256
67 #define SSH_CHAN_POLL_TIMEOUT 10000
100 int init_conn(
int *sockfd,
int *portno,
char *srv);
102 int est_connect(
int *sfd,
char *serv,
int *portno,
struct addrinfo *hints,
115 int exch_msg(
char *outgoing_msg,
size_t om_length,
struct mgemessage *msg);
msg_arguments
enum specifying error status of arguments.
Definition: libswoccommon.h:91
@ args_ok
Definition: libswoccommon.h:91
@ args_err
Definition: libswoccommon.h:91
int ssh
Use SSH false == 0, true == 1.
Definition: validateconfig.c:60
BEGIN_C_DECLS int pollint
Polling interval.
Definition: validateconfig.c:59
comms_mode
enum indentify send or receive mode.
Definition: libswoccommon.h:94
@ recv_mode
Definition: libswoccommon.h:94
@ send_mode
Definition: libswoccommon.h:94
msg_request
enum identifying the message request.
Definition: libswoccommon.h:73
@ swocstatus
Definition: libswoccommon.h:85
@ swocallow
Definition: libswoccommon.h:74
@ swocid
Definition: libswoccommon.h:80
@ swocblock
Definition: libswoccommon.h:75
@ swoclock
Definition: libswoccommon.h:81
@ swocreload
Definition: libswoccommon.h:83
@ swocrelease
Definition: libswoccommon.h:82
@ swocblocklist
Definition: libswoccommon.h:76
@ req_err
Definition: libswoccommon.h:87
@ swocunblock
Definition: libswoccommon.h:86
@ swocdisallow
Definition: libswoccommon.h:78
@ swocreset
Definition: libswoccommon.h:84
@ swocend
Definition: libswoccommon.h:79
@ swocblockstatus
Definition: libswoccommon.h:77
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:91
void libswoccommon_print_src_version(void)
Print the source version string to stdout.
Definition: version.c:69
int srvportno
Server port number.
Definition: validateconfig.c:62
int sshportno
Local port to use if using SSH.
Definition: validateconfig.c:63
int prep_recv_sock(int *sockfd, int *portno)
Prepare TCP socket to receive connections.
Definition: tcp.c:63
int close_sock(const int *sockfd)
Close TCP socket.
Definition: tcp.c:240
int exch_msg(char *outgoing_msg, size_t om_length, struct mgemessage *msg)
Exchange messages.
Definition: messages.c:178
int open_ssh_tunnel(void)
Establish SSH connection.
Definition: ssh.c:80
char server[]
Server name.
Definition: validateconfig.c:61
int init_conn(int *sockfd, int *portno, char *srv)
Initiate TCP stream socket connection.
Definition: tcp.c:101
char sshuser[]
Server username for SSH.
Definition: validateconfig.c:64
int swcom_validate_config(void)
Parse and validate the config file.
Definition: validateconfig.c:71
msg_source
enum identifying the source of a message.
Definition: libswoccommon.h:70
@ src_err
Definition: libswoccommon.h:70
@ swocserver
Definition: libswoccommon.h:70
@ swocserverd
Definition: libswoccommon.h:70
@ swocclient
Definition: libswoccommon.h:70
int est_connect(int *sfd, char *serv, int *portno, struct addrinfo *hints, enum comms_mode *mode)
Establish send or receive connection.
Definition: tcp.c:129
int listen_sock(const int *sfd)
Set TCP socket to listen.
Definition: tcp.c:212
int send_outgoing_msg(char *outgoing_msg, size_t outgoing_msg_length, int *newsockfd)
Send a message.
Definition: messages.c:151
char * libswoccommon_get_pkg_version(void)
Get the git-describe based package version.
Definition: version.c:43
char * libswoccommon_get_src_version(void)
Get the source version.
Definition: version.c:52
int close_ssh_tunnel(void)
Disconnect and close an SSH session.
Definition: ssh.c:154
void libswoccommon_print_pkg_version(void)
Print the package version string to stdout.
Definition: version.c:60