Add network constants

This commit is contained in:
Théophile Bastian 2016-11-16 18:56:52 +01:00
parent 6c05e83024
commit 17c4cc7bde
3 changed files with 48 additions and 0 deletions

1
.gitignore vendored
View file

@ -28,3 +28,4 @@
*.out
*.app
projet.pdf

14
data.h Normal file
View file

@ -0,0 +1,14 @@
/***************************************************************************
* By Théophile Bastian, 2017
* M1 Network course project at ENS Cachan, Juliusz Chroboczek.
* License: WTFPL v2 <http://www.wtfpl.net/>
**************************************************************************/
#pragma once
#include <cstdint>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;

33
nw_constants.h Normal file
View file

@ -0,0 +1,33 @@
/***************************************************************************
* By Théophile Bastian, 2017
* M1 Network course project at ENS Cachan, Juliusz Chroboczek.
* License: WTFPL v2 <http://www.wtfpl.net/>
**************************************************************************/
#pragma once
#include "data.h"
namespace csts {
const u8 MAGIC = 57;
const u8 VERSION = 0;
const u8 TLV_PAD1 = 0;
const u8 TLV_PADN = 1;
const u8 TLV_IHU = 2;
const u8 TLV_NR = 3;
const u8 TLV_NEIGH = 4;
const u8 TLV_DATA = 5;
const u8 TLV_IHAVE = 6;
const u8 TLV_DATA_TEXT = 32;
const u8 TLV_DATA_PNG = 33;
const u8 TLV_DATA_JPG = 34;
const int TIMEOUT_UNIDIR = 100*1000; // ms
const int TIMEOUT_SYM_RECV = 150*1000; // ms
const int TIMEOUT_SYM_IHU = 300*1000; // ms
};