コード例 #1
0
        public static void Encode(XdrDataOutputStream stream, PeerStatList encodedPeerStatList)
        {
            int PeerStatListsize = encodedPeerStatList.InnerValue.Length;

            stream.WriteInt(PeerStatListsize);
            for (int i = 0; i < PeerStatListsize; i++)
            {
                PeerStats.Encode(stream, encodedPeerStatList.InnerValue[i]);
            }
        }
コード例 #2
0
        public static PeerStatList Decode(XdrDataInputStream stream)
        {
            PeerStatList decodedPeerStatList = new PeerStatList();
            int          PeerStatListsize    = stream.ReadInt();

            decodedPeerStatList.InnerValue = new PeerStats[PeerStatListsize];
            for (int i = 0; i < PeerStatListsize; i++)
            {
                decodedPeerStatList.InnerValue[i] = PeerStats.Decode(stream);
            }
            return(decodedPeerStatList);
        }
コード例 #3
0
 public static void Encode(XdrDataOutputStream stream, PeerStats encodedPeerStats)
 {
     NodeID.Encode(stream, encodedPeerStats.Id);
     stream.WriteString(encodedPeerStats.VersionStr);
     Uint64.Encode(stream, encodedPeerStats.MessagesRead);
     Uint64.Encode(stream, encodedPeerStats.MessagesWritten);
     Uint64.Encode(stream, encodedPeerStats.BytesRead);
     Uint64.Encode(stream, encodedPeerStats.BytesWritten);
     Uint64.Encode(stream, encodedPeerStats.SecondsConnected);
     Uint64.Encode(stream, encodedPeerStats.UniqueFloodBytesRecv);
     Uint64.Encode(stream, encodedPeerStats.DuplicateFloodBytesRecv);
     Uint64.Encode(stream, encodedPeerStats.UniqueFetchBytesRecv);
     Uint64.Encode(stream, encodedPeerStats.DuplicateFetchBytesRecv);
     Uint64.Encode(stream, encodedPeerStats.UniqueFloodMessageRecv);
     Uint64.Encode(stream, encodedPeerStats.DuplicateFloodMessageRecv);
     Uint64.Encode(stream, encodedPeerStats.UniqueFetchMessageRecv);
     Uint64.Encode(stream, encodedPeerStats.DuplicateFetchMessageRecv);
 }
コード例 #4
0
        public static PeerStats Decode(XdrDataInputStream stream)
        {
            PeerStats decodedPeerStats = new PeerStats();

            decodedPeerStats.Id                        = NodeID.Decode(stream);
            decodedPeerStats.VersionStr                = stream.ReadString();
            decodedPeerStats.MessagesRead              = Uint64.Decode(stream);
            decodedPeerStats.MessagesWritten           = Uint64.Decode(stream);
            decodedPeerStats.BytesRead                 = Uint64.Decode(stream);
            decodedPeerStats.BytesWritten              = Uint64.Decode(stream);
            decodedPeerStats.SecondsConnected          = Uint64.Decode(stream);
            decodedPeerStats.UniqueFloodBytesRecv      = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFloodBytesRecv   = Uint64.Decode(stream);
            decodedPeerStats.UniqueFetchBytesRecv      = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFetchBytesRecv   = Uint64.Decode(stream);
            decodedPeerStats.UniqueFloodMessageRecv    = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFloodMessageRecv = Uint64.Decode(stream);
            decodedPeerStats.UniqueFetchMessageRecv    = Uint64.Decode(stream);
            decodedPeerStats.DuplicateFetchMessageRecv = Uint64.Decode(stream);
            return(decodedPeerStats);
        }