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

Method SendMuleInfoPacket

src/BaseClient.cpp:746–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

744}
745
746void CUpDownClient::SendMuleInfoPacket(bool bAnswer, bool OSInfo)
747{
748 wxCHECK2(m_socket != NULL, return);
749
750 CPacket* packet = NULL;
751 CMemFile data;
752
753 data.WriteUInt8(CURRENT_VERSION_SHORT);
754
755 if (OSInfo) {
756
757 // Special MuleInfo packet for clients supporting it.
758 // This means aMule >= 2.0.0 and Hydranode
759
760 // Violently mark it as special Mule Info packet
761 // Sending this makes non-supporting-osinfo clients to refuse to read this
762 // packet. Anyway, this packet should NEVER get to non-supporting clients.
763
764 data.WriteUInt8(/*EMULE_PROTOCOL*/ 0xFF);
765
766 data.WriteUInt32(1); // One Tag (OS_INFO)
767
768 CTagString tag1(ET_OS_INFO,theApp->GetOSType());
769 tag1.WriteTagToFile(&data);
770
771 m_OSInfo_sent = true; // So we don't send it again
772
773 } else {
774
775 // Normal MuleInfo packet
776
777 // Kry - There's no point on upgrading to VBT tags here
778 // as no client supporting it uses mule info packet.
779
780 data.WriteUInt8(EMULE_PROTOCOL);
781
782 // Tag number
783 data.WriteUInt32(9);
784
785 CTagInt32 tag1(ET_COMPRESSION,1);
786 tag1.WriteTagToFile(&data);
787 CTagInt32 tag2(ET_UDPVER,4);
788 tag2.WriteTagToFile(&data);
789 CTagInt32 tag3(ET_UDPPORT, thePrefs::GetEffectiveUDPPort());
790 tag3.WriteTagToFile(&data);
791 CTagInt32 tag4(ET_SOURCEEXCHANGE,3);
792 tag4.WriteTagToFile(&data);
793 CTagInt32 tag5(ET_COMMENTS,1);
794 tag5.WriteTagToFile(&data);
795 CTagInt32 tag6(ET_EXTENDEDREQUEST,2);
796 tag6.WriteTagToFile(&data);
797
798 uint32 dwTagValue = (theApp->CryptoAvailable() ? 3 : 0);
799 // Kry - Needs the preview code from eMule
800 /*
801 // set 'Preview supported' only if 'View Shared Files' allowed
802 if (thePrefs::CanSeeShares() != vsfaNobody) {
803 dwTagValue |= 128;

Callers 2

ProcessPacketMethod · 0.80
ProcessExtPacketMethod · 0.80

Calls 5

WriteUInt8Method · 0.80
WriteUInt32Method · 0.80
WriteTagToFileMethod · 0.80
GetPacketSizeMethod · 0.80
CryptoAvailableMethod · 0.45

Tested by

no test coverage detected