From d9370d195a2bc7fdca5a5fb52871fbf9d728c6bd Mon Sep 17 00:00:00 2001 From: mallocnull Date: Mon, 30 Oct 2017 17:00:10 -0500 Subject: [PATCH] casual squidding --- src/packet.c | 10 +++++++--- src/packet.h | 12 ++++++++---- src/server/server.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/packet.c b/src/packet.c index 4c75134..eaacd14 100644 --- a/src/packet.c +++ b/src/packet.c @@ -36,7 +36,7 @@ void packet_context_register(uint8_t direction, uint8_t id, uint8_t iter_pt, uin va_start(args, count); for(i = 0; i < count; ++i) { - uint16_t length = va_arg(args, uint16_t); + uint16_t length = va_arg(args, int); ptr[id].region_lengths[i] = length; ptr[id].length += length; } @@ -44,9 +44,13 @@ void packet_context_register(uint8_t direction, uint8_t id, uint8_t iter_pt, uin } void packet_context_free() { - free(ctx.c2s.region_lengths); + int i; + + for(i = 0; i < ctx.count; ++i) + free(ctx.c2s[i].region_lengths); free(ctx.c2s); - free(ctx.s2c.region_lengths); + for(i = 0; i < ctx.count; ++i) + free(ctx.s2c[i].region_lengths); free(ctx.s2c); } \ No newline at end of file diff --git a/src/packet.h b/src/packet.h index 0f5b1e2..7410333 100644 --- a/src/packet.h +++ b/src/packet.h @@ -25,10 +25,14 @@ struct packet_t { }; void packet_context_init(uint8_t); - -void packet_context_register(uint8_t, uint8_t, uint8_t, ...); -void packet_context_register_iter(uint8_t, uint8_t, uint8_t, uint8_t, ...); - +void packet_context_register(uint8_t, uint8_t, uint8_t, uint8_t, ...); void packet_context_free(); +packet_t* packet_init_in(uint8_t*); +packet_t* packet_init_out(uint8_t); + + + +void packet_free(packet_t*); + #endif \ No newline at end of file diff --git a/src/server/server.h b/src/server/server.h index ccb5d88..b1a949e 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -2,6 +2,8 @@ #define SERVER_H #include +#include "context.h" +#include "user.h" #include "sock.h" #include "queue.h" #include "flimit.h"