From 63f2669df12d6833d0049313594e1f366e0c4127 Mon Sep 17 00:00:00 2001 From: lns Date: Mon, 13 Aug 2018 15:54:49 +0200 Subject: basic jail packet parsing functions Signed-off-by: lns --- src/jail_packet.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/jail_packet.h') diff --git a/src/jail_packet.h b/src/jail_packet.h index 0fc202d..55016d5 100644 --- a/src/jail_packet.h +++ b/src/jail_packet.h @@ -38,19 +38,23 @@ #include "pevent.h" -#define PKT_INVALID 0x0 -#define PKT_HELLO 0x1 +#define PKT_INVALID 0x0 /* should not happen, otherwise error */ +#define PKT_HELLO 0x1 /* request(PKT_HELLO) -> response(PKT_HELLO) */ +#define PKT_USER 0x2 /* request(PKT_USER) -> response(PKT_USER) */ +#define PKT_PASS 0x3 /* request(PKT_PASS) -> response(PKT_PASS) */ typedef enum jail_packet_state { JP_NONE, JP_INVALID, JP_HELLO } jail_packet_state; typedef struct jail_packet_ctx { + int is_server; jail_packet_state pstate; + on_data_cb on_data; + void *user_data; } jail_packet_ctx; -int jail_packet_loop(event_ctx *ctx, jail_packet_ctx *pkt_ctx, - on_data_cb on_data); +int jail_packet_loop(event_ctx *ctx, jail_packet_ctx *pkt_ctx); #endif -- cgit v1.2.3