mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 05:40:09 +00:00
[Release-17] Upgrade SBI to v17.x.0
This commit is contained in:
parent
969c116e77
commit
4d44b1843e
1687 changed files with 121604 additions and 9310 deletions
|
|
@ -5,13 +5,15 @@
|
|||
#include "context_info.h"
|
||||
|
||||
OpenAPI_context_info_t *OpenAPI_context_info_create(
|
||||
OpenAPI_list_t *orig_headers
|
||||
OpenAPI_list_t *orig_headers,
|
||||
OpenAPI_list_t *request_headers
|
||||
)
|
||||
{
|
||||
OpenAPI_context_info_t *context_info_local_var = ogs_malloc(sizeof(OpenAPI_context_info_t));
|
||||
ogs_assert(context_info_local_var);
|
||||
|
||||
context_info_local_var->orig_headers = orig_headers;
|
||||
context_info_local_var->request_headers = request_headers;
|
||||
|
||||
return context_info_local_var;
|
||||
}
|
||||
|
|
@ -30,6 +32,13 @@ void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info)
|
|||
OpenAPI_list_free(context_info->orig_headers);
|
||||
context_info->orig_headers = NULL;
|
||||
}
|
||||
if (context_info->request_headers) {
|
||||
OpenAPI_list_for_each(context_info->request_headers, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(context_info->request_headers);
|
||||
context_info->request_headers = NULL;
|
||||
}
|
||||
ogs_free(context_info);
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +67,20 @@ cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info)
|
|||
}
|
||||
}
|
||||
|
||||
if (context_info->request_headers) {
|
||||
cJSON *request_headersList = cJSON_AddArrayToObject(item, "requestHeaders");
|
||||
if (request_headersList == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [request_headers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_for_each(context_info->request_headers, node) {
|
||||
if (cJSON_AddStringToObject(request_headersList, "", (char*)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_context_info_convertToJSON() failed [request_headers]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
|
@ -68,6 +91,8 @@ OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJS
|
|||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *orig_headers = NULL;
|
||||
OpenAPI_list_t *orig_headersList = NULL;
|
||||
cJSON *request_headers = NULL;
|
||||
OpenAPI_list_t *request_headersList = NULL;
|
||||
orig_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "origHeaders");
|
||||
if (orig_headers) {
|
||||
cJSON *orig_headers_local = NULL;
|
||||
|
|
@ -89,8 +114,30 @@ OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJS
|
|||
}
|
||||
}
|
||||
|
||||
request_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "requestHeaders");
|
||||
if (request_headers) {
|
||||
cJSON *request_headers_local = NULL;
|
||||
if (!cJSON_IsArray(request_headers)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [request_headers]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
request_headersList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(request_headers_local, request_headers) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsString(request_headers_local)) {
|
||||
ogs_error("OpenAPI_context_info_parseFromJSON() failed [request_headers]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(request_headersList, ogs_strdup(request_headers_local->valuestring));
|
||||
}
|
||||
}
|
||||
|
||||
context_info_local_var = OpenAPI_context_info_create (
|
||||
orig_headers ? orig_headersList : NULL
|
||||
orig_headers ? orig_headersList : NULL,
|
||||
request_headers ? request_headersList : NULL
|
||||
);
|
||||
|
||||
return context_info_local_var;
|
||||
|
|
@ -102,6 +149,13 @@ end:
|
|||
OpenAPI_list_free(orig_headersList);
|
||||
orig_headersList = NULL;
|
||||
}
|
||||
if (request_headersList) {
|
||||
OpenAPI_list_for_each(request_headersList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(request_headersList);
|
||||
request_headersList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue