From 17c4cc7bde0a5e2ee5ef7a1c05de63a672951a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Wed, 16 Nov 2016 18:56:52 +0100 Subject: [PATCH] Add network constants --- .gitignore | 1 + data.h | 14 ++++++++++++++ nw_constants.h | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 data.h create mode 100644 nw_constants.h diff --git a/.gitignore b/.gitignore index 14b117c..e5e1e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ *.out *.app +projet.pdf diff --git a/data.h b/data.h new file mode 100644 index 0000000..6d89822 --- /dev/null +++ b/data.h @@ -0,0 +1,14 @@ +/*************************************************************************** + * By Théophile Bastian, 2017 + * M1 Network course project at ENS Cachan, Juliusz Chroboczek. + * License: WTFPL v2 + **************************************************************************/ + +#pragma once + +#include + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; + diff --git a/nw_constants.h b/nw_constants.h new file mode 100644 index 0000000..5c4cf2b --- /dev/null +++ b/nw_constants.h @@ -0,0 +1,33 @@ +/*************************************************************************** + * By Théophile Bastian, 2017 + * M1 Network course project at ENS Cachan, Juliusz Chroboczek. + * License: WTFPL v2 + **************************************************************************/ + +#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 + +}; +