diff options
-rw-r--r-- | libglouglou/libglouglou.c | 10 | ||||
-rw-r--r-- | libglouglou/libglouglou.h | 13 |
2 files changed, 22 insertions, 1 deletions
diff --git a/libglouglou/libglouglou.c b/libglouglou/libglouglou.c index aa50611..c2c284a 100644 --- a/libglouglou/libglouglou.c +++ b/libglouglou/libglouglou.c @@ -490,6 +490,11 @@ pkt_decode(char **buf, int *buf_len) strncpy((char *)newpkt.exec_cmd, (char *)pkt->exec_cmd, newpkt.exec_cmdlen); break; + case PACKET_EXIT: + newpkt.exit_pid = ntohl(pkt->exit_pid); + newpkt.exit_tgid = ntohl(pkt->exit_tgid); + newpkt.exit_ecode = pkt->exit_ecode; + break; default: goto invalid; invalid("type switch"); @@ -565,6 +570,11 @@ pkt_encode(struct gg_packet *pkt, int *len) strncpy((char *)newpkt.exec_cmd, (char *)pkt->exec_cmd, pkt->exec_cmdlen); break; + case PACKET_EXIT: + newpkt.exit_pid = htonl(pkt->exit_pid); + newpkt.exit_tgid = htonl(pkt->exit_tgid); + newpkt.exit_ecode = pkt->exit_ecode; + break; default: error("Unsupported packet type"); return NULL; diff --git a/libglouglou/libglouglou.h b/libglouglou/libglouglou.h index 4cac24d..8ee890f 100644 --- a/libglouglou/libglouglou.h +++ b/libglouglou/libglouglou.h @@ -16,7 +16,7 @@ #define PACKET_HEADER_SIZE 2 #define PACKET_TYPE_MIN 0x00 -#define PACKET_TYPE_MAX 0x11 +#define PACKET_TYPE_MAX 0x12 enum gg_packet_type { /* u_int8_t */ PACKET_NEWCONN = 0x00, PACKET_DELCONN = 0x01, @@ -24,6 +24,7 @@ enum gg_packet_type { /* u_int8_t */ PACKET_NAME = 0x03, PACKET_FORK = 0x10, PACKET_EXEC = 0x11, + PACKET_EXIT = 0x12, }; /* XXX is packed needed everywhere ? */ @@ -61,6 +62,11 @@ struct __attribute__((packed)) gg_packet { u_int8_t cmdlen; u_char cmd[GG_PKTARG_MAX]; } exec; + struct __attribute__((packed)) exit { + u_int32_t pid; + u_int32_t tgid; + u_int8_t ecode; + } exit; } pdat; #define newconn_id pdat.newconn.id #define newconn_src pdat.newconn.src @@ -80,6 +86,9 @@ struct __attribute__((packed)) gg_packet { #define exec_pid pdat.exec.pid #define exec_cmdlen pdat.exec.cmdlen #define exec_cmd pdat.exec.cmd +#define exit_pid pdat.exit.pid +#define exit_tgid pdat.exit.tgid +#define exit_ecode pdat.exit.ecode }; typedef struct gg_packet_props_t { @@ -99,6 +108,8 @@ gg_packet_props_t gg_packet_props[] = { { (PACKET_HEADER_SIZE + sizeof((struct gg_packet *)0)->pdat.fork) }, [PACKET_EXEC] = \ { ((PACKET_HEADER_SIZE + sizeof((struct gg_packet *)0)->pdat.exec) - GG_PKTARG_MAX) }, + [PACKET_EXIT] = \ + { (PACKET_HEADER_SIZE + sizeof((struct gg_packet *)0)->pdat.exit) }, }; struct gg_user { |