TSG-14351 tsg-service-chaining-engine通过Mock Mrzcpd进行单元测试

This commit is contained in:
luwenpeng
2023-03-30 17:44:33 +08:00
parent 0e85d3c9c5
commit 0f45abedc8
32 changed files with 1482 additions and 19 deletions

View File

@@ -53,7 +53,7 @@ struct packet_io
// return 0 : success
// return -1 : error
static int mbuff_get_metadata(marsio_buff_t *rx_buff, struct metadata *meta)
int mbuff_get_metadata(marsio_buff_t *rx_buff, struct metadata *meta)
{
memset(meta, 0, sizeof(struct metadata));
@@ -119,7 +119,7 @@ static int mbuff_get_metadata(marsio_buff_t *rx_buff, struct metadata *meta)
// return 0 : success
// return -1 : error
static int mbuff_set_metadata(marsio_buff_t *tx_buff, struct metadata *meta)
int mbuff_set_metadata(marsio_buff_t *tx_buff, struct metadata *meta)
{
if (meta->session_id)
{
@@ -134,6 +134,7 @@ static int mbuff_set_metadata(marsio_buff_t *tx_buff, struct metadata *meta)
if (meta->is_ctrl_pkt)
{
marsio_buff_set_ctrlbuf(tx_buff);
if (marsio_buff_set_metadata(tx_buff, MR_BUFF_PAYLOAD_OFFSET, &(meta->l7offset), sizeof(meta->l7offset)) != 0)
{
LOG_ERROR("%s: unable to set l7offset for metadata", LOG_TAG_PKTIO);
@@ -1267,3 +1268,15 @@ int packet_io_thread_polling_endpoint(struct packet_io *handle, struct thread_ct
return nr_recv;
}
struct mr_instance *packet_io_get_mr_instance(struct packet_io *handle)
{
if (handle)
{
return handle->instance;
}
else
{
return NULL;
}
}