This commit is contained in:
gonzalef 2020-03-07 21:33:11 +01:00
parent 10c3893f37
commit 188f9547c7
1 changed files with 78 additions and 0 deletions

78
tlv.h Normal file
View File

@ -0,0 +1,78 @@
#include <sys/socket.h>
#include <netinet/in.h>
typedef union tlv {
pad1 *pad1;
padn *padn;
neighbour_req *neighbour_req;
neighbour *neighbour;
network_hash *network_hash;
network_state_req *network_state_req;
node_hash *node_hash;
node_state_req *node_state_req;
node_state *node_state;
warning *warning;
} tlv;
typedef struct pad1 {
char type;
} pad1;
typedef struct padn {
char type;
char length;
char *mbz;
} padn;
typedef struct neighbour_req {
char type;
char length;
} neighbour_req;
typedef struct neighbour {
char type;
char length;
struct in6_addr ip;
short port;
} neighbour;
typedef struct network_hash {
char type;
char length;
char *network_hash;
} network_hash;
typedef struct network_state_req {
char type;
char length;
} network_state_req;
typedef struct node_hash {
char type;
char length;
long node_id;
short seqno;
char *node_hash;
} node_hash;
typedef struct node_state_req {
char type;
char length;
long node_id;
} node_state_req;
typedef struct node_state {
char type;
char length;
long node_id;
short seqno;
char *node_hash;
char *data;
} node_state;
typedef struct warning {
char type;
char length;
char *message;
} warning;