X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMono.Security%2FMono.Security.Protocol.Tls%2FTlsStream.cs;h=cb112e9bdad92d7ca5416e4ee6de9554f8ef6427;hb=6b6435d1b3206b0162c37e5ecce8d9a699fe6467;hp=4eeea2d28ae95b46ede2ccce0bfbbc9858a80dde;hpb=b2268df5368412ab0d3098af78fc28cd9067f1f4;p=mono.git diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs index 4eeea2d28ae..cb112e9bdad 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs @@ -1,26 +1,26 @@ -/* Transport Security Layer (TLS) - * Copyright (c) 2003 Carlos Guzmán Álvarez - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ +// Transport Security Layer (TLS) +// Copyright (c) 2003-2004 Carlos Guzman Alvarez + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// using System; using System.IO; @@ -30,7 +30,7 @@ namespace Mono.Security.Protocol.Tls { internal class TlsStream : Stream { - #region FIELDS + #region Fields private bool canRead; private bool canWrite; @@ -38,7 +38,7 @@ namespace Mono.Security.Protocol.Tls #endregion - #region PROPERTIES + #region Properties public bool EOF { @@ -57,37 +57,37 @@ namespace Mono.Security.Protocol.Tls #endregion - #region STREAM_PROPERTIES + #region Stream Properties public override bool CanWrite { - get { return canWrite; } + get { return this.canWrite; } } public override bool CanRead { - get { return canRead; } + get { return this.canRead; } } public override bool CanSeek { - get { return buffer.CanSeek; } + get { return this.buffer.CanSeek; } } public override long Position { - get { return buffer.Position; } - set { buffer.Position = value; } + get { return this.buffer.Position; } + set { this.buffer.Position = value; } } public override long Length { - get { return buffer.Length; } + get { return this.buffer.Length; } } #endregion - #region CONSTRUCTORS + #region Constructors public TlsStream() : base() { @@ -105,7 +105,7 @@ namespace Mono.Security.Protocol.Tls #endregion - #region SPECIFIC_READ_METHODS + #region Specific Read Methods public new byte ReadByte() { @@ -150,17 +150,17 @@ namespace Mono.Security.Protocol.Tls #endregion - #region SPECIFIC_WRITE_METHODS + #region Specific Write Methods public void Write(byte value) { - WriteByte(value); + this.WriteByte(value); } public void Write(short value) { byte[] bytes = BitConverter.GetBytes((short)IPAddress.HostToNetworkOrder(value)); - Write(bytes); + this.Write(bytes); } public void WriteInt24(int value) @@ -168,65 +168,65 @@ namespace Mono.Security.Protocol.Tls int int24 = IPAddress.HostToNetworkOrder(value); byte[] content = new byte[3]; - System.Array.Copy(BitConverter.GetBytes(int24), 1, content, 0, 3); + Buffer.BlockCopy(BitConverter.GetBytes(int24), 1, content, 0, 3); - Write(content); + this.Write(content); } public void Write(int value) { byte[] bytes = BitConverter.GetBytes((int)IPAddress.HostToNetworkOrder(value)); - Write(bytes); + this.Write(bytes); } public void Write(long value) { byte[] bytes = BitConverter.GetBytes((long)IPAddress.HostToNetworkOrder(value)); - Write(bytes); + this.Write(bytes); } public void Write(byte[] buffer) { - Write(buffer, 0, buffer.Length); + this.Write(buffer, 0, buffer.Length); } #endregion - #region METHODS + #region Methods public void Reset() { - buffer.SetLength(0); - buffer.Position = 0; + this.buffer.SetLength(0); + this.buffer.Position = 0; } public byte[] ToArray() { - return buffer.ToArray(); + return this.buffer.ToArray(); } #endregion - #region STREAM_METHODS + #region Stream Methods public override void Flush() { - buffer.Flush(); + this.buffer.Flush(); } public override void SetLength(long length) { - buffer.SetLength(length); + this.buffer.SetLength(length); } public override long Seek(long offset, System.IO.SeekOrigin loc) { - return buffer.Seek(offset, loc); + return this.buffer.Seek(offset, loc); } public override int Read(byte[] buffer, int offset, int count) { - if (canRead) + if (this.canRead) { return this.buffer.Read(buffer, offset, count); } @@ -235,7 +235,7 @@ namespace Mono.Security.Protocol.Tls public override void Write(byte[] buffer, int offset, int count) { - if (canWrite) + if (this.canWrite) { this.buffer.Write(buffer, offset, count); }