62 lines
1.2 KiB
C
62 lines
1.2 KiB
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
#include <errno.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/ipc.h>
|
||
|
#include <sys/msg.h>
|
||
|
|
||
|
#include "log.h"
|
||
|
#include "trace_api.h"
|
||
|
|
||
|
void cb(trace_ret_t ret, void *arg)
|
||
|
{
|
||
|
printf("reply valaue:%u\n", ret);
|
||
|
}
|
||
|
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
printf("1111\n");
|
||
|
|
||
|
SYSLOG_INIT("test-client");
|
||
|
policy_client_init();
|
||
|
|
||
|
printf("argc num:%d\n", argc);
|
||
|
int count = 1;
|
||
|
if (argc >= 2) {
|
||
|
count = atoi(argv[1]);
|
||
|
}
|
||
|
|
||
|
int async = 1;
|
||
|
if (argc >= 3) {
|
||
|
async = atoi(argv[2]);
|
||
|
}
|
||
|
|
||
|
for (int i = 0; i < count; i++) {
|
||
|
|
||
|
trace_policy_t trace1 = {0};
|
||
|
//trace1.src.addr.ip4.s_addr = i;
|
||
|
trace1.dst.addr.ip4.s_addr = i;
|
||
|
//memset(&trace1, 0, sizeof(trace1));
|
||
|
trace1.src.family = 2;
|
||
|
trace1.dst.family = 2;
|
||
|
|
||
|
if (async == 1) {
|
||
|
printf("async exec\n");
|
||
|
policy_async_exec(&trace1, cb, NULL);
|
||
|
} else {
|
||
|
printf("sync exec\n");
|
||
|
policy_sync_exec(&trace1);
|
||
|
}
|
||
|
printf("send success\n");
|
||
|
}
|
||
|
|
||
|
//policy_client_exit();
|
||
|
sleep(10);
|
||
|
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|