Greenbone Vulnerability Manager  8.0.1~git
Macros | Functions
comm.c File Reference

Generic communication utilities. More...

#include "utils.h"
#include <errno.h>
#include <fcntl.h>
#include <glib.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>

Macros

#define G_LOG_DOMAIN   "md comm"
 GLib log domain. More...
 

Functions

unsigned int to_server_buffer_space ()
 Get the number of characters free in the server output buffer. More...
 
int sendn_to_server (const void *msg, size_t n)
 Send a number of bytes to the server. More...
 
int send_to_server (const char *msg)
 Send a message to the server. More...
 
int sendf_to_server (const char *format,...)
 Format and send a message to the server. More...
 

Detailed Description

Generic communication utilities.

This file contains generic convenience utilities for handling a buffer that is used to communicate with a server.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "md comm"

GLib log domain.

Todo:
Consider moving to libs (so please leave "server" in the names).

Function Documentation

◆ send_to_server()

int send_to_server ( const char *  msg)

Send a message to the server.

Parameters
[in]msgThe message, a string.
Returns
0 for success, any other value for failure.

◆ sendf_to_server()

int sendf_to_server ( const char *  format,
  ... 
)

Format and send a message to the server.

Parameters
[in]formatprintf-style format string for message.
Returns
0 for success, any other value for failure.

◆ sendn_to_server()

int sendn_to_server ( const void *  msg,
size_t  n 
)

Send a number of bytes to the server.

Parameters
[in]msgThe message, a sequence of bytes.
[in]nThe number of bytes from msg to send.
Returns
0 for success, any other value for failure.

◆ to_server_buffer_space()

unsigned int to_server_buffer_space ( )

Get the number of characters free in the server output buffer.

Returns
Number of characters free in server output buffer. 0 when full.