Refactor (NGAP): add conversion functions to ngap_common.c
These conversion functions will be needed across different NGAP libraries upon refactoring: tnl_to_bitstring, bitstring_to_tnl Therefore, they are moved to the common lib.
This commit is contained in:
@@ -28,8 +28,28 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "conversions.h"
|
||||
#include "ngap_common.h"
|
||||
#include "ngap_msg_includes.h"
|
||||
|
||||
void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in)
|
||||
{
|
||||
if (in.length) {
|
||||
out->buf = malloc_or_fail(in.length);
|
||||
memcpy(out->buf, in.buffer, in.length);
|
||||
out->size = in.length;
|
||||
out->bits_unused = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in)
|
||||
{
|
||||
if (in.size) {
|
||||
memcpy(out->buffer, in.buf, in.size);
|
||||
out->length = in.size;
|
||||
}
|
||||
}
|
||||
|
||||
void encode_ngap_cause(NGAP_Cause_t *out, const ngap_cause_t *in)
|
||||
{
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
**/
|
||||
typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu);
|
||||
|
||||
void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in);
|
||||
void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in);
|
||||
void encode_ngap_cause(NGAP_Cause_t *out, const ngap_cause_t *in);
|
||||
nr_guami_t decode_ngap_guami(const NGAP_GUAMI_t *in);
|
||||
ngap_cause_t decode_ngap_cause(const NGAP_Cause_t *in);
|
||||
|
||||
@@ -191,20 +191,3 @@ void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance)
|
||||
}
|
||||
}
|
||||
|
||||
void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in)
|
||||
{
|
||||
if (in.length) {
|
||||
out->buf = malloc_or_fail(in.length);
|
||||
memcpy(out->buf, in.buffer, in.length);
|
||||
out->size = in.length;
|
||||
out->bits_unused = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in)
|
||||
{
|
||||
if (in.size) {
|
||||
memcpy(out->buffer, in.buf, in.size);
|
||||
out->length = in.size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,4 @@ uint16_t ngap_gNB_fetch_add_global_cnx_id(void);
|
||||
|
||||
void ngap_gNB_prepare_internal_data(void);
|
||||
|
||||
void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in);
|
||||
|
||||
void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in);
|
||||
|
||||
#endif /* NGAP_GNB_MANAGEMENT_PROCEDURES_H_ */
|
||||
|
||||
Reference in New Issue
Block a user