internal static (PeerId fromPeerId, PeerId toPeerId, StreamId streamId, string extensionId) ParseExtensionSignalingPacket(BinaryReader reader) { var fromPeerId = PeerId.Decode(reader); var toPeerId = PeerId.Decode(reader); var streamId = StreamId.Decode(reader); var extensionId = P2ptpCommon.DecodeString1ASCII(reader); return(fromPeerId, toPeerId, streamId, extensionId); }
public PeerHelloPacket(byte[] data) { if (data.Length < MinEncodedSize) { throw new ArgumentException(nameof(data)); } var index = P2ptpCommon.HeaderSize; FromPeerId = PeerId.Decode(data, ref index); StreamId = StreamId.Decode(data, ref index); ToPeerId = PeerId.Decode(data, ref index); LibraryVersion = P2ptpCommon.DecodeUInt32(data, ref index); ProtocolVersion = P2ptpCommon.DecodeUInt16(data, ref index); Status = (PeerHelloRequestStatus)data[index++]; RequestTime32 = P2ptpCommon.DecodeUInt32(data, ref index); RoleFlags = data[index++]; var extensionIdsLength = data[index++]; ExtensionIds = new string[extensionIdsLength]; for (byte i = 0; i < extensionIdsLength; i++) { ExtensionIds[i] = P2ptpCommon.DecodeString1ASCII(data, ref index); } }