M1-nw-project/nw_constants.h

47 lines
1.1 KiB
C++

/***************************************************************************
* 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; // s
const int TIMEOUT_SYM_RECV = 150; // s
const int TIMEOUT_SYM_IHU = 300; // s
const int TIMEOUT_DATA = 35*60; // s
const int TIME_RESEND_IHU = 90; // s
const int TIME_RESEND_EMPTY = 30; // s
const int TIME_REPUBLISH_DATA = 25*60; // s
const int TIME_PEER_PEEK = 30; // s
const int TIME_SEND_NR = 60; // s
const int TIME_RESEND_FLOOD = 3; // s
const int SYM_COUNT_BEFORE_PEEK = 5;
const int NB_NEIGH_PER_NR = 5;
const int FLOOD_RETRIES = 3;
const u16 DEFAULT_PORT = 1192;
}