mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-03 13:50:08 +00:00
feat: Add dedicated QoS flow
This commit is contained in:
parent
65aea5ebf2
commit
235a041b8d
205 changed files with 6053 additions and 3831 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue