libe3 0.6.1
C++ library for E3AP RAN vendor integration
Loading...
Searching...
No Matches
e2sm_dapp_c.cpp File Reference

C API of the E2SM-DAPP codec, implemented on top of the C++ one. More...

#include "libe3/e2sm_dapp_c.h"
#include <cstdlib>
#include <cstring>
#include <new>
#include <string>
#include <vector>
#include "libe3/e2sm_dapp.hpp"

Go to the source code of this file.

Functions

void libe3_e2sm_dapp_bytes_free (libe3_e2sm_dapp_bytes_t *b)
e3_error_t libe3_e2sm_dapp_encode_event_trigger (const libe3_e2sm_dapp_event_trigger_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_event_trigger (const uint8_t *buf, size_t len, libe3_e2sm_dapp_event_trigger_t *out)
void libe3_e2sm_dapp_free_event_trigger (libe3_e2sm_dapp_event_trigger_t *v)
e3_error_t libe3_e2sm_dapp_encode_action_definition (const libe3_e2sm_dapp_action_definition_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_action_definition (const uint8_t *buf, size_t len, libe3_e2sm_dapp_action_definition_t *out)
void libe3_e2sm_dapp_free_action_definition (libe3_e2sm_dapp_action_definition_t *v)
e3_error_t libe3_e2sm_dapp_encode_ind_hdr (const libe3_e2sm_dapp_ind_hdr_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ind_hdr (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ind_hdr_t *out)
void libe3_e2sm_dapp_free_ind_hdr (libe3_e2sm_dapp_ind_hdr_t *v)
e3_error_t libe3_e2sm_dapp_encode_ind_msg (const libe3_e2sm_dapp_ind_msg_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ind_msg (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ind_msg_t *out)
void libe3_e2sm_dapp_free_ind_msg (libe3_e2sm_dapp_ind_msg_t *v)
e3_error_t libe3_e2sm_dapp_encode_ctrl_hdr (const libe3_e2sm_dapp_ctrl_hdr_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ctrl_hdr (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ctrl_hdr_t *out)
void libe3_e2sm_dapp_free_ctrl_hdr (libe3_e2sm_dapp_ctrl_hdr_t *v)
e3_error_t libe3_e2sm_dapp_encode_ctrl_msg (const libe3_e2sm_dapp_ctrl_msg_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ctrl_msg (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ctrl_msg_t *out)
void libe3_e2sm_dapp_free_ctrl_msg (libe3_e2sm_dapp_ctrl_msg_t *v)
e3_error_t libe3_e2sm_dapp_encode_ctrl_outcome (const libe3_e2sm_dapp_ctrl_outcome_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ctrl_outcome (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ctrl_outcome_t *out)
void libe3_e2sm_dapp_free_ctrl_outcome (libe3_e2sm_dapp_ctrl_outcome_t *v)
e3_error_t libe3_e2sm_dapp_encode_ran_function_definition (const libe3_e2sm_dapp_ran_function_definition_t *in, libe3_e2sm_dapp_bytes_t *out)
e3_error_t libe3_e2sm_dapp_decode_ran_function_definition (const uint8_t *buf, size_t len, libe3_e2sm_dapp_ran_function_definition_t *out)
void libe3_e2sm_dapp_free_ran_function_definition (libe3_e2sm_dapp_ran_function_definition_t *v)

Detailed Description

C API of the E2SM-DAPP codec, implemented on top of the C++ one.

Every function converts the C struct to its C++ counterpart (or back), calls pack() / unpack(), and maps the result to an e3_error_t. All memory handed to the caller is malloc'ed, so the free_* functions and plain free both work. Nothing here lets a C++ exception cross the C boundary.

SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University SPDX-License-Identifier: Apache-2.0

Definition in file e2sm_dapp_c.cpp.

Function Documentation

◆ libe3_e2sm_dapp_bytes_free()

void libe3_e2sm_dapp_bytes_free ( libe3_e2sm_dapp_bytes_t * b)

Release b->data and zero *b.

Parameters
bbytes to release, may be NULL

Definition at line 338 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_action_definition()

e3_error_t libe3_e2sm_dapp_decode_action_definition ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_action_definition_t * out )

Decode a action definition from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_action_definition(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 390 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ctrl_hdr()

e3_error_t libe3_e2sm_dapp_decode_ctrl_hdr ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ctrl_hdr_t * out )

Decode a control header from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ctrl_hdr(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 531 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ctrl_msg()

e3_error_t libe3_e2sm_dapp_decode_ctrl_msg ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ctrl_msg_t * out )

Decode a control message from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ctrl_msg(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 572 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ctrl_outcome()

e3_error_t libe3_e2sm_dapp_decode_ctrl_outcome ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ctrl_outcome_t * out )

Decode a control outcome from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ctrl_outcome(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 618 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_event_trigger()

e3_error_t libe3_e2sm_dapp_decode_event_trigger ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_event_trigger_t * out )

Decode a event trigger from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_event_trigger(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 357 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ind_hdr()

e3_error_t libe3_e2sm_dapp_decode_ind_hdr ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ind_hdr_t * out )

Decode a indication header from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ind_hdr(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 429 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ind_msg()

e3_error_t libe3_e2sm_dapp_decode_ind_msg ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ind_msg_t * out )

Decode a indication message from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ind_msg(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 479 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_decode_ran_function_definition()

e3_error_t libe3_e2sm_dapp_decode_ran_function_definition ( const uint8_t * buf,
size_t len,
libe3_e2sm_dapp_ran_function_definition_t * out )

Decode a RAN function definition from APER bytes.

Parameters
bufbytes to decode
lennumber of bytes
outreceives the value; release it with libe3_e2sm_dapp_free_ran_function_definition(). Zeroed on failure.
Returns
0 on success, an e3_error_t on failure

Definition at line 710 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_action_definition()

e3_error_t libe3_e2sm_dapp_encode_action_definition ( const libe3_e2sm_dapp_action_definition_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a action definition as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 378 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ctrl_hdr()

e3_error_t libe3_e2sm_dapp_encode_ctrl_hdr ( const libe3_e2sm_dapp_ctrl_hdr_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a control header as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 514 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ctrl_msg()

e3_error_t libe3_e2sm_dapp_encode_ctrl_msg ( const libe3_e2sm_dapp_ctrl_msg_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a control message as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 559 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ctrl_outcome()

e3_error_t libe3_e2sm_dapp_encode_ctrl_outcome ( const libe3_e2sm_dapp_ctrl_outcome_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a control outcome as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 596 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_event_trigger()

e3_error_t libe3_e2sm_dapp_encode_event_trigger ( const libe3_e2sm_dapp_event_trigger_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a event trigger as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 347 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ind_hdr()

e3_error_t libe3_e2sm_dapp_encode_ind_hdr ( const libe3_e2sm_dapp_ind_hdr_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a indication header as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 412 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ind_msg()

e3_error_t libe3_e2sm_dapp_encode_ind_msg ( const libe3_e2sm_dapp_ind_msg_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a indication message as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 457 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_encode_ran_function_definition()

e3_error_t libe3_e2sm_dapp_encode_ran_function_definition ( const libe3_e2sm_dapp_ran_function_definition_t * in,
libe3_e2sm_dapp_bytes_t * out )

Encode a RAN function definition as APER.

Parameters
invalue to encode, only read
outreceives the bytes; release them with libe3_e2sm_dapp_bytes_free()
Returns
0 on success, an e3_error_t on failure

Definition at line 649 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_action_definition()

void libe3_e2sm_dapp_free_action_definition ( libe3_e2sm_dapp_action_definition_t * v)

Release everything a decode of a action definition allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 403 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ctrl_hdr()

void libe3_e2sm_dapp_free_ctrl_hdr ( libe3_e2sm_dapp_ctrl_hdr_t * v)

Release everything a decode of a control header allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 550 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ctrl_msg()

void libe3_e2sm_dapp_free_ctrl_msg ( libe3_e2sm_dapp_ctrl_msg_t * v)

Release everything a decode of a control message allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 586 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ctrl_outcome()

void libe3_e2sm_dapp_free_ctrl_outcome ( libe3_e2sm_dapp_ctrl_outcome_t * v)

Release everything a decode of a control outcome allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 639 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_event_trigger()

void libe3_e2sm_dapp_free_event_trigger ( libe3_e2sm_dapp_event_trigger_t * v)

Release everything a decode of a event trigger allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 369 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ind_hdr()

void libe3_e2sm_dapp_free_ind_hdr ( libe3_e2sm_dapp_ind_hdr_t * v)

Release everything a decode of a indication header allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 448 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ind_msg()

void libe3_e2sm_dapp_free_ind_msg ( libe3_e2sm_dapp_ind_msg_t * v)

Release everything a decode of a indication message allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 503 of file e2sm_dapp_c.cpp.

◆ libe3_e2sm_dapp_free_ran_function_definition()

void libe3_e2sm_dapp_free_ran_function_definition ( libe3_e2sm_dapp_ran_function_definition_t * v)

Release everything a decode of a RAN function definition allocated, and zero the struct. Freeing twice is harmless.

Parameters
vvalue to release, may be NULL

Definition at line 768 of file e2sm_dapp_c.cpp.