common.h File Reference

Common CMX functions. More...

#include <stdint.h>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Defines

#define CMX_FALSE   0
 Boolean false value.
#define CMX_TRUE   1
 Boolean true value.
#define CMX_SHM_TAG   "CMX_1 \0"
 The CMX tag is written in the first 8 bytes of a shared memory objects.
#define CMX_SHM_TAG_LEN   8
 Length of the CMX Version Tag.
#define CMX_NAME_SZ   64
 Size of identifiers.
#define CMX_SHM_PAYLOAD_SZ   115
 Number of bytes in a single payload slot.
#define CMX_SHM_MAX_STRING_SZ   64400
 CMX_SHM_PAYLOAD_SZ A string single is maximum 560 slots long. Thats means maximum 64,4kB: 115 Bytes/Slot * 560 Slots = 64400 Bytes This value is limited by the uint16_t size counter in cmx_shm_value_string.
#define CMX_NUMBER_OF_VALUES   0x4fff
 Number of values.
#define CMX_STRING_END_INDEX   0xffff
 Magic end-marking index value for strings.

Enumerations

enum  cmx_cmx_error {
  E_CMX_SUCCESS = 0, E_CMX_OPERATION_FAILED = -1, E_CMX_INVALID_HANDLE = -2, E_CMX_TYPE_MISMATCH = -3,
  E_CMX_CORRUPT_SEGMENT = -4, E_CMX_INVALID_ARGUMENT = -5, E_CMX_OUT_OF_MEMORY = -6, E_CMX_CREATE_FAILED = -7,
  E_CMX_INVALID_PID = -8, E_CMX_CONCURRENT_MODIFICATION = -9, E_CMX_NAME_EXISTS = -10, E_CMX_NOT_FOUND = -11,
  E_CMX_COMPONENT_FULL = -12, E_CMX_PROTOCOL_VERSION = -13, E_CMX_OUT_OF_RANGE = -14, E_CMX_UNUSED_3 = -15,
  E_CMX_UNUSED_1 = -16, E_CMX_UNUSED_2 = -17
}
 

CMX error codes. Use cmx_common_strerror() for to-string conversion.

More...

Functions

const char * cmx_common_strerror (const int code)
 returns a string description of a cmx_cmx_error code
int cmx_common_check_string_length (const char *string, unsigned int min_size, unsigned int max_size)
 Check length of a character string.
uint64_t cmx_common_current_time_usec ()
 Get current time in usec.
int cmx_common_current_pid ()

Detailed Description

Common CMX functions.


Enumeration Type Documentation

CMX error codes. Use cmx_common_strerror() for to-string conversion.

Enumerator:
E_CMX_SUCCESS 
See also:
cmx_cmx_error
E_CMX_OPERATION_FAILED 
See also:
cmx_cmx_error
E_CMX_INVALID_HANDLE 
See also:
cmx_cmx_error
E_CMX_TYPE_MISMATCH 
See also:
cmx_cmx_error
E_CMX_CORRUPT_SEGMENT 
See also:
cmx_cmx_error
E_CMX_INVALID_ARGUMENT 
See also:
cmx_cmx_error
E_CMX_OUT_OF_MEMORY 
See also:
cmx_cmx_error
E_CMX_CREATE_FAILED 
See also:
cmx_cmx_error
E_CMX_INVALID_PID 
See also:
cmx_cmx_error
E_CMX_CONCURRENT_MODIFICATION 
See also:
cmx_cmx_error
E_CMX_NAME_EXISTS 
See also:
cmx_cmx_error
E_CMX_NOT_FOUND 
See also:
cmx_cmx_error
E_CMX_COMPONENT_FULL 
See also:
cmx_cmx_error
E_CMX_PROTOCOL_VERSION 
See also:
cmx_cmx_error
E_CMX_OUT_OF_RANGE 
See also:
cmx_cmx_error
E_CMX_UNUSED_3 
See also:
cmx_cmx_error
E_CMX_UNUSED_1 
See also:
cmx_cmx_error
E_CMX_UNUSED_2 
See also:
cmx_cmx_error

Function Documentation

int cmx_common_check_string_length ( const char *  string,
unsigned int  min_size,
unsigned int  max_size 
)

Check length of a character string.

Returns CMX_FALSE

  • if pointer `string` is NULL.
  • if string has less than min_size characters
  • if string has max_size characters or more.
    Returns:
    • CMX_TRUE if string is null-terminated and in given size range.
    • CMX_FALSE otherwise.
int cmx_common_current_pid (  ) 
Returns:
the PID of the current process as reported by the system.
uint64_t cmx_common_current_time_usec (  ) 

Get current time in usec.

Returns:
  • The current time, timestamp in usec since begin of epoch.
  • 0 on error.
Examples:
/demo/fast-writer.c, and /demo/measure-fail.c.

Generated on 14 Feb 2014 by  doxygen 1.6.1