post
This commit is contained in:
parent
4ebed74a15
commit
f4d3dcbd6d
4
parser.c
4
parser.c
@ -21,8 +21,8 @@ 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);
|
||||
}
|
||||
|
2
parser.h
2
parser.h
@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
|
||||
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 {
|
||||
|
4
tlv.c
4
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;
|
||||
}
|
||||
}
|
||||
|
4
tlv.h
4
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)
|
||||
|
Loading…
Reference in New Issue
Block a user