tor_multipath_voip/src/meas_lat.c

60 lines
1.3 KiB
C
Raw Normal View History

#include <stdlib.h>
#include <stdio.h>
#include "evt_core.h"
2019-02-14 17:08:20 +00:00
#include "net_tools.h"
2019-02-14 17:08:20 +00:00
struct timer_ctx {
uint64_t counter;
};
2019-02-18 20:55:53 +00:00
void on_udp(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
2019-02-14 17:08:20 +00:00
}
2019-02-18 20:55:53 +00:00
void on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
2019-02-14 17:08:20 +00:00
}
int main(int argc, char** argv) {
printf("~ measlat ~\n");
if (argc < 3) exit(EXIT_FAILURE);
struct timer_ctx apptime = {0};
struct evt_core_ctx evts = {0};
2019-02-14 17:08:20 +00:00
struct evt_core_cat udp_read = {
.app_ctx = NULL,
.free_app_ctx = NULL,
.cb = on_udp,
2019-02-18 20:55:53 +00:00
.err_cb = NULL,
2019-02-14 17:08:20 +00:00
.name = "udp-read",
.flags = EPOLLIN | EPOLLET,
.socklist = NULL
};
struct evt_core_cat timer = {
.app_ctx = &apptime,
.free_app_ctx = NULL,
.cb = on_timer,
2019-02-18 20:55:53 +00:00
.err_cb = NULL,
2019-02-14 17:08:20 +00:00
.name = "timer",
.flags = EPOLLIN | EPOLLET,
.socklist = NULL
};
evt_core_init(&evts);
2019-02-14 17:08:20 +00:00
evt_core_add_cat (&evts, &udp_read);
evt_core_add_cat(&evts, &timer);
printf("--- Categories registered\n");
int udp_sock = create_udp_client (argv[1], argv[2]);
2019-02-18 13:35:09 +00:00
char url[1024];
struct evt_core_cat cat = {0};
struct evt_core_fdinfo fdinfo = {0};
fdinfo.cat = &cat;
fdinfo.url = url;
fdinfo.fd = udp_sock;
fdinfo.cat->name = "udp-read";
sprintf(fdinfo.url, "udp:read:%s:%s", argv[1], argv[2]);
evt_core_add_fd (&evts, &fdinfo);
return 0;
}