2019-06-13 02:53:14 +00:00
|
|
|
#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");
|
2019-06-18 09:47:43 +00:00
|
|
|
trace_client_init();
|
2019-06-13 02:53:14 +00:00
|
|
|
|
|
|
|
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};
|
2019-06-18 09:47:43 +00:00
|
|
|
|
2019-06-13 02:53:14 +00:00
|
|
|
//trace1.src.addr.ip4.s_addr = i;
|
|
|
|
trace1.dst.addr.ip4.s_addr = i;
|
|
|
|
//memset(&trace1, 0, sizeof(trace1));
|
2019-06-18 09:47:43 +00:00
|
|
|
trace1.src.family = TRACE_FAMILY_IP4;
|
|
|
|
trace1.dst.family = TRACE_FAMILY_IP4;
|
|
|
|
trace1.protocol = 30;
|
2019-06-13 02:53:14 +00:00
|
|
|
|
|
|
|
if (async == 1) {
|
|
|
|
printf("async exec\n");
|
2019-06-18 09:47:43 +00:00
|
|
|
trace_async_exec(&trace1, cb, NULL);
|
|
|
|
} else if (async == 2) {
|
|
|
|
printf("exec no reply\n");
|
|
|
|
trace_exec_no_reply(&trace1);
|
2019-06-13 02:53:14 +00:00
|
|
|
} else {
|
|
|
|
printf("sync exec\n");
|
2019-06-18 09:47:43 +00:00
|
|
|
trace_sync_exec(&trace1);
|
2019-06-13 02:53:14 +00:00
|
|
|
}
|
|
|
|
printf("send success\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
//policy_client_exit();
|
|
|
|
sleep(10);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|