使用cmsg公共库解析cmsg信息,对业务层提供获取cmsg句柄的接口

This commit is contained in:
luqiuwen
2019-06-01 17:00:36 +08:00
parent 1b872c246d
commit 77aa3063f7
11 changed files with 133 additions and 283 deletions

View File

@@ -8,19 +8,25 @@
#include "tfe_utils.h"
#include "tfe_cmsg.h"
int main()
{
return 0;
}
/*
int main(){
//init
struct tfe_cmsg *cmsg = tfe_cmsg_init();
//set
uint32_t value = 0x12345678;
int ret = tfe_cmsg_set(cmsg, TCP_RESTORE_INFO_TLV_SEQ, (const unsigned char*)(&value), 4);
int ret = tfe_cmsg_set(cmsg, TFE_CMSG_TCP_RESTORE_SEQ, (const unsigned char*)(&value), 4);
printf("tfe_cmsg_set: ret is %d\n", ret);
//get TCP_RESTORE_INFO_TLV_SEQ
uint16_t size = -1;
unsigned char *value1 = NULL;
ret = tfe_cmsg_get(cmsg, TCP_RESTORE_INFO_TLV_SEQ, &size, &value1);
ret = tfe_cmsg_get(cmsg, TFE_CMSG_TCP_RESTORE_SEQ, &size, &value1);
printf("tfe_cmsg_get: ret is %d, type is TCP_RESTORE_INFO_TLV_SEQ, value is 0x%02x, value_size is %d\n", ret, ((uint32_t*)value1)[0], size);
//get_serialize_size
@@ -45,6 +51,7 @@ int main(){
//get TCP_RESTORE_INFO_TLV_SEQ
size = -1;
unsigned char *value2 = NULL;
ret = tfe_cmsg_get(cmsg1, TCP_RESTORE_INFO_TLV_SEQ, &size, &value2);
ret = tfe_cmsg_get(cmsg1, TFE_CMSG_TCP_RESTORE_SEQ, &size, &value2);
printf("tfe_cmsg_get: ret is %d, type is TCP_RESTORE_INFO_TLV_SEQ, value is 0x%02x, value_size is %d\n", ret, ((uint32_t*)value2)[0], size);
}
*/