CAEN Utility  2.0.2
Utilities for CAEN projects
CAENSerDes.c File Reference

TCP/IP CAEN protocol. More...

#include <CAENSerDes.h>
#include <CAENLogger.h>
#include <CAENMultiplatform.h>
#include <CAENThread.h>
#include <CAENSocket.h>
Include dependency graph for CAENSerDes.c:

Go to the source code of this file.

Macros

#define PKTHEAD_PROTOVERS_SIZE   (sizeof(PKTHEAD_PROTOVERS_TYPE))
 
#define PKTHEAD_TOTLEN_SIZE   (sizeof(PKTHEAD_TOTLEN_TYPE))
 
#define PKTHEAD_CMD_SIZE   (sizeof(PKTHEAD_CMD_TYPE))
 
#define PKTHEAD_NPARAMS_SIZE   (sizeof(PKTHEAD_NPARAMS_TYPE))
 
#define PKTHEAD_TOTALSIZE   (PKTHEAD_PROTOVERS_SIZE + PKTHEAD_TOTLEN_SIZE + PKTHEAD_CMD_SIZE + PKTHEAD_NPARAMS_SIZE)
 

Typedefs

typedef uint16_t PARAMTYPE_TYPE
 
typedef uint16_t PARAMNUM_TYPE
 

Functions

static PKTHEAD_PROTOVERS_TYPEgetProtoVersPtr (uint8_t *header)
 
static const PKTHEAD_PROTOVERS_TYPEgetProtoVersConstPtr (const uint8_t *header)
 
static PKTHEAD_TOTLEN_TYPEgetSizePtr (uint8_t *header)
 
static PKTHEAD_CMD_TYPEgetCmdPtr (uint8_t *header)
 
static const PKTHEAD_CMD_TYPEgetCmdConstPtr (const uint8_t *header)
 
static PKTHEAD_NPARAMS_TYPEgetParamsNumPtr (uint8_t *header)
 
static bool checkProtoVersPtr (const uint8_t *header, uint8_t version)
 
static PKTHEAD_TOTLEN_TYPEsetSizeToHeader (uint8_t *header, PKTHEAD_TOTLEN_TYPE size)
 
static PKTHEAD_NPARAMS_TYPEincrHeaderParamsNum (uint8_t *header)
 
static size_t getSizeOfType (c_type_t t)
 
uint8_t * c_createheader (uint16_t version, PKTHEAD_CMD_TYPE cmd, size_t *allocatedSize)
 
PKTHEAD_CMD_TYPE c_getcmd (const uint8_t *buffer)
 
uint8_t * c_recv_packet (const c_socket_t *sckt, PKTHEAD_CMD_TYPE *cmd, PKTHEAD_TOTLEN_TYPE *totSize, PKTHEAD_NPARAMS_TYPE *totParams)
 
uint8_t * c_recv_packet_unlock (c_socket_t *sckt, PKTHEAD_CMD_TYPE *cmd, PKTHEAD_TOTLEN_TYPE *totSize, PKTHEAD_NPARAMS_TYPE *totParams)
 
static PARAMTYPE_TYPE ptypeton (PARAMTYPE_TYPE type)
 
static PARAMTYPE_TYPE ntoptype (PARAMTYPE_TYPE type)
 
static PARAMNUM_TYPE pnumton (PARAMNUM_TYPE type)
 
static PARAMNUM_TYPE ntopnum (PARAMNUM_TYPE type)
 
static c_type_t toggleSigned (c_type_t type)
 
uint8_t * serialize_int8_t (const int8_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_char (const char *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_uint8_t (const uint8_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_int16_t (const int16_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_uint16_t (const uint16_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_int32_t (const int32_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_uint32_t (const uint32_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_int64_t (const int64_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_uint64_t (const uint64_t *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_float (const float *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * serialize_double (const double *src, uint32_t num, uint8_t *buffer, size_t *allocSize)
 
uint8_t * deserialize_int8_t (int8_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_int8_t_array (int8_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_char (char *dest, uint32_t maxnum, uint8_t *buffer)
 
uint8_t * deserialize_uint8_t (uint8_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_uint8_t_array (uint8_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_int16_t (int16_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_int16_t_array (int16_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_uint16_t (uint16_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_uint16_t_array (uint16_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_int32_t (int32_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_int32_t_array (int32_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_uint32_t (uint32_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_uint32_t_array (uint32_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_int64_t (int64_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_int64_t_array (int64_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_uint64_t (uint64_t *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_uint64_t_array (uint64_t *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_float (float *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_float_array (float *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 
uint8_t * deserialize_double (double *dest, uint32_t num, uint8_t *buffer)
 
uint8_t * deserialize_double_array (double *dest, uint32_t maxnum, uint32_t *num, uint8_t *buffer)
 

Variables

static const c_locallogger_t __locallogger = { ( "CAENSerDesLog.log" ), ( "CAENSerDes.c" ) }
 

Detailed Description

TCP/IP CAEN protocol.

Author
Giovanni Cerretani

Definition in file CAENSerDes.c.

Macro Definition Documentation

◆ PKTHEAD_PROTOVERS_SIZE

#define PKTHEAD_PROTOVERS_SIZE   (sizeof(PKTHEAD_PROTOVERS_TYPE))

Definition at line 50 of file CAENSerDes.c.

◆ PKTHEAD_TOTLEN_SIZE

#define PKTHEAD_TOTLEN_SIZE   (sizeof(PKTHEAD_TOTLEN_TYPE))

Definition at line 51 of file CAENSerDes.c.

◆ PKTHEAD_CMD_SIZE

#define PKTHEAD_CMD_SIZE   (sizeof(PKTHEAD_CMD_TYPE))

Definition at line 52 of file CAENSerDes.c.

◆ PKTHEAD_NPARAMS_SIZE

#define PKTHEAD_NPARAMS_SIZE   (sizeof(PKTHEAD_NPARAMS_TYPE))

Definition at line 53 of file CAENSerDes.c.

◆ PKTHEAD_TOTALSIZE

Definition at line 54 of file CAENSerDes.c.

Typedef Documentation

◆ PARAMTYPE_TYPE

typedef uint16_t PARAMTYPE_TYPE

Definition at line 228 of file CAENSerDes.c.

◆ PARAMNUM_TYPE

typedef uint16_t PARAMNUM_TYPE

Definition at line 229 of file CAENSerDes.c.

Function Documentation

◆ getProtoVersPtr()

static PKTHEAD_PROTOVERS_TYPE* getProtoVersPtr ( uint8_t *  header)
static

Definition at line 56 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ getProtoVersConstPtr()

static const PKTHEAD_PROTOVERS_TYPE* getProtoVersConstPtr ( const uint8_t *  header)
static

Definition at line 61 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ getSizePtr()

static PKTHEAD_TOTLEN_TYPE* getSizePtr ( uint8_t *  header)
static

Definition at line 66 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ getCmdPtr()

static PKTHEAD_CMD_TYPE* getCmdPtr ( uint8_t *  header)
static

Definition at line 71 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ getCmdConstPtr()

static const PKTHEAD_CMD_TYPE* getCmdConstPtr ( const uint8_t *  header)
static

Definition at line 76 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ getParamsNumPtr()

static PKTHEAD_NPARAMS_TYPE* getParamsNumPtr ( uint8_t *  header)
static

Definition at line 81 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ checkProtoVersPtr()

static bool checkProtoVersPtr ( const uint8_t *  header,
uint8_t  version 
)
static

Definition at line 86 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSizeToHeader()

static PKTHEAD_TOTLEN_TYPE* setSizeToHeader ( uint8_t *  header,
PKTHEAD_TOTLEN_TYPE  size 
)
static

Definition at line 92 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrHeaderParamsNum()

static PKTHEAD_NPARAMS_TYPE* incrHeaderParamsNum ( uint8_t *  header)
static

Definition at line 98 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSizeOfType()

static size_t getSizeOfType ( c_type_t  t)
static

Definition at line 107 of file CAENSerDes.c.

Here is the caller graph for this function:

◆ ptypeton()

static PARAMTYPE_TYPE ptypeton ( PARAMTYPE_TYPE  type)
static

Definition at line 231 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ntoptype()

static PARAMTYPE_TYPE ntoptype ( PARAMTYPE_TYPE  type)
static

Definition at line 235 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pnumton()

static PARAMNUM_TYPE pnumton ( PARAMNUM_TYPE  type)
static

Definition at line 239 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ntopnum()

static PARAMNUM_TYPE ntopnum ( PARAMNUM_TYPE  type)
static

Definition at line 243 of file CAENSerDes.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggleSigned()

static c_type_t toggleSigned ( c_type_t  type)
static

Definition at line 247 of file CAENSerDes.c.

Here is the caller graph for this function:

Variable Documentation

◆ __locallogger

const c_locallogger_t __locallogger = { ( "CAENSerDesLog.log" ), ( "CAENSerDes.c" ) }
static

Definition at line 48 of file CAENSerDes.c.