From f4d3dcbd6dc93dad499a5eb6df78d13cade50203 Mon Sep 17 00:00:00 2001 From: gonzalef Date: Tue, 24 Mar 2020 15:39:31 +0100 Subject: [PATCH] post --- parser.c | 6 +++--- parser.h | 4 ++-- tlv.c | 4 ++-- tlv.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/parser.c b/parser.c index fa2f061..5b1b48a 100644 --- a/parser.c +++ b/parser.c @@ -21,11 +21,11 @@ cmd_token parse_cmd() { token.type = NETWORK_STATE_REQ; else if(strcmp("node state", arg) == 0) token.type = NODE_STATE_REQ; - } else if(strcmp("send", cmd) == 0) { - token.type = SEND; + } else if(strcmp("post", cmd) == 0) { + token.type = POST; //arg[192] = 0; strcpy(token.arg, arg); } return token; -} \ No newline at end of file +} diff --git a/parser.h b/parser.h index 4573a86..8663a5a 100644 --- a/parser.h +++ b/parser.h @@ -2,7 +2,7 @@ #include typedef enum cmd_type { - NEIGHBOUR_REQ, NETWORK_STATE_REQ, NODE_STATE_REQ, SEND, ERROR + NEIGHBOUR_REQ, NETWORK_STATE_REQ, NODE_STATE_REQ, POST, ERROR } cmd_type; typedef struct cmd_token { @@ -11,4 +11,4 @@ typedef struct cmd_token { } cmd_token; // retourne le type de commande à exécuter -cmd_token parse_cmd(); \ No newline at end of file +cmd_token parse_cmd(); diff --git a/tlv.c b/tlv.c index ec0e5e3..2284815 100644 --- a/tlv.c +++ b/tlv.c @@ -12,11 +12,11 @@ int build_tlv(tlv *tlv, cmd_token token) { case NODE_STATE_REQ: // a remplir break; - case SEND: + case POST: // a remplir break; case ERROR: - printf("Wrong format, use 'req {neighbour | network state | node state}' or 'send {message}'"); + printf("Wrong format, use 'req {neighbour | network state | node state}' or 'post {message}'"); break; } } diff --git a/tlv.h b/tlv.h index d42dae6..35625ac 100644 --- a/tlv.h +++ b/tlv.h @@ -20,7 +20,7 @@ typedef struct pad1 { typedef struct padn { unsigned char type; unsigned char length; - char *mbz; + char mbz[256]; } padn; // 2 octets @@ -73,7 +73,7 @@ typedef struct node_state { long node_id; short seqno; char node_hash[16]; - char *data; + char data[192]; } node_state; // 2 octets min, 258 ocets max (unsigned char 0 -> 255)