Example #1
0
 public void AddTag(KadTag pTag, uint uDbgSourceIP = 0)
 {
     // Filter tags which are for sending query results only and should never be stored (or even worse sent within the taglist)
     if (!pTag->m_name.Compare(TAG_KADAICHHASHRESULT))
     {
         DebugLogWarning(_T("Received result tag TAG_KADAICHHASHRESULT on publishing, filtered, source %s"), ipstr(ntohl(uDbgSourceIP)));
         delete pTag;
     }
     else if (!pTag->m_name.Compare(TAG_PUBLISHINFO))
     {
         DebugLogWarning("Received result tag TAG_PUBLISHINFO on publishing, filtered, source %s", ipstr(ntohl(uDbgSourceIP)));
         delete pTag;
     }
     else
     {
         m_listTag.push_back(pTag);
     }
 }
Example #2
0
        public Entry Copy()
        {
            Entry pEntry = new Entry();

            for (POSITION pos = m_listFileNames.GetHeadPosition(); pos != null;)
            {
                pEntry.m_listFileNames.AddTail(m_listFileNames.GetNext(pos));
            }
            pEntry.m_uIP = m_uIP;
            pEntry.m_uKeyID.SetValue(m_uKeyID);
            pEntry.m_tLifetime = m_tLifetime;
            pEntry.m_uSize     = m_uSize;
            pEntry.m_bSource   = m_bSource;
            pEntry.m_uSourceID.SetValue(m_uSourceID);
            pEntry.m_uTCPPort = m_uTCPPort;
            pEntry.m_uUDPPort = m_uUDPPort;
            for (TagList::const_iterator itTagList = m_listTag.begin(); itTagList != m_listTag.end(); itTagList++)
            {
                KadTag pTag = *itTagList;
                pEntry.m_listTag.push_back(pTag.Copy());
            }
            return(pEntry);
        }
Example #3
0
        public bool GetIntTagValue(KadTagNameString strTagName, ulong rValue, bool bIncludeVirtualTags)
        {
            for (TagList::const_iterator itTagList = m_listTag.begin(); itTagList != m_listTag.end(); itTagList++)
            {
                KadTag pTag = *itTagList;
                if (pTag.IsInt() && !pTag.m_name.Compare(strTagName))
                {
                    rValue = pTag->GetInt();
                    return(true);
                }
            }

            if (bIncludeVirtualTags)
            {
                // SizeTag is not stored anymore, but queried in some places
                if (!strTagName.Compare(TAG_FILESIZE))
                {
                    rValue = m_uSize;
                    return(true);
                }
            }
            rValue = 0;
            return(false);
        }