88 lines
1.6 KiB
C
88 lines
1.6 KiB
C
#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;
|
|
|
|
|
|
// 1 octet
|
|
typedef struct pad1 {
|
|
unsigned unsigned char type;
|
|
} pad1;
|
|
|
|
// 2 octets min, 257 octets max (unsigned char 0 -> 255)
|
|
typedef struct padn {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
char *mbz;
|
|
} padn;
|
|
|
|
// 2 octets
|
|
typedef struct neighbour_req {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
} neighbour_req;
|
|
|
|
// 132 octets
|
|
typedef struct neighbour {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
struct in6_addr ip;
|
|
short port;
|
|
} neighbour;
|
|
|
|
// 18 octets
|
|
typedef struct network_hash {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
char *network_hash;
|
|
} network_hash;
|
|
|
|
// 2 octets
|
|
typedef struct network_state_req {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
} network_state_req;
|
|
|
|
// 28 octets
|
|
typedef struct node_hash {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
long node_id;
|
|
short seqno;
|
|
char *node_hash;
|
|
} node_hash;
|
|
|
|
// 10 octets
|
|
typedef struct node_state_req {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
long node_id;
|
|
} node_state_req;
|
|
|
|
// 28 octets min, 220 octets max (data 0 -> 192)
|
|
typedef struct node_state {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
long node_id;
|
|
short seqno;
|
|
char *node_hash;
|
|
char *data;
|
|
} node_state;
|
|
|
|
// 2 octets min, 257 ocets max (unsigned char 0 -> 255)
|
|
typedef struct warning {
|
|
unsigned char type;
|
|
unsigned char length;
|
|
char *message;
|
|
} warning; |