Added conditional includes

This commit is contained in:
n07070 2020-03-24 12:24:56 +01:00
parent 2ff5c656ea
commit 35d50d178a
3 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,7 @@
// Define constants
#ifndef NODE_H
#define NODE_H
// fonctions signatures
void listen_for_packets();
@ -24,3 +26,5 @@ void t_get_network_state();
char * hash();
short * get_seq_no(short s, int n);
#endif

View File

@ -1,6 +1,9 @@
#include <stdio.h>
#include <string.h>
#ifndef PARSER_H
#define PARSER_H
typedef enum cmd_type {
NEIGHBOUR_REQ, NETWORK_STATE_REQ, NODE_STATE_REQ, SEND, ERROR
} cmd_type;
@ -12,3 +15,5 @@ typedef struct cmd_token {
// retourne le type de commande à exécuter
cmd_token parse_cmd();
#endif

View File

@ -3,6 +3,9 @@
#include <stdlib.h>
#include "parser.h"
#ifndef TLV_H
#define TLV_H
// 8 octets min (struct pointer 4 octets), 1024 octets max
typedef struct packet {
unsigned char magic; // 95 (si autre, ignorer)
@ -111,3 +114,5 @@ 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(tlv *tlv, long node_id, short seqno, char *node_hash, char *data);
int build_warning(tlv *tlv, char *message);
#endif