MCPcopy Create free account
hub / github.com/amule-project/amule / ProcessHelloTypePacket

Method ProcessHelloTypePacket

src/BaseClient.cpp:467–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467bool CUpDownClient::ProcessHelloTypePacket(const CMemFile& data)
468{
469 uint32 dwEmuleTags = 0;
470
471 CMD4Hash hash = data.ReadHash();
472 SetUserHash( hash );
473 SetUserIDHybrid( data.ReadUInt32() );
474 uint16 nUserPort = data.ReadUInt16(); // hmm clientport is sent twice - why?
475 uint32 tagcount = data.ReadUInt32();
476 for (uint32 i = 0;i < tagcount; i++){
477 CTag temptag(data, true);
478 switch(temptag.GetNameID()){
479 case CT_NAME:
480 m_Username = temptag.GetStr();
481 break;
482
483 case CT_VERSION:
484 m_nClientVersion = temptag.GetInt();
485 break;
486
487 case ET_MOD_VERSION:
488 if (temptag.IsStr()) {
489 m_strModVersion = temptag.GetStr();
490 } else if (temptag.IsInt()) {
491 m_strModVersion = CFormat("ModID=%u") % temptag.GetInt();
492 } else {
493 m_strModVersion = "ModID=<Unknown>";
494 }
495
496 break;
497
498 case CT_PORT:
499 nUserPort = temptag.GetInt();
500 break;
501
502 case CT_EMULE_UDPPORTS:
503 // 16 KAD Port
504 // 16 UDP Port
505 SetKadPort((temptag.GetInt() >> 16) & 0xFFFF);
506 m_nUDPPort = temptag.GetInt() & 0xFFFF;
507 dwEmuleTags |= 1;
508 #ifdef __PACKET_DEBUG__
509 AddLogLineNS(CFormat("Hello type packet processing with eMule ports UDP=%i KAD=%i") % m_nUDPPort % m_nKadPort);
510 #endif
511 break;
512
513 case CT_EMULE_BUDDYIP:
514 // 32 BUDDY IP
515 m_nBuddyIP = temptag.GetInt();
516 #ifdef __PACKET_DEBUG__
517 AddLogLineNS(CFormat("Hello type packet processing with eMule BuddyIP=%u (%s)") % m_nBuddyIP % Uint32toStringIP(m_nBuddyIP));
518 #endif
519 break;
520
521 case CT_EMULE_BUDDYUDP:
522 // 16 --Reserved for future use--
523 // 16 BUDDY Port
524 m_nBuddyPort = (uint16)temptag.GetInt();

Callers

nothing calls this directly

Calls 15

CFormatClass · 0.85
Uint32toStringIPFunction · 0.85
ReadUInt32Method · 0.80
ReadUInt16Method · 0.80
GetNameIDMethod · 0.80
IsStrMethod · 0.80
SetListNameMethod · 0.80
GetCreditMethod · 0.80
ComparePriorUserhashMethod · 0.80
FindFriendMethod · 0.80
LinkClientMethod · 0.80
wxStringClass · 0.70

Tested by

no test coverage detected