Register for packet types in NodeList

This commit is contained in:
Ryan Huffman 2015-07-08 11:15:00 -07:00
parent 9d0bffaa19
commit 8a415b2adb
2 changed files with 18 additions and 0 deletions

View file

@ -90,6 +90,18 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
// we definitely want STUN to update our public socket, so call the LNL to kick that off
startSTUNPublicSocketUpdate();
auto packetReceiver = getPacketReceiver();
packetReceiver.registerPacketListener(PacketType::DomainList, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::DomainServerAddedNode, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::DomainServerRequireDTLS, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::ICEServerPeerInformation, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::Ping, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::PingReply, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::ICEPing, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::ICEPingReply, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::StunResponse, this, "processReceivedPacket");
packetReceiver.registerPacketListener(PacketType::DomainServerPathResponse, this, "processReceivedPacket");
}
qint64 NodeList::sendStats(const QJsonObject& statsObject, const HifiSockAddr& destination) {
@ -152,6 +164,11 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
}
}
// TODO: Break this out into individual packet types
void NodeList::processReceivedPacket(std::unique_ptr<NLPacket>, HifiSockAddr senderSockAddr) {
qDebug() << "Got packet!";
}
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
PacketType::Value packetType = packetTypeForPacket(packet);
switch (packetType) {

View file

@ -61,6 +61,7 @@ public:
void addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes);
void resetNodeInterestSet() { _nodeTypesOfInterest.clear(); }
void processReceivedPacket(std::unique_ptr<NLPacket>, HifiSockAddr senderSockAddr);
void processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet);
void setAssignmentServerSocket(const HifiSockAddr& serverSocket) { _assignmentServerSocket = serverSocket; }