Skip to content

Commit

Permalink
add onos e2sm asn1
Browse files Browse the repository at this point in the history
  • Loading branch information
onehouwong committed Mar 12, 2024
1 parent 98785c4 commit 664e0ab
Show file tree
Hide file tree
Showing 625 changed files with 79,041 additions and 0 deletions.
1,954 changes: 1,954 additions & 0 deletions src/asn1/asn1/e2ap_v2.asn1

Large diffs are not rendered by default.

480 changes: 480 additions & 0 deletions src/asn1/asn1/e2sm_kpm_v2.0.3-changed.asn

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/asn1/asn1_compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Defeind ASN.1 executable
ASN1C="/opt/asn1c/bin/asn1c"

# Define input ASN.1 files
ASN_FILES="asn1/e2sm_kpm_v2.0.3-changed.asn asn1/e2ap_v2.asn1"

# Define output directory
OUTPUT_DIR="src"

# Create output directory if it doesn't exist
mkdir -p $OUTPUT_DIR

# ASN.1 compilation flags
FLAGs="-gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -fincludes-quoted"

# Compile ASN.1 files
$ASN1C -gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -fincludes-quoted $ASN_FILES -D $OUTPUT_DIR
116 changes: 116 additions & 0 deletions src/asn1/src/AMFName.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "E2AP-IEs"
* found in "asn1/e2ap_v2.asn1"
* `asn1c -gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -fincludes-quoted -D src`
*/

#include "AMFName.h"

static const int permitted_alphabet_table_1[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
};
static const int permitted_alphabet_code2value_1[74] = {
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
113,114,115,116,117,118,119,120,121,122,};


static int check_permitted_alphabet_1(const void *sptr) {
const int *table = permitted_alphabet_table_1;
/* The underlying type is PrintableString */
const PrintableString_t *st = (const PrintableString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;

for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!table[cv]) return -1;
}
return 0;
}

int
AMFName_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const PrintableString_t *st = (const PrintableString_t *)sptr;
size_t size;

if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}

size = st->size;

if((size >= 1UL && size <= 150UL)
&& !check_permitted_alphabet_1(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}

static int asn_PER_MAP_AMFName_1_v2c(unsigned int value) {
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
return -1;
return permitted_alphabet_table_1[value] - 1;
}
static int asn_PER_MAP_AMFName_1_c2v(unsigned int code) {
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
return -1;
return permitted_alphabet_code2value_1[code];
}
/*
* This type is implemented using PrintableString,
* so here we adjust the DEF accordingly.
*/
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
asn_per_constraints_t asn_PER_type_AMFName_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
asn_PER_MAP_AMFName_1_v2c, /* Value to PER code map */
asn_PER_MAP_AMFName_1_c2v /* PER code to value map */
};
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
static const ber_tlv_tag_t asn_DEF_AMFName_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
};
asn_TYPE_descriptor_t asn_DEF_AMFName = {
"AMFName",
"AMFName",
&asn_OP_PrintableString,
asn_DEF_AMFName_tags_1,
sizeof(asn_DEF_AMFName_tags_1)
/sizeof(asn_DEF_AMFName_tags_1[0]), /* 1 */
asn_DEF_AMFName_tags_1, /* Same as above */
sizeof(asn_DEF_AMFName_tags_1)
/sizeof(asn_DEF_AMFName_tags_1[0]), /* 1 */
{
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
&asn_PER_type_AMFName_constr_1,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
AMFName_constraint
},
0, 0, /* No members */
0 /* No specifics */
};

42 changes: 42 additions & 0 deletions src/asn1/src/AMFName.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "E2AP-IEs"
* found in "asn1/e2ap_v2.asn1"
* `asn1c -gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -fincludes-quoted -D src`
*/

#ifndef _AMFName_H_
#define _AMFName_H_


#include "asn_application.h"

/* Including external dependencies */
#include "PrintableString.h"

#ifdef __cplusplus
extern "C" {
#endif

/* AMFName */
typedef PrintableString_t AMFName_t;

/* Implementation */
extern asn_per_constraints_t asn_PER_type_AMFName_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_AMFName;
asn_struct_free_f AMFName_free;
asn_struct_print_f AMFName_print;
asn_constr_check_f AMFName_constraint;
xer_type_decoder_f AMFName_decode_xer;
xer_type_encoder_f AMFName_encode_xer;
per_type_decoder_f AMFName_decode_uper;
per_type_encoder_f AMFName_encode_uper;
per_type_decoder_f AMFName_decode_aper;
per_type_encoder_f AMFName_encode_aper;

#ifdef __cplusplus
}
#endif

#endif /* _AMFName_H_ */
#include "asn_internal.h"
83 changes: 83 additions & 0 deletions src/asn1/src/ANY.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2004-2017 Lev Walkin <[email protected]>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <ANY.h>

asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
sizeof(ANY_t),
offsetof(ANY_t, _asn_ctx),
ASN_OSUBV_ANY
};
asn_TYPE_operation_t asn_OP_ANY = {
OCTET_STRING_free,
#if !defined(ASN_DISABLE_PRINT_SUPPORT)
OCTET_STRING_print,
#else
0,
#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
OCTET_STRING_compare,
OCTET_STRING_copy,
#if !defined(ASN_DISABLE_BER_SUPPORT)
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
#if !defined(ASN_DISABLE_XER_SUPPORT)
OCTET_STRING_decode_xer_hex,
ANY_encode_xer,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_decode_jer_hex,
ANY_encode_jer,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
0,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
ANY_decode_uper,
ANY_encode_uper,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
#if !defined(ASN_DISABLE_APER_SUPPORT)
ANY_decode_aper,
ANY_encode_aper,
#else
0,
0,
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
0, /* Random fill is not defined for ANY type */
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_ANY = {
"ANY",
"ANY",
&asn_OP_ANY,
0, 0, 0, 0,
{
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
asn_generic_no_constraint
}, /* No constraints */
0, 0, /* No members */
&asn_SPC_ANY_specs,
};
86 changes: 86 additions & 0 deletions src/asn1/src/ANY.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*-
* Copyright (c) 2004-2017 Lev Walkin <[email protected]>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN_TYPE_ANY_H
#define ASN_TYPE_ANY_H

#include <OCTET_STRING.h> /* Implemented via OCTET STRING type */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ANY {
uint8_t *buf; /* BER-encoded ANY contents */
int size; /* Size of the above buffer */

asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} ANY_t;

extern asn_TYPE_descriptor_t asn_DEF_ANY;
extern asn_TYPE_operation_t asn_OP_ANY;
extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;

#define ANY_free OCTET_STRING_free

#if !defined(ASN_DISABLE_PRINT_SUPPORT)
#define ANY_print OCTET_STRING_print
#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */

#define ANY_compare OCTET_STRING_compare
#define ANY_copy OCTET_STRING_copy

#define ANY_constraint asn_generic_no_constraint

#if !defined(ASN_DISABLE_BER_SUPPORT)
#define ANY_decode_ber OCTET_STRING_decode_ber
#define ANY_encode_der OCTET_STRING_encode_der
#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */

#if !defined(ASN_DISABLE_XER_SUPPORT)
#define ANY_decode_xer OCTET_STRING_decode_xer_hex
xer_type_encoder_f ANY_encode_xer;
#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */

#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_decoder_f ANY_decode_jer;
jer_type_encoder_f ANY_encode_jer;
#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */

#if !defined(ASN_DISABLE_UPER_SUPPORT)
per_type_decoder_f ANY_decode_uper;
per_type_encoder_f ANY_encode_uper;
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
#if !defined(ASN_DISABLE_APER_SUPPORT)
per_type_decoder_f ANY_decode_aper;
per_type_encoder_f ANY_encode_aper;
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

/******************************
* Handy conversion routines. *
******************************/

/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

/* Convert the contents of the ANY type into the specified type. */
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#if !defined(ASN_DISABLE_APER_SUPPORT)
int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */

#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
&asn_DEF_ANY, (buf), (size))

#ifdef __cplusplus
}
#endif

#endif /* ASN_TYPE_ANY_H */
Loading

0 comments on commit 664e0ab

Please sign in to comment.