14#ifndef LIBSWOCCOMMON_H
15#define LIBSWOCCOMMON_H
20#include <libmgec/mge-message.h>
21#include <libmgec/mge-portability.h>
33#define SOCK_BUF_SIZE 256
39#define SSH_CHAN_POLL_TIMEOUT 10000
72int init_conn(
int *sockfd,
int *portno,
const char *srv);
74int est_connect(
int *sfd,
const char *serv,
int *portno,
struct addrinfo *hints,
87int exch_msg(
const char *outgoing_msg,
size_t om_length,
88 struct mgemessage *msg);
94__attribute__((
const)) const
char *libswoccommon_get_pkg_version(
void);
96__attribute__((const)) const
char *libswoccommon_get_src_version(
void);
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