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
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
7#ifndef INTERNAL_UTILITY_API_H__
8#define INTERNAL_UTILITY_API_H__
9
16#include <assert.h>
17#include <stdbool.h>
18
19#include "cdi_utility_api.h"
20
21//*********************************************************************************************************************
22//***************************************** START OF DEFINITIONS AND TYPES ********************************************
23//*********************************************************************************************************************
24
35
36//*********************************************************************************************************************
37//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
38//*********************************************************************************************************************
39
48const char* InternalUtilityKeyEnumToString(InternalEnumStringKeyTypes key_type, int enum_value);
49
58static inline int64_t NextMultipleOf(int64_t value, int quantum)
59{
60 assert(value > 0);
61 assert(quantum > 0);
62 return quantum * ((value - 1) / quantum + 1);
63}
64
73static inline int64_t PrevMultipleOf(int64_t value, int quantum)
74{
75 assert(value > 0);
76 assert(quantum > 0);
77 return quantum * (value / quantum);
78}
79
80#endif // INTERNAL_UTILITY_API_H__
The declarations in this header file correspond to the definitions in cdi_utility_api....
const char * InternalUtilityKeyEnumToString(InternalEnumStringKeyTypes key_type, int enum_value)
Definition internal_utility.c:90
static int64_t NextMultipleOf(int64_t value, int quantum)
Definition internal_utility.h:58
InternalEnumStringKeyTypes
Enums used to indicate which key-value array a function is to access.
Definition internal_utility.h:30
@ kKeyProbeCommand
Key for ProbeCommand.
Definition internal_utility.h:32
@ kKeyProbeState
Key for ProbeState.
Definition internal_utility.h:31
@ kKeyEndpointManagerCommand
Key for EndpointManagerCommand.
Definition internal_utility.h:33
static int64_t PrevMultipleOf(int64_t value, int quantum)
Definition internal_utility.h:73