CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
internal_utility.h File Reference

The declarations in this header file correspond to the definitions in internal_utility.c. More...

#include <assert.h>
#include <stdbool.h>
#include "cdi_utility_api.h"

Go to the source code of this file.

Enumerations

enum  InternalEnumStringKeyTypes { kKeyProbeState , kKeyProbeCommand , kKeyEndpointManagerCommand }
 Enums used to indicate which key-value array a function is to access. More...
 

Functions

const char * InternalUtilityKeyEnumToString (InternalEnumStringKeyTypes key_type, int enum_value)
 
static int64_t NextMultipleOf (int64_t value, int quantum)
 
static int64_t PrevMultipleOf (int64_t value, int quantum)
 

Detailed Description

The declarations in this header file correspond to the definitions in internal_utility.c.

Enumeration Type Documentation

◆ InternalEnumStringKeyTypes

Enums used to indicate which key-value array a function is to access.

NOTE: Update InternalUtilityKeyGetArray in internal_utility.c whenever an entry is added to this table.

Enumerator
kKeyProbeState 

Key for ProbeState.

kKeyProbeCommand 

Key for ProbeCommand.

kKeyEndpointManagerCommand 

Key for EndpointManagerCommand.

Function Documentation

◆ InternalUtilityKeyEnumToString()

const char * InternalUtilityKeyEnumToString ( InternalEnumStringKeyTypes key_type,
int enum_value )

Function used to convert an internal enum value to a string.

Parameters
key_typeEnum from InternalEnumStringKeyTypes which indicates which key-value array to search for enum_value.
enum_valueValue to convert to a string.
Returns
Pointer to returned string. If no match was found, NULL is returned.

◆ NextMultipleOf()

static int64_t NextMultipleOf ( int64_t value,
int quantum )
inlinestatic

Helper function to up-quantize an integer value.

Parameters
valueThe value to quantize.
quantumThe number to calculate a multiple of.
Returns
The smallest multiple of quantum equal to or greater than value.

◆ PrevMultipleOf()

static int64_t PrevMultipleOf ( int64_t value,
int quantum )
inlinestatic

Helper function to down-quantize an integer value.

Parameters
valueThe value to quantize.
quantumThe number to calculate a multiple of.
Returns
The largest multiple of quantum equal to or smaller than value.