Lines Matching defs:packet
65 wxCHECK_RET(length >= 2, wxT("Invalid packet."));
84 AddDebugLogLineN(logServerUDP, CFormat(wxT("Expected encrypted packet, but received unencrytped from server %s, UDPKey %u, Challenge: %u")) % pServer->GetListName() % pServer->GetServerKeyUDP() % pServer->GetChallenge());
86 AddDebugLogLineN(logServerUDP, CFormat(wxT("Received encrypted packet from server %s, UDPKey %u, Challenge: %u")) % pServer->GetListName() % pServer->GetServerKeyUDP() % pServer->GetChallenge());
97 AddDebugLogLineN(logServerUDP, CFormat(wxT("Received invalid packet, protocol (0x%x) and opcode (0x%x)")) % protocol % opcode);
104 void CServerUDPSocket::ProcessPacket(CMemFile& packet, uint8 opcode, uint32 ip, uint16 port)
107 unsigned size = packet.GetLength();
111 CFormat( wxT("Received UDP server packet from %s:%u, opcode (0x%x)")) %
124 theApp->searchlist->ProcessUDPSearchAnswer(packet, true, ip, port - 4);
126 if (packet.GetPosition() + 2 < size) {
127 // An additional packet?
128 uint8 protocol = packet.ReadUInt8();
129 uint8 new_opcode = packet.ReadUInt8();
137 wxT("Got server search reply with additional packet.") );
141 } while (packet.GetPosition()+2 < size);
148 CMD4Hash fileid = packet.ReadHash();
150 file->AddSources(packet, ip, port-4, SF_REMOTE_SERVER, false);
154 uint8 count = packet.ReadUInt8();
155 packet.Seek(count*(4+2), wxFromCurrent);
158 if (packet.GetPosition()+2 < size) {
159 // An additional packet?
160 uint8 protocol = packet.ReadUInt8();
161 uint8 new_opcode = packet.ReadUInt8();
169 } while ((packet.GetPosition() + 2) < size);
176 throw wxString(CFormat(wxT("Unknown server on a OP_GLOBSERVSTATRES packet (%s:%d)")) % Uint32toStringIP(ip) % (port-4));
179 throw wxString(CFormat(wxT("Invalid OP_GLOBSERVSTATRES packet (size=%u)")) % size);
181 uint32 challenge = packet.ReadUInt32();
183 throw wxString(CFormat(wxT("Invalid challenge on OP_GLOBSERVSTATRES packet (0x%x != 0x%x)")) % challenge % update->GetChallenge());
191 uint32 cur_user = packet.ReadUInt32();
192 uint32 cur_files = packet.ReadUInt32();
202 cur_maxusers = packet.ReadUInt32();
204 cur_softfiles = packet.ReadUInt32();
205 cur_hardfiles = packet.ReadUInt32();
207 uUDPFlags = packet.ReadUInt32();
209 uLowIDUsers = packet.ReadUInt32();
211 nUDPObfuscationPort = packet.ReadUInt16();
212 nTCPObfuscationPort = packet.ReadUInt16();
213 dwServerUDPKey = packet.ReadUInt32();
244 //theStats.AddUpDataOverheadServer(packet->size);
260 // old packet: <name_len 2><name name_len><desc_len 2 desc_en>
261 // new packet: <challenge 4><taglist>
266 uint16 Len = packet.ReadUInt16();
268 packet.Seek(-2, wxFromCurrent); // Step back
272 if (update->GetDescReqChallenge() != 0 && packet.ReadUInt32() == update->GetDescReqChallenge()) {
276 uint32 uTags = packet.ReadUInt32();
278 CTag tag(packet, update->GetUnicodeSupport());
305 // A server sent us a new server description packet (including a challenge) although we did not
309 // ignore this packet
313 update->SetDescription(packet.ReadString(update->GetUnicodeSupport()));
314 update->SetListName(packet.ReadString(update->GetUnicodeSupport()));
324 AddDebugLogLineN(logServerUDP, wxT("Invalid UDP packet encountered: ") + error.what());
349 void CServerUDPSocket::SendPacket(CPacket* packet, CServer* host, bool delPacket, bool rawpacket, uint16 port_offset)
363 // We might need to encrypt the packet for this server.
365 uint16 uRawPacketSize = packet->GetPacketSize() + 2;
367 memcpy(pRawPacket, packet->GetUDPHeader(), 2);
368 memcpy(pRawPacket + 2, packet->GetDataBuffer(), packet->GetPacketSize());
371 AddDebugLogLineN(logServerUDP, CFormat(wxT("Sending encrypted packet to server %s, UDPKey %u, port %u, original OPCode 0x%02x")) % host->GetListName() % host->GetServerKeyUDP() % host->GetObfuscationPortUDP() % packet->GetOpCode());
375 item.packet = new CPacket(encryptedpacket, pRawPacket[0], pRawPacket[1]);
379 delete packet;
383 AddDebugLogLineN(logServerUDP, CFormat(wxT("Sending regular packet to server %s, port %u (raw = %s), OPCode 0x%02x")) % host->GetListName() % host->GetObfuscationPortUDP() % (rawpacket ? wxT("True") : wxT("False")) % packet->GetOpCode());
385 item.packet = packet;
387 item.packet = new CPacket(*packet);
406 CPacket* packet = item.packet;
418 // Not much we can do here, just drop the packet.
429 // Drop the packet, dns failed last time
430 AddDebugLogLineN(logServerUDP, wxT("Trying to send a UDP packet to a server host that failed DNS: ")+item.addr);
437 AddDebugLogLineN(logServerUDP, wxT("Sending a UDP packet to a resolved DNS server host: ")+item.addr);
442 AddDebugLogLineN(logServerUDP, wxT("Trying to send a UDP packet to a server host that is checking DNS: ")+item.addr);
443 // Let the packet queued, and wait for resolution
452 AddDebugLogLineN(logServerUDP, wxT("Trying to send a UDP packet to a server host that is not on serverlist"));
453 // Not much we can do here, just drop the packet.
461 AddDebugLogLineN(logServerUDP, wxT("Sending a UDP packet to a server: ")+update->GetAddress());
463 CMuleUDPSocket::SendPacket(packet, item.ip, item.port, false, NULL, false, 0);
465 AddDebugLogLineN(logServerUDP, wxT("Sending a UDP packet to a server no in serverlist: ")+Uint32_16toStringIP_Port(item.ip,item.port));