Libtrap: Internal development docs  1.16.1
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
trap_internal.h File Reference

Internal functions and macros for libtrap Verbose and debug macros from libcommlbr. More...

#include <config.h>
#include <stdio.h>
#include <pthread.h>
#include "../include/libtrap/trap.h"
#include "trap_ifc.h"
Include dependency graph for trap_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hello_msg_header_s
 
struct  reader_threads_s
 
struct  autoflush_timeouts
 List of autoflush timeouts of output interfaces. More...
 
struct  trap_ctx_priv_s
 
struct  trap_buffer_header_s
 

Macros

#define MAX_ERROR_MSG_BUFF_SIZE   1024
 
#define DEFAULT_MAX_TERMINAL_WIDTH   85
 
#define SERVICE_GET_COM   10
 Signaling a request for module statistics (interfaces stats - received messages and buffers, sent messages and buffers, autoflushes counter) More...
 
#define SERVICE_SET_COM   11
 Signaling a request to set some interface parameters (timeouts etc.) More...
 
#define SERVICE_OK_REPLY   12
 A value used as a reply signaling success. More...
 
#define NEG_RES_CONT   111
 If the data format and data specifier of input and output interface are the same (input interface can receive the data for module right after the negotiation) More...
 
#define NEG_RES_RECEIVER_FMT_SUBSET   112
 If the data format of input and output interfaces is the same and data specifier of the input interface is subset of the output interface data specifier. More...
 
#define NEG_RES_SENDER_FMT_SUBSET   116
 If the data format of input and output interfaces is the same and new data specifier of the output interface is subset of the old one (it is not first negotiation) More...
 
#define NEG_RES_FMT_MISMATCH   113
 If the data format or data specifier of input and output interfaces does not match. More...
 
#define NEG_RES_FMT_CHANGED   117
 If the data format has changed (for JSON type, UNIREC type uses *SUBSET variants) More...
 
#define NEG_RES_OK   116
 Signaling success (hello message successfully sent to input interface) More...
 
#define NEG_RES_FAILED   114
 If receiving the data from output interface fails or sending the data to input interface fails. More...
 
#define NEG_RES_FMT_UNKNOWN   115
 If the output interface has not specified data format. More...
 
#define MSG(level, format, args...)   if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg(level,trap_err_msg);}
 Debug message macro if DEBUG macro is defined. More...
 
#define MSG_NONL(level, format, args...)   if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg_nonl(trap_err_msg);}
 Debug message macro if DEBUG macro is defined - without new line. More...
 
#define LINE()   {fprintf(stderr, "file: %s, line: %i\n", __FILE__, __LINE__); fflush(stderr);}
 
#define INLINE
 
#define VERBOSE(level, format, args...)
 
#define DEBUG_IFC(X)
 
#define DEBUG_BUF(X)
 
#define TRAP_IN_IFC_COUNTERS   1
 
#define TRAP_OUT_IFC_COUNTERS   3
 
Timeouts handling
#define TRAP_NO_IFC_SLEEP   4
 seconds to sleep, when autoflushing is not active More...
 
#define TRAP_IFC_TIMEOUT   2000000
 size of default timeout on output interfaces in microseconds More...
 

Typedefs

typedef struct trap_ctx_priv_s trap_ctx_priv_t
 
typedef struct hello_msg_header_s hello_msg_header_t
 
typedef enum trap_verbose_level trap_verbose_level_t
 VERBOSE/MSG levels. More...
 
typedef struct autoflush_timeouts ifc_autoflush_t
 List of autoflush timeouts of output interfaces. More...
 
typedef struct trap_buffer_header_s trap_buffer_header_t
 

Enumerations

enum  trap_verbose_level {
  CL_ERROR = -3, CL_WARNING = -2, CL_VERBOSE_OFF = -1, CL_VERBOSE_BASIC,
  CL_VERBOSE_ADVANCED, CL_VERBOSE_LIBRARY
}
 VERBOSE/MSG levels. More...
 

Functions

void trap_verbose_msg (int level, char *string)
 send verbose message to stderr More...
 
trap_ctx_priv_ttrap_create_ctx_t ()
 
struct trap_buffer_header_s __attribute__ ((__packed__))
 
_Bool __sync_bool_compare_and_swap_8 (int64_t *ptr, int64_t oldvar, int64_t newval)
 
uint64_t __sync_fetch_and_add_8 (uint64_t *ptr, uint64_t value)
 
uint64_t __sync_add_and_fetch_8 (uint64_t *ptr, uint64_t value)
 
uint64_t __sync_or_and_fetch_8 (uint64_t *ptr, uint64_t value)
 
uint64_t __sync_and_and_fetch_8 (uint64_t *ptr, uint64_t value)
 

Variables

int trap_debug
 
int trap_verbose
 
char trap_err_msg []
 
trap_ctx_priv_ttrap_glob_ctx
 
uint32_t data_length
 
uint8_t data [0]
 

Detailed Description

Internal functions and macros for libtrap Verbose and debug macros from libcommlbr.

Author
Tomas Konir Tomas.nosp@m..Kon.nosp@m.ir@li.nosp@m.bero.nosp@m.uter..nosp@m.org
Milan Kovacik xkova.nosp@m.ci1@.nosp@m.fi.mu.nosp@m.ni.c.nosp@m.z
Vojtech Krmicek xkrmi.nosp@m.cek@.nosp@m.fi.mu.nosp@m.ni.c.nosp@m.z
Juraj Blaho xblah.nosp@m.o00@.nosp@m.stud..nosp@m.fit..nosp@m.vutbr.nosp@m..cz
Tomas Cejka cejka.nosp@m.t@ce.nosp@m.snet..nosp@m.cz
Tomas Jansky jansk.nosp@m.to1@.nosp@m.fit.c.nosp@m.vut..nosp@m.cz
Date
2006-2018

Copyright (C) 2006-2018 CESNET

LICENSE TERMS

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the Company nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

ALTERNATIVELY, provided that this notice is retained in full, this product may be distributed under the terms of the GNU General Public License (GPL) version 2 or later, in which case the provisions of the GPL apply INSTEAD OF those given above.

This software is provided `‘as is’', and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the company or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Definition in file trap_internal.h.

Macro Definition Documentation

◆ DEFAULT_MAX_TERMINAL_WIDTH

#define DEFAULT_MAX_TERMINAL_WIDTH   85

Max length of line printed in help (used for line-breaks).

Definition at line 62 of file trap_internal.h.

◆ MAX_ERROR_MSG_BUFF_SIZE

#define MAX_ERROR_MSG_BUFF_SIZE   1024

Definition at line 57 of file trap_internal.h.

◆ SERVICE_GET_COM

#define SERVICE_GET_COM   10

Signaling a request for module statistics (interfaces stats - received messages and buffers, sent messages and buffers, autoflushes counter)

Definition at line 65 of file trap_internal.h.

◆ SERVICE_OK_REPLY

#define SERVICE_OK_REPLY   12

A value used as a reply signaling success.

Definition at line 67 of file trap_internal.h.

◆ SERVICE_SET_COM

#define SERVICE_SET_COM   11

Signaling a request to set some interface parameters (timeouts etc.)

Definition at line 66 of file trap_internal.h.

◆ TRAP_IN_IFC_COUNTERS

#define TRAP_IN_IFC_COUNTERS   1

Number of counter types sf IN IFC stored trap_ctx_priv_s used in service_thread_routine()

Definition at line 350 of file trap_internal.h.

◆ TRAP_OUT_IFC_COUNTERS

#define TRAP_OUT_IFC_COUNTERS   3

Number of counter types sf OUT IFC stored trap_ctx_priv_s used in service_thread_routine()

Definition at line 354 of file trap_internal.h.

Typedef Documentation

◆ ifc_autoflush_t

List of autoflush timeouts of output interfaces.

◆ trap_buffer_header_t

Definition at line 365 of file trap_internal.h.

Function Documentation

◆ __attribute__()

struct trap_buffer_header_s __attribute__ ( (__packed__)  )

◆ __sync_add_and_fetch_8()

uint64_t __sync_add_and_fetch_8 ( uint64_t *  ptr,
uint64_t  value 
)

Definition at line 137 of file trap_internal.c.

◆ __sync_and_and_fetch_8()

uint64_t __sync_and_and_fetch_8 ( uint64_t *  ptr,
uint64_t  value 
)

Definition at line 146 of file trap_internal.c.

◆ __sync_bool_compare_and_swap_8()

_Bool __sync_bool_compare_and_swap_8 ( int64_t *  ptr,
int64_t  oldvar,
int64_t  newval 
)

Definition at line 119 of file trap_internal.c.

◆ __sync_fetch_and_add_8()

uint64_t __sync_fetch_and_add_8 ( uint64_t *  ptr,
uint64_t  value 
)

Definition at line 128 of file trap_internal.c.

◆ __sync_or_and_fetch_8()

uint64_t __sync_or_and_fetch_8 ( uint64_t *  ptr,
uint64_t  value 
)

Definition at line 155 of file trap_internal.c.

Variable Documentation

◆ data

uint8_t data[0]

Definition at line 361 of file trap_internal.h.

◆ data_length

uint32_t data_length

size of data in the data unit

Definition at line 357 of file trap_internal.h.