feat: Add dedicated QoS flow

This commit is contained in:
Sukchan Lee 2020-12-31 21:07:08 -05:00
parent 65aea5ebf2
commit 235a041b8d
205 changed files with 6053 additions and 3831 deletions

View File

@ -38,9 +38,13 @@ If you find Open5GS useful for work, please consider supporting this Open Source
If you don't understand something about Open5GS, the [https://open5gs.org/open5gs/docs/](https://open5gs.org/open5gs/docs/) is a great place to look for answers.
## Technical Discussion
## Community
Problem with Open5GS can be filed as [issues](https://github.com/open5gs/open5gs/issues) in this repository. Voice and text chat are available in Open5GS's [Discord](https://discordapp.com/) workspace. Use [this link](https://discord.gg/GreNkuc) to get started.
Problem with Open5GS can be filed as [issues](https://github.com/open5gs/open5gs/issues) in this repository.
Other topics related to this project are happening on the [discussions](https://github.com/open5gs/open5gs/discussions).
Voice and text chat are available in Open5GS's [Discord](https://discordapp.com/) workspace. Use [this link](https://discord.gg/GreNkuc) to get started.
## Contributing

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -97,9 +98,9 @@ sgwc:
- addr: 127.0.0.3
smf:
sbi:
- addr: 127.0.0.4
port: 7777
# sbi:
# - addr: 127.0.0.4
# port: 7777
gtpc:
- addr: 127.0.0.4
- addr: ::1
@ -211,12 +212,12 @@ pcrf:
- identity: smf.localdomain
addr: 127.0.0.4
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
ausf:
sbi:

View File

@ -38,6 +38,7 @@ example_conf = '''
310014.yaml
csfb.yaml
volte.yaml
vonr.yaml
minimal.yaml
srslte.yaml
sample.yaml

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -63,9 +64,9 @@ sgwc:
- addr: 127.0.0.3
smf:
sbi:
- addr: 127.0.0.4
port: 7777
# sbi:
# - addr: 127.0.0.4
# port: 7777
gtpc:
- addr: 127.0.0.4
- addr: ::1
@ -177,12 +178,12 @@ pcrf:
- identity: smf.localdomain
addr: 127.0.0.4
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
ausf:
sbi:

View File

@ -9,6 +9,7 @@ parameter:
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -63,9 +64,9 @@ sgwc:
- addr: 127.0.0.3
smf:
sbi:
- addr: 127.0.0.4
port: 7777
# sbi:
# - addr: 127.0.0.4
# port: 7777
gtpc:
- addr: 127.0.0.4
- addr: ::1
@ -182,12 +183,12 @@ pcrf:
- identity: pcscf.localdomain
addr: 127.0.0.1
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
ausf:
sbi:

211
configs/vonr.yaml.in Normal file
View File

@ -0,0 +1,211 @@
db_uri: mongodb://localhost/open5gs
logger:
parameter:
# no_nrf: true
# no_amf: true
# no_smf: true
# no_upf: true
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
# no_sgwu: true
# no_pcrf: true
# no_hss: true
mme:
freeDiameter:
identity: mme.localdomain
realm: localdomain
listen_on: 127.0.0.2
load_extension:
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
conf: 0x8888
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
connect:
- identity: hss.localdomain
addr: 127.0.0.8
s1ap:
- addr: 127.0.0.2
gtpc:
- addr: 127.0.0.2
gummei:
plmn_id:
mcc: 901
mnc: 70
mme_gid: 2
mme_code: 1
tai:
plmn_id:
mcc: 901
mnc: 70
tac: 1
security:
integrity_order : [ EIA2, EIA1, EIA0 ]
ciphering_order : [ EEA0, EEA1, EEA2 ]
network_name:
full: Open5GS
sgwc:
gtpc:
- addr: 127.0.0.3
pfcp:
- addr: 127.0.0.3
smf:
sbi:
- addr: 127.0.0.4
port: 7777
gtpc:
- addr: 127.0.0.4
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2001:4860:4860::8844
p-cscf:
- 127.0.0.1
- ::1
mtu: 1400
freeDiameter:
identity: smf.localdomain
realm: localdomain
listen_on: 127.0.0.4
load_extension:
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
conf: 0x8888
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
connect:
- identity: pcrf.localdomain
addr: 127.0.0.9
amf:
sbi:
- addr: 127.0.0.5
port: 7777
ngap:
- addr: 127.0.0.5
guami:
- plmn_id:
mcc: 901
mnc: 70
amf_id:
region: 2
set: 1
tai:
- plmn_id:
mcc: 901
mnc: 70
tac: 1
plmn_support:
- plmn_id:
mcc: 901
mnc: 70
s_nssai:
- sst: 1
security:
integrity_order : [ NIA2, NIA1, NIA0 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
network_name:
full: Open5GS
amf_name: open5gs-amf0
sgwu:
gtpu:
- addr: 127.0.0.6
pfcp:
- addr: 127.0.0.6
upf:
pfcp:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
- addr: 10.45.0.1/16
- addr: cafe::1/64
hss:
freeDiameter:
identity: hss.localdomain
realm: localdomain
listen_on: 127.0.0.8
load_extension:
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
conf: 0x8888
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
connect:
- identity: mme.localdomain
addr: 127.0.0.2
pcrf:
freeDiameter:
identity: pcrf.localdomain
realm: localdomain
listen_on: 127.0.0.9
load_extension:
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
conf: 0x8888
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
connect:
- identity: smf.localdomain
addr: 127.0.0.4
- identity: pcscf.localdomain
addr: 127.0.0.1
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
ausf:
sbi:
- addr: 127.0.0.11
port: 7777
udm:
sbi:
- addr: 127.0.0.12
port: 7777
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -41,7 +41,7 @@ ogs_pkbuf_t *ogs_asn_encode(const asn_TYPE_descriptor_t *td, void *sptr)
return NULL;
}
ogs_pkbuf_trim(pkbuf, (enc_ret.encoded >> 3));
ogs_pkbuf_trim(pkbuf, ((enc_ret.encoded + 7) >> 3));
return pkbuf;
}

View File

@ -255,7 +255,7 @@ char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd)
if (sd.v == OGS_S_NSSAI_NO_SD_VALUE)
return NULL;
return ogs_uint24_to_string(sd);
return ogs_uint24_to_0string(sd);
}
ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex)
@ -472,3 +472,13 @@ char *ogs_ipv6_to_string(uint8_t *addr6)
return (char *)OGS_INET6_NTOP(addr6, buf);
}
void ogs_session_data_free(ogs_session_data_t *session_data)
{
int i;
ogs_assert(session_data);
for (i = 0; i < session_data->num_of_pcc_rule; i++)
OGS_PCC_RULE_FREE(&session_data->pcc_rule[i]);
}

View File

@ -330,8 +330,8 @@ typedef struct ogs_pcc_rule_s {
#define OGS_PCC_RULE_TYPE_REMOVE 2
uint8_t type;
#define OGS_MAX_PCC_RULE_NAME_LEN 256
char *name;
char *id; /* 5GC */
char *name; /* EPC */
/* Num of Flow per PCC Rule */
#define OGS_MAX_NUM_OF_FLOW 8
@ -359,8 +359,11 @@ typedef struct ogs_pcc_rule_s {
if ((__sRC)->name) { \
(__dST)->name = ogs_strdup((__sRC)->name); \
ogs_assert((__dST)->name); \
} else \
ogs_assert_if_reached(); \
} \
if ((__sRC)->id) { \
(__dST)->id = ogs_strdup((__sRC)->id); \
ogs_assert((__dST)->id); \
} \
for (__iNDEX = 0; __iNDEX < (__sRC)->num_of_flow; __iNDEX++) { \
(__dST)->flow[__iNDEX].direction = (__sRC)->flow[__iNDEX].direction; \
(__dST)->flow[__iNDEX].description = \
@ -377,6 +380,8 @@ typedef struct ogs_pcc_rule_s {
do { \
int __pCCrULE_iNDEX; \
ogs_assert((__pCCrULE)); \
if ((__pCCrULE)->id) \
ogs_free((__pCCrULE)->id); \
if ((__pCCrULE)->name) \
ogs_free((__pCCrULE)->name); \
for (__pCCrULE_iNDEX = 0; \
@ -507,6 +512,15 @@ typedef struct ogs_subscription_data_s {
} msisdn[OGS_MAX_NUM_OF_MSISDN];
} ogs_subscription_data_t;
typedef struct ogs_session_data_s {
ogs_pdn_t pdn;
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
} ogs_session_data_t;
void ogs_session_data_free(ogs_session_data_t *session_data);
#ifdef __cplusplus
}
#endif

View File

@ -23,6 +23,10 @@
#include <ctype.h>
#endif
#if HAVE_LIMITS_H
#include <limits.h>
#endif
#include "ogs-core.h"
void *ogs_ascii_to_hex(char *in, int in_len, void *out, int out_len)
@ -156,64 +160,73 @@ char ogs_from_hex(char ch)
return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
}
char *ogs_uint24_to_string(ogs_uint24_t x)
char *ogs_uint24_to_0string(ogs_uint24_t x)
{
return ogs_msprintf("%06x", x.v);
}
char *ogs_uint28_to_string(uint32_t x)
char *ogs_uint28_to_0string(uint32_t x)
{
return ogs_msprintf("%07x", x);
}
char *ogs_uint32_to_string(uint32_t x)
char *ogs_uint32_to_0string(uint32_t x)
{
return ogs_msprintf("%08x", x);
}
char *ogs_uint36_to_string(uint64_t x)
char *ogs_uint36_to_0string(uint64_t x)
{
return ogs_msprintf("%09llx", (long long)x);
}
char *ogs_uint64_to_0string(uint64_t x)
{
return ogs_msprintf("%016llx", (long long)x);
}
char *ogs_uint64_to_string(uint64_t x)
{
char *str, *p;
str = ogs_uint64_to_0string(x);
ogs_assert(str);
p = ogs_left_trimcharacter(str, '0');
ogs_assert(p);
ogs_free(str);
return ogs_strdup(p);
}
ogs_uint24_t ogs_uint24_from_string(char *str)
{
ogs_uint24_t x;
ogs_assert(str);
ogs_ascii_to_hex(str, strlen(str), &x, 3);
return ogs_be24toh(x);
x.v = ogs_uint64_from_string(str);
return x;
}
uint32_t ogs_uint28_from_string(char *str)
{
uint32_t x;
ogs_assert(str);
x = 0;
ogs_ascii_to_hex(str, strlen(str), &x, 4);
return be32toh(x) >> 4;
}
uint32_t ogs_uint32_from_string(char *str)
{
uint32_t x;
ogs_assert(str);
ogs_ascii_to_hex(str, strlen(str), &x, 4);
return be32toh(x);
}
uint64_t ogs_uint36_from_string(char *str)
uint64_t ogs_uint64_from_string(char *str)
{
uint64_t x;
ogs_assert(str);
x = 0;
ogs_ascii_to_hex(str, strlen(str), &x, 5);
if (strlen(str) == 0)
return 0;
return be64toh(x) >> 28;
errno = 0;
x = strtoll(str, NULL, 16);
if ((errno == ERANGE && (x == LONG_MAX || x == LONG_MIN)) ||
(errno != 0 && x == 0)) {
ogs_log_message(OGS_LOG_FATAL, ogs_errno, "strtoll()) failed [%lld]",
(long long)x);
ogs_assert_if_reached();
}
return x;
}

View File

@ -39,15 +39,15 @@ void *ogs_buffer_to_bcd(uint8_t *in, int in_len, void *out);
char ogs_from_hex(char ch);
char *ogs_uint24_to_string(ogs_uint24_t x);
char *ogs_uint28_to_string(uint32_t x);
char *ogs_uint32_to_string(uint32_t x);
char *ogs_uint36_to_string(uint64_t x);
char *ogs_uint24_to_0string(ogs_uint24_t x);
char *ogs_uint28_to_0string(uint32_t x);
char *ogs_uint32_to_0string(uint32_t x);
char *ogs_uint36_to_0string(uint64_t x);
char *ogs_uint64_to_0string(uint64_t x);
char *ogs_uint64_to_string(uint64_t x);
ogs_uint24_t ogs_uint24_from_string(char *str);
uint32_t ogs_uint28_from_string(char *str);
uint32_t ogs_uint32_from_string(char *str);
uint64_t ogs_uint36_from_string(char *str);
uint64_t ogs_uint64_from_string(char *str);
#ifdef __cplusplus
}

View File

@ -53,6 +53,10 @@
#include <stdarg.h>
#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#include "ogs-core.h"
int ogs_vsnprintf(char *str, size_t size, const char *format, va_list ap)
@ -254,3 +258,64 @@ char *ogs_mstrcatf(char *source, const char *message, ...)
}
return out;
}
char *ogs_trimwhitespace(char *str)
{
char *end;
if (str == NULL) {
return NULL;
} else if (*str == 0) {
return str;
}
while (isspace((unsigned char)*str)) str++;
end = str + strlen(str) - 1;
while(end > str && isspace((unsigned char)*end)) {
end--;
}
*(end+1) = 0;
return str;
}
char *ogs_left_trimcharacter(char *str, char to_remove)
{
if (str == NULL) {
return NULL;
} else if (*str == 0) {
return str;
}
while(*str == to_remove) str++;
return str;
}
char *ogs_right_trimcharacter(char *str, char to_remove)
{
char *end;
if (str == NULL) {
return NULL;
} else if (*str == 0) {
return str;
}
end = str + strlen(str) - 1;
while(end > str && (*end == to_remove)) {
end--;
}
*(end+1) = 0;
return str;
}
char *ogs_trimcharacter(char *str, char to_remove)
{
return ogs_right_trimcharacter(
ogs_left_trimcharacter(str, to_remove), to_remove);
}

View File

@ -96,6 +96,12 @@ char *ogs_msprintf(const char *message, ...)
char *ogs_mstrcatf(char *source, const char *message, ...)
OGS_GNUC_PRINTF(2, 3);
char *ogs_trimwhitespace(char *str);
char *ogs_left_trimcharacter(char *str, char to_remove);
char *ogs_right_trimcharacter(char *str, char to_remove);
char *ogs_trimcharacter(char *str, char to_remove);
#ifdef __cplusplus
}
#endif

View File

@ -22,6 +22,7 @@ libdbi_sources = files('''
ogs-mongoc.c
subscription.c
session.c
'''.split())
libmongoc_dep = dependency('libmongoc-1.0')

View File

@ -27,6 +27,7 @@
#include "dbi/ogs-mongoc.h"
#include "dbi/subscription.h"
#include "dbi/session.h"
#undef OGS_DBI_INSIDE

383
lib/dbi/session.c Normal file
View File

@ -0,0 +1,383 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ogs-dbi.h"
int ogs_dbi_session_data(char *supi, char *dnn,
ogs_session_data_t *session_data)
{
int rv = OGS_OK;
mongoc_cursor_t *cursor = NULL;
bson_t *query = NULL;
bson_t *opts = NULL;
bson_error_t error;
const bson_t *document;
bson_iter_t iter;
bson_iter_t child1_iter, child2_iter, child3_iter;
bson_iter_t child4_iter, child5_iter, child6_iter;
const char *utf8 = NULL;
uint32_t length = 0;
char *supi_type = NULL;
char *supi_id = NULL;
ogs_session_data_t zero_data;
ogs_assert(supi);
ogs_assert(dnn);
ogs_assert(session_data);
memset(&zero_data, 0, sizeof(zero_data));
/* session_data should be initialized to zero */
ogs_assert(memcmp(session_data, &zero_data, sizeof(zero_data)) == 0);
supi_type = ogs_id_get_type(supi);
ogs_assert(supi_type);
supi_id = ogs_id_get_value(supi);
ogs_assert(supi_id);
query = BCON_NEW(
supi_type, BCON_UTF8(supi_id),
"pdn.apn", BCON_UTF8(dnn));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
opts = BCON_NEW(
"projection", "{",
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1),
"}"
);
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, opts, NULL);
#else
asdklfjasdf
opts = BCON_NEW(
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1)
);
cursor = mongoc_collection_find(self.subscriberCollection,
MONGOC_QUERY_NONE, 0, 0, 0, query, opts, NULL);
#endif
if (!mongoc_cursor_next(cursor, &document)) {
ogs_error("Cannot find IMSI(%s)+APN(%s) in DB", supi_id, dnn);
rv = OGS_ERROR;
goto out;
}
if (mongoc_cursor_error(cursor, &error)) {
ogs_error("Cursor Failure: %s", error.message);
rv = OGS_ERROR;
goto out;
}
if (!bson_iter_init(&iter, document)) {
ogs_error("bson_iter_init failed in this document");
rv = OGS_ERROR;
goto out;
}
while (bson_iter_next(&iter)) {
const char *key = bson_iter_key(&iter);
if (!strcmp(key, "pdn") &&
BSON_ITER_HOLDS_ARRAY(&iter)) {
int pdn_index = 0;
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_pdn_t *pdn = NULL;
ogs_assert(child1_key);
pdn_index = atoi(child1_key);
ogs_assert(pdn_index == 0);
pdn = &session_data->pdn;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if ((!strcmp(child2_key, "apn") ||
!strcmp(child2_key, "dnn")) &&
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
utf8 = bson_iter_utf8(&child2_iter, &length);
ogs_cpystrn(pdn->dnn, utf8,
ogs_min(length, OGS_MAX_APN_LEN)+1);
} else if (!strcmp(child2_key, "type") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
pdn->pdn_type = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "qci") &&
BSON_ITER_HOLDS_INT32(&child3_iter)) {
pdn->qos.qci = bson_iter_int32(&child3_iter);
} else if (!strcmp(child3_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.priority_level =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_capability =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child4_iter);
}
}
}
}
} else if (!strcmp(child2_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.uplink =
bson_iter_int64(&child3_iter) * 1024;
} else if (!strcmp(child3_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.downlink =
bson_iter_int64(&child3_iter) * 1024;
}
}
} else if (!strcmp(child2_key, "pcc_rule") &&
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
int pcc_rule_index = 0;
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
ogs_pcc_rule_t *pcc_rule = NULL;
ogs_assert(child3_key);
pcc_rule_index = atoi(child3_key);
ogs_assert(pcc_rule_index <
OGS_MAX_NUM_OF_PCC_RULE);
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "qci") &&
BSON_ITER_HOLDS_INT32(
&child5_iter)) {
pcc_rule->qos.qci =
bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"priority_level") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
priority_level =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_capability =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability")
&& BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(
&child6_iter);
}
}
} else if (!strcmp(child5_key, "mbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
} else if (!strcmp(child5_key, "gbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(&child5_iter,
&child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
}
}
} else if (!strcmp(child4_key, "flow") &&
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
int flow_index = 0;
bson_iter_recurse(&child4_iter,
&child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
ogs_flow_t *flow = NULL;
ogs_assert(child5_key);
flow_index = atoi(child5_key);
ogs_assert(
flow_index < OGS_MAX_NUM_OF_FLOW);
flow = &pcc_rule->flow[flow_index];
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"direction") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
flow->direction =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"description") &&
BSON_ITER_HOLDS_UTF8(
&child6_iter)) {
utf8 = bson_iter_utf8(
&child6_iter, &length);
flow->description =
ogs_malloc(length+1);
ogs_cpystrn(
(char*)flow->description,
utf8, length+1);
}
}
flow_index++;
}
pcc_rule->num_of_flow = flow_index;
}
}
/* EPC: Charing-Rule-Name */
if (pcc_rule->name) {
ogs_error(
"PCC Rule Name has already been defined");
ogs_free(pcc_rule->name);
}
pcc_rule->name = ogs_msprintf(
"%s%d", dnn, pcc_rule_index+1);
ogs_assert(pcc_rule->name);
/* 5GC: PCC-Rule-Id */
if (pcc_rule->id) {
ogs_error(
"PCC Rule Id has already been defined");
ogs_free(pcc_rule->id);
}
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
ogs_assert(pcc_rule->id);
pcc_rule->precedence = pcc_rule_index+1;
pcc_rule->flow_status = OGS_FLOW_STATUS_ENABLED;
pcc_rule_index++;
}
session_data->num_of_pcc_rule = pcc_rule_index;
}
}
}
}
}
out:
if (query) bson_destroy(query);
if (opts) bson_destroy(opts);
if (cursor) mongoc_cursor_destroy(cursor);
ogs_free(supi_type);
ogs_free(supi_id);
return rv;
}

38
lib/dbi/session.h Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined(OGS_DBI_INSIDE) && !defined(OGS_DBI_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_DBI_SESSION_H
#define OGS_DBI_SESSION_H
#ifdef __cplusplus
extern "C" {
#endif
int ogs_dbi_session_data(char *supi, char *dnn,
ogs_session_data_t *session_data);
#ifdef __cplusplus
}
#endif
#endif /* OGS_DBI_SESSION_H */

View File

@ -35,8 +35,6 @@
#include "ogs-core.h"
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
#define OGS_DIAMETER_INSIDE
#include "diameter/common/message.h"

View File

@ -157,14 +157,3 @@ int ogs_diam_gx_init(void)
return 0;
}
void ogs_diam_gx_message_free(ogs_diam_gx_message_t *gx_message)
{
int i;
ogs_assert(gx_message);
for (i = 0; i < gx_message->num_of_pcc_rule; i++) {
OGS_PCC_RULE_FREE(&gx_message->pcc_rule[i]);
}
}

View File

@ -155,13 +155,10 @@ typedef struct ogs_diam_gx_message_s {
#define OGS_DIAM_GX_CC_REQUEST_TYPE_EVENT_REQUEST 4
uint32_t cc_request_type;
ogs_pdn_t pdn;
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
ogs_session_data_t session_data;
} ogs_diam_gx_message_t;
int ogs_diam_gx_init(void);
void ogs_diam_gx_message_free(ogs_diam_gx_message_t *gx_message);
#ifdef __cplusplus
}

View File

@ -21,6 +21,7 @@
#define OGS_GTP_H
#include "ogs-core.h"
#include "ipfw/ogs-ipfw.h"
#include "ogs-app.h"
#define OGS_GTPV1_U_UDP_PORT 2152

View File

@ -318,121 +318,125 @@ int16_t ogs_gtp_parse_tft(ogs_gtp_tft_t *tft, ogs_tlv_octet_t *octet)
sizeof(tft->pf[i].precedence));
size += sizeof(tft->pf[i].precedence);
ogs_assert(size+sizeof(tft->pf[i].length) <= octet->len);
memcpy(&tft->pf[i].length, (unsigned char *)octet->data+size,
sizeof(tft->pf[i].length));
size += sizeof(tft->pf[i].length);
ogs_assert(size+sizeof(tft->pf[i].content.length) <= octet->len);
memcpy(&tft->pf[i].content.length, (unsigned char *)octet->data+size,
sizeof(tft->pf[i].content.length));
size += sizeof(tft->pf[i].content.length);
j = 0; len = 0;
while(len < tft->pf[i].length) {
ogs_assert(size+len+sizeof(tft->pf[i].component[j].type) <=
while(len < tft->pf[i].content.length) {
ogs_assert(size+len+sizeof(tft->pf[i].content.component[j].type) <=
octet->len);
memcpy(&tft->pf[i].component[j].type,
memcpy(&tft->pf[i].content.component[j].type,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].type));
len += sizeof(tft->pf[i].component[j].type);
switch(tft->pf[i].component[j].type) {
case GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(size+len+sizeof(tft->pf[i].component[j].proto) <=
octet->len);
memcpy(&tft->pf[i].component[j].proto,
sizeof(tft->pf[i].content.component[j].type));
len += sizeof(tft->pf[i].content.component[j].type);
switch(tft->pf[i].content.component[j].type) {
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].content.component[j].proto) <=
octet->len);
memcpy(&tft->pf[i].content.component[j].proto,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].proto));
len += sizeof(tft->pf[i].component[j].proto);
sizeof(tft->pf[i].content.component[j].proto));
len += sizeof(tft->pf[i].content.component[j].proto);
break;
case GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv4.addr) <= octet->len);
memcpy(&tft->pf[i].component[j].ipv4.addr,
sizeof(tft->pf[i].content.component[j].ipv4.addr) <=
octet->len);
memcpy(&tft->pf[i].content.component[j].ipv4.addr,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv4.addr));
len += sizeof(tft->pf[i].component[j].ipv4.addr);
sizeof(tft->pf[i].content.component[j].ipv4.addr));
len += sizeof(tft->pf[i].content.component[j].ipv4.addr);
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv4.mask) <= octet->len);
memcpy(&tft->pf[i].component[j].ipv4.mask,
sizeof(tft->pf[i].content.component[j].ipv4.mask) <=
octet->len);
memcpy(&tft->pf[i].content.component[j].ipv4.mask,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv4.mask));
len += sizeof(tft->pf[i].component[j].ipv4.mask);
sizeof(tft->pf[i].content.component[j].ipv4.mask));
len += sizeof(tft->pf[i].content.component[j].ipv4.mask);
break;
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv6.addr) <= octet->len);
memcpy(&tft->pf[i].component[j].ipv6.addr,
sizeof(tft->pf[i].content.component[j].ipv6.addr) <=
octet->len);
memcpy(&tft->pf[i].content.component[j].ipv6.addr,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv6.addr));
len += sizeof(tft->pf[i].component[j].ipv6.addr);
sizeof(tft->pf[i].content.component[j].ipv6.addr));
len += sizeof(tft->pf[i].content.component[j].ipv6.addr);
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv6.prefixlen) <=
sizeof(tft->pf[i].content.component[j].ipv6.prefixlen) <=
octet->len);
memcpy(&tft->pf[i].component[j].ipv6.prefixlen,
memcpy(&tft->pf[i].content.component[j].ipv6.prefixlen,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv6.prefixlen));
len += sizeof(tft->pf[i].component[j].ipv6.prefixlen);
sizeof(tft->pf[i].content.component[j].ipv6.prefixlen));
len += sizeof(tft->pf[i].content.component[j].ipv6.prefixlen);
break;
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv6_mask.addr) <=
sizeof(tft->pf[i].content.component[j].ipv6_mask.addr) <=
octet->len);
memcpy(&tft->pf[i].component[j].ipv6_mask.addr,
memcpy(&tft->pf[i].content.component[j].ipv6_mask.addr,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv6_mask.addr));
len += sizeof(tft->pf[i].component[j].ipv6_mask.addr);
sizeof(tft->pf[i].content.component[j].ipv6_mask.addr));
len += sizeof(tft->pf[i].content.component[j].ipv6_mask.addr);
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].ipv6_mask.mask) <=
sizeof(tft->pf[i].content.component[j].ipv6_mask.mask) <=
octet->len);
memcpy(&tft->pf[i].component[j].ipv6_mask.mask,
memcpy(&tft->pf[i].content.component[j].ipv6_mask.mask,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].ipv6_mask.mask));
len += sizeof(tft->pf[i].component[j].ipv6_mask.mask);
sizeof(tft->pf[i].content.component[j].ipv6_mask.mask));
len += sizeof(tft->pf[i].content.component[j].ipv6_mask.mask);
break;
case GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].port.low) <=
sizeof(tft->pf[i].content.component[j].port.low) <=
octet->len);
memcpy(&tft->pf[i].component[j].port.low,
memcpy(&tft->pf[i].content.component[j].port.low,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].port.low));
tft->pf[i].component[j].port.low =
htobe16(tft->pf[i].component[j].port.low);
len += sizeof(tft->pf[i].component[j].port.low);
sizeof(tft->pf[i].content.component[j].port.low));
tft->pf[i].content.component[j].port.low =
htobe16(tft->pf[i].content.component[j].port.low);
len += sizeof(tft->pf[i].content.component[j].port.low);
break;
case GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].port.low) <=
sizeof(tft->pf[i].content.component[j].port.low) <=
octet->len);
memcpy(&tft->pf[i].component[j].port.low,
memcpy(&tft->pf[i].content.component[j].port.low,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].port.low));
tft->pf[i].component[j].port.low =
htobe16(tft->pf[i].component[j].port.low);
len += sizeof(tft->pf[i].component[j].port.low);
sizeof(tft->pf[i].content.component[j].port.low));
tft->pf[i].content.component[j].port.low =
htobe16(tft->pf[i].content.component[j].port.low);
len += sizeof(tft->pf[i].content.component[j].port.low);
ogs_assert(size+len+
sizeof(tft->pf[i].component[j].port.high) <=
sizeof(tft->pf[i].content.component[j].port.high) <=
octet->len);
memcpy(&tft->pf[i].component[j].port.high,
memcpy(&tft->pf[i].content.component[j].port.high,
(unsigned char *)octet->data+size+len,
sizeof(tft->pf[i].component[j].port.high));
tft->pf[i].component[j].port.high =
htobe16(tft->pf[i].component[j].port.high);
len += sizeof(tft->pf[i].component[j].port.high);
sizeof(tft->pf[i].content.component[j].port.high));
tft->pf[i].content.component[j].port.high =
htobe16(tft->pf[i].content.component[j].port.high);
len += sizeof(tft->pf[i].content.component[j].port.high);
break;
default:
ogs_error("Unknown Packet Filter Type(%d)",
tft->pf[i].component[j].type);
tft->pf[i].content.component[j].type);
return -1;
}
j++;
}
tft->pf[i].num_of_component = j;
tft->pf[i].content.num_of_component = j;
size += len;
}
@ -480,118 +484,124 @@ int16_t ogs_gtp_build_tft(
sizeof(target.pf[i].precedence));
size += sizeof(target.pf[i].precedence);
ogs_assert(size + sizeof(target.pf[i].length) <= data_len);
memcpy((unsigned char *)octet->data + size, &target.pf[i].length,
sizeof(target.pf[i].length));
size += sizeof(target.pf[i].length);
ogs_assert(size + sizeof(target.pf[i].content.length) <= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].content.length,
sizeof(target.pf[i].content.length));
size += sizeof(target.pf[i].content.length);
for (j = 0; j < target.pf[i].num_of_component; j++) {
for (j = 0; j < target.pf[i].content.num_of_component; j++) {
ogs_assert(size +
sizeof(target.pf[i].component[j].type) <= data_len);
sizeof(target.pf[i].content.component[j].type) <= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].type,
sizeof(target.pf[i].component[j].type));
size += sizeof(target.pf[i].component[j].type);
switch(target.pf[i].component[j].type) {
case GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].proto) <= data_len);
&target.pf[i].content.component[j].type,
sizeof(target.pf[i].content.component[j].type));
size += sizeof(target.pf[i].content.component[j].type);
switch(target.pf[i].content.component[j].type) {
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(size + sizeof(
target.pf[i].content.component[j].proto) <= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].proto,
sizeof(target.pf[i].component[j].proto));
size += sizeof(target.pf[i].component[j].proto);
&target.pf[i].content.component[j].proto,
sizeof(target.pf[i].content.component[j].proto));
size += sizeof(target.pf[i].content.component[j].proto);
break;
case GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv4.addr)
sizeof(target.pf[i].content.component[j].ipv4.addr)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv4.addr,
sizeof(target.pf[i].component[j].ipv4.addr));
size += sizeof(target.pf[i].component[j].ipv4.addr);
&target.pf[i].content.component[j].ipv4.addr,
sizeof(target.pf[i].content.component[j].ipv4.addr));
size += sizeof(target.pf[i].content.component[j].ipv4.addr);
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv4.mask)
sizeof(target.pf[i].content.component[j].ipv4.mask)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv4.mask,
sizeof(target.pf[i].component[j].ipv4.mask));
size += sizeof(target.pf[i].component[j].ipv4.mask);
&target.pf[i].content.component[j].ipv4.mask,
sizeof(target.pf[i].content.component[j].ipv4.mask));
size += sizeof(target.pf[i].content.component[j].ipv4.mask);
break;
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv6.addr)
sizeof(target.pf[i].content.component[j].ipv6.addr)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv6.addr,
sizeof(target.pf[i].component[j].ipv6.addr));
size += sizeof(target.pf[i].component[j].ipv6.addr);
&target.pf[i].content.component[j].ipv6.addr,
sizeof(target.pf[i].content.component[j].ipv6.addr));
size += sizeof(target.pf[i].content.component[j].ipv6.addr);
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv6.prefixlen)
sizeof(target.pf[i].content.component[j].ipv6.prefixlen)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv6.prefixlen,
sizeof(target.pf[i].component[j].ipv6.prefixlen));
size += sizeof(target.pf[i].component[j].ipv6.prefixlen);
&target.pf[i].content.component[j].ipv6.prefixlen,
sizeof(target.pf[i].content.component[j].ipv6.prefixlen));
size += sizeof(
target.pf[i].content.component[j].ipv6.prefixlen);
break;
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv6_mask.addr)
sizeof(target.pf[i].content.component[j].ipv6_mask.addr)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv6_mask.addr,
sizeof(target.pf[i].component[j].ipv6_mask.addr));
size += sizeof(target.pf[i].component[j].ipv6_mask.addr);
&target.pf[i].content.component[j].ipv6_mask.addr,
sizeof(
target.pf[i].content.component[j].ipv6_mask.addr));
size += sizeof(
target.pf[i].content.component[j].ipv6_mask.addr);
ogs_assert(size +
sizeof(target.pf[i].component[j].ipv6_mask.mask)
sizeof(target.pf[i].content.component[j].ipv6_mask.mask)
<= data_len);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].ipv6_mask.mask,
sizeof(target.pf[i].component[j].ipv6_mask.mask));
size += sizeof(target.pf[i].component[j].ipv6_mask.mask);
&target.pf[i].content.component[j].ipv6_mask.mask,
sizeof(
target.pf[i].content.component[j].ipv6_mask.mask));
size += sizeof(
target.pf[i].content.component[j].ipv6_mask.mask);
break;
case GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].port.low)
sizeof(target.pf[i].content.component[j].port.low)
<= data_len);
target.pf[i].component[j].port.low =
htobe16(target.pf[i].component[j].port.low);
target.pf[i].content.component[j].port.low =
htobe16(target.pf[i].content.component[j].port.low);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].port.low,
sizeof(target.pf[i].component[j].port.low));
size += sizeof(target.pf[i].component[j].port.low);
&target.pf[i].content.component[j].port.low,
sizeof(target.pf[i].content.component[j].port.low));
size += sizeof(target.pf[i].content.component[j].port.low);
break;
case GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
ogs_assert(size +
sizeof(target.pf[i].component[j].port.low)
sizeof(target.pf[i].content.component[j].port.low)
<= data_len);
target.pf[i].component[j].port.low =
htobe16(target.pf[i].component[j].port.low);
target.pf[i].content.component[j].port.low =
htobe16(target.pf[i].content.component[j].port.low);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].port.low,
sizeof(target.pf[i].component[j].port.low));
size += sizeof(target.pf[i].component[j].port.low);
&target.pf[i].content.component[j].port.low,
sizeof(target.pf[i].content.component[j].port.low));
size += sizeof(target.pf[i].content.component[j].port.low);
ogs_assert(size +
sizeof(target.pf[i].component[j].port.high)
sizeof(target.pf[i].content.component[j].port.high)
<= data_len);
target.pf[i].component[j].port.high =
htobe16(target.pf[i].component[j].port.high);
target.pf[i].content.component[j].port.high =
htobe16(target.pf[i].content.component[j].port.high);
memcpy((unsigned char *)octet->data + size,
&target.pf[i].component[j].port.high,
sizeof(target.pf[i].component[j].port.high));
size += sizeof(target.pf[i].component[j].port.high);
&target.pf[i].content.component[j].port.high,
sizeof(target.pf[i].content.component[j].port.high));
size += sizeof(target.pf[i].content.component[j].port.high);
break;
default:
ogs_error("Unknown Packet Filter Type(%d)",
target.pf[i].component[j].type);
target.pf[i].content.component[j].type);
return -1;
}
}

View File

@ -275,7 +275,6 @@ int16_t ogs_gtp_build_flow_qos(ogs_tlv_octet_t *octet,
* See subclause 10.5.6.12 in 3GPP TS 24.008 [13]. */
#define OGS_GTP_MAX_TRAFFIC_FLOW_TEMPLATE 255
#define OGS_GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
typedef struct ogs_gtp_tft_s {
union {
struct {
@ -302,44 +301,7 @@ ED3(uint8_t code:3;,
uint8_t flags;
};
uint8_t precedence;
uint8_t length;
#define GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
#define GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
#define GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
#define GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
#define GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
#define GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
#define GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
#define GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
#define GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
#define GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
#define GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
#define GTP_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
#define GTP_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
#define GTP_PACKET_FILTER_FLOW_LABEL_TYPE 128
struct {
uint8_t type;
union {
uint8_t proto;
struct {
uint32_t addr;
uint32_t mask;
} ipv4;
struct {
uint32_t addr[4];
uint8_t prefixlen;
} ipv6;
struct {
uint32_t addr[4];
uint32_t mask[4];
} ipv6_mask;
struct {
uint16_t low;
uint16_t high;
} port;
};
} component[OGS_GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
uint8_t num_of_component;
ogs_pf_content_t content;
} pf[OGS_MAX_NUM_OF_PACKET_FILTER];
} ogs_gtp_tft_t;

View File

@ -365,3 +365,123 @@ void ogs_ipfw_rule_swap(ogs_ipfw_rule_t *ipfw_rule)
ogs_ipfw_copy_and_swap(&dst, ipfw_rule);
memcpy(ipfw_rule, &dst, sizeof(ogs_ipfw_rule_t));
}
void ogs_pf_content_from_ipfw_rule(
uint8_t direction, ogs_pf_content_t *content, ogs_ipfw_rule_t *rule)
{
int j, len;
ogs_assert(content);
ogs_assert(rule);
j = 0, len = 0;
if (rule->proto) {
content->component[j].type =
OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE;
content->component[j].proto = rule->proto;
j++; len += 2;
}
if (rule->ipv4_src) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
content->component[j].ipv4.addr = rule->ip.src.addr[0];
content->component[j].ipv4.mask = rule->ip.src.mask[0];
j++; len += 9;
}
if (rule->ipv4_dst) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
content->component[j].ipv4.addr = rule->ip.dst.addr[0];
content->component[j].ipv4.mask = rule->ip.dst.mask[0];
j++; len += 9;
}
if (rule->ipv6_src) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
memcpy(content->component[j].ipv6.addr,
rule->ip.src.addr, sizeof rule->ip.src.addr);
content->component[j].ipv6.prefixlen =
contigmask((uint8_t *)rule->ip.src.mask, 128);
j++; len += 18;
}
if (rule->ipv6_dst) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
memcpy(content->component[j].ipv6.addr,
rule->ip.dst.addr, sizeof rule->ip.dst.addr);
content->component[j].ipv6.prefixlen =
contigmask((uint8_t *)rule->ip.dst.mask, 128);
j++; len += 18;
}
if (rule->port.src.low) {
if (rule->port.src.low == rule->port.src.high) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
content->component[j].port.low = rule->port.src.low;
j++; len += 3;
} else {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
content->component[j].port.low = rule->port.src.low;
content->component[j].port.high = rule->port.src.high;
j++; len += 5;
}
}
if (rule->port.dst.low) {
if (rule->port.dst.low == rule->port.dst.high) {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
content->component[j].port.low = rule->port.dst.low;
j++; len += 3;
} else {
if (direction == OGS_FLOW_DOWNLINK_ONLY)
content->component[j].type =
OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
else
content->component[j].type =
OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
content->component[j].port.low = rule->port.dst.low;
content->component[j].port.high = rule->port.dst.high;
j++; len += 5;
}
}
content->num_of_component = j;
content->length = len;
}

View File

@ -86,6 +86,52 @@ ogs_ipfw_rule_t *ogs_ipfw_copy_and_swap(
ogs_ipfw_rule_t *dst, ogs_ipfw_rule_t *src);
void ogs_ipfw_rule_swap(ogs_ipfw_rule_t *ipfw_rule);
#define OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
typedef struct ogs_pf_content_s {
uint8_t length;
#define OGS_PACKET_FILTER_MATCH_ALL 1
#define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
#define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
#define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
#define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
#define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
#define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
#define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
#define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
#define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
#define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128
struct {
uint8_t type;
union {
uint8_t proto;
struct {
uint32_t addr;
uint32_t mask;
} ipv4;
struct {
uint32_t addr[4];
uint8_t prefixlen;
} ipv6;
struct {
uint32_t addr[4];
uint32_t mask[4];
} ipv6_mask;
struct {
uint16_t low;
uint16_t high;
} port;
};
} component[OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
uint8_t num_of_component;
} ogs_pf_content_t;
void ogs_pf_content_from_ipfw_rule(
uint8_t direction, ogs_pf_content_t *content, ogs_ipfw_rule_t *rule);
#ifdef __cplusplus
}
#endif

View File

@ -21,6 +21,7 @@
#define OGS_NAS_5GS_H
#include "ogs-nas-common.h"
#include "ipfw/ogs-ipfw.h"
#define OGS_NAS_INSIDE

View File

@ -246,10 +246,84 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
return num_of_s_nssai;
}
void ogs_nas_build_qos_flow_descriptions(
ogs_nas_qos_flow_descriptions_t *flow_descriptions,
ogs_nas_qos_flow_description_t *flow_description,
int num_of_flow_description)
{
int i, j;
char *buffer;
uint16_t length;
ogs_nas_qos_flow_description_t target;
ogs_assert(flow_descriptions);
ogs_assert(flow_description);
ogs_assert(num_of_flow_description);
buffer = ogs_calloc(1, OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
ogs_assert(buffer);
length = 0;
for (i = 0; i < num_of_flow_description; i++) {
memcpy(&target, flow_description + i,
sizeof(ogs_nas_qos_flow_description_t));
ogs_assert(length + 3 <= OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target, 3);
length += 3;
for (j = 0; j < target.num_of_parameter; j++) {
ogs_assert(length + sizeof(target.param[j].identifier) <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target.param[j].identifier,
sizeof(target.param[j].identifier));
length += sizeof(target.param[j].identifier);
ogs_assert(length + sizeof(target.param[j].len) <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target.param[j].len,
sizeof(target.param[j].len));
length += sizeof(target.param[j].len);
switch(target.param[j].identifier) {
case OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI:
ogs_assert(target.param[j].len == 1);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target.param[j].qci,
target.param[j].len);
length += target.param[j].len;
break;
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_UPLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK:
ogs_assert(target.param[j].len == 3);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
target.param[j].br.bitrate =
htobe16(target.param[j].br.bitrate);
memcpy(buffer + length, &target.param[j].br,
target.param[j].len);
length += target.param[j].len;
break;
default:
ogs_fatal("Unknown qos_flow parameter identifier [%d]",
target.param[j].identifier);
ogs_assert_if_reached();
}
}
}
flow_descriptions->buffer = buffer;
flow_descriptions->length = length;
}
void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
ogs_nas_qos_rule_t *rule, int num_of_rule)
{
int i, j;
int i, j, k;
char *buffer;
uint16_t length;
ogs_nas_qos_rule_t target;
@ -263,6 +337,8 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
length = 0;
for (i = 0; i < num_of_rule; i++) {
char *rule_length = NULL;
memcpy(&target, rule + i, sizeof(ogs_nas_qos_rule_t));
ogs_assert(length + sizeof(target.identifier) <=
@ -270,10 +346,13 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
memcpy(buffer + length, &target.identifier, sizeof(target.identifier));
length += sizeof(target.identifier);
ogs_assert(length + sizeof(target.length) <=
OGS_NAS_MAX_QOS_RULES_LEN);
target.length = htobe16(target.length);
memcpy(buffer + length, &target.length, sizeof(target.length));
/* Just store the location of the QoS rule length */
rule_length = buffer+length;
length += sizeof(target.length);
ogs_assert(length + sizeof(target.flags) <= OGS_NAS_MAX_QOS_RULES_LEN);
@ -287,126 +366,137 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
sizeof(target.pf[j].flags));
length += sizeof(target.pf[j].flags);
ogs_assert(length + sizeof(target.pf[j].length) <=
ogs_assert(length + sizeof(target.pf[j].content.length) <=
OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length, &target.pf[j].length,
sizeof(target.pf[j].length));
length += sizeof(target.pf[j].length);
memcpy(buffer + length, &target.pf[j].content.length,
sizeof(target.pf[j].content.length));
length += sizeof(target.pf[j].content.length);
for (j = 0; j < target.pf[j].num_of_component; j++) {
ogs_assert(length + sizeof(target.pf[j].component[j].type) <=
for (k = 0; k < target.pf[j].content.num_of_component; k++) {
ogs_assert(length +
sizeof(target.pf[j].content.component[k].type) <=
OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].type,
sizeof(target.pf[j].component[j].type));
length += sizeof(target.pf[j].component[j].type);
switch(target.pf[j].component[j].type) {
memcpy(buffer + length, &target.pf[j].content.component[k].type,
sizeof(target.pf[j].content.component[k].type));
length += sizeof(target.pf[j].content.component[k].type);
switch(target.pf[j].content.component[k].type) {
case OGS_PACKET_FILTER_MATCH_ALL:
break;
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].proto) <=
sizeof(target.pf[j].content.component[k].proto) <=
OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].proto,
sizeof(target.pf[j].component[j].proto));
length += sizeof(target.pf[j].component[j].proto);
&target.pf[j].content.component[k].proto,
sizeof(target.pf[j].content.component[k].proto));
length += sizeof(target.pf[j].content.component[k].proto);
break;
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv4.addr)
sizeof(target.pf[j].content.component[k].ipv4.addr)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv4.addr,
sizeof(target.pf[j].component[j].ipv4.addr));
length += sizeof(target.pf[j].component[j].ipv4.addr);
&target.pf[j].content.component[k].ipv4.addr,
sizeof(target.pf[j].content.component[k].ipv4.addr));
length +=
sizeof(target.pf[j].content.component[k].ipv4.addr);
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv4.mask)
sizeof(target.pf[j].content.component[k].ipv4.mask)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv4.mask,
sizeof(target.pf[j].component[j].ipv4.mask));
length += sizeof(target.pf[j].component[j].ipv4.mask);
&target.pf[j].content.component[k].ipv4.mask,
sizeof(target.pf[j].content.component[k].ipv4.mask));
length +=
sizeof(target.pf[j].content.component[k].ipv4.mask);
break;
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv6.addr)
sizeof(target.pf[j].content.component[k].ipv6.addr)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv6.addr,
sizeof(target.pf[j].component[j].ipv6.addr));
length += sizeof(target.pf[j].component[j].ipv6.addr);
&target.pf[j].content.component[k].ipv6.addr,
sizeof(target.pf[j].content.component[k].ipv6.addr));
length +=
sizeof(target.pf[j].content.component[k].ipv6.addr);
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv6.prefixlen)
sizeof(target.pf[j].content.component[k].ipv6.prefixlen)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv6.prefixlen,
sizeof(target.pf[j].component[j].ipv6.prefixlen));
length += sizeof(target.pf[j].component[j].ipv6.prefixlen);
&target.pf[j].content.component[k].ipv6.prefixlen,
sizeof(
target.pf[j].content.component[k].ipv6.prefixlen));
length += sizeof(
target.pf[j].content.component[k].ipv6.prefixlen);
break;
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv6_mask.addr)
sizeof(target.pf[j].content.component[k].ipv6_mask.addr)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv6_mask.addr,
sizeof(target.pf[j].component[j].ipv6_mask.addr));
length += sizeof(target.pf[j].component[j].ipv6_mask.addr);
&target.pf[j].content.component[k].ipv6_mask.addr,
sizeof(
target.pf[j].content.component[k].ipv6_mask.addr));
length += sizeof(
target.pf[j].content.component[k].ipv6_mask.addr);
ogs_assert(length +
sizeof(target.pf[j].component[j].ipv6_mask.mask)
sizeof(target.pf[j].content.component[k].ipv6_mask.mask)
<= OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length,
&target.pf[j].component[j].ipv6_mask.mask,
sizeof(target.pf[j].component[j].ipv6_mask.mask));
length += sizeof(target.pf[j].component[j].ipv6_mask.mask);
&target.pf[j].content.component[k].ipv6_mask.mask,
sizeof(
target.pf[j].content.component[k].ipv6_mask.mask));
length += sizeof(
target.pf[j].content.component[k].ipv6_mask.mask);
break;
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].port.low)
sizeof(target.pf[j].content.component[k].port.low)
<= OGS_NAS_MAX_QOS_RULES_LEN);
target.pf[j].component[j].port.low =
htobe16(target.pf[j].component[j].port.low);
target.pf[j].content.component[k].port.low =
htobe16(target.pf[j].content.component[k].port.low);
memcpy(buffer + length,
&target.pf[j].component[j].port.low,
sizeof(target.pf[j].component[j].port.low));
length += sizeof(target.pf[j].component[j].port.low);
&target.pf[j].content.component[k].port.low,
sizeof(target.pf[j].content.component[k].port.low));
length +=
sizeof(target.pf[j].content.component[k].port.low);
break;
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
ogs_assert(length +
sizeof(target.pf[j].component[j].port.low)
sizeof(target.pf[j].content.component[k].port.low)
<= OGS_NAS_MAX_QOS_RULES_LEN);
target.pf[j].component[j].port.low =
htobe16(target.pf[j].component[j].port.low);
target.pf[j].content.component[k].port.low =
htobe16(target.pf[j].content.component[k].port.low);
memcpy(buffer + length,
&target.pf[j].component[j].port.low,
sizeof(target.pf[j].component[j].port.low));
length += sizeof(target.pf[j].component[j].port.low);
&target.pf[j].content.component[k].port.low,
sizeof(target.pf[j].content.component[k].port.low));
length +=
sizeof(target.pf[j].content.component[k].port.low);
ogs_assert(length +
sizeof(target.pf[j].component[j].port.high)
sizeof(target.pf[j].content.component[k].port.high)
<= OGS_NAS_MAX_QOS_RULES_LEN);
target.pf[j].component[j].port.high =
htobe16(target.pf[j].component[j].port.high);
target.pf[j].content.component[k].port.high =
htobe16(target.pf[j].content.component[k].port.high);
memcpy(buffer + length,
&target.pf[j].component[j].port.high,
sizeof(target.pf[j].component[j].port.high));
length += sizeof(target.pf[j].component[j].port.high);
&target.pf[j].content.component[k].port.high,
sizeof(target.pf[j].content.component[k].port.high));
length +=
sizeof(target.pf[j].content.component[k].port.high);
break;
default:
ogs_fatal("Unknown Packet Filter Type(%d)",
target.pf[j].component[j].type);
target.pf[j].content.component[k].type);
ogs_assert_if_reached();
}
}
}
ogs_assert(length + sizeof(target.precedence) <=
@ -417,6 +507,11 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
OGS_NAS_MAX_QOS_RULES_LEN);
memcpy(buffer + length, &target.flow.flags, sizeof(target.precedence));
length += sizeof(target.flow.flags);
/* Update QoS Rule Length */
target.length = htobe16(
buffer+length - rule_length - sizeof(target.length));
memcpy(rule_length, &target.length, sizeof(target.length));
}
rules->buffer = buffer;

View File

@ -707,10 +707,14 @@ typedef struct ogs_nas_qos_flow_parameter_s {
#define OGS_NAX_QOS_FLOW_PARAMETER_ID_EPS_BEARER_IDENTITY 7
uint8_t identifier;
uint8_t len;
#define OGS_NAS_MAX_QOS_FLOW_PARAEMTER_LEN 255
uint8_t content[OGS_NAS_MAX_QOS_FLOW_PARAEMTER_LEN];
union {
uint8_t qci;
ogs_nas_bitrate_t br;
};
} ogs_nas_qos_flow_parameter_t;
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_DESCRIPTION 8
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER 8
typedef struct ogs_nas_qos_flow_description_s {
ED2(uint8_t spare1:2;,
uint8_t identifier:6;)
@ -734,18 +738,23 @@ ED3(uint8_t spare3:1;,
* 0 extension of previously provided parameters
* 1 replacement of all previously provided parameters
*/
uint8_t E:1;,
uint8_t E_bit:1;,
uint8_t num_of_parameter:6;)
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER 8
ogs_nas_qos_flow_parameter_t param[OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER];
} ogs_nas_qos_flow_description_t;
#define OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN 65535
typedef struct ogs_nas_qos_flow_descriptions_s {
uint16_t length;
void *buffer;
} ogs_nas_qos_flow_descriptions_t;
void ogs_nas_build_qos_flow_descriptions(
ogs_nas_qos_flow_descriptions_t *flow_descriptions,
ogs_nas_qos_flow_description_t *flow_description,
int num_of_flow_description);
/* 9.11.4.13 QoS rules
* M LV-E 6-65535 */
#define OGS_NAS_MAX_NUM_OF_QOS_RULE 8
@ -775,49 +784,11 @@ typedef struct ogs_nas_qos_rule_s {
#define OGS_NAS_QOS_DIRECTION_UPLINK 2
#define OGS_NAS_QOS_DIRECTION_BIDIRECTIONAL 3
uint8_t direction:2;,
uint8_t pf_identifier:4;)
uint8_t identifier:4;)
};
uint8_t flags;
};
uint8_t length;
#define OGS_PACKET_FILTER_MATCH_ALL 1
#define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
#define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
#define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
#define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
#define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
#define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
#define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
#define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
#define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
#define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128
struct {
uint8_t type;
union {
uint8_t proto;
struct {
uint32_t addr;
uint32_t mask;
} ipv4;
struct {
uint32_t addr[4];
uint8_t prefixlen;
} ipv6;
struct {
uint32_t addr[4];
uint32_t mask[4];
} ipv6_mask;
struct {
uint16_t low;
uint16_t high;
} port;
};
} component[OGS_NAS_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
uint8_t num_of_component;
ogs_pf_content_t content;
} pf[OGS_MAX_NUM_OF_PACKET_FILTER];
uint8_t precedence;

View File

@ -782,9 +782,10 @@ ED2(uint8_t reserved:5;,
#define OGS_NAS_EPS_PDN_TYPE_NON_IP 5
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL 1
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_PDU_SESSION 2
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL_EMERGENCY 3
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_PDU_SESSION_EMERGENCY 4
#define OGS_NAS_5GS_REQUEST_TYPE_MODIFICATION 5
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL_EMERGENCY_REQUEST 3
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_EMERGENCY_PDU_SESSION 4
#define OGS_NAS_5GS_REQUEST_TYPE_MODIFICATION_REQUEST 5
#define OGS_NAS_5GS_REQUEST_TYPE_MA_PDU_REQUEST 6
typedef struct ogs_nas_request_type_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,

View File

@ -509,7 +509,7 @@ void ogs_pfcp_build_update_far_activate(
message->far_id.presence = 1;
message->far_id.u32 = far->id;
ogs_assert(far->apply_action == OGS_PFCP_APPLY_ACTION_FORW);
ogs_assert(far->apply_action & OGS_PFCP_APPLY_ACTION_FORW);
message->apply_action.presence = 1;
message->apply_action.u8 = far->apply_action;

View File

@ -544,7 +544,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
v = ogs_yaml_iter_value(&e_cell_id_iter);
if (v) {
e_cell_id[num_of_e_cell_id]
= ogs_uint28_from_string((char*)v);
= ogs_uint64_from_string((char*)v);
num_of_e_cell_id++;
}
} while (
@ -572,7 +572,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
v = ogs_yaml_iter_value(&nr_cell_id_iter);
if (v) {
nr_cell_id[num_of_nr_cell_id]
= ogs_uint36_from_string((char*)v);
= ogs_uint64_from_string((char*)v);
num_of_nr_cell_id++;
}
} while (

View File

@ -486,6 +486,7 @@ ED5(uint8_t spare1:4;,
uint8_t ipv6:1;,
uint8_t ipv4:1;)
union {
#define OGS_PFCP_DEFAULT_CHOOSE_ID 5
struct {
ED4(uint8_t choose_id;,
uint8_t spare2;,

View File

@ -996,9 +996,10 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
}
}
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build, void (*timer_cb)(void *data))
ogs_sbi_xact_t *ogs_sbi_xact_add(
OpenAPI_nf_type_e target_nf_type, ogs_sbi_object_t *sbi_object,
ogs_sbi_build_f build, void *context, void *data,
void (*timer_cb)(void *data))
{
ogs_sbi_xact_t *xact = NULL;
@ -1011,7 +1012,7 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
xact->target_nf_type = target_nf_type;
xact->sbi_object = sbi_object;
xact->request = (*build)(sbi_object, data);
xact->request = (*build)(context, data);
ogs_assert(xact->request);
xact->t_response = ogs_timer_add(

View File

@ -125,7 +125,7 @@ typedef struct ogs_sbi_object_s {
} ogs_sbi_object_t;
typedef ogs_sbi_request_t *(*ogs_sbi_build_f)(
ogs_sbi_object_t *sbi_object, void *data);
void *context, void *data);
typedef struct ogs_sbi_xact_s {
ogs_lnode_t lnode;
@ -230,9 +230,10 @@ bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build, void (*timer_cb)(void *data));
ogs_sbi_xact_t *ogs_sbi_xact_add(
OpenAPI_nf_type_e target_nf_type, ogs_sbi_object_t *sbi_object,
ogs_sbi_build_f build, void *context, void *data,
void (*timer_cb)(void *data));
void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact);
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object);

View File

@ -546,12 +546,12 @@ OpenAPI_nr_location_t *ogs_sbi_build_nr_location(
Tai = ogs_calloc(1, sizeof(*Tai));
ogs_assert(Tai);
Tai->plmn_id = ogs_sbi_build_plmn_id(&tai->plmn_id);
Tai->tac = ogs_uint24_to_string(tai->tac);
Tai->tac = ogs_uint24_to_0string(tai->tac);
Ncgi = ogs_calloc(1, sizeof(*Ncgi));
ogs_assert(Ncgi);
Ncgi->plmn_id = ogs_sbi_build_plmn_id(&nr_cgi->plmn_id);
Ncgi->nr_cell_id = ogs_uint36_to_string(nr_cgi->cell_id);
Ncgi->nr_cell_id = ogs_uint36_to_0string(nr_cgi->cell_id);
NrLocation = ogs_calloc(1, sizeof(*NrLocation));
ogs_assert(NrLocation);
@ -584,7 +584,7 @@ bool ogs_sbi_parse_nr_location(ogs_5gs_tai_t *tai, ogs_nr_cgi_t *nr_cgi,
if (Ncgi->plmn_id)
ogs_sbi_parse_plmn_id(&nr_cgi->plmn_id, Ncgi->plmn_id);
if (Ncgi->nr_cell_id)
nr_cgi->cell_id = ogs_uint36_from_string(Ncgi->nr_cell_id);
nr_cgi->cell_id = ogs_uint64_from_string(Ncgi->nr_cell_id);
}

View File

@ -140,6 +140,57 @@ extern "C" {
#define OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL "npcf-smpolicycontrol"
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
#define OGS_SBI_FEATURES_IS_SET(__fEATURES, __n) \
(__fEATURES & (1 << ((__n)-1)))
#define OGS_SBI_FEATURES_SET(__fEATURES, __n) \
__fEATURES |= (1 << ((__n)-1))
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_SLICE_SUPPORT 1
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_PENDING_TRANSACTION 2
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION 3
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_DNN_REPLACEMENT_CONTROL 4
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_MULTIPLE_ACCESS_TYPES 5
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_WIRELINE_WIRELESS_CONVERGE 6
#define OGS_SBI_NPCF_SMPOLICYCONTROL_TSC 1
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RES_SHARE 2
#define OGS_SBI_NPCF_SMPOLICYCONTROL_3GPP_PS_DATA_OFF 3
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ADC 4
#define OGS_SBI_NPCF_SMPOLICYCONTROL_UMC 5
#define OGS_SBI_NPCF_SMPOLICYCONTROL_NET_LOC 6
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RAN_NAS_CAUSE 7
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PROV_AF_SIGNAL_FLOW 8
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PCSCF_RESTORATION_ENHANCEMENT 9
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PRA 10
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RULE_VERSIONING 11
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SPONSORED_CONNECTIVITY 12
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RAN_SUPPORT_INFO 13
#define OGS_SBI_NPCF_SMPOLICYCONTROL_POLICY_UPDATE_WHEN_UE_SUSPENDS 14
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ACCESS_TYPE_CONDITION 15
#define OGS_SBI_NPCF_SMPOLICYCONTROL_MULTI_IPV6_ADDR_PREFIX 16
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SESSION_RULE_ERROR_HANDLING 17
#define OGS_SBI_NPCF_SMPOLICYCONTROL_AF_CHARGING_IDENTIFIER 18
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ATSSS 19
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PENDING_TRANSACTION 20
#define OGS_SBI_NPCF_SMPOLICYCONTROL_URLLC 21
#define OGS_SBI_NPCF_SMPOLICYCONTROL_MAC_ADDRESS_RANGE 22
#define OGS_SBI_NPCF_SMPOLICYCONTROL_WWC 23
#define OGS_SBI_NPCF_SMPOLICYCONTROL_QOS_MONITORING 24
#define OGS_SBI_NPCF_SMPOLICYCONTROL_AUTHORIZATION_WITH_REQUIRED_QOS 25
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ENHANCED_BACKGROUND_DATA_TRANSFER 26
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DN_AUTHORIZATION 27
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PDU_SESSION_REL_CAUSE 28
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SAME_PCF 29
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ADC_MULTI_REDIRECTION 30
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RESP_BASED_SESSION_REL 31
#define OGS_SBI_NPCF_SMPOLICYCONTROL_TIME_SENSITIVE_NETWORKING 32
#define OGS_SBI_NPCF_SMPOLICYCONTROL_EMDBV 33
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DNN_SELECTION_MODE 34
#define OGS_SBI_NPCF_SMPOLICYCONTROL_EPS_FALLBACK_REPORT 35
#define OGS_SBI_NPCF_SMPOLICYCONTROL_POLICY_DECISION_ERROR_HANDLING 36
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DDN_EVENT_POLICY_CONTROL 37
#define OGS_SBI_NPCF_SMPOLICYCONTROL_REALLOCATION_OF_CREDIT 38
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "af_sig_protocol.h"
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
)
char* OpenAPI_af_sig_protocol_ToString(OpenAPI_af_sig_protocol_e af_sig_protocol)
{
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_sig_protocol_t));
if (!af_sig_protocol_local_var) {
return NULL;
}
return af_sig_protocol_local_var;
const char *af_sig_protocolArray[] = { "NULL", "NO_INFORMATION", "SIP" };
size_t sizeofArray = sizeof(af_sig_protocolArray) / sizeof(af_sig_protocolArray[0]);
if (af_sig_protocol < sizeofArray)
return (char *)af_sig_protocolArray[af_sig_protocol];
else
return (char *)"Unknown";
}
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol)
OpenAPI_af_sig_protocol_e OpenAPI_af_sig_protocol_FromString(char* af_sig_protocol)
{
if (NULL == af_sig_protocol) {
return;
int stringToReturn = 0;
const char *af_sig_protocolArray[] = { "NULL", "NO_INFORMATION", "SIP" };
size_t sizeofArray = sizeof(af_sig_protocolArray) / sizeof(af_sig_protocolArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(af_sig_protocol, af_sig_protocolArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(af_sig_protocol);
}
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol)
{
cJSON *item = NULL;
if (af_sig_protocol == NULL) {
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed [AfSigProtocol]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON)
{
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = NULL;
af_sig_protocol_local_var = OpenAPI_af_sig_protocol_create (
);
return af_sig_protocol_local_var;
end:
return NULL;
}
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_sig_protocol_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_af_sig_protocol_free(dst);
dst = OpenAPI_af_sig_protocol_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* af_sig_protocol.h
*
* Possible values are - NO_INFORMATION: Indicate that no information about the AF signalling protocol is being provided. - SIP: Indicate that the signalling protocol is Session Initiation Protocol.
*
*/
#ifndef _OpenAPI_af_sig_protocol_H_
@ -12,22 +12,16 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_sig_protocol_s OpenAPI_af_sig_protocol_t;
typedef struct OpenAPI_af_sig_protocol_s {
} OpenAPI_af_sig_protocol_t;
typedef enum { OpenAPI_af_sig_protocol_NULL = 0, OpenAPI_af_sig_protocol_NO_INFORMATION, OpenAPI_af_sig_protocol_SIP } OpenAPI_af_sig_protocol_e;
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
);
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol);
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON);
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol);
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src);
char* OpenAPI_af_sig_protocol_ToString(OpenAPI_af_sig_protocol_e af_sig_protocol);
OpenAPI_af_sig_protocol_e OpenAPI_af_sig_protocol_FromString(char* af_sig_protocol);
#ifdef __cplusplus
}

View File

@ -6,12 +6,12 @@
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
char *chg_id,
OpenAPI_metering_method_t *metering_method,
OpenAPI_metering_method_e metering_method,
int offline,
int online,
int sdf_handl,
int rating_group,
OpenAPI_reporting_level_t *reporting_level,
OpenAPI_reporting_level_e reporting_level,
int service_id,
char *sponsor_id,
char *app_svc_prov_id,
@ -46,8 +46,6 @@ void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data)
}
OpenAPI_lnode_t *node;
ogs_free(charging_data->chg_id);
OpenAPI_metering_method_free(charging_data->metering_method);
OpenAPI_reporting_level_free(charging_data->reporting_level);
ogs_free(charging_data->sponsor_id);
ogs_free(charging_data->app_svc_prov_id);
ogs_free(charging_data->af_charg_id);
@ -74,13 +72,7 @@ cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_dat
}
if (charging_data->metering_method) {
cJSON *metering_method_local_JSON = OpenAPI_metering_method_convertToJSON(charging_data->metering_method);
if (metering_method_local_JSON == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
goto end;
}
cJSON_AddItemToObject(item, "meteringMethod", metering_method_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "meteringMethod", OpenAPI_metering_method_ToString(charging_data->metering_method)) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
goto end;
}
@ -115,13 +107,7 @@ cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_dat
}
if (charging_data->reporting_level) {
cJSON *reporting_level_local_JSON = OpenAPI_reporting_level_convertToJSON(charging_data->reporting_level);
if (reporting_level_local_JSON == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
goto end;
}
cJSON_AddItemToObject(item, "reportingLevel", reporting_level_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "reportingLevel", OpenAPI_reporting_level_ToString(charging_data->reporting_level)) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
goto end;
}
@ -183,9 +169,13 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
cJSON *metering_method = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "meteringMethod");
OpenAPI_metering_method_t *metering_method_local_nonprim = NULL;
OpenAPI_metering_method_e metering_methodVariable;
if (metering_method) {
metering_method_local_nonprim = OpenAPI_metering_method_parseFromJSON(metering_method);
if (!cJSON_IsString(metering_method)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [metering_method]");
goto end;
}
metering_methodVariable = OpenAPI_metering_method_FromString(metering_method->valuestring);
}
cJSON *offline = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "offline");
@ -226,9 +216,13 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
cJSON *reporting_level = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "reportingLevel");
OpenAPI_reporting_level_t *reporting_level_local_nonprim = NULL;
OpenAPI_reporting_level_e reporting_levelVariable;
if (reporting_level) {
reporting_level_local_nonprim = OpenAPI_reporting_level_parseFromJSON(reporting_level);
if (!cJSON_IsString(reporting_level)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [reporting_level]");
goto end;
}
reporting_levelVariable = OpenAPI_reporting_level_FromString(reporting_level->valuestring);
}
cJSON *service_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "serviceId");
@ -278,12 +272,12 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
charging_data_local_var = OpenAPI_charging_data_create (
ogs_strdup(chg_id->valuestring),
metering_method ? metering_method_local_nonprim : NULL,
metering_method ? metering_methodVariable : 0,
offline ? offline->valueint : 0,
online ? online->valueint : 0,
sdf_handl ? sdf_handl->valueint : 0,
rating_group ? rating_group->valuedouble : 0,
reporting_level ? reporting_level_local_nonprim : NULL,
reporting_level ? reporting_levelVariable : 0,
service_id ? service_id->valuedouble : 0,
sponsor_id ? ogs_strdup(sponsor_id->valuestring) : NULL,
app_svc_prov_id ? ogs_strdup(app_svc_prov_id->valuestring) : NULL,

View File

@ -22,12 +22,12 @@ extern "C" {
typedef struct OpenAPI_charging_data_s OpenAPI_charging_data_t;
typedef struct OpenAPI_charging_data_s {
char *chg_id;
struct OpenAPI_metering_method_s *metering_method;
OpenAPI_metering_method_e metering_method;
int offline;
int online;
int sdf_handl;
int rating_group;
struct OpenAPI_reporting_level_s *reporting_level;
OpenAPI_reporting_level_e reporting_level;
int service_id;
char *sponsor_id;
char *app_svc_prov_id;
@ -37,12 +37,12 @@ typedef struct OpenAPI_charging_data_s {
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
char *chg_id,
OpenAPI_metering_method_t *metering_method,
OpenAPI_metering_method_e metering_method,
int offline,
int online,
int sdf_handl,
int rating_group,
OpenAPI_reporting_level_t *reporting_level,
OpenAPI_reporting_level_e reporting_level,
int service_id,
char *sponsor_id,
char *app_svc_prov_id,

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "credit_management_status.h"
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
)
char* OpenAPI_credit_management_status_ToString(OpenAPI_credit_management_status_e credit_management_status)
{
OpenAPI_credit_management_status_t *credit_management_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_credit_management_status_t));
if (!credit_management_status_local_var) {
return NULL;
}
return credit_management_status_local_var;
const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" };
size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]);
if (credit_management_status < sizeofArray)
return (char *)credit_management_statusArray[credit_management_status];
else
return (char *)"Unknown";
}
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status)
OpenAPI_credit_management_status_e OpenAPI_credit_management_status_FromString(char* credit_management_status)
{
if (NULL == credit_management_status) {
return;
int stringToReturn = 0;
const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" };
size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(credit_management_status, credit_management_statusArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(credit_management_status);
}
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status)
{
cJSON *item = NULL;
if (credit_management_status == NULL) {
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed [CreditManagementStatus]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON)
{
OpenAPI_credit_management_status_t *credit_management_status_local_var = NULL;
credit_management_status_local_var = OpenAPI_credit_management_status_create (
);
return credit_management_status_local_var;
end:
return NULL;
}
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_credit_management_status_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_credit_management_status_free(dst);
dst = OpenAPI_credit_management_status_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_credit_management_status_s OpenAPI_credit_management_status_t;
typedef struct OpenAPI_credit_management_status_s {
} OpenAPI_credit_management_status_t;
typedef enum { OpenAPI_credit_management_status_NULL = 0, OpenAPI_credit_management_status_END_USER_SER_DENIED, OpenAPI_credit_management_status_CREDIT_CTRL_NOT_APP, OpenAPI_credit_management_status_AUTH_REJECTED, OpenAPI_credit_management_status_USER_UNKNOWN, OpenAPI_credit_management_status_RATING_FAILED } OpenAPI_credit_management_status_e;
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
);
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status);
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON);
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status);
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src);
char* OpenAPI_credit_management_status_ToString(OpenAPI_credit_management_status_e credit_management_status);
OpenAPI_credit_management_status_e OpenAPI_credit_management_status_FromString(char* credit_management_status);
#ifdef __cplusplus
}

View File

@ -8,7 +8,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_create(
char *dest_mac_addr,
char *eth_type,
char *f_desc,
OpenAPI_flow_direction_t *f_dir,
OpenAPI_flow_direction_e f_dir,
char *source_mac_addr,
OpenAPI_list_t *vlan_tags,
char *src_mac_addr_end,
@ -40,7 +40,6 @@ void OpenAPI_eth_flow_description_free(OpenAPI_eth_flow_description_t *eth_flow_
ogs_free(eth_flow_description->dest_mac_addr);
ogs_free(eth_flow_description->eth_type);
ogs_free(eth_flow_description->f_desc);
OpenAPI_flow_direction_free(eth_flow_description->f_dir);
ogs_free(eth_flow_description->source_mac_addr);
OpenAPI_list_for_each(eth_flow_description->vlan_tags, node) {
ogs_free(node->data);
@ -85,13 +84,7 @@ cJSON *OpenAPI_eth_flow_description_convertToJSON(OpenAPI_eth_flow_description_t
}
if (eth_flow_description->f_dir) {
cJSON *f_dir_local_JSON = OpenAPI_flow_direction_convertToJSON(eth_flow_description->f_dir);
if (f_dir_local_JSON == NULL) {
ogs_error("OpenAPI_eth_flow_description_convertToJSON() failed [f_dir]");
goto end;
}
cJSON_AddItemToObject(item, "fDir", f_dir_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "fDir", OpenAPI_flow_direction_ToString(eth_flow_description->f_dir)) == NULL) {
ogs_error("OpenAPI_eth_flow_description_convertToJSON() failed [f_dir]");
goto end;
}
@ -173,9 +166,13 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_parseFromJSON(cJSON
cJSON *f_dir = cJSON_GetObjectItemCaseSensitive(eth_flow_descriptionJSON, "fDir");
OpenAPI_flow_direction_t *f_dir_local_nonprim = NULL;
OpenAPI_flow_direction_e f_dirVariable;
if (f_dir) {
f_dir_local_nonprim = OpenAPI_flow_direction_parseFromJSON(f_dir);
if (!cJSON_IsString(f_dir)) {
ogs_error("OpenAPI_eth_flow_description_parseFromJSON() failed [f_dir]");
goto end;
}
f_dirVariable = OpenAPI_flow_direction_FromString(f_dir->valuestring);
}
cJSON *source_mac_addr = cJSON_GetObjectItemCaseSensitive(eth_flow_descriptionJSON, "sourceMacAddr");
@ -229,7 +226,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_parseFromJSON(cJSON
dest_mac_addr ? ogs_strdup(dest_mac_addr->valuestring) : NULL,
ogs_strdup(eth_type->valuestring),
f_desc ? ogs_strdup(f_desc->valuestring) : NULL,
f_dir ? f_dir_local_nonprim : NULL,
f_dir ? f_dirVariable : 0,
source_mac_addr ? ogs_strdup(source_mac_addr->valuestring) : NULL,
vlan_tags ? vlan_tagsList : NULL,
src_mac_addr_end ? ogs_strdup(src_mac_addr_end->valuestring) : NULL,

View File

@ -23,7 +23,7 @@ typedef struct OpenAPI_eth_flow_description_s {
char *dest_mac_addr;
char *eth_type;
char *f_desc;
struct OpenAPI_flow_direction_s *f_dir;
OpenAPI_flow_direction_e f_dir;
char *source_mac_addr;
OpenAPI_list_t *vlan_tags;
char *src_mac_addr_end;
@ -34,7 +34,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_create(
char *dest_mac_addr,
char *eth_type,
char *f_desc,
OpenAPI_flow_direction_t *f_dir,
OpenAPI_flow_direction_e f_dir,
char *source_mac_addr,
OpenAPI_list_t *vlan_tags,
char *src_mac_addr_end,

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "failure_cause.h"
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
)
char* OpenAPI_failure_cause_ToString(OpenAPI_failure_cause_e failure_cause)
{
OpenAPI_failure_cause_t *failure_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_cause_t));
if (!failure_cause_local_var) {
return NULL;
}
return failure_cause_local_var;
const char *failure_causeArray[] = { "NULL", "PCC_RULE_EVENT", "PCC_QOS_FLOW_EVENT", "RULE_PERMANENT_ERROR", "RULE_TEMPORARY_ERROR" };
size_t sizeofArray = sizeof(failure_causeArray) / sizeof(failure_causeArray[0]);
if (failure_cause < sizeofArray)
return (char *)failure_causeArray[failure_cause];
else
return (char *)"Unknown";
}
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause)
OpenAPI_failure_cause_e OpenAPI_failure_cause_FromString(char* failure_cause)
{
if (NULL == failure_cause) {
return;
int stringToReturn = 0;
const char *failure_causeArray[] = { "NULL", "PCC_RULE_EVENT", "PCC_QOS_FLOW_EVENT", "RULE_PERMANENT_ERROR", "RULE_TEMPORARY_ERROR" };
size_t sizeofArray = sizeof(failure_causeArray) / sizeof(failure_causeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(failure_cause, failure_causeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(failure_cause);
}
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause)
{
cJSON *item = NULL;
if (failure_cause == NULL) {
ogs_error("OpenAPI_failure_cause_convertToJSON() failed [FailureCause]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON)
{
OpenAPI_failure_cause_t *failure_cause_local_var = NULL;
failure_cause_local_var = OpenAPI_failure_cause_create (
);
return failure_cause_local_var;
end:
return NULL;
}
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_failure_cause_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_failure_cause_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_failure_cause_free(dst);
dst = OpenAPI_failure_cause_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_failure_cause_s OpenAPI_failure_cause_t;
typedef struct OpenAPI_failure_cause_s {
} OpenAPI_failure_cause_t;
typedef enum { OpenAPI_failure_cause_NULL = 0, OpenAPI_failure_cause_PCC_RULE_EVENT, OpenAPI_failure_cause_PCC_QOS_FLOW_EVENT, OpenAPI_failure_cause_RULE_PERMANENT_ERROR, OpenAPI_failure_cause_RULE_TEMPORARY_ERROR } OpenAPI_failure_cause_e;
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
);
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause);
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON);
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause);
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src);
char* OpenAPI_failure_cause_ToString(OpenAPI_failure_cause_e failure_cause);
OpenAPI_failure_cause_e OpenAPI_failure_cause_FromString(char* failure_cause);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "failure_code.h"
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
)
char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code)
{
OpenAPI_failure_code_t *failure_code_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_code_t));
if (!failure_code_local_var) {
return NULL;
}
return failure_code_local_var;
const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" };
size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]);
if (failure_code < sizeofArray)
return (char *)failure_codeArray[failure_code];
else
return (char *)"Unknown";
}
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code)
OpenAPI_failure_code_e OpenAPI_failure_code_FromString(char* failure_code)
{
if (NULL == failure_code) {
return;
int stringToReturn = 0;
const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" };
size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(failure_code, failure_codeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(failure_code);
}
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code)
{
cJSON *item = NULL;
if (failure_code == NULL) {
ogs_error("OpenAPI_failure_code_convertToJSON() failed [FailureCode]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON)
{
OpenAPI_failure_code_t *failure_code_local_var = NULL;
failure_code_local_var = OpenAPI_failure_code_create (
);
return failure_code_local_var;
end:
return NULL;
}
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_failure_code_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_failure_code_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_failure_code_free(dst);
dst = OpenAPI_failure_code_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* failure_code.h
*
* Possible values are - UNK_RULE_ID: Indicates that the pre-provisioned PCC rule could not be successfully activated because the PCC rule identifier is unknown to the SMF. - RA_GR_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Rating Group specified within the Charging Data policy decision which the PCC rule refers to is unknown or, invalid. - SER_ID_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Service Identifier specified within the Charging Data policy decision which the PCC rule refers to is invalid, unknown, or not applicable to the service being charged. - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. - MAX_NR_QoS_FLOW: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to the fact that the maximum number of QoS flows has been reached for the PDU session. - MISS_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or enforced because neither the \&quot;flowInfos\&quot; attribute nor the \&quot;appId\&quot; attribute is specified within the PccRule data structure by the PCF during the first install request of the PCC rule. - RES_ALLO_FAIL: Indicate that the PCC rule could not be successfully installed or maintained since the QoS flow establishment/modification failed, or the QoS flow was released. - UNSUCC_QOS_VAL: indicate that the QoS validation has failed or when Guaranteed Bandwidth &gt; Max-Requested-Bandwidth. - INCOR_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or modified at the SMF because the provided flow information is not supported by the network (e.g. the provided IP address(es) or Ipv6 prefix(es) do not correspond to an IP version applicable for the PDU session). - PS_TO_CS_HAN: Indicate that the PCC rule could not be maintained because of PS to CS handover. - APP_ID_ERR: Indicate that the rule could not be successfully installed or enforced because the Application Identifier is invalid, unknown, or not applicable to the application required for detection. - NO_QOS_FLOW_BOUND: Indicate that there is no QoS flow which the SMF can bind the PCC rule(s) to. - FILTER_RES: Indicate that the Flow Information within the \&quot;flowInfos\&quot; attribute cannot be handled by the SMF because any of the restrictions defined in subclause 5.4.2 of 3GPP TS 29.212 was not met. - MISS_REDI_SER_ADDR: Indicate that the PCC rule could not be successfully installed or enforced at the SMF because there is no valid Redirect Server Address within the Traffic Control Data policy decision which the PCC rule refers to provided by the PCF and no preconfigured redirection address for this PCC rule at the SMF. - CM_END_USER_SER_DENIED: Indicate that the charging system denied the service request due to service restrictions (e.g. terminate rating group) or limitations related to the end-user, for example the end-user&#39;s account could not cover the requested service. - CM_CREDIT_CON_NOT_APP: Indicate that the charging system determined that the service can be granted to the end user but no further credit control is needed for the service (e.g. service is free of charge or is treated for offline charging). - CM_AUTH_REJ: Indicate that the charging system denied the service request in order to terminate the service for which credit is requested. - CM_USER_UNK: Indicate that the specified end user could not be found in the charging system. - CM_RAT_FAILED: Indicate that the charging system cannot rate the service request due to insufficient rating input, incorrect AVP combination or due to an attribute or an attribute value that is not recognized or supported in the rating. - UE_STA_SUSP: Indicates that the UE is in suspend state.
*
*/
#ifndef _OpenAPI_failure_code_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_failure_code_s OpenAPI_failure_code_t;
typedef struct OpenAPI_failure_code_s {
} OpenAPI_failure_code_t;
typedef enum { OpenAPI_failure_code_NULL = 0, OpenAPI_failure_code_UNK_RULE_ID, OpenAPI_failure_code_RA_GR_ERR, OpenAPI_failure_code_SER_ID_ERR, OpenAPI_failure_code_NF_MAL, OpenAPI_failure_code_RES_LIM, OpenAPI_failure_code_MAX_NR_QoS_FLOW, OpenAPI_failure_code_MISS_FLOW_INFO, OpenAPI_failure_code_RES_ALLO_FAIL, OpenAPI_failure_code_UNSUCC_QOS_VAL, OpenAPI_failure_code_INCOR_FLOW_INFO, OpenAPI_failure_code_PS_TO_CS_HAN, OpenAPI_failure_code_APP_ID_ERR, OpenAPI_failure_code_NO_QOS_FLOW_BOUND, OpenAPI_failure_code_FILTER_RES, OpenAPI_failure_code_MISS_REDI_SER_ADDR, OpenAPI_failure_code_CM_END_USER_SER_DENIED, OpenAPI_failure_code_CM_CREDIT_CON_NOT_APP, OpenAPI_failure_code_CM_AUTH_REJ, OpenAPI_failure_code_CM_USER_UNK, OpenAPI_failure_code_CM_RAT_FAILED, OpenAPI_failure_code_UE_STA_SUSP } OpenAPI_failure_code_e;
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
);
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code);
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON);
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code);
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src);
char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code);
OpenAPI_failure_code_e OpenAPI_failure_code_FromString(char* failure_code);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "flow_direction.h"
OpenAPI_flow_direction_t *OpenAPI_flow_direction_create(
)
char* OpenAPI_flow_direction_ToString(OpenAPI_flow_direction_e flow_direction)
{
OpenAPI_flow_direction_t *flow_direction_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_direction_t));
if (!flow_direction_local_var) {
return NULL;
}
return flow_direction_local_var;
const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" };
size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]);
if (flow_direction < sizeofArray)
return (char *)flow_directionArray[flow_direction];
else
return (char *)"Unknown";
}
void OpenAPI_flow_direction_free(OpenAPI_flow_direction_t *flow_direction)
OpenAPI_flow_direction_e OpenAPI_flow_direction_FromString(char* flow_direction)
{
if (NULL == flow_direction) {
return;
int stringToReturn = 0;
const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" };
size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(flow_direction, flow_directionArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(flow_direction);
}
cJSON *OpenAPI_flow_direction_convertToJSON(OpenAPI_flow_direction_t *flow_direction)
{
cJSON *item = NULL;
if (flow_direction == NULL) {
ogs_error("OpenAPI_flow_direction_convertToJSON() failed [FlowDirection]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_flow_direction_t *OpenAPI_flow_direction_parseFromJSON(cJSON *flow_directionJSON)
{
OpenAPI_flow_direction_t *flow_direction_local_var = NULL;
flow_direction_local_var = OpenAPI_flow_direction_create (
);
return flow_direction_local_var;
end:
return NULL;
}
OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_flow_direction_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_flow_direction_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_flow_direction_free(dst);
dst = OpenAPI_flow_direction_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* flow_direction.h
*
* Possible values are - DOWNLINK: The corresponding filter applies for traffic to the UE. - UPLINK: The corresponding filter applies for traffic from the UE. - BIDIRECTIONAL: The corresponding filter applies for traffic both to and from the UE. - UNSPECIFIED: The corresponding filter applies for traffic to the UE (downlink), but has no specific direction declared. The service data flow detection shall apply the filter for uplink traffic as if the filter was bidirectional. The PCF shall not use the value UNSPECIFIED in filters created by the network in NW-initiated procedures. The PCF shall only include the value UNSPECIFIED in filters in UE-initiated procedures if the same value is received from the SMF.
*
*/
#ifndef _OpenAPI_flow_direction_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_flow_direction_s OpenAPI_flow_direction_t;
typedef struct OpenAPI_flow_direction_s {
} OpenAPI_flow_direction_t;
typedef enum { OpenAPI_flow_direction_NULL = 0, OpenAPI_flow_direction_DOWNLINK, OpenAPI_flow_direction_UPLINK, OpenAPI_flow_direction_BIDIRECTIONAL, OpenAPI_flow_direction_UNSPECIFIED } OpenAPI_flow_direction_e;
OpenAPI_flow_direction_t *OpenAPI_flow_direction_create(
);
void OpenAPI_flow_direction_free(OpenAPI_flow_direction_t *flow_direction);
OpenAPI_flow_direction_t *OpenAPI_flow_direction_parseFromJSON(cJSON *flow_directionJSON);
cJSON *OpenAPI_flow_direction_convertToJSON(OpenAPI_flow_direction_t *flow_direction);
OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src);
char* OpenAPI_flow_direction_ToString(OpenAPI_flow_direction_e flow_direction);
OpenAPI_flow_direction_e OpenAPI_flow_direction_FromString(char* flow_direction);
#ifdef __cplusplus
}

View File

@ -12,7 +12,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_create(
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_rm_t *flow_direction
OpenAPI_flow_direction_e flow_direction
)
{
OpenAPI_flow_information_t *flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_information_t));
@ -43,7 +43,6 @@ void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information)
ogs_free(flow_information->tos_traffic_class);
ogs_free(flow_information->spi);
ogs_free(flow_information->flow_label);
OpenAPI_flow_direction_rm_free(flow_information->flow_direction);
ogs_free(flow_information);
}
@ -113,13 +112,7 @@ cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_i
}
if (flow_information->flow_direction) {
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_rm_convertToJSON(flow_information->flow_direction);
if (flow_direction_local_JSON == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
goto end;
}
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "flowDirection", OpenAPI_flow_direction_ToString(flow_information->flow_direction)) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
goto end;
}
@ -195,9 +188,13 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_i
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDirection");
OpenAPI_flow_direction_rm_t *flow_direction_local_nonprim = NULL;
OpenAPI_flow_direction_e flow_directionVariable;
if (flow_direction) {
flow_direction_local_nonprim = OpenAPI_flow_direction_rm_parseFromJSON(flow_direction);
if (!cJSON_IsString(flow_direction)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_direction]");
goto end;
}
flow_directionVariable = OpenAPI_flow_direction_FromString(flow_direction->valuestring);
}
flow_information_local_var = OpenAPI_flow_information_create (
@ -208,7 +205,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_i
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
spi ? ogs_strdup(spi->valuestring) : NULL,
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
flow_direction ? flow_direction_local_nonprim : NULL
flow_direction ? flow_directionVariable : 0
);
return flow_information_local_var;

View File

@ -13,7 +13,7 @@
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "eth_flow_description.h"
#include "flow_direction_rm.h"
#include "flow_direction.h"
#ifdef __cplusplus
extern "C" {
@ -28,7 +28,7 @@ typedef struct OpenAPI_flow_information_s {
char *tos_traffic_class;
char *spi;
char *flow_label;
struct OpenAPI_flow_direction_rm_s *flow_direction;
OpenAPI_flow_direction_e flow_direction;
} OpenAPI_flow_information_t;
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
@ -39,7 +39,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_create(
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_rm_t *flow_direction
OpenAPI_flow_direction_e flow_direction
);
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information);
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "ma_pdu_indication.h"
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
)
char* OpenAPI_ma_pdu_indication_ToString(OpenAPI_ma_pdu_indication_e ma_pdu_indication)
{
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_ma_pdu_indication_t));
if (!ma_pdu_indication_local_var) {
return NULL;
}
return ma_pdu_indication_local_var;
const char *ma_pdu_indicationArray[] = { "NULL", "MA_PDU_REQUEST", "MA_PDU_NETWORK_UPGRADE_ALLOWED" };
size_t sizeofArray = sizeof(ma_pdu_indicationArray) / sizeof(ma_pdu_indicationArray[0]);
if (ma_pdu_indication < sizeofArray)
return (char *)ma_pdu_indicationArray[ma_pdu_indication];
else
return (char *)"Unknown";
}
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
OpenAPI_ma_pdu_indication_e OpenAPI_ma_pdu_indication_FromString(char* ma_pdu_indication)
{
if (NULL == ma_pdu_indication) {
return;
int stringToReturn = 0;
const char *ma_pdu_indicationArray[] = { "NULL", "MA_PDU_REQUEST", "MA_PDU_NETWORK_UPGRADE_ALLOWED" };
size_t sizeofArray = sizeof(ma_pdu_indicationArray) / sizeof(ma_pdu_indicationArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(ma_pdu_indication, ma_pdu_indicationArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(ma_pdu_indication);
}
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
{
cJSON *item = NULL;
if (ma_pdu_indication == NULL) {
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed [MaPduIndication]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON)
{
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = NULL;
ma_pdu_indication_local_var = OpenAPI_ma_pdu_indication_create (
);
return ma_pdu_indication_local_var;
end:
return NULL;
}
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_ma_pdu_indication_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_ma_pdu_indication_free(dst);
dst = OpenAPI_ma_pdu_indication_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_ma_pdu_indication_s OpenAPI_ma_pdu_indication_t;
typedef struct OpenAPI_ma_pdu_indication_s {
} OpenAPI_ma_pdu_indication_t;
typedef enum { OpenAPI_ma_pdu_indication_NULL = 0, OpenAPI_ma_pdu_indication_MA_PDU_REQUEST, OpenAPI_ma_pdu_indication_MA_PDU_NETWORK_UPGRADE_ALLOWED } OpenAPI_ma_pdu_indication_e;
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
);
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON);
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src);
char* OpenAPI_ma_pdu_indication_ToString(OpenAPI_ma_pdu_indication_e ma_pdu_indication);
OpenAPI_ma_pdu_indication_e OpenAPI_ma_pdu_indication_FromString(char* ma_pdu_indication);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "metering_method.h"
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
)
char* OpenAPI_metering_method_ToString(OpenAPI_metering_method_e metering_method)
{
OpenAPI_metering_method_t *metering_method_local_var = OpenAPI_malloc(sizeof(OpenAPI_metering_method_t));
if (!metering_method_local_var) {
return NULL;
}
return metering_method_local_var;
const char *metering_methodArray[] = { "NULL", "DURATION", "VOLUME", "DURATION_VOLUME", "EVENT" };
size_t sizeofArray = sizeof(metering_methodArray) / sizeof(metering_methodArray[0]);
if (metering_method < sizeofArray)
return (char *)metering_methodArray[metering_method];
else
return (char *)"Unknown";
}
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method)
OpenAPI_metering_method_e OpenAPI_metering_method_FromString(char* metering_method)
{
if (NULL == metering_method) {
return;
int stringToReturn = 0;
const char *metering_methodArray[] = { "NULL", "DURATION", "VOLUME", "DURATION_VOLUME", "EVENT" };
size_t sizeofArray = sizeof(metering_methodArray) / sizeof(metering_methodArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(metering_method, metering_methodArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(metering_method);
}
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method)
{
cJSON *item = NULL;
if (metering_method == NULL) {
ogs_error("OpenAPI_metering_method_convertToJSON() failed [MeteringMethod]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON)
{
OpenAPI_metering_method_t *metering_method_local_var = NULL;
metering_method_local_var = OpenAPI_metering_method_create (
);
return metering_method_local_var;
end:
return NULL;
}
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_metering_method_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_metering_method_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_metering_method_free(dst);
dst = OpenAPI_metering_method_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* metering_method.h
*
* Possible values are - DURATION: Indicates that the duration of the service data flow traffic shall be metered. - VOLUME: Indicates that volume of the service data flow traffic shall be metered. - DURATION_VOLUME: Indicates that the duration and the volume of the service data flow traffic shall be metered. - EVENT: Indicates that events of the service data flow traffic shall be metered.
*
*/
#ifndef _OpenAPI_metering_method_H_
@ -12,22 +12,16 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_metering_method_s OpenAPI_metering_method_t;
typedef struct OpenAPI_metering_method_s {
} OpenAPI_metering_method_t;
typedef enum { OpenAPI_metering_method_NULL = 0, OpenAPI_metering_method_DURATION, OpenAPI_metering_method_VOLUME, OpenAPI_metering_method_DURATION_VOLUME, OpenAPI_metering_method_EVENT } OpenAPI_metering_method_e;
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
);
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method);
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON);
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method);
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src);
char* OpenAPI_metering_method_ToString(OpenAPI_metering_method_e metering_method);
OpenAPI_metering_method_e OpenAPI_metering_method_FromString(char* metering_method);
#ifdef __cplusplus
}

View File

@ -10,7 +10,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_t *flow_direction
OpenAPI_flow_direction_e flow_direction
)
{
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_packet_filter_info_t));
@ -38,7 +38,6 @@ void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter
ogs_free(packet_filter_info->tos_traffic_class);
ogs_free(packet_filter_info->spi);
ogs_free(packet_filter_info->flow_label);
OpenAPI_flow_direction_free(packet_filter_info->flow_direction);
ogs_free(packet_filter_info);
}
@ -88,13 +87,7 @@ cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *pa
}
if (packet_filter_info->flow_direction) {
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_convertToJSON(packet_filter_info->flow_direction);
if (flow_direction_local_JSON == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
goto end;
}
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "flowDirection", OpenAPI_flow_direction_ToString(packet_filter_info->flow_direction)) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
goto end;
}
@ -154,9 +147,13 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *pa
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowDirection");
OpenAPI_flow_direction_t *flow_direction_local_nonprim = NULL;
OpenAPI_flow_direction_e flow_directionVariable;
if (flow_direction) {
flow_direction_local_nonprim = OpenAPI_flow_direction_parseFromJSON(flow_direction);
if (!cJSON_IsString(flow_direction)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [flow_direction]");
goto end;
}
flow_directionVariable = OpenAPI_flow_direction_FromString(flow_direction->valuestring);
}
packet_filter_info_local_var = OpenAPI_packet_filter_info_create (
@ -165,7 +162,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *pa
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
spi ? ogs_strdup(spi->valuestring) : NULL,
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
flow_direction ? flow_direction_local_nonprim : NULL
flow_direction ? flow_directionVariable : 0
);
return packet_filter_info_local_var;

View File

@ -25,7 +25,7 @@ typedef struct OpenAPI_packet_filter_info_s {
char *tos_traffic_class;
char *spi;
char *flow_label;
struct OpenAPI_flow_direction_s *flow_direction;
OpenAPI_flow_direction_e flow_direction;
} OpenAPI_packet_filter_info_t;
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
@ -34,7 +34,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_t *flow_direction
OpenAPI_flow_direction_e flow_direction
);
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info);
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON);

View File

@ -5,7 +5,7 @@
#include "partial_success_report.h"
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
OpenAPI_failure_cause_t *failure_cause,
OpenAPI_failure_cause_e failure_cause,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports,
OpenAPI_ue_camping_rep_t *ue_camping_rep
@ -29,7 +29,6 @@ void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *parti
return;
}
OpenAPI_lnode_t *node;
OpenAPI_failure_cause_free(partial_success_report->failure_cause);
OpenAPI_list_for_each(partial_success_report->rule_reports, node) {
OpenAPI_rule_report_free(node->data);
}
@ -56,13 +55,7 @@ cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_repo
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
cJSON *failure_cause_local_JSON = OpenAPI_failure_cause_convertToJSON(partial_success_report->failure_cause);
if (failure_cause_local_JSON == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
cJSON_AddItemToObject(item, "failureCause", failure_cause_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "failureCause", OpenAPI_failure_cause_ToString(partial_success_report->failure_cause)) == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
@ -133,9 +126,13 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c
goto end;
}
OpenAPI_failure_cause_t *failure_cause_local_nonprim = NULL;
OpenAPI_failure_cause_e failure_causeVariable;
failure_cause_local_nonprim = OpenAPI_failure_cause_parseFromJSON(failure_cause);
if (!cJSON_IsString(failure_cause)) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [failure_cause]");
goto end;
}
failure_causeVariable = OpenAPI_failure_cause_FromString(failure_cause->valuestring);
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ruleReports");
@ -191,7 +188,7 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c
}
partial_success_report_local_var = OpenAPI_partial_success_report_create (
failure_cause_local_nonprim,
failure_causeVariable,
rule_reports ? rule_reportsList : NULL,
sess_rule_reports ? sess_rule_reportsList : NULL,
ue_camping_rep ? ue_camping_rep_local_nonprim : NULL

View File

@ -23,14 +23,14 @@ extern "C" {
typedef struct OpenAPI_partial_success_report_s OpenAPI_partial_success_report_t;
typedef struct OpenAPI_partial_success_report_s {
struct OpenAPI_failure_cause_s *failure_cause;
OpenAPI_failure_cause_e failure_cause;
OpenAPI_list_t *rule_reports;
OpenAPI_list_t *sess_rule_reports;
struct OpenAPI_ue_camping_rep_s *ue_camping_rep;
} OpenAPI_partial_success_report_t;
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
OpenAPI_failure_cause_t *failure_cause,
OpenAPI_failure_cause_e failure_cause,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports,
OpenAPI_ue_camping_rep_t *ue_camping_rep

View File

@ -10,7 +10,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
int cont_ver,
char *pcc_rule_id,
int precedence,
OpenAPI_af_sig_protocol_t *af_sig_protocol,
OpenAPI_af_sig_protocol_e af_sig_protocol,
int app_reloc,
OpenAPI_list_t *ref_qos_data,
OpenAPI_list_t *ref_alt_qos_params,
@ -65,7 +65,6 @@ void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule)
OpenAPI_list_free(pcc_rule->flow_infos);
ogs_free(pcc_rule->app_id);
ogs_free(pcc_rule->pcc_rule_id);
OpenAPI_af_sig_protocol_free(pcc_rule->af_sig_protocol);
OpenAPI_list_for_each(pcc_rule->ref_qos_data, node) {
ogs_free(node->data);
}
@ -165,13 +164,7 @@ cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule)
}
if (pcc_rule->af_sig_protocol) {
cJSON *af_sig_protocol_local_JSON = OpenAPI_af_sig_protocol_convertToJSON(pcc_rule->af_sig_protocol);
if (af_sig_protocol_local_JSON == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
goto end;
}
cJSON_AddItemToObject(item, "afSigProtocol", af_sig_protocol_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "afSigProtocol", OpenAPI_af_sig_protocol_ToString(pcc_rule->af_sig_protocol)) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
goto end;
}
@ -423,9 +416,13 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
cJSON *af_sig_protocol = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "afSigProtocol");
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_nonprim = NULL;
OpenAPI_af_sig_protocol_e af_sig_protocolVariable;
if (af_sig_protocol) {
af_sig_protocol_local_nonprim = OpenAPI_af_sig_protocol_parseFromJSON(af_sig_protocol);
if (!cJSON_IsString(af_sig_protocol)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [af_sig_protocol]");
goto end;
}
af_sig_protocolVariable = OpenAPI_af_sig_protocol_FromString(af_sig_protocol->valuestring);
}
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appReloc");
@ -635,7 +632,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
cont_ver ? cont_ver->valuedouble : 0,
ogs_strdup(pcc_rule_id->valuestring),
precedence ? precedence->valuedouble : 0,
af_sig_protocol ? af_sig_protocol_local_nonprim : NULL,
af_sig_protocol ? af_sig_protocolVariable : 0,
app_reloc ? app_reloc->valueint : 0,
ref_qos_data ? ref_qos_dataList : NULL,
ref_alt_qos_params ? ref_alt_qos_paramsList : NULL,

View File

@ -27,7 +27,7 @@ typedef struct OpenAPI_pcc_rule_s {
int cont_ver;
char *pcc_rule_id;
int precedence;
struct OpenAPI_af_sig_protocol_s *af_sig_protocol;
OpenAPI_af_sig_protocol_e af_sig_protocol;
int app_reloc;
OpenAPI_list_t *ref_qos_data;
OpenAPI_list_t *ref_alt_qos_params;
@ -49,7 +49,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
int cont_ver,
char *pcc_rule_id,
int precedence,
OpenAPI_af_sig_protocol_t *af_sig_protocol,
OpenAPI_af_sig_protocol_e af_sig_protocol,
int app_reloc,
OpenAPI_list_t *ref_qos_data,
OpenAPI_list_t *ref_alt_qos_params,

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "pdu_session_rel_cause.h"
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
)
char* OpenAPI_pdu_session_rel_cause_ToString(OpenAPI_pdu_session_rel_cause_e pdu_session_rel_cause)
{
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_rel_cause_t));
if (!pdu_session_rel_cause_local_var) {
return NULL;
}
return pdu_session_rel_cause_local_var;
const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO" };
size_t sizeofArray = sizeof(pdu_session_rel_causeArray) / sizeof(pdu_session_rel_causeArray[0]);
if (pdu_session_rel_cause < sizeofArray)
return (char *)pdu_session_rel_causeArray[pdu_session_rel_cause];
else
return (char *)"Unknown";
}
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
OpenAPI_pdu_session_rel_cause_e OpenAPI_pdu_session_rel_cause_FromString(char* pdu_session_rel_cause)
{
if (NULL == pdu_session_rel_cause) {
return;
int stringToReturn = 0;
const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO" };
size_t sizeofArray = sizeof(pdu_session_rel_causeArray) / sizeof(pdu_session_rel_causeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(pdu_session_rel_cause, pdu_session_rel_causeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(pdu_session_rel_cause);
}
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
{
cJSON *item = NULL;
if (pdu_session_rel_cause == NULL) {
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed [PduSessionRelCause]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON)
{
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = NULL;
pdu_session_rel_cause_local_var = OpenAPI_pdu_session_rel_cause_create (
);
return pdu_session_rel_cause_local_var;
end:
return NULL;
}
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_pdu_session_rel_cause_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_pdu_session_rel_cause_free(dst);
dst = OpenAPI_pdu_session_rel_cause_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_pdu_session_rel_cause_s OpenAPI_pdu_session_rel_cause_t;
typedef struct OpenAPI_pdu_session_rel_cause_s {
} OpenAPI_pdu_session_rel_cause_t;
typedef enum { OpenAPI_pdu_session_rel_cause_NULL = 0, OpenAPI_pdu_session_rel_cause_PS_TO_CS_HO } OpenAPI_pdu_session_rel_cause_e;
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
);
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON);
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src);
char* OpenAPI_pdu_session_rel_cause_ToString(OpenAPI_pdu_session_rel_cause_e pdu_session_rel_cause);
OpenAPI_pdu_session_rel_cause_e OpenAPI_pdu_session_rel_cause_FromString(char* pdu_session_rel_cause);
#ifdef __cplusplus
}

View File

@ -28,7 +28,7 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create(
OpenAPI_list_t *mapping_snssais,
OpenAPI_list_t *n3g_allowed_snssais,
OpenAPI_guami_t *guami,
char *servive_name,
char *service_name,
OpenAPI_trace_data_t *trace_req,
char *supp_feat
)
@ -60,7 +60,7 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create(
policy_association_request_local_var->mapping_snssais = mapping_snssais;
policy_association_request_local_var->n3g_allowed_snssais = n3g_allowed_snssais;
policy_association_request_local_var->guami = guami;
policy_association_request_local_var->servive_name = servive_name;
policy_association_request_local_var->service_name = service_name;
policy_association_request_local_var->trace_req = trace_req;
policy_association_request_local_var->supp_feat = supp_feat;
@ -111,7 +111,7 @@ void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_
}
OpenAPI_list_free(policy_association_request->n3g_allowed_snssais);
OpenAPI_guami_free(policy_association_request->guami);
ogs_free(policy_association_request->servive_name);
ogs_free(policy_association_request->service_name);
OpenAPI_trace_data_free(policy_association_request->trace_req);
ogs_free(policy_association_request->supp_feat);
ogs_free(policy_association_request);
@ -416,9 +416,9 @@ cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_associati
}
}
if (policy_association_request->servive_name) {
if (cJSON_AddStringToObject(item, "serviveName", policy_association_request->servive_name) == NULL) {
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [servive_name]");
if (policy_association_request->service_name) {
if (cJSON_AddStringToObject(item, "serviceName", policy_association_request->service_name) == NULL) {
ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [service_name]");
goto end;
}
}
@ -756,11 +756,11 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr
guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami);
}
cJSON *servive_name = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "serviveName");
cJSON *service_name = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "serviceName");
if (servive_name) {
if (!cJSON_IsString(servive_name)) {
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [servive_name]");
if (service_name) {
if (!cJSON_IsString(service_name)) {
ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [service_name]");
goto end;
}
}
@ -808,7 +808,7 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr
mapping_snssais ? mapping_snssaisList : NULL,
n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL,
guami ? guami_local_nonprim : NULL,
servive_name ? ogs_strdup(servive_name->valuestring) : NULL,
service_name ? ogs_strdup(service_name->valuestring) : NULL,
trace_req ? trace_req_local_nonprim : NULL,
ogs_strdup(supp_feat->valuestring)
);

View File

@ -1,7 +1,7 @@
/*
* policy_association_request.h
*
* Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification.
* Information which the NF service consumer provides when requesting the creation of a policy association. The serviceName property corresponds to the serviceName in the main body of the specification.
*/
#ifndef _OpenAPI_policy_association_request_H_
@ -53,7 +53,7 @@ typedef struct OpenAPI_policy_association_request_s {
OpenAPI_list_t *mapping_snssais;
OpenAPI_list_t *n3g_allowed_snssais;
struct OpenAPI_guami_s *guami;
char *servive_name;
char *service_name;
struct OpenAPI_trace_data_s *trace_req;
char *supp_feat;
} OpenAPI_policy_association_request_t;
@ -82,7 +82,7 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create(
OpenAPI_list_t *mapping_snssais,
OpenAPI_list_t *n3g_allowed_snssais,
OpenAPI_guami_t *guami,
char *servive_name,
char *service_name,
OpenAPI_trace_data_t *trace_req,
char *supp_feat
);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "policy_control_request_trigger.h"
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_create(
)
char* OpenAPI_policy_control_request_trigger_ToString(OpenAPI_policy_control_request_trigger_e policy_control_request_trigger)
{
OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_control_request_trigger_t));
if (!policy_control_request_trigger_local_var) {
return NULL;
}
return policy_control_request_trigger_local_var;
const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "EPS_FALLBACK", "MA_PDU", "TSN_ETHER_PORT", "TSN_CONTAINER", "_5G_RG_JOIN", "_5G_RG_LEAVE" };
size_t sizeofArray = sizeof(policy_control_request_triggerArray) / sizeof(policy_control_request_triggerArray[0]);
if (policy_control_request_trigger < sizeofArray)
return (char *)policy_control_request_triggerArray[policy_control_request_trigger];
else
return (char *)"Unknown";
}
void OpenAPI_policy_control_request_trigger_free(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger)
OpenAPI_policy_control_request_trigger_e OpenAPI_policy_control_request_trigger_FromString(char* policy_control_request_trigger)
{
if (NULL == policy_control_request_trigger) {
return;
int stringToReturn = 0;
const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "EPS_FALLBACK", "MA_PDU", "TSN_ETHER_PORT", "TSN_CONTAINER", "_5G_RG_JOIN", "_5G_RG_LEAVE" };
size_t sizeofArray = sizeof(policy_control_request_triggerArray) / sizeof(policy_control_request_triggerArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(policy_control_request_trigger, policy_control_request_triggerArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(policy_control_request_trigger);
}
cJSON *OpenAPI_policy_control_request_trigger_convertToJSON(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger)
{
cJSON *item = NULL;
if (policy_control_request_trigger == NULL) {
ogs_error("OpenAPI_policy_control_request_trigger_convertToJSON() failed [PolicyControlRequestTrigger]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_parseFromJSON(cJSON *policy_control_request_triggerJSON)
{
OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger_local_var = NULL;
policy_control_request_trigger_local_var = OpenAPI_policy_control_request_trigger_create (
);
return policy_control_request_trigger_local_var;
end:
return NULL;
}
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_copy(OpenAPI_policy_control_request_trigger_t *dst, OpenAPI_policy_control_request_trigger_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_policy_control_request_trigger_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_policy_control_request_trigger_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_policy_control_request_trigger_free(dst);
dst = OpenAPI_policy_control_request_trigger_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* policy_control_request_trigger.h
*
* Possible values are - PLMN_CH: PLMN Change - RES_MO_RE: A request for resource modification has been received by the SMF. The SMF always reports to the PCF. - AC_TY_CH: Access Type Change - UE_IP_CH: UE IP address change. The SMF always reports to the PCF. - UE_MAC_CH: A new UE MAC address is detected or a used UE MAC address is inactive for a specific period - AN_CH_COR: Access Network Charging Correlation Information - US_RE: The PDU Session or the Monitoring key specific resources consumed by a UE either reached the threshold or needs to be reported for other reasons. - APP_STA: The start of application traffic has been detected. - APP_STO: The stop of application traffic has been detected. - AN_INFO: Access Network Information report - CM_SES_FAIL: Credit management session failure - PS_DA_OFF: The SMF reports when the 3GPP PS Data Off status changes. The SMF always reports to the PCF. - DEF_QOS_CH: Default QoS Change. The SMF always reports to the PCF. - SE_AMBR_CH: Session AMBR Change. The SMF always reports to the PCF. - QOS_NOTIF: The SMF notify the PCF when receiving notification from RAN that QoS targets of the QoS Flow cannot be guranteed or gurateed again. - NO_CREDIT: Out of credit - REALLO_OF_CREDIT: Reallocation of credit - PRA_CH: Change of UE presence in Presence Reporting Area - SAREA_CH: Location Change with respect to the Serving Area - SCNN_CH: Location Change with respect to the Serving CN node - RE_TIMEOUT: Indicates the SMF generated the request because there has been a PCC revalidation timeout - RES_RELEASE: Indicate that the SMF can inform the PCF of the outcome of the release of resources for those rules that require so. - SUCC_RES_ALLO: Indicates that the requested rule data is the successful resource allocation. - RAT_TY_CH: RAT Type Change. - REF_QOS_IND_CH: Reflective QoS indication Change - NUM_OF_PACKET_FILTER: Indicates that the SMF shall report the number of supported packet filter for signalled QoS rules - UE_STATUS_RESUME: Indicates that the UEs status is resumed. - UE_TZ_CH: UE Time Zone Change - AUTH_PROF_CH: The DN-AAA authorization profile index has changed - QOS_MONITORING: Indicate that the SMF notifies the PCF of the QoS Monitoring information. - SCELL_CH: Location Change with respect to the Serving Cell. Only applicable to the interworking scenario as defined in Annex B. - EPS_FALLBACK: EPS Fallback report is enabled in the SMF. - MA_PDU: UE Indicates that the SMF notifies the PCF of the MA PDU session request - TSN_ETHER_PORT: Manageable Ethernet port detected - TSN_CONTAINER: Port management container detected. - 5G_RG_JOIN: The 5G-RG has joined to an IP Multicast Group. - 5G_RG_LEAVE: The 5G-RG has left an IP Multicast Group.
*
*/
#ifndef _OpenAPI_policy_control_request_trigger_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_policy_control_request_trigger_s OpenAPI_policy_control_request_trigger_t;
typedef struct OpenAPI_policy_control_request_trigger_s {
} OpenAPI_policy_control_request_trigger_t;
typedef enum { OpenAPI_policy_control_request_trigger_NULL = 0, OpenAPI_policy_control_request_trigger_PLMN_CH, OpenAPI_policy_control_request_trigger_RES_MO_RE, OpenAPI_policy_control_request_trigger_AC_TY_CH, OpenAPI_policy_control_request_trigger_UE_IP_CH, OpenAPI_policy_control_request_trigger_UE_MAC_CH, OpenAPI_policy_control_request_trigger_AN_CH_COR, OpenAPI_policy_control_request_trigger_US_RE, OpenAPI_policy_control_request_trigger_APP_STA, OpenAPI_policy_control_request_trigger_APP_STO, OpenAPI_policy_control_request_trigger_AN_INFO, OpenAPI_policy_control_request_trigger_CM_SES_FAIL, OpenAPI_policy_control_request_trigger_PS_DA_OFF, OpenAPI_policy_control_request_trigger_DEF_QOS_CH, OpenAPI_policy_control_request_trigger_SE_AMBR_CH, OpenAPI_policy_control_request_trigger_QOS_NOTIF, OpenAPI_policy_control_request_trigger_NO_CREDIT, OpenAPI_policy_control_request_trigger_REALLO_OF_CREDIT, OpenAPI_policy_control_request_trigger_PRA_CH, OpenAPI_policy_control_request_trigger_SAREA_CH, OpenAPI_policy_control_request_trigger_SCNN_CH, OpenAPI_policy_control_request_trigger_RE_TIMEOUT, OpenAPI_policy_control_request_trigger_RES_RELEASE, OpenAPI_policy_control_request_trigger_SUCC_RES_ALLO, OpenAPI_policy_control_request_trigger_RAT_TY_CH, OpenAPI_policy_control_request_trigger_REF_QOS_IND_CH, OpenAPI_policy_control_request_trigger_NUM_OF_PACKET_FILTER, OpenAPI_policy_control_request_trigger_UE_STATUS_RESUME, OpenAPI_policy_control_request_trigger_UE_TZ_CH, OpenAPI_policy_control_request_trigger_AUTH_PROF_CH, OpenAPI_policy_control_request_trigger_QOS_MONITORING, OpenAPI_policy_control_request_trigger_SCELL_CH, OpenAPI_policy_control_request_trigger_EPS_FALLBACK, OpenAPI_policy_control_request_trigger_MA_PDU, OpenAPI_policy_control_request_trigger_TSN_ETHER_PORT, OpenAPI_policy_control_request_trigger_TSN_CONTAINER, OpenAPI_policy_control_request_trigger__5G_RG_JOIN, OpenAPI_policy_control_request_trigger__5G_RG_LEAVE } OpenAPI_policy_control_request_trigger_e;
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_create(
);
void OpenAPI_policy_control_request_trigger_free(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger);
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_parseFromJSON(cJSON *policy_control_request_triggerJSON);
cJSON *OpenAPI_policy_control_request_trigger_convertToJSON(OpenAPI_policy_control_request_trigger_t *policy_control_request_trigger);
OpenAPI_policy_control_request_trigger_t *OpenAPI_policy_control_request_trigger_copy(OpenAPI_policy_control_request_trigger_t *dst, OpenAPI_policy_control_request_trigger_t *src);
char* OpenAPI_policy_control_request_trigger_ToString(OpenAPI_policy_control_request_trigger_e policy_control_request_trigger);
OpenAPI_policy_control_request_trigger_e OpenAPI_policy_control_request_trigger_FromString(char* policy_control_request_trigger);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "qos_flow_usage.h"
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_create(
)
char* OpenAPI_qos_flow_usage_ToString(OpenAPI_qos_flow_usage_e qos_flow_usage)
{
OpenAPI_qos_flow_usage_t *qos_flow_usage_local_var = OpenAPI_malloc(sizeof(OpenAPI_qos_flow_usage_t));
if (!qos_flow_usage_local_var) {
return NULL;
}
return qos_flow_usage_local_var;
const char *qos_flow_usageArray[] = { "NULL", "GENERAL", "IMS_SIG" };
size_t sizeofArray = sizeof(qos_flow_usageArray) / sizeof(qos_flow_usageArray[0]);
if (qos_flow_usage < sizeofArray)
return (char *)qos_flow_usageArray[qos_flow_usage];
else
return (char *)"Unknown";
}
void OpenAPI_qos_flow_usage_free(OpenAPI_qos_flow_usage_t *qos_flow_usage)
OpenAPI_qos_flow_usage_e OpenAPI_qos_flow_usage_FromString(char* qos_flow_usage)
{
if (NULL == qos_flow_usage) {
return;
int stringToReturn = 0;
const char *qos_flow_usageArray[] = { "NULL", "GENERAL", "IMS_SIG" };
size_t sizeofArray = sizeof(qos_flow_usageArray) / sizeof(qos_flow_usageArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(qos_flow_usage, qos_flow_usageArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(qos_flow_usage);
}
cJSON *OpenAPI_qos_flow_usage_convertToJSON(OpenAPI_qos_flow_usage_t *qos_flow_usage)
{
cJSON *item = NULL;
if (qos_flow_usage == NULL) {
ogs_error("OpenAPI_qos_flow_usage_convertToJSON() failed [QosFlowUsage]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_parseFromJSON(cJSON *qos_flow_usageJSON)
{
OpenAPI_qos_flow_usage_t *qos_flow_usage_local_var = NULL;
qos_flow_usage_local_var = OpenAPI_qos_flow_usage_create (
);
return qos_flow_usage_local_var;
end:
return NULL;
}
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_copy(OpenAPI_qos_flow_usage_t *dst, OpenAPI_qos_flow_usage_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_qos_flow_usage_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_qos_flow_usage_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_qos_flow_usage_free(dst);
dst = OpenAPI_qos_flow_usage_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* qos_flow_usage.h
*
* Possible values are - GENERAL: Indicate no specific QoS flow usage information is available. - IMS_SIG: Indicate that the QoS flow is used for IMS signalling only.
*
*/
#ifndef _OpenAPI_qos_flow_usage_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_qos_flow_usage_s OpenAPI_qos_flow_usage_t;
typedef struct OpenAPI_qos_flow_usage_s {
} OpenAPI_qos_flow_usage_t;
typedef enum { OpenAPI_qos_flow_usage_NULL = 0, OpenAPI_qos_flow_usage_GENERAL, OpenAPI_qos_flow_usage_IMS_SIG } OpenAPI_qos_flow_usage_e;
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_create(
);
void OpenAPI_qos_flow_usage_free(OpenAPI_qos_flow_usage_t *qos_flow_usage);
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_parseFromJSON(cJSON *qos_flow_usageJSON);
cJSON *OpenAPI_qos_flow_usage_convertToJSON(OpenAPI_qos_flow_usage_t *qos_flow_usage);
OpenAPI_qos_flow_usage_t *OpenAPI_qos_flow_usage_copy(OpenAPI_qos_flow_usage_t *dst, OpenAPI_qos_flow_usage_t *src);
char* OpenAPI_qos_flow_usage_ToString(OpenAPI_qos_flow_usage_e qos_flow_usage);
OpenAPI_qos_flow_usage_e OpenAPI_qos_flow_usage_FromString(char* qos_flow_usage);
#ifdef __cplusplus
}

View File

@ -42,13 +42,7 @@ void OpenAPI_qos_monitoring_data_free(OpenAPI_qos_monitoring_data_t *qos_monitor
}
OpenAPI_lnode_t *node;
ogs_free(qos_monitoring_data->qm_id);
OpenAPI_list_for_each(qos_monitoring_data->req_qos_mon_params, node) {
OpenAPI_requested_qos_monitoring_parameter_free(node->data);
}
OpenAPI_list_free(qos_monitoring_data->req_qos_mon_params);
OpenAPI_list_for_each(qos_monitoring_data->rep_freqs, node) {
OpenAPI_reporting_frequency_free(node->data);
}
OpenAPI_list_free(qos_monitoring_data->rep_freqs);
ogs_free(qos_monitoring_data->notify_uri);
ogs_free(qos_monitoring_data->notify_corre_id);
@ -75,41 +69,31 @@ cJSON *OpenAPI_qos_monitoring_data_convertToJSON(OpenAPI_qos_monitoring_data_t *
}
if (qos_monitoring_data->req_qos_mon_params) {
cJSON *req_qos_mon_paramsList = cJSON_AddArrayToObject(item, "reqQosMonParams");
if (req_qos_mon_paramsList == NULL) {
cJSON *req_qos_mon_params = cJSON_AddArrayToObject(item, "reqQosMonParams");
if (req_qos_mon_params == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_lnode_t *req_qos_mon_params_node;
if (qos_monitoring_data->req_qos_mon_params) {
OpenAPI_list_for_each(qos_monitoring_data->req_qos_mon_params, req_qos_mon_params_node) {
cJSON *itemLocal = OpenAPI_requested_qos_monitoring_parameter_convertToJSON(req_qos_mon_params_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
cJSON_AddItemToArray(req_qos_mon_paramsList, itemLocal);
OpenAPI_list_for_each(qos_monitoring_data->req_qos_mon_params, req_qos_mon_params_node) {
if (cJSON_AddStringToObject(req_qos_mon_params, "", OpenAPI_requested_qos_monitoring_parameter_ToString((OpenAPI_requested_qos_monitoring_parameter_e)req_qos_mon_params_node->data)) == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
}
}
if (qos_monitoring_data->rep_freqs) {
cJSON *rep_freqsList = cJSON_AddArrayToObject(item, "repFreqs");
if (rep_freqsList == NULL) {
cJSON *rep_freqs = cJSON_AddArrayToObject(item, "repFreqs");
if (rep_freqs == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_freqs]");
goto end;
}
OpenAPI_lnode_t *rep_freqs_node;
if (qos_monitoring_data->rep_freqs) {
OpenAPI_list_for_each(qos_monitoring_data->rep_freqs, rep_freqs_node) {
cJSON *itemLocal = OpenAPI_reporting_frequency_convertToJSON(rep_freqs_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_freqs]");
goto end;
}
cJSON_AddItemToArray(rep_freqsList, itemLocal);
OpenAPI_list_for_each(qos_monitoring_data->rep_freqs, rep_freqs_node) {
if (cJSON_AddStringToObject(rep_freqs, "", OpenAPI_reporting_frequency_ToString((OpenAPI_reporting_frequency_e)rep_freqs_node->data)) == NULL) {
ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [rep_freqs]");
goto end;
}
}
}
@ -195,13 +179,12 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON *
req_qos_mon_paramsList = OpenAPI_list_create();
cJSON_ArrayForEach(req_qos_mon_params_local_nonprimitive, req_qos_mon_params ) {
if (!cJSON_IsObject(req_qos_mon_params_local_nonprimitive)) {
if (!cJSON_IsString(req_qos_mon_params_local_nonprimitive)) {
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_requested_qos_monitoring_parameter_t *req_qos_mon_paramsItem = OpenAPI_requested_qos_monitoring_parameter_parseFromJSON(req_qos_mon_params_local_nonprimitive);
OpenAPI_list_add(req_qos_mon_paramsList, req_qos_mon_paramsItem);
OpenAPI_list_add(req_qos_mon_paramsList, (void *)OpenAPI_requested_qos_monitoring_parameter_FromString(req_qos_mon_params_local_nonprimitive->valuestring));
}
}
@ -218,13 +201,12 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON *
rep_freqsList = OpenAPI_list_create();
cJSON_ArrayForEach(rep_freqs_local_nonprimitive, rep_freqs ) {
if (!cJSON_IsObject(rep_freqs_local_nonprimitive)) {
if (!cJSON_IsString(rep_freqs_local_nonprimitive)) {
ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [rep_freqs]");
goto end;
}
OpenAPI_reporting_frequency_t *rep_freqsItem = OpenAPI_reporting_frequency_parseFromJSON(rep_freqs_local_nonprimitive);
OpenAPI_list_add(rep_freqsList, rep_freqsItem);
OpenAPI_list_add(rep_freqsList, (void *)OpenAPI_reporting_frequency_FromString(rep_freqs_local_nonprimitive->valuestring));
}
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "redirect_address_type.h"
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_create(
)
char* OpenAPI_redirect_address_type_ToString(OpenAPI_redirect_address_type_e redirect_address_type)
{
OpenAPI_redirect_address_type_t *redirect_address_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_redirect_address_type_t));
if (!redirect_address_type_local_var) {
return NULL;
}
return redirect_address_type_local_var;
const char *redirect_address_typeArray[] = { "NULL", "IPV4_ADDR", "IPV6_ADDR", "URL", "SIP_URI" };
size_t sizeofArray = sizeof(redirect_address_typeArray) / sizeof(redirect_address_typeArray[0]);
if (redirect_address_type < sizeofArray)
return (char *)redirect_address_typeArray[redirect_address_type];
else
return (char *)"Unknown";
}
void OpenAPI_redirect_address_type_free(OpenAPI_redirect_address_type_t *redirect_address_type)
OpenAPI_redirect_address_type_e OpenAPI_redirect_address_type_FromString(char* redirect_address_type)
{
if (NULL == redirect_address_type) {
return;
int stringToReturn = 0;
const char *redirect_address_typeArray[] = { "NULL", "IPV4_ADDR", "IPV6_ADDR", "URL", "SIP_URI" };
size_t sizeofArray = sizeof(redirect_address_typeArray) / sizeof(redirect_address_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(redirect_address_type, redirect_address_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(redirect_address_type);
}
cJSON *OpenAPI_redirect_address_type_convertToJSON(OpenAPI_redirect_address_type_t *redirect_address_type)
{
cJSON *item = NULL;
if (redirect_address_type == NULL) {
ogs_error("OpenAPI_redirect_address_type_convertToJSON() failed [RedirectAddressType]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_parseFromJSON(cJSON *redirect_address_typeJSON)
{
OpenAPI_redirect_address_type_t *redirect_address_type_local_var = NULL;
redirect_address_type_local_var = OpenAPI_redirect_address_type_create (
);
return redirect_address_type_local_var;
end:
return NULL;
}
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_copy(OpenAPI_redirect_address_type_t *dst, OpenAPI_redirect_address_type_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_redirect_address_type_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_redirect_address_type_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_redirect_address_type_free(dst);
dst = OpenAPI_redirect_address_type_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* redirect_address_type.h
*
* Possible values are - IPV4_ADDR: Indicates that the address type is in the form of \&quot;dotted-decimal\&quot; IPv4 address. - IPV6_ADDR: Indicates that the address type is in the form of IPv6 address. - URL: Indicates that the address type is in the form of Uniform Resource Locator. - SIP_URI: Indicates that the address type is in the form of SIP Uniform Resource Identifier.
*
*/
#ifndef _OpenAPI_redirect_address_type_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_redirect_address_type_s OpenAPI_redirect_address_type_t;
typedef struct OpenAPI_redirect_address_type_s {
} OpenAPI_redirect_address_type_t;
typedef enum { OpenAPI_redirect_address_type_NULL = 0, OpenAPI_redirect_address_type_IPV4_ADDR, OpenAPI_redirect_address_type_IPV6_ADDR, OpenAPI_redirect_address_type_URL, OpenAPI_redirect_address_type_SIP_URI } OpenAPI_redirect_address_type_e;
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_create(
);
void OpenAPI_redirect_address_type_free(OpenAPI_redirect_address_type_t *redirect_address_type);
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_parseFromJSON(cJSON *redirect_address_typeJSON);
cJSON *OpenAPI_redirect_address_type_convertToJSON(OpenAPI_redirect_address_type_t *redirect_address_type);
OpenAPI_redirect_address_type_t *OpenAPI_redirect_address_type_copy(OpenAPI_redirect_address_type_t *dst, OpenAPI_redirect_address_type_t *src);
char* OpenAPI_redirect_address_type_ToString(OpenAPI_redirect_address_type_e redirect_address_type);
OpenAPI_redirect_address_type_e OpenAPI_redirect_address_type_FromString(char* redirect_address_type);
#ifdef __cplusplus
}

View File

@ -6,7 +6,7 @@
OpenAPI_redirect_information_t *OpenAPI_redirect_information_create(
int redirect_enabled,
OpenAPI_redirect_address_type_t *redirect_address_type,
OpenAPI_redirect_address_type_e redirect_address_type,
char *redirect_server_address
)
{
@ -27,7 +27,6 @@ void OpenAPI_redirect_information_free(OpenAPI_redirect_information_t *redirect_
return;
}
OpenAPI_lnode_t *node;
OpenAPI_redirect_address_type_free(redirect_information->redirect_address_type);
ogs_free(redirect_information->redirect_server_address);
ogs_free(redirect_information);
}
@ -50,13 +49,7 @@ cJSON *OpenAPI_redirect_information_convertToJSON(OpenAPI_redirect_information_t
}
if (redirect_information->redirect_address_type) {
cJSON *redirect_address_type_local_JSON = OpenAPI_redirect_address_type_convertToJSON(redirect_information->redirect_address_type);
if (redirect_address_type_local_JSON == NULL) {
ogs_error("OpenAPI_redirect_information_convertToJSON() failed [redirect_address_type]");
goto end;
}
cJSON_AddItemToObject(item, "redirectAddressType", redirect_address_type_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "redirectAddressType", OpenAPI_redirect_address_type_ToString(redirect_information->redirect_address_type)) == NULL) {
ogs_error("OpenAPI_redirect_information_convertToJSON() failed [redirect_address_type]");
goto end;
}
@ -87,9 +80,13 @@ OpenAPI_redirect_information_t *OpenAPI_redirect_information_parseFromJSON(cJSON
cJSON *redirect_address_type = cJSON_GetObjectItemCaseSensitive(redirect_informationJSON, "redirectAddressType");
OpenAPI_redirect_address_type_t *redirect_address_type_local_nonprim = NULL;
OpenAPI_redirect_address_type_e redirect_address_typeVariable;
if (redirect_address_type) {
redirect_address_type_local_nonprim = OpenAPI_redirect_address_type_parseFromJSON(redirect_address_type);
if (!cJSON_IsString(redirect_address_type)) {
ogs_error("OpenAPI_redirect_information_parseFromJSON() failed [redirect_address_type]");
goto end;
}
redirect_address_typeVariable = OpenAPI_redirect_address_type_FromString(redirect_address_type->valuestring);
}
cJSON *redirect_server_address = cJSON_GetObjectItemCaseSensitive(redirect_informationJSON, "redirectServerAddress");
@ -103,7 +100,7 @@ OpenAPI_redirect_information_t *OpenAPI_redirect_information_parseFromJSON(cJSON
redirect_information_local_var = OpenAPI_redirect_information_create (
redirect_enabled ? redirect_enabled->valueint : 0,
redirect_address_type ? redirect_address_type_local_nonprim : NULL,
redirect_address_type ? redirect_address_typeVariable : 0,
redirect_server_address ? ogs_strdup(redirect_server_address->valuestring) : NULL
);

View File

@ -21,13 +21,13 @@ extern "C" {
typedef struct OpenAPI_redirect_information_s OpenAPI_redirect_information_t;
typedef struct OpenAPI_redirect_information_s {
int redirect_enabled;
struct OpenAPI_redirect_address_type_s *redirect_address_type;
OpenAPI_redirect_address_type_e redirect_address_type;
char *redirect_server_address;
} OpenAPI_redirect_information_t;
OpenAPI_redirect_information_t *OpenAPI_redirect_information_create(
int redirect_enabled,
OpenAPI_redirect_address_type_t *redirect_address_type,
OpenAPI_redirect_address_type_e redirect_address_type,
char *redirect_server_address
);
void OpenAPI_redirect_information_free(OpenAPI_redirect_information_t *redirect_information);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "reporting_frequency.h"
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_create(
)
char* OpenAPI_reporting_frequency_ToString(OpenAPI_reporting_frequency_e reporting_frequency)
{
OpenAPI_reporting_frequency_t *reporting_frequency_local_var = OpenAPI_malloc(sizeof(OpenAPI_reporting_frequency_t));
if (!reporting_frequency_local_var) {
return NULL;
}
return reporting_frequency_local_var;
const char *reporting_frequencyArray[] = { "NULL", "EVENT_TRIGGERED", "PERIODIC", "SESSION_RELEASE" };
size_t sizeofArray = sizeof(reporting_frequencyArray) / sizeof(reporting_frequencyArray[0]);
if (reporting_frequency < sizeofArray)
return (char *)reporting_frequencyArray[reporting_frequency];
else
return (char *)"Unknown";
}
void OpenAPI_reporting_frequency_free(OpenAPI_reporting_frequency_t *reporting_frequency)
OpenAPI_reporting_frequency_e OpenAPI_reporting_frequency_FromString(char* reporting_frequency)
{
if (NULL == reporting_frequency) {
return;
int stringToReturn = 0;
const char *reporting_frequencyArray[] = { "NULL", "EVENT_TRIGGERED", "PERIODIC", "SESSION_RELEASE" };
size_t sizeofArray = sizeof(reporting_frequencyArray) / sizeof(reporting_frequencyArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(reporting_frequency, reporting_frequencyArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(reporting_frequency);
}
cJSON *OpenAPI_reporting_frequency_convertToJSON(OpenAPI_reporting_frequency_t *reporting_frequency)
{
cJSON *item = NULL;
if (reporting_frequency == NULL) {
ogs_error("OpenAPI_reporting_frequency_convertToJSON() failed [ReportingFrequency]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_parseFromJSON(cJSON *reporting_frequencyJSON)
{
OpenAPI_reporting_frequency_t *reporting_frequency_local_var = NULL;
reporting_frequency_local_var = OpenAPI_reporting_frequency_create (
);
return reporting_frequency_local_var;
end:
return NULL;
}
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_copy(OpenAPI_reporting_frequency_t *dst, OpenAPI_reporting_frequency_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_reporting_frequency_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_reporting_frequency_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_reporting_frequency_free(dst);
dst = OpenAPI_reporting_frequency_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_reporting_frequency_s OpenAPI_reporting_frequency_t;
typedef struct OpenAPI_reporting_frequency_s {
} OpenAPI_reporting_frequency_t;
typedef enum { OpenAPI_reporting_frequency_NULL = 0, OpenAPI_reporting_frequency_EVENT_TRIGGERED, OpenAPI_reporting_frequency_PERIODIC, OpenAPI_reporting_frequency_SESSION_RELEASE } OpenAPI_reporting_frequency_e;
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_create(
);
void OpenAPI_reporting_frequency_free(OpenAPI_reporting_frequency_t *reporting_frequency);
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_parseFromJSON(cJSON *reporting_frequencyJSON);
cJSON *OpenAPI_reporting_frequency_convertToJSON(OpenAPI_reporting_frequency_t *reporting_frequency);
OpenAPI_reporting_frequency_t *OpenAPI_reporting_frequency_copy(OpenAPI_reporting_frequency_t *dst, OpenAPI_reporting_frequency_t *src);
char* OpenAPI_reporting_frequency_ToString(OpenAPI_reporting_frequency_e reporting_frequency);
OpenAPI_reporting_frequency_e OpenAPI_reporting_frequency_FromString(char* reporting_frequency);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "reporting_level.h"
OpenAPI_reporting_level_t *OpenAPI_reporting_level_create(
)
char* OpenAPI_reporting_level_ToString(OpenAPI_reporting_level_e reporting_level)
{
OpenAPI_reporting_level_t *reporting_level_local_var = OpenAPI_malloc(sizeof(OpenAPI_reporting_level_t));
if (!reporting_level_local_var) {
return NULL;
}
return reporting_level_local_var;
const char *reporting_levelArray[] = { "NULL", "SER_ID_LEVEL", "RAT_GR_LEVEL", "SPON_CON_LEVEL" };
size_t sizeofArray = sizeof(reporting_levelArray) / sizeof(reporting_levelArray[0]);
if (reporting_level < sizeofArray)
return (char *)reporting_levelArray[reporting_level];
else
return (char *)"Unknown";
}
void OpenAPI_reporting_level_free(OpenAPI_reporting_level_t *reporting_level)
OpenAPI_reporting_level_e OpenAPI_reporting_level_FromString(char* reporting_level)
{
if (NULL == reporting_level) {
return;
int stringToReturn = 0;
const char *reporting_levelArray[] = { "NULL", "SER_ID_LEVEL", "RAT_GR_LEVEL", "SPON_CON_LEVEL" };
size_t sizeofArray = sizeof(reporting_levelArray) / sizeof(reporting_levelArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(reporting_level, reporting_levelArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(reporting_level);
}
cJSON *OpenAPI_reporting_level_convertToJSON(OpenAPI_reporting_level_t *reporting_level)
{
cJSON *item = NULL;
if (reporting_level == NULL) {
ogs_error("OpenAPI_reporting_level_convertToJSON() failed [ReportingLevel]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_reporting_level_t *OpenAPI_reporting_level_parseFromJSON(cJSON *reporting_levelJSON)
{
OpenAPI_reporting_level_t *reporting_level_local_var = NULL;
reporting_level_local_var = OpenAPI_reporting_level_create (
);
return reporting_level_local_var;
end:
return NULL;
}
OpenAPI_reporting_level_t *OpenAPI_reporting_level_copy(OpenAPI_reporting_level_t *dst, OpenAPI_reporting_level_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_reporting_level_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_reporting_level_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_reporting_level_free(dst);
dst = OpenAPI_reporting_level_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* reporting_level.h
*
* Possible values are - SER_ID_LEVEL: Indicates that the usage shall be reported on service id and rating group combination level. - RAT_GR_LEVEL: Indicates that the usage shall be reported on rating group level. - SPON_CON_LEVEL: Indicates that the usage shall be reported on sponsor identity and rating group combination level.
*
*/
#ifndef _OpenAPI_reporting_level_H_
@ -12,22 +12,16 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_reporting_level_s OpenAPI_reporting_level_t;
typedef struct OpenAPI_reporting_level_s {
} OpenAPI_reporting_level_t;
typedef enum { OpenAPI_reporting_level_NULL = 0, OpenAPI_reporting_level_SER_ID_LEVEL, OpenAPI_reporting_level_RAT_GR_LEVEL, OpenAPI_reporting_level_SPON_CON_LEVEL } OpenAPI_reporting_level_e;
OpenAPI_reporting_level_t *OpenAPI_reporting_level_create(
);
void OpenAPI_reporting_level_free(OpenAPI_reporting_level_t *reporting_level);
OpenAPI_reporting_level_t *OpenAPI_reporting_level_parseFromJSON(cJSON *reporting_levelJSON);
cJSON *OpenAPI_reporting_level_convertToJSON(OpenAPI_reporting_level_t *reporting_level);
OpenAPI_reporting_level_t *OpenAPI_reporting_level_copy(OpenAPI_reporting_level_t *dst, OpenAPI_reporting_level_t *src);
char* OpenAPI_reporting_level_ToString(OpenAPI_reporting_level_e reporting_level);
OpenAPI_reporting_level_e OpenAPI_reporting_level_FromString(char* reporting_level);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "requested_qos_monitoring_parameter.h"
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_create(
)
char* OpenAPI_requested_qos_monitoring_parameter_ToString(OpenAPI_requested_qos_monitoring_parameter_e requested_qos_monitoring_parameter)
{
OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter_local_var = OpenAPI_malloc(sizeof(OpenAPI_requested_qos_monitoring_parameter_t));
if (!requested_qos_monitoring_parameter_local_var) {
return NULL;
}
return requested_qos_monitoring_parameter_local_var;
const char *requested_qos_monitoring_parameterArray[] = { "NULL", "DOWNLINK", "UPLINK", "ROUND_TRIP" };
size_t sizeofArray = sizeof(requested_qos_monitoring_parameterArray) / sizeof(requested_qos_monitoring_parameterArray[0]);
if (requested_qos_monitoring_parameter < sizeofArray)
return (char *)requested_qos_monitoring_parameterArray[requested_qos_monitoring_parameter];
else
return (char *)"Unknown";
}
void OpenAPI_requested_qos_monitoring_parameter_free(OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter)
OpenAPI_requested_qos_monitoring_parameter_e OpenAPI_requested_qos_monitoring_parameter_FromString(char* requested_qos_monitoring_parameter)
{
if (NULL == requested_qos_monitoring_parameter) {
return;
int stringToReturn = 0;
const char *requested_qos_monitoring_parameterArray[] = { "NULL", "DOWNLINK", "UPLINK", "ROUND_TRIP" };
size_t sizeofArray = sizeof(requested_qos_monitoring_parameterArray) / sizeof(requested_qos_monitoring_parameterArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(requested_qos_monitoring_parameter, requested_qos_monitoring_parameterArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(requested_qos_monitoring_parameter);
}
cJSON *OpenAPI_requested_qos_monitoring_parameter_convertToJSON(OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter)
{
cJSON *item = NULL;
if (requested_qos_monitoring_parameter == NULL) {
ogs_error("OpenAPI_requested_qos_monitoring_parameter_convertToJSON() failed [RequestedQosMonitoringParameter]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_parseFromJSON(cJSON *requested_qos_monitoring_parameterJSON)
{
OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter_local_var = NULL;
requested_qos_monitoring_parameter_local_var = OpenAPI_requested_qos_monitoring_parameter_create (
);
return requested_qos_monitoring_parameter_local_var;
end:
return NULL;
}
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_copy(OpenAPI_requested_qos_monitoring_parameter_t *dst, OpenAPI_requested_qos_monitoring_parameter_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_requested_qos_monitoring_parameter_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_requested_qos_monitoring_parameter_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_requested_qos_monitoring_parameter_free(dst);
dst = OpenAPI_requested_qos_monitoring_parameter_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_requested_qos_monitoring_parameter_s OpenAPI_requested_qos_monitoring_parameter_t;
typedef struct OpenAPI_requested_qos_monitoring_parameter_s {
} OpenAPI_requested_qos_monitoring_parameter_t;
typedef enum { OpenAPI_requested_qos_monitoring_parameter_NULL = 0, OpenAPI_requested_qos_monitoring_parameter_DOWNLINK, OpenAPI_requested_qos_monitoring_parameter_UPLINK, OpenAPI_requested_qos_monitoring_parameter_ROUND_TRIP } OpenAPI_requested_qos_monitoring_parameter_e;
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_create(
);
void OpenAPI_requested_qos_monitoring_parameter_free(OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter);
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_parseFromJSON(cJSON *requested_qos_monitoring_parameterJSON);
cJSON *OpenAPI_requested_qos_monitoring_parameter_convertToJSON(OpenAPI_requested_qos_monitoring_parameter_t *requested_qos_monitoring_parameter);
OpenAPI_requested_qos_monitoring_parameter_t *OpenAPI_requested_qos_monitoring_parameter_copy(OpenAPI_requested_qos_monitoring_parameter_t *dst, OpenAPI_requested_qos_monitoring_parameter_t *src);
char* OpenAPI_requested_qos_monitoring_parameter_ToString(OpenAPI_requested_qos_monitoring_parameter_e requested_qos_monitoring_parameter);
OpenAPI_requested_qos_monitoring_parameter_e OpenAPI_requested_qos_monitoring_parameter_FromString(char* requested_qos_monitoring_parameter);
#ifdef __cplusplus
}

View File

@ -29,9 +29,6 @@ void OpenAPI_requested_rule_data_free(OpenAPI_requested_rule_data_t *requested_r
ogs_free(node->data);
}
OpenAPI_list_free(requested_rule_data->ref_pcc_rule_ids);
OpenAPI_list_for_each(requested_rule_data->req_data, node) {
OpenAPI_requested_rule_data_type_free(node->data);
}
OpenAPI_list_free(requested_rule_data->req_data);
ogs_free(requested_rule_data);
}
@ -68,21 +65,16 @@ cJSON *OpenAPI_requested_rule_data_convertToJSON(OpenAPI_requested_rule_data_t *
ogs_error("OpenAPI_requested_rule_data_convertToJSON() failed [req_data]");
goto end;
}
cJSON *req_dataList = cJSON_AddArrayToObject(item, "reqData");
if (req_dataList == NULL) {
cJSON *req_data = cJSON_AddArrayToObject(item, "reqData");
if (req_data == NULL) {
ogs_error("OpenAPI_requested_rule_data_convertToJSON() failed [req_data]");
goto end;
}
OpenAPI_lnode_t *req_data_node;
if (requested_rule_data->req_data) {
OpenAPI_list_for_each(requested_rule_data->req_data, req_data_node) {
cJSON *itemLocal = OpenAPI_requested_rule_data_type_convertToJSON(req_data_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_requested_rule_data_convertToJSON() failed [req_data]");
goto end;
}
cJSON_AddItemToArray(req_dataList, itemLocal);
OpenAPI_list_for_each(requested_rule_data->req_data, req_data_node) {
if (cJSON_AddStringToObject(req_data, "", OpenAPI_requested_rule_data_type_ToString((OpenAPI_requested_rule_data_type_e)req_data_node->data)) == NULL) {
ogs_error("OpenAPI_requested_rule_data_convertToJSON() failed [req_data]");
goto end;
}
}
@ -133,13 +125,12 @@ OpenAPI_requested_rule_data_t *OpenAPI_requested_rule_data_parseFromJSON(cJSON *
req_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(req_data_local_nonprimitive, req_data ) {
if (!cJSON_IsObject(req_data_local_nonprimitive)) {
if (!cJSON_IsString(req_data_local_nonprimitive)) {
ogs_error("OpenAPI_requested_rule_data_parseFromJSON() failed [req_data]");
goto end;
}
OpenAPI_requested_rule_data_type_t *req_dataItem = OpenAPI_requested_rule_data_type_parseFromJSON(req_data_local_nonprimitive);
OpenAPI_list_add(req_dataList, req_dataItem);
OpenAPI_list_add(req_dataList, (void *)OpenAPI_requested_rule_data_type_FromString(req_data_local_nonprimitive->valuestring));
}
requested_rule_data_local_var = OpenAPI_requested_rule_data_create (

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "requested_rule_data_type.h"
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_create(
)
char* OpenAPI_requested_rule_data_type_ToString(OpenAPI_requested_rule_data_type_e requested_rule_data_type)
{
OpenAPI_requested_rule_data_type_t *requested_rule_data_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_requested_rule_data_type_t));
if (!requested_rule_data_type_local_var) {
return NULL;
}
return requested_rule_data_type_local_var;
const char *requested_rule_data_typeArray[] = { "NULL", "CH_ID", "MS_TIME_ZONE", "USER_LOC_INFO", "RES_RELEASE", "SUCC_RES_ALLO", "EPS_FALLBACK" };
size_t sizeofArray = sizeof(requested_rule_data_typeArray) / sizeof(requested_rule_data_typeArray[0]);
if (requested_rule_data_type < sizeofArray)
return (char *)requested_rule_data_typeArray[requested_rule_data_type];
else
return (char *)"Unknown";
}
void OpenAPI_requested_rule_data_type_free(OpenAPI_requested_rule_data_type_t *requested_rule_data_type)
OpenAPI_requested_rule_data_type_e OpenAPI_requested_rule_data_type_FromString(char* requested_rule_data_type)
{
if (NULL == requested_rule_data_type) {
return;
int stringToReturn = 0;
const char *requested_rule_data_typeArray[] = { "NULL", "CH_ID", "MS_TIME_ZONE", "USER_LOC_INFO", "RES_RELEASE", "SUCC_RES_ALLO", "EPS_FALLBACK" };
size_t sizeofArray = sizeof(requested_rule_data_typeArray) / sizeof(requested_rule_data_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(requested_rule_data_type, requested_rule_data_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(requested_rule_data_type);
}
cJSON *OpenAPI_requested_rule_data_type_convertToJSON(OpenAPI_requested_rule_data_type_t *requested_rule_data_type)
{
cJSON *item = NULL;
if (requested_rule_data_type == NULL) {
ogs_error("OpenAPI_requested_rule_data_type_convertToJSON() failed [RequestedRuleDataType]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_parseFromJSON(cJSON *requested_rule_data_typeJSON)
{
OpenAPI_requested_rule_data_type_t *requested_rule_data_type_local_var = NULL;
requested_rule_data_type_local_var = OpenAPI_requested_rule_data_type_create (
);
return requested_rule_data_type_local_var;
end:
return NULL;
}
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_copy(OpenAPI_requested_rule_data_type_t *dst, OpenAPI_requested_rule_data_type_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_requested_rule_data_type_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_requested_rule_data_type_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_requested_rule_data_type_free(dst);
dst = OpenAPI_requested_rule_data_type_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* requested_rule_data_type.h
*
* Possible values are - CH_ID: Indicates that the requested rule data is the charging identifier. - MS_TIME_ZONE: Indicates that the requested access network info type is the UE&#39;s timezone. - USER_LOC_INFO: Indicates that the requested access network info type is the UE&#39;s location. - RES_RELEASE: Indicates that the requested rule data is the result of the release of resource. - SUCC_RES_ALLO: Indicates that the requested rule data is the successful resource allocation. - EPS_FALLBACK: Indicates that the requested rule data is the report of QoS flow rejection due to EPS fallback.
*
*/
#ifndef _OpenAPI_requested_rule_data_type_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_requested_rule_data_type_s OpenAPI_requested_rule_data_type_t;
typedef struct OpenAPI_requested_rule_data_type_s {
} OpenAPI_requested_rule_data_type_t;
typedef enum { OpenAPI_requested_rule_data_type_NULL = 0, OpenAPI_requested_rule_data_type_CH_ID, OpenAPI_requested_rule_data_type_MS_TIME_ZONE, OpenAPI_requested_rule_data_type_USER_LOC_INFO, OpenAPI_requested_rule_data_type_RES_RELEASE, OpenAPI_requested_rule_data_type_SUCC_RES_ALLO, OpenAPI_requested_rule_data_type_EPS_FALLBACK } OpenAPI_requested_rule_data_type_e;
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_create(
);
void OpenAPI_requested_rule_data_type_free(OpenAPI_requested_rule_data_type_t *requested_rule_data_type);
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_parseFromJSON(cJSON *requested_rule_data_typeJSON);
cJSON *OpenAPI_requested_rule_data_type_convertToJSON(OpenAPI_requested_rule_data_type_t *requested_rule_data_type);
OpenAPI_requested_rule_data_type_t *OpenAPI_requested_rule_data_type_copy(OpenAPI_requested_rule_data_type_t *dst, OpenAPI_requested_rule_data_type_t *src);
char* OpenAPI_requested_rule_data_type_ToString(OpenAPI_requested_rule_data_type_e requested_rule_data_type);
OpenAPI_requested_rule_data_type_e OpenAPI_requested_rule_data_type_FromString(char* requested_rule_data_type);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "rule_operation.h"
OpenAPI_rule_operation_t *OpenAPI_rule_operation_create(
)
char* OpenAPI_rule_operation_ToString(OpenAPI_rule_operation_e rule_operation)
{
OpenAPI_rule_operation_t *rule_operation_local_var = OpenAPI_malloc(sizeof(OpenAPI_rule_operation_t));
if (!rule_operation_local_var) {
return NULL;
}
return rule_operation_local_var;
const char *rule_operationArray[] = { "NULL", "CREATE_PCC_RULE", "DELETE_PCC_RULE", "MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS", "MODIFY_PCC_RULE_AND_REPLACE_PACKET_FILTERS", "MODIFY_PCC_RULE_AND_DELETE_PACKET_FILTERS", "MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS" };
size_t sizeofArray = sizeof(rule_operationArray) / sizeof(rule_operationArray[0]);
if (rule_operation < sizeofArray)
return (char *)rule_operationArray[rule_operation];
else
return (char *)"Unknown";
}
void OpenAPI_rule_operation_free(OpenAPI_rule_operation_t *rule_operation)
OpenAPI_rule_operation_e OpenAPI_rule_operation_FromString(char* rule_operation)
{
if (NULL == rule_operation) {
return;
int stringToReturn = 0;
const char *rule_operationArray[] = { "NULL", "CREATE_PCC_RULE", "DELETE_PCC_RULE", "MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS", "MODIFY_PCC_RULE_AND_REPLACE_PACKET_FILTERS", "MODIFY_PCC_RULE_AND_DELETE_PACKET_FILTERS", "MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS" };
size_t sizeofArray = sizeof(rule_operationArray) / sizeof(rule_operationArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(rule_operation, rule_operationArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(rule_operation);
}
cJSON *OpenAPI_rule_operation_convertToJSON(OpenAPI_rule_operation_t *rule_operation)
{
cJSON *item = NULL;
if (rule_operation == NULL) {
ogs_error("OpenAPI_rule_operation_convertToJSON() failed [RuleOperation]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_rule_operation_t *OpenAPI_rule_operation_parseFromJSON(cJSON *rule_operationJSON)
{
OpenAPI_rule_operation_t *rule_operation_local_var = NULL;
rule_operation_local_var = OpenAPI_rule_operation_create (
);
return rule_operation_local_var;
end:
return NULL;
}
OpenAPI_rule_operation_t *OpenAPI_rule_operation_copy(OpenAPI_rule_operation_t *dst, OpenAPI_rule_operation_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_rule_operation_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_rule_operation_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_rule_operation_free(dst);
dst = OpenAPI_rule_operation_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* rule_operation.h
*
* Possible values are - CREATE_PCC_RULE: Indicates to create a new PCC rule to reserve the resource requested by the UE. - DELETE_PCC_RULE: Indicates to delete a PCC rule corresponding to reserve the resource requested by the UE.. - MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS: Indicates to modify the PCC rule by adding new packet filter(s). - MODIFY_ PCC_RULE_AND_REPLACE_PACKET_FILTERS: Indicates to modify the PCC rule by replacing the existing packet filter(s). - MODIFY_ PCC_RULE_AND_DELETE_PACKET_FILTERS: Indicates to modify the PCC rule by deleting the existing packet filter(s). - MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS: Indicates to modify the PCC rule by modifying the QoS of the PCC rule.
*
*/
#ifndef _OpenAPI_rule_operation_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_rule_operation_s OpenAPI_rule_operation_t;
typedef struct OpenAPI_rule_operation_s {
} OpenAPI_rule_operation_t;
typedef enum { OpenAPI_rule_operation_NULL = 0, OpenAPI_rule_operation_CREATE_PCC_RULE, OpenAPI_rule_operation_DELETE_PCC_RULE, OpenAPI_rule_operation_MODIFY_PCC_RULE_AND_ADD_PACKET_FILTERS, OpenAPI_rule_operation_MODIFY_PCC_RULE_AND_REPLACE_PACKET_FILTERS, OpenAPI_rule_operation_MODIFY_PCC_RULE_AND_DELETE_PACKET_FILTERS, OpenAPI_rule_operation_MODIFY_PCC_RULE_WITHOUT_MODIFY_PACKET_FILTERS } OpenAPI_rule_operation_e;
OpenAPI_rule_operation_t *OpenAPI_rule_operation_create(
);
void OpenAPI_rule_operation_free(OpenAPI_rule_operation_t *rule_operation);
OpenAPI_rule_operation_t *OpenAPI_rule_operation_parseFromJSON(cJSON *rule_operationJSON);
cJSON *OpenAPI_rule_operation_convertToJSON(OpenAPI_rule_operation_t *rule_operation);
OpenAPI_rule_operation_t *OpenAPI_rule_operation_copy(OpenAPI_rule_operation_t *dst, OpenAPI_rule_operation_t *src);
char* OpenAPI_rule_operation_ToString(OpenAPI_rule_operation_e rule_operation);
OpenAPI_rule_operation_e OpenAPI_rule_operation_FromString(char* rule_operation);
#ifdef __cplusplus
}

View File

@ -6,9 +6,9 @@
OpenAPI_rule_report_t *OpenAPI_rule_report_create(
OpenAPI_list_t *pcc_rule_ids,
OpenAPI_rule_status_t *rule_status,
OpenAPI_rule_status_e rule_status,
OpenAPI_list_t *cont_vers,
OpenAPI_failure_code_t *failure_code,
OpenAPI_failure_code_e failure_code,
OpenAPI_final_unit_action_t *fin_unit_act,
OpenAPI_list_t *ran_nas_rel_causes
)
@ -37,12 +37,10 @@ void OpenAPI_rule_report_free(OpenAPI_rule_report_t *rule_report)
ogs_free(node->data);
}
OpenAPI_list_free(rule_report->pcc_rule_ids);
OpenAPI_rule_status_free(rule_report->rule_status);
OpenAPI_list_for_each(rule_report->cont_vers, node) {
ogs_free(node->data);
}
OpenAPI_list_free(rule_report->cont_vers);
OpenAPI_failure_code_free(rule_report->failure_code);
OpenAPI_final_unit_action_free(rule_report->fin_unit_act);
OpenAPI_list_for_each(rule_report->ran_nas_rel_causes, node) {
OpenAPI_ran_nas_rel_cause_free(node->data);
@ -83,13 +81,7 @@ cJSON *OpenAPI_rule_report_convertToJSON(OpenAPI_rule_report_t *rule_report)
ogs_error("OpenAPI_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
cJSON *rule_status_local_JSON = OpenAPI_rule_status_convertToJSON(rule_report->rule_status);
if (rule_status_local_JSON == NULL) {
ogs_error("OpenAPI_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
cJSON_AddItemToObject(item, "ruleStatus", rule_status_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "ruleStatus", OpenAPI_rule_status_ToString(rule_report->rule_status)) == NULL) {
ogs_error("OpenAPI_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
@ -111,13 +103,7 @@ cJSON *OpenAPI_rule_report_convertToJSON(OpenAPI_rule_report_t *rule_report)
}
if (rule_report->failure_code) {
cJSON *failure_code_local_JSON = OpenAPI_failure_code_convertToJSON(rule_report->failure_code);
if (failure_code_local_JSON == NULL) {
ogs_error("OpenAPI_rule_report_convertToJSON() failed [failure_code]");
goto end;
}
cJSON_AddItemToObject(item, "failureCode", failure_code_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "failureCode", OpenAPI_failure_code_ToString(rule_report->failure_code)) == NULL) {
ogs_error("OpenAPI_rule_report_convertToJSON() failed [failure_code]");
goto end;
}
@ -192,9 +178,13 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON)
goto end;
}
OpenAPI_rule_status_t *rule_status_local_nonprim = NULL;
OpenAPI_rule_status_e rule_statusVariable;
rule_status_local_nonprim = OpenAPI_rule_status_parseFromJSON(rule_status);
if (!cJSON_IsString(rule_status)) {
ogs_error("OpenAPI_rule_report_parseFromJSON() failed [rule_status]");
goto end;
}
rule_statusVariable = OpenAPI_rule_status_FromString(rule_status->valuestring);
cJSON *cont_vers = cJSON_GetObjectItemCaseSensitive(rule_reportJSON, "contVers");
@ -218,9 +208,13 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON)
cJSON *failure_code = cJSON_GetObjectItemCaseSensitive(rule_reportJSON, "failureCode");
OpenAPI_failure_code_t *failure_code_local_nonprim = NULL;
OpenAPI_failure_code_e failure_codeVariable;
if (failure_code) {
failure_code_local_nonprim = OpenAPI_failure_code_parseFromJSON(failure_code);
if (!cJSON_IsString(failure_code)) {
ogs_error("OpenAPI_rule_report_parseFromJSON() failed [failure_code]");
goto end;
}
failure_codeVariable = OpenAPI_failure_code_FromString(failure_code->valuestring);
}
cJSON *fin_unit_act = cJSON_GetObjectItemCaseSensitive(rule_reportJSON, "finUnitAct");
@ -255,9 +249,9 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON)
rule_report_local_var = OpenAPI_rule_report_create (
pcc_rule_idsList,
rule_status_local_nonprim,
rule_statusVariable,
cont_vers ? cont_versList : NULL,
failure_code ? failure_code_local_nonprim : NULL,
failure_code ? failure_codeVariable : 0,
fin_unit_act ? fin_unit_act_local_nonprim : NULL,
ran_nas_rel_causes ? ran_nas_rel_causesList : NULL
);

View File

@ -24,18 +24,18 @@ extern "C" {
typedef struct OpenAPI_rule_report_s OpenAPI_rule_report_t;
typedef struct OpenAPI_rule_report_s {
OpenAPI_list_t *pcc_rule_ids;
struct OpenAPI_rule_status_s *rule_status;
OpenAPI_rule_status_e rule_status;
OpenAPI_list_t *cont_vers;
struct OpenAPI_failure_code_s *failure_code;
OpenAPI_failure_code_e failure_code;
struct OpenAPI_final_unit_action_s *fin_unit_act;
OpenAPI_list_t *ran_nas_rel_causes;
} OpenAPI_rule_report_t;
OpenAPI_rule_report_t *OpenAPI_rule_report_create(
OpenAPI_list_t *pcc_rule_ids,
OpenAPI_rule_status_t *rule_status,
OpenAPI_rule_status_e rule_status,
OpenAPI_list_t *cont_vers,
OpenAPI_failure_code_t *failure_code,
OpenAPI_failure_code_e failure_code,
OpenAPI_final_unit_action_t *fin_unit_act,
OpenAPI_list_t *ran_nas_rel_causes
);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "rule_status.h"
OpenAPI_rule_status_t *OpenAPI_rule_status_create(
)
char* OpenAPI_rule_status_ToString(OpenAPI_rule_status_e rule_status)
{
OpenAPI_rule_status_t *rule_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_rule_status_t));
if (!rule_status_local_var) {
return NULL;
}
return rule_status_local_var;
const char *rule_statusArray[] = { "NULL", "ACTIVE", "INACTIVE" };
size_t sizeofArray = sizeof(rule_statusArray) / sizeof(rule_statusArray[0]);
if (rule_status < sizeofArray)
return (char *)rule_statusArray[rule_status];
else
return (char *)"Unknown";
}
void OpenAPI_rule_status_free(OpenAPI_rule_status_t *rule_status)
OpenAPI_rule_status_e OpenAPI_rule_status_FromString(char* rule_status)
{
if (NULL == rule_status) {
return;
int stringToReturn = 0;
const char *rule_statusArray[] = { "NULL", "ACTIVE", "INACTIVE" };
size_t sizeofArray = sizeof(rule_statusArray) / sizeof(rule_statusArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(rule_status, rule_statusArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(rule_status);
}
cJSON *OpenAPI_rule_status_convertToJSON(OpenAPI_rule_status_t *rule_status)
{
cJSON *item = NULL;
if (rule_status == NULL) {
ogs_error("OpenAPI_rule_status_convertToJSON() failed [RuleStatus]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_rule_status_t *OpenAPI_rule_status_parseFromJSON(cJSON *rule_statusJSON)
{
OpenAPI_rule_status_t *rule_status_local_var = NULL;
rule_status_local_var = OpenAPI_rule_status_create (
);
return rule_status_local_var;
end:
return NULL;
}
OpenAPI_rule_status_t *OpenAPI_rule_status_copy(OpenAPI_rule_status_t *dst, OpenAPI_rule_status_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_rule_status_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_rule_status_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_rule_status_free(dst);
dst = OpenAPI_rule_status_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* rule_status.h
*
* Possible values are - ACTIVE: Indicates that the PCC rule(s) are successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF), or the session rule(s) are successfully installed - INACTIVE: Indicates that the PCC rule(s) are removed (for those provisioned from PCF) or inactive (for those pre-defined in SMF) or the session rule(s) are removed.
*
*/
#ifndef _OpenAPI_rule_status_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_rule_status_s OpenAPI_rule_status_t;
typedef struct OpenAPI_rule_status_s {
} OpenAPI_rule_status_t;
typedef enum { OpenAPI_rule_status_NULL = 0, OpenAPI_rule_status_ACTIVE, OpenAPI_rule_status_INACTIVE } OpenAPI_rule_status_e;
OpenAPI_rule_status_t *OpenAPI_rule_status_create(
);
void OpenAPI_rule_status_free(OpenAPI_rule_status_t *rule_status);
OpenAPI_rule_status_t *OpenAPI_rule_status_parseFromJSON(cJSON *rule_statusJSON);
cJSON *OpenAPI_rule_status_convertToJSON(OpenAPI_rule_status_t *rule_status);
OpenAPI_rule_status_t *OpenAPI_rule_status_copy(OpenAPI_rule_status_t *dst, OpenAPI_rule_status_t *src);
char* OpenAPI_rule_status_ToString(OpenAPI_rule_status_e rule_status);
OpenAPI_rule_status_e OpenAPI_rule_status_FromString(char* rule_status);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "session_rule_failure_code.h"
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_create(
)
char* OpenAPI_session_rule_failure_code_ToString(OpenAPI_session_rule_failure_code_e session_rule_failure_code)
{
OpenAPI_session_rule_failure_code_t *session_rule_failure_code_local_var = OpenAPI_malloc(sizeof(OpenAPI_session_rule_failure_code_t));
if (!session_rule_failure_code_local_var) {
return NULL;
}
return session_rule_failure_code_local_var;
const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "UNSUCC_QOS_VAL", "UE_STA_SUSP" };
size_t sizeofArray = sizeof(session_rule_failure_codeArray) / sizeof(session_rule_failure_codeArray[0]);
if (session_rule_failure_code < sizeofArray)
return (char *)session_rule_failure_codeArray[session_rule_failure_code];
else
return (char *)"Unknown";
}
void OpenAPI_session_rule_failure_code_free(OpenAPI_session_rule_failure_code_t *session_rule_failure_code)
OpenAPI_session_rule_failure_code_e OpenAPI_session_rule_failure_code_FromString(char* session_rule_failure_code)
{
if (NULL == session_rule_failure_code) {
return;
int stringToReturn = 0;
const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "UNSUCC_QOS_VAL", "UE_STA_SUSP" };
size_t sizeofArray = sizeof(session_rule_failure_codeArray) / sizeof(session_rule_failure_codeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(session_rule_failure_code, session_rule_failure_codeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(session_rule_failure_code);
}
cJSON *OpenAPI_session_rule_failure_code_convertToJSON(OpenAPI_session_rule_failure_code_t *session_rule_failure_code)
{
cJSON *item = NULL;
if (session_rule_failure_code == NULL) {
ogs_error("OpenAPI_session_rule_failure_code_convertToJSON() failed [SessionRuleFailureCode]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_parseFromJSON(cJSON *session_rule_failure_codeJSON)
{
OpenAPI_session_rule_failure_code_t *session_rule_failure_code_local_var = NULL;
session_rule_failure_code_local_var = OpenAPI_session_rule_failure_code_create (
);
return session_rule_failure_code_local_var;
end:
return NULL;
}
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_copy(OpenAPI_session_rule_failure_code_t *dst, OpenAPI_session_rule_failure_code_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_session_rule_failure_code_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_session_rule_failure_code_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_session_rule_failure_code_free(dst);
dst = OpenAPI_session_rule_failure_code_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* session_rule_failure_code.h
*
* Possible values are - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. - UNSUCC_QOS_VAL: indicate that the QoS validation has failed. - UE_STA_SUSP: Indicates that the UE is in suspend state.
*
*/
#ifndef _OpenAPI_session_rule_failure_code_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_session_rule_failure_code_s OpenAPI_session_rule_failure_code_t;
typedef struct OpenAPI_session_rule_failure_code_s {
} OpenAPI_session_rule_failure_code_t;
typedef enum { OpenAPI_session_rule_failure_code_NULL = 0, OpenAPI_session_rule_failure_code_NF_MAL, OpenAPI_session_rule_failure_code_RES_LIM, OpenAPI_session_rule_failure_code_UNSUCC_QOS_VAL, OpenAPI_session_rule_failure_code_UE_STA_SUSP } OpenAPI_session_rule_failure_code_e;
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_create(
);
void OpenAPI_session_rule_failure_code_free(OpenAPI_session_rule_failure_code_t *session_rule_failure_code);
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_parseFromJSON(cJSON *session_rule_failure_codeJSON);
cJSON *OpenAPI_session_rule_failure_code_convertToJSON(OpenAPI_session_rule_failure_code_t *session_rule_failure_code);
OpenAPI_session_rule_failure_code_t *OpenAPI_session_rule_failure_code_copy(OpenAPI_session_rule_failure_code_t *dst, OpenAPI_session_rule_failure_code_t *src);
char* OpenAPI_session_rule_failure_code_ToString(OpenAPI_session_rule_failure_code_e session_rule_failure_code);
OpenAPI_session_rule_failure_code_e OpenAPI_session_rule_failure_code_FromString(char* session_rule_failure_code);
#ifdef __cplusplus
}

View File

@ -6,8 +6,8 @@
OpenAPI_session_rule_report_t *OpenAPI_session_rule_report_create(
OpenAPI_list_t *rule_ids,
OpenAPI_rule_status_t *rule_status,
OpenAPI_session_rule_failure_code_t *sess_rule_failure_code
OpenAPI_rule_status_e rule_status,
OpenAPI_session_rule_failure_code_e sess_rule_failure_code
)
{
OpenAPI_session_rule_report_t *session_rule_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_session_rule_report_t));
@ -31,8 +31,6 @@ void OpenAPI_session_rule_report_free(OpenAPI_session_rule_report_t *session_rul
ogs_free(node->data);
}
OpenAPI_list_free(session_rule_report->rule_ids);
OpenAPI_rule_status_free(session_rule_report->rule_status);
OpenAPI_session_rule_failure_code_free(session_rule_report->sess_rule_failure_code);
ogs_free(session_rule_report);
}
@ -68,25 +66,13 @@ cJSON *OpenAPI_session_rule_report_convertToJSON(OpenAPI_session_rule_report_t *
ogs_error("OpenAPI_session_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
cJSON *rule_status_local_JSON = OpenAPI_rule_status_convertToJSON(session_rule_report->rule_status);
if (rule_status_local_JSON == NULL) {
ogs_error("OpenAPI_session_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
cJSON_AddItemToObject(item, "ruleStatus", rule_status_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "ruleStatus", OpenAPI_rule_status_ToString(session_rule_report->rule_status)) == NULL) {
ogs_error("OpenAPI_session_rule_report_convertToJSON() failed [rule_status]");
goto end;
}
if (session_rule_report->sess_rule_failure_code) {
cJSON *sess_rule_failure_code_local_JSON = OpenAPI_session_rule_failure_code_convertToJSON(session_rule_report->sess_rule_failure_code);
if (sess_rule_failure_code_local_JSON == NULL) {
ogs_error("OpenAPI_session_rule_report_convertToJSON() failed [sess_rule_failure_code]");
goto end;
}
cJSON_AddItemToObject(item, "sessRuleFailureCode", sess_rule_failure_code_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "sessRuleFailureCode", OpenAPI_session_rule_failure_code_ToString(session_rule_report->sess_rule_failure_code)) == NULL) {
ogs_error("OpenAPI_session_rule_report_convertToJSON() failed [sess_rule_failure_code]");
goto end;
}
@ -128,21 +114,29 @@ OpenAPI_session_rule_report_t *OpenAPI_session_rule_report_parseFromJSON(cJSON *
goto end;
}
OpenAPI_rule_status_t *rule_status_local_nonprim = NULL;
OpenAPI_rule_status_e rule_statusVariable;
rule_status_local_nonprim = OpenAPI_rule_status_parseFromJSON(rule_status);
if (!cJSON_IsString(rule_status)) {
ogs_error("OpenAPI_session_rule_report_parseFromJSON() failed [rule_status]");
goto end;
}
rule_statusVariable = OpenAPI_rule_status_FromString(rule_status->valuestring);
cJSON *sess_rule_failure_code = cJSON_GetObjectItemCaseSensitive(session_rule_reportJSON, "sessRuleFailureCode");
OpenAPI_session_rule_failure_code_t *sess_rule_failure_code_local_nonprim = NULL;
OpenAPI_session_rule_failure_code_e sess_rule_failure_codeVariable;
if (sess_rule_failure_code) {
sess_rule_failure_code_local_nonprim = OpenAPI_session_rule_failure_code_parseFromJSON(sess_rule_failure_code);
if (!cJSON_IsString(sess_rule_failure_code)) {
ogs_error("OpenAPI_session_rule_report_parseFromJSON() failed [sess_rule_failure_code]");
goto end;
}
sess_rule_failure_codeVariable = OpenAPI_session_rule_failure_code_FromString(sess_rule_failure_code->valuestring);
}
session_rule_report_local_var = OpenAPI_session_rule_report_create (
rule_idsList,
rule_status_local_nonprim,
sess_rule_failure_code ? sess_rule_failure_code_local_nonprim : NULL
rule_statusVariable,
sess_rule_failure_code ? sess_rule_failure_codeVariable : 0
);
return session_rule_report_local_var;

View File

@ -22,14 +22,14 @@ extern "C" {
typedef struct OpenAPI_session_rule_report_s OpenAPI_session_rule_report_t;
typedef struct OpenAPI_session_rule_report_s {
OpenAPI_list_t *rule_ids;
struct OpenAPI_rule_status_s *rule_status;
struct OpenAPI_session_rule_failure_code_s *sess_rule_failure_code;
OpenAPI_rule_status_e rule_status;
OpenAPI_session_rule_failure_code_e sess_rule_failure_code;
} OpenAPI_session_rule_report_t;
OpenAPI_session_rule_report_t *OpenAPI_session_rule_report_create(
OpenAPI_list_t *rule_ids,
OpenAPI_rule_status_t *rule_status,
OpenAPI_session_rule_failure_code_t *sess_rule_failure_code
OpenAPI_rule_status_e rule_status,
OpenAPI_session_rule_failure_code_e sess_rule_failure_code
);
void OpenAPI_session_rule_report_free(OpenAPI_session_rule_report_t *session_rule_report);
OpenAPI_session_rule_report_t *OpenAPI_session_rule_report_parseFromJSON(cJSON *session_rule_reportJSON);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "sm_policy_association_release_cause.h"
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_create(
)
char* OpenAPI_sm_policy_association_release_cause_ToString(OpenAPI_sm_policy_association_release_cause_e sm_policy_association_release_cause)
{
OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_sm_policy_association_release_cause_t));
if (!sm_policy_association_release_cause_local_var) {
return NULL;
}
return sm_policy_association_release_cause_local_var;
const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET" };
size_t sizeofArray = sizeof(sm_policy_association_release_causeArray) / sizeof(sm_policy_association_release_causeArray[0]);
if (sm_policy_association_release_cause < sizeofArray)
return (char *)sm_policy_association_release_causeArray[sm_policy_association_release_cause];
else
return (char *)"Unknown";
}
void OpenAPI_sm_policy_association_release_cause_free(OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause)
OpenAPI_sm_policy_association_release_cause_e OpenAPI_sm_policy_association_release_cause_FromString(char* sm_policy_association_release_cause)
{
if (NULL == sm_policy_association_release_cause) {
return;
int stringToReturn = 0;
const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET" };
size_t sizeofArray = sizeof(sm_policy_association_release_causeArray) / sizeof(sm_policy_association_release_causeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(sm_policy_association_release_cause, sm_policy_association_release_causeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(sm_policy_association_release_cause);
}
cJSON *OpenAPI_sm_policy_association_release_cause_convertToJSON(OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause)
{
cJSON *item = NULL;
if (sm_policy_association_release_cause == NULL) {
ogs_error("OpenAPI_sm_policy_association_release_cause_convertToJSON() failed [SmPolicyAssociationReleaseCause]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_parseFromJSON(cJSON *sm_policy_association_release_causeJSON)
{
OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause_local_var = NULL;
sm_policy_association_release_cause_local_var = OpenAPI_sm_policy_association_release_cause_create (
);
return sm_policy_association_release_cause_local_var;
end:
return NULL;
}
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_copy(OpenAPI_sm_policy_association_release_cause_t *dst, OpenAPI_sm_policy_association_release_cause_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_sm_policy_association_release_cause_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_sm_policy_association_release_cause_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_sm_policy_association_release_cause_free(dst);
dst = OpenAPI_sm_policy_association_release_cause_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_sm_policy_association_release_cause_s OpenAPI_sm_policy_association_release_cause_t;
typedef struct OpenAPI_sm_policy_association_release_cause_s {
} OpenAPI_sm_policy_association_release_cause_t;
typedef enum { OpenAPI_sm_policy_association_release_cause_NULL = 0, OpenAPI_sm_policy_association_release_cause_UNSPECIFIED, OpenAPI_sm_policy_association_release_cause_UE_SUBSCRIPTION, OpenAPI_sm_policy_association_release_cause_INSUFFICIENT_RES, OpenAPI_sm_policy_association_release_cause_VALIDATION_CONDITION_NOT_MET } OpenAPI_sm_policy_association_release_cause_e;
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_create(
);
void OpenAPI_sm_policy_association_release_cause_free(OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause);
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_parseFromJSON(cJSON *sm_policy_association_release_causeJSON);
cJSON *OpenAPI_sm_policy_association_release_cause_convertToJSON(OpenAPI_sm_policy_association_release_cause_t *sm_policy_association_release_cause);
OpenAPI_sm_policy_association_release_cause_t *OpenAPI_sm_policy_association_release_cause_copy(OpenAPI_sm_policy_association_release_cause_t *dst, OpenAPI_sm_policy_association_release_cause_t *src);
char* OpenAPI_sm_policy_association_release_cause_ToString(OpenAPI_sm_policy_association_release_cause_e sm_policy_association_release_cause);
OpenAPI_sm_policy_association_release_cause_e OpenAPI_sm_policy_association_release_cause_FromString(char* sm_policy_association_release_cause);
#ifdef __cplusplus
}

View File

@ -36,12 +36,12 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_create(
int ref_qos_indication,
OpenAPI_trace_data_t *trace_req,
OpenAPI_snssai_t *slice_info,
OpenAPI_qos_flow_usage_t *qos_flow_usage,
OpenAPI_qos_flow_usage_e qos_flow_usage,
OpenAPI_serving_nf_identity_t *serv_nf_id,
char *supp_feat,
char *smf_id,
char *recovery_time,
OpenAPI_ma_pdu_indication_t *ma_pdu_ind,
OpenAPI_ma_pdu_indication_e ma_pdu_ind,
OpenAPI_atsss_capability_t *atsss_capab
)
{
@ -121,12 +121,10 @@ void OpenAPI_sm_policy_context_data_free(OpenAPI_sm_policy_context_data_t *sm_po
OpenAPI_subscribed_default_qos_free(sm_policy_context_data->subs_def_qos);
OpenAPI_trace_data_free(sm_policy_context_data->trace_req);
OpenAPI_snssai_free(sm_policy_context_data->slice_info);
OpenAPI_qos_flow_usage_free(sm_policy_context_data->qos_flow_usage);
OpenAPI_serving_nf_identity_free(sm_policy_context_data->serv_nf_id);
ogs_free(sm_policy_context_data->supp_feat);
ogs_free(sm_policy_context_data->smf_id);
ogs_free(sm_policy_context_data->recovery_time);
OpenAPI_ma_pdu_indication_free(sm_policy_context_data->ma_pdu_ind);
OpenAPI_atsss_capability_free(sm_policy_context_data->atsss_capab);
ogs_free(sm_policy_context_data);
}
@ -434,13 +432,7 @@ cJSON *OpenAPI_sm_policy_context_data_convertToJSON(OpenAPI_sm_policy_context_da
}
if (sm_policy_context_data->qos_flow_usage) {
cJSON *qos_flow_usage_local_JSON = OpenAPI_qos_flow_usage_convertToJSON(sm_policy_context_data->qos_flow_usage);
if (qos_flow_usage_local_JSON == NULL) {
ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [qos_flow_usage]");
goto end;
}
cJSON_AddItemToObject(item, "qosFlowUsage", qos_flow_usage_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "qosFlowUsage", OpenAPI_qos_flow_usage_ToString(sm_policy_context_data->qos_flow_usage)) == NULL) {
ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [qos_flow_usage]");
goto end;
}
@ -481,13 +473,7 @@ cJSON *OpenAPI_sm_policy_context_data_convertToJSON(OpenAPI_sm_policy_context_da
}
if (sm_policy_context_data->ma_pdu_ind) {
cJSON *ma_pdu_ind_local_JSON = OpenAPI_ma_pdu_indication_convertToJSON(sm_policy_context_data->ma_pdu_ind);
if (ma_pdu_ind_local_JSON == NULL) {
ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [ma_pdu_ind]");
goto end;
}
cJSON_AddItemToObject(item, "maPduInd", ma_pdu_ind_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "maPduInd", OpenAPI_ma_pdu_indication_ToString(sm_policy_context_data->ma_pdu_ind)) == NULL) {
ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [ma_pdu_ind]");
goto end;
}
@ -813,9 +799,13 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c
cJSON *qos_flow_usage = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "qosFlowUsage");
OpenAPI_qos_flow_usage_t *qos_flow_usage_local_nonprim = NULL;
OpenAPI_qos_flow_usage_e qos_flow_usageVariable;
if (qos_flow_usage) {
qos_flow_usage_local_nonprim = OpenAPI_qos_flow_usage_parseFromJSON(qos_flow_usage);
if (!cJSON_IsString(qos_flow_usage)) {
ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [qos_flow_usage]");
goto end;
}
qos_flow_usageVariable = OpenAPI_qos_flow_usage_FromString(qos_flow_usage->valuestring);
}
cJSON *serv_nf_id = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "servNfId");
@ -854,9 +844,13 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c
cJSON *ma_pdu_ind = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "maPduInd");
OpenAPI_ma_pdu_indication_t *ma_pdu_ind_local_nonprim = NULL;
OpenAPI_ma_pdu_indication_e ma_pdu_indVariable;
if (ma_pdu_ind) {
ma_pdu_ind_local_nonprim = OpenAPI_ma_pdu_indication_parseFromJSON(ma_pdu_ind);
if (!cJSON_IsString(ma_pdu_ind)) {
ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [ma_pdu_ind]");
goto end;
}
ma_pdu_indVariable = OpenAPI_ma_pdu_indication_FromString(ma_pdu_ind->valuestring);
}
cJSON *atsss_capab = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "atsssCapab");
@ -898,12 +892,12 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c
ref_qos_indication ? ref_qos_indication->valueint : 0,
trace_req ? trace_req_local_nonprim : NULL,
slice_info_local_nonprim,
qos_flow_usage ? qos_flow_usage_local_nonprim : NULL,
qos_flow_usage ? qos_flow_usageVariable : 0,
serv_nf_id ? serv_nf_id_local_nonprim : NULL,
supp_feat ? ogs_strdup(supp_feat->valuestring) : NULL,
smf_id ? ogs_strdup(smf_id->valuestring) : NULL,
recovery_time ? ogs_strdup(recovery_time->valuestring) : NULL,
ma_pdu_ind ? ma_pdu_ind_local_nonprim : NULL,
ma_pdu_ind ? ma_pdu_indVariable : 0,
atsss_capab ? atsss_capab_local_nonprim : NULL
);

Some files were not shown because too many files have changed in this diff Show More