增加和kni通信接口

This commit is contained in:
崔一鸣
2019-06-02 15:10:57 +08:00
committed by luqiuwen
parent 28becac88d
commit cc126a73a1
6 changed files with 154 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
#include "tfe_types.h"
#include "tfe_utils.h"
#include "sender_scm.h"
#include "tfe_cmsg.h"
int main(){
struct tfe_cmsg *cmsg = tfe_cmsg_init();
if(cmsg == NULL){
printf("Failed at call tfe_cmsg_init\n");
}
//set
uint32_t value = 0x12345678;
int ret = tfe_cmsg_set(cmsg, TFE_CMSG_TCP_RESTORE_SEQ, (const unsigned char*)(&value), 4);
if(ret < 0){
printf("Failed at call tfe_cmsg_set: ret is %d\n", ret);
return -1;
}
//sender_scm
const char *profile = "../../conf/tfe/tfe.conf";
struct sender_scm* sender = sender_scm_init(profile, NULL);
if(sender == NULL){
printf("Failed at call sender_scm_init\n");
return -1;
}
ret = sender_scm_cmsg_send(sender, cmsg);
if(ret < 0){
printf("Failed at call sender_scm_cmsg_send, ret is %d\n", ret);
return -1;
}
return 0;
}