TSG-14568 tsg-service-chaining-engine支持MAAT4

This commit is contained in:
luwenpeng
2023-04-07 14:09:20 +08:00
parent 0f45abedc8
commit 7215e0b545
24 changed files with 193 additions and 141 deletions

View File

@@ -126,7 +126,7 @@ int ctrl_packet_parser_parse(struct ctrl_pkt_parser *handler, const char *data,
goto error_out;
}
handler->policy_id_num = MIN(cJSON_GetArraySize(item), (int)(sizeof(handler->policy_ids) / sizeof(handler->policy_ids[0])));
handler->rule_id_num = MIN(cJSON_GetArraySize(item), (int)(sizeof(handler->rule_ids) / sizeof(handler->rule_ids[0])));
cJSON_ArrayForEach(elem, item)
{
if (!cJSON_IsNumber(elem))
@@ -134,10 +134,10 @@ int ctrl_packet_parser_parse(struct ctrl_pkt_parser *handler, const char *data,
LOG_ERROR("%s: unexpected control packet: (invalid service_chaining value) %s", LOG_TAG_POLICY, data);
continue;
}
handler->policy_ids[iter] = elem->valueint;
handler->rule_ids[iter] = elem->valueint;
iter++;
if (iter == handler->policy_id_num)
if (iter == handler->rule_id_num)
{
break;
}
@@ -160,11 +160,11 @@ void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler)
LOG_INFO("%s: session_id : %lu", LOG_TAG_POLICY, handler->session_id);
LOG_INFO("%s: state : %s", LOG_TAG_POLICY, session_state_to_string(handler->state));
LOG_INFO("%s: method : %s", LOG_TAG_POLICY, handler->method);
LOG_INFO("%s: policy_id_num : %d", LOG_TAG_POLICY, handler->policy_id_num);
LOG_INFO("%s: rule_id_num : %d", LOG_TAG_POLICY, handler->rule_id_num);
for (int i = 0; i < handler->policy_id_num; i++)
for (int i = 0; i < handler->rule_id_num; i++)
{
LOG_INFO("%s: policy_ids[%03d] : %i", LOG_TAG_POLICY, i, handler->policy_ids[i]);
LOG_INFO("%s: rule_ids[%03d] : %lu", LOG_TAG_POLICY, i, handler->rule_ids[i]);
}
}
}

View File

@@ -22,7 +22,7 @@ void fixed_num_array_init(struct fixed_num_array *array)
array->size = sizeof(array->elems) / sizeof(array->elems[0]);
}
void fixed_num_array_add_elem(struct fixed_num_array *array, int elem)
void fixed_num_array_add_elem(struct fixed_num_array *array, uint64_t elem)
{
if (array->num < array->size)
{
@@ -35,7 +35,7 @@ void fixed_num_array_add_elem(struct fixed_num_array *array, int elem)
}
}
void fixed_num_array_del_elem(struct fixed_num_array *array, int elem)
void fixed_num_array_del_elem(struct fixed_num_array *array, uint64_t elem)
{
for (int i = 0; i < array->num; i++)
{
@@ -75,7 +75,7 @@ int fixed_num_array_count_elem(struct fixed_num_array *array)
}
}
int fixed_num_array_exist_elem(struct fixed_num_array *array, int elem)
int fixed_num_array_exist_elem(struct fixed_num_array *array, uint64_t elem)
{
for (int i = 0; i < array->num; i++)
{