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