public static PeerAddress Decode(XdrDataInputStream stream) { PeerAddress decodedPeerAddress = new PeerAddress(); decodedPeerAddress.Ip = PeerAddressIp.Decode(stream); decodedPeerAddress.Port = Uint32.Decode(stream); decodedPeerAddress.NumFailures = Uint32.Decode(stream); return(decodedPeerAddress); }
public static PeerAddress Decode(IByteReader stream) { PeerAddress decodedPeerAddress = new PeerAddress(); decodedPeerAddress.Ip = PeerAddressIp.Decode(stream); decodedPeerAddress.Port = Uint32.Decode(stream); decodedPeerAddress.NumFailures = Uint32.Decode(stream); return(decodedPeerAddress); }
public static void Encode(IByteWriter stream, PeerAddressIp encodedPeerAddressIp) { XdrEncoding.EncodeInt32((int)encodedPeerAddressIp.Discriminant.InnerValue, stream); switch (encodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = encodedPeerAddressIp.Ipv4.Length; XdrEncoding.WriteFixOpaque(stream, (uint)ipv4size, encodedPeerAddressIp.Ipv4); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = encodedPeerAddressIp.Ipv6.Length; XdrEncoding.WriteFixOpaque(stream, (uint)ipv6size, encodedPeerAddressIp.Ipv6); break; } }
public static PeerAddressIp Decode(IByteReader stream) { PeerAddressIp decodedPeerAddressIp = new PeerAddressIp(); decodedPeerAddressIp.Discriminant = IPAddrType.Decode(stream); switch (decodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = 4; decodedPeerAddressIp.Ipv4 = XdrEncoding.ReadFixOpaque(stream, (uint)ipv4size); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = 16; decodedPeerAddressIp.Ipv6 = XdrEncoding.ReadFixOpaque(stream, (uint)ipv6size); break; } return decodedPeerAddressIp; }
public static void Encode(IByteWriter stream, PeerAddressIp encodedPeerAddressIp) { XdrEncoding.EncodeInt32((int)encodedPeerAddressIp.Discriminant.InnerValue, stream); switch (encodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = encodedPeerAddressIp.Ipv4.Length; XdrEncoding.WriteFixOpaque(stream, (uint)ipv4size, encodedPeerAddressIp.Ipv4); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = encodedPeerAddressIp.Ipv6.Length; XdrEncoding.WriteFixOpaque(stream, (uint)ipv6size, encodedPeerAddressIp.Ipv6); break; } }
public static void Encode(XdrDataOutputStream stream, PeerAddressIp encodedPeerAddressIp) { stream.WriteInt((int)encodedPeerAddressIp.Discriminant.InnerValue); switch (encodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = encodedPeerAddressIp.Ipv4.Length; stream.Write(encodedPeerAddressIp.Ipv4, 0, ipv4size); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = encodedPeerAddressIp.Ipv6.Length; stream.Write(encodedPeerAddressIp.Ipv6, 0, ipv6size); break; } }
public static PeerAddressIp Decode(IByteReader stream) { PeerAddressIp decodedPeerAddressIp = new PeerAddressIp(); decodedPeerAddressIp.Discriminant = IPAddrType.Decode(stream); switch (decodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = 4; decodedPeerAddressIp.Ipv4 = XdrEncoding.ReadFixOpaque(stream, (uint)ipv4size); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = 16; decodedPeerAddressIp.Ipv6 = XdrEncoding.ReadFixOpaque(stream, (uint)ipv6size); break; } return(decodedPeerAddressIp); }
public static PeerAddressIp Decode(XdrDataInputStream stream) { PeerAddressIp decodedPeerAddressIp = new PeerAddressIp(); IPAddrType discriminant = IPAddrType.Decode(stream); decodedPeerAddressIp.Discriminant = discriminant; switch (decodedPeerAddressIp.Discriminant.InnerValue) { case IPAddrType.IPAddrTypeEnum.IPv4: int ipv4size = 4; decodedPeerAddressIp.Ipv4 = new byte[ipv4size]; stream.Read(decodedPeerAddressIp.Ipv4, 0, ipv4size); break; case IPAddrType.IPAddrTypeEnum.IPv6: int ipv6size = 16; decodedPeerAddressIp.Ipv6 = new byte[ipv6size]; stream.Read(decodedPeerAddressIp.Ipv6, 0, ipv6size); break; } return(decodedPeerAddressIp); }
public static void Encode(XdrDataOutputStream stream, PeerAddress encodedPeerAddress) { PeerAddressIp.Encode(stream, encodedPeerAddress.Ip); Uint32.Encode(stream, encodedPeerAddress.Port); Uint32.Encode(stream, encodedPeerAddress.NumFailures); }
public static void Encode(IByteWriter stream, PeerAddress encodedPeerAddress) { PeerAddressIp.Encode(stream, encodedPeerAddress.Ip); Uint32.Encode(stream, encodedPeerAddress.Port); Uint32.Encode(stream, encodedPeerAddress.NumFailures); }