增加和kni通信接口
This commit is contained in:
33
platform/test/test_sender_scm.cpp
Normal file
33
platform/test/test_sender_scm.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user