Fix capture + send data
This commit is contained in:
parent
6b4a784171
commit
4582d4a9d2
2 changed files with 11 additions and 1 deletions
|
@ -52,7 +52,7 @@ void traffic_capture_notify(struct capture_ctx* ctx, struct buffer_packet *bp, c
|
|||
|
||||
dynbuf_append (
|
||||
strcmp(dest, "in") == 0 ? &ctx->in : &ctx->out,
|
||||
(char*)&bp,
|
||||
(char*)bp,
|
||||
sizeof(struct buffer_packet));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ struct measure_conf* create_measure_conf(int max_mes, int plsize) {
|
|||
perror("malloc failed");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return mc;
|
||||
}
|
||||
|
||||
|
@ -114,6 +115,15 @@ int on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
|||
perror("clock_gettime error");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
char *my_msg = "Tu n'es pas tout a fait la misere,\nCar les levres les plus pauvres te denoncent\nPar un sourire.";
|
||||
size_t msg_len = strlen(my_msg);
|
||||
size_t cursor_msg = 0;
|
||||
for (size_t i = sizeof(struct packet_header); i < mc->payload_size; i++) {
|
||||
mc->payload[i] = my_msg[cursor_msg];
|
||||
cursor_msg = (cursor_msg + 1) % msg_len;
|
||||
}
|
||||
|
||||
struct evt_core_fdinfo* tgtinfo = evt_core_get_first_from_cat (ctx, "udp-read");
|
||||
if (tgtinfo == NULL) tgtinfo = evt_core_get_first_from_cat (ctx, "tcp-read");
|
||||
if (tgtinfo == NULL) {
|
||||
|
|
Loading…
Reference in a new issue