MGE General C Library - API Documentation
Library of general C functions.
message.c File Reference

Message processing functions. More...

#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "internal.h"
#include <mge-errno.h>
#include <mgebuffer.h>
#include <mgememory.h>
#include <mgemessage.h>
Include dependency graph for message.c:

Functions

struct mgemessagepull_msg (struct mgebuffer *buf, struct mgemessage *msg)
 Pull a message from a buffer object. More...
 
void clear_msg (struct mgemessage *msg, const char terminator, const char separator)
 Clear message struct. More...
 
void print_msg (struct mgemessage *msg)
 Print a message struct. More...
 

Variables

static int args
 Number of arguments in the message. More...
 

Detailed Description

Message processing functions.

All message handling support functions.

Author
Copyright (C) 2017-2020 Mark Grant

Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0

Version
v1.0.14 ==== 19/07/2020

Function Documentation

◆ clear_msg()

void clear_msg ( struct mgemessage msg,
const char  terminator,
const char  separator 
)

Clear message struct.

Free memory allocated to the object and initialise the fields.

Parameters
msgA message object to clear.
terminatorThe message delimitter to use.
separatorThe message element delimitter to use.

◆ print_msg()

void print_msg ( struct mgemessage msg)

Print a message struct.

Useful for debugging.

Parameters
msgThe message object to print to stdout.

◆ pull_msg()

struct mgemessage* pull_msg ( struct mgebuffer buf,
struct mgemessage msg 
)

Pull a message from a buffer object.

On error NULL is returned and mge_errno is set.

Parameters
bufA buffer object.
msgA message object.
Returns
The resulting message object, partial or complete, or NULL on error.

Variable Documentation

◆ args

int args
static

Number of arguments in the message.