Message processing functions common to swoc programs.
More...
#include <arpa/inet.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <libswoccommon.h>
#include <mge-errno.h>
#include <mgebuffer.h>
#include <mgemessage.h>
|
| static int | get_reply_msg (int sockfd, struct mgemessage *recv_msg) |
| |
| static int | host_id (int sockfd, char *orig_outgoing_msg) |
| |
| static int | get_host_name_ip (int sock_fd, char *host_name, socklen_t host_name_size, char *host_ip, socklen_t host_ip_size) |
| |
| void | parse_msg (struct mgemessage *msg, enum msg_arguments *msg_args, enum msg_source *msg_src, enum msg_request *msg_req) |
| | Parse a message. More...
|
| |
| int | send_outgoing_msg (char *outgoing_msg, size_t outgoing_msg_length, int *newsockfd) |
| | Send a message. More...
|
| |
| int | exch_msg (char *outgoing_msg, size_t om_length, struct mgemessage *msg) |
| | Exchange messages. More...
|
| |
Message processing functions common to swoc programs.
- Author
- Copyright (C) 2017-2022 Mark Grant
Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only
- Version
- v1.1.18 ==== 09/06/2022
◆ exch_msg()
| int exch_msg |
( |
char * |
outgoing_msg, |
|
|
size_t |
om_length, |
|
|
struct mgemessage * |
msg |
|
) |
| |
Exchange messages.
Send and receive 1 requested message after sending ID message. On error mge_errno will be set.
- Parameters
-
| outgoing_msg | The message to send. |
| om_length | The length of the outgoing message. |
| msg | The received message. |
- Returns
- 0 on success, < zero on error.
◆ get_host_name_ip()
| static int get_host_name_ip |
( |
int |
sock_fd, |
|
|
char * |
host_name, |
|
|
socklen_t |
host_name_size, |
|
|
char * |
host_ip, |
|
|
socklen_t |
host_ip_size |
|
) |
| |
|
static |
◆ get_reply_msg()
| static int get_reply_msg |
( |
int |
sockfd, |
|
|
struct mgemessage * |
recv_msg |
|
) |
| |
|
static |
◆ host_id()
| static int host_id |
( |
int |
sockfd, |
|
|
char * |
orig_outgoing_msg |
|
) |
| |
|
static |
◆ parse_msg()
| void parse_msg |
( |
struct mgemessage * |
msg, |
|
|
enum msg_arguments * |
msg_args, |
|
|
enum msg_source * |
msg_src, |
|
|
enum msg_request * |
msg_req |
|
) |
| |
Parse a message.
Identify message source and request.
- Parameters
-
| msg | The message to process. |
| msg_args | The arguments to the message. |
| msg_src | The source of the message. |
| msg_req | The request contained in the message. |
◆ send_outgoing_msg()
| int send_outgoing_msg |
( |
char * |
outgoing_msg, |
|
|
size_t |
outgoing_msg_length, |
|
|
int * |
newsockfd |
|
) |
| |
Send a message.
On error mge_errno will be set.
- Parameters
-
| outgoing_msg | The message to send. |
| outgoing_msg_length | The length of the message. |
| newsockfd | The socket file descriptor. |
- Returns
- 0 on success, < zero on error.