Added conditional includes
This commit is contained in:
parent
2ff5c656ea
commit
35d50d178a
@ -1,5 +1,7 @@
|
|||||||
// Define constants
|
// Define constants
|
||||||
|
|
||||||
|
#ifndef NODE_H
|
||||||
|
#define NODE_H
|
||||||
|
|
||||||
// fonctions signatures
|
// fonctions signatures
|
||||||
void listen_for_packets();
|
void listen_for_packets();
|
||||||
@ -24,3 +26,5 @@ void t_get_network_state();
|
|||||||
char * hash();
|
char * hash();
|
||||||
|
|
||||||
short * get_seq_no(short s, int n);
|
short * get_seq_no(short s, int n);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef PARSER_H
|
||||||
|
#define PARSER_H
|
||||||
|
|
||||||
typedef enum cmd_type {
|
typedef enum cmd_type {
|
||||||
NEIGHBOUR_REQ, NETWORK_STATE_REQ, NODE_STATE_REQ, SEND, ERROR
|
NEIGHBOUR_REQ, NETWORK_STATE_REQ, NODE_STATE_REQ, SEND, ERROR
|
||||||
} cmd_type;
|
} cmd_type;
|
||||||
@ -11,4 +14,6 @@ typedef struct cmd_token {
|
|||||||
} cmd_token;
|
} cmd_token;
|
||||||
|
|
||||||
// retourne le type de commande à exécuter
|
// retourne le type de commande à exécuter
|
||||||
cmd_token parse_cmd();
|
cmd_token parse_cmd();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
// 8 octets min (struct pointer 4 octets), 1024 octets max
|
#ifndef TLV_H
|
||||||
|
#define TLV_H
|
||||||
|
|
||||||
|
// 8 octets min (struct pointer 4 octets), 1024 octets max
|
||||||
typedef struct packet {
|
typedef struct packet {
|
||||||
unsigned char magic; // 95 (si autre, ignorer)
|
unsigned char magic; // 95 (si autre, ignorer)
|
||||||
unsigned char version; // 1 (si autre, ignorer)
|
unsigned char version; // 1 (si autre, ignorer)
|
||||||
@ -110,4 +113,6 @@ int build_network_state_req(tlv *tlv);
|
|||||||
int build_node_hash(tlv *tlv, long node_id, short seqno, char *node_hash);
|
int build_node_hash(tlv *tlv, long node_id, short seqno, char *node_hash);
|
||||||
int build_node_state_req(tlv *tlv, long node_id);
|
int build_node_state_req(tlv *tlv, long node_id);
|
||||||
int build_node_state(tlv *tlv, long node_id, short seqno, char *node_hash, char *data);
|
int build_node_state(tlv *tlv, long node_id, short seqno, char *node_hash, char *data);
|
||||||
int build_warning(tlv *tlv, char *message);
|
int build_warning(tlv *tlv, char *message);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user