You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
838 B
31 lines
838 B
/*************************************************************************** |
|
* By Théophile Bastian, 2017 |
|
* M1 Network course project at ENS Cachan, Juliusz Chroboczek. |
|
* License: WTFPL v2 <http://www.wtfpl.net/> |
|
**************************************************************************/ |
|
|
|
#pragma once |
|
|
|
#include "neighbours.h" |
|
#include "protocol.h" |
|
#include "dataStore.h" |
|
|
|
class PacketParser { |
|
public: |
|
PacketParser(Neighbours* nei, Protocol* proto, DataStore* dataStore); |
|
|
|
void parse(Bytes pck, const SockAddr& addr); |
|
|
|
private: //meth |
|
void readTLV(Bytes& pck, u64 nei, const SockAddr& addr); |
|
void receiveNeigh(Bytes& pck); |
|
void receiveData(Bytes& pck, u64 from); |
|
void receiveIHave(Bytes& pck, u64 from); |
|
void handleNR(u64 from); |
|
|
|
private: |
|
Neighbours* neighbours; |
|
Protocol* protocol; |
|
DataStore* dataStore; |
|
}; |
|
|
|
|