You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2007/02/26 18:46:12 UTC
svn commit: r511923 [4/4] - in /incubator/qpid/trunk/qpid/dotnet: ./
Qpid.Buffer.Tests/ Qpid.Buffer.Tests/Properties/ Qpid.Buffer/
Qpid.Client.Tests/ Qpid.Client/ Qpid.Client/Client/
Qpid.Client/Client/Message/ Qpid.Client/Client/Transport/Socket/Block...
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/EncodingUtils.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/EncodingUtils.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/EncodingUtils.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/EncodingUtils.cs Mon Feb 26 09:46:07 2007
@@ -19,6 +19,7 @@
*
*/
using System;
+using System.Globalization;
using System.Text;
using Qpid.Buffer;
@@ -52,13 +53,13 @@
encodedString = DEFAULT_ENCODER.GetBytes(s);
}
// TODO: check length fits in an unsigned byte
- buffer.put((byte)encodedString.Length);
- buffer.put(encodedString);
+ buffer.Put((byte)encodedString.Length);
+ buffer.Put(encodedString);
} else
{
// really writing out unsigned byte
- buffer.put((byte)0);
+ buffer.Put((byte)0);
}
}
@@ -103,14 +104,14 @@
}
public static string ReadLongString(ByteBuffer buffer, Encoding encoding)
{
- uint length = buffer.getUnsignedInt();
+ uint length = buffer.GetUInt32();
if ( length == 0 )
{
return null;
} else
{
byte[] data = new byte[length];
- buffer.get(data);
+ buffer.GetBytes(data);
lock ( encoding )
{
return encoding.GetString(data);
@@ -132,14 +133,13 @@
{
lock ( encoding )
{
- byte[] encodedString = null;
- encodedString = encoding.GetBytes(s);
- buffer.put((uint)encodedString.Length);
- buffer.put(encodedString);
+ byte[] encodedString = encoding.GetBytes(s);
+ buffer.Put((uint)encodedString.Length);
+ buffer.Put(encodedString);
}
} else
{
- buffer.put((uint)0);
+ buffer.Put((uint)0);
}
}
@@ -156,14 +156,14 @@
}
public static byte[] ReadLongstr(ByteBuffer buffer)
{
- uint length = buffer.getUnsignedInt();
+ uint length = buffer.GetUInt32();
if ( length == 0 )
{
return null;
} else
{
byte[] result = new byte[length];
- buffer.get(result);
+ buffer.GetBytes(result);
return result;
}
}
@@ -171,18 +171,18 @@
{
if ( data != null )
{
- buffer.put((uint)data.Length);
- buffer.put(data);
+ buffer.Put((uint)data.Length);
+ buffer.Put(data);
} else
{
- buffer.put((uint)0);
+ buffer.Put((uint)0);
}
}
// BOOLEANS
public static bool[] ReadBooleans(ByteBuffer buffer)
{
- byte packedValue = buffer.get();
+ byte packedValue = buffer.GetByte();
bool[] result = new bool[8];
for ( int i = 0; i < 8; i++ )
@@ -202,7 +202,7 @@
}
}
- buffer.put(packedValue);
+ buffer.Put(packedValue);
}
// FIELD TABLES
@@ -226,7 +226,7 @@
/// <exception cref="AMQFrameDecodingException">if the buffer does not contain a decodable field table</exception>
public static FieldTable ReadFieldTable(ByteBuffer buffer)
{
- uint length = buffer.GetUnsignedInt();
+ uint length = buffer.GetUInt32();
if ( length == 0 )
{
return null;
@@ -242,7 +242,7 @@
table.WriteToBuffer(buffer);
} else
{
- buffer.put((uint)0);
+ buffer.Put((uint)0);
}
}
@@ -255,14 +255,14 @@
/// <exception cref="AMQFrameDecodingException">if the buffer does not contain a decodable short string</exception>
public static string ReadShortString(ByteBuffer buffer)
{
- byte length = buffer.get();
+ byte length = buffer.GetByte();
if ( length == 0 )
{
return null;
} else
{
byte[] data = new byte[length];
- buffer.get(data);
+ buffer.GetBytes(data);
lock ( DEFAULT_ENCODER )
{
@@ -280,12 +280,12 @@
}
public static bool ReadBoolean(ByteBuffer buffer)
{
- byte packedValue = buffer.get();
+ byte packedValue = buffer.GetByte();
return (packedValue == 1);
}
public static void WriteBoolean(ByteBuffer buffer, bool value)
{
- buffer.put((byte)(value ? 1 : 0));
+ buffer.Put((byte)(value ? 1 : 0));
}
@@ -296,11 +296,11 @@
}
public static char ReadChar(ByteBuffer buffer)
{
- return (char)buffer.get();
+ return (char)buffer.GetByte();
}
public static void WriteChar(ByteBuffer buffer, char value)
{
- buffer.put((byte)value);
+ buffer.Put((byte)value);
}
// BYTE
@@ -310,11 +310,11 @@
}
public static byte ReadByte(ByteBuffer buffer)
{
- return buffer.get();
+ return buffer.GetByte();
}
public static void WriteByte(ByteBuffer buffer, byte value)
{
- buffer.put(value);
+ buffer.Put(value);
}
// SBYTE
@@ -324,11 +324,11 @@
}
public static sbyte ReadSByte(ByteBuffer buffer)
{
- return (sbyte)buffer.get();
+ return buffer.GetSByte();
}
public static void WriteSByte(ByteBuffer buffer, sbyte value)
{
- buffer.put((byte)value);
+ buffer.Put(value);
}
// INT16
@@ -339,11 +339,11 @@
public static short ReadShort(ByteBuffer buffer)
{
- return buffer.getShort();
+ return buffer.GetInt16();
}
public static void WriteShort(ByteBuffer buffer, short value)
{
- buffer.putShort(value);
+ buffer.Put(value);
}
// UINT16
@@ -354,11 +354,11 @@
public static ushort ReadUnsignedShort(ByteBuffer buffer)
{
- return buffer.GetUnsignedShort();
+ return buffer.GetUInt16();
}
public static void WriteUnsignedShort(ByteBuffer buffer, ushort value)
{
- buffer.put(value);
+ buffer.Put(value);
}
@@ -369,11 +369,11 @@
}
public static int ReadInteger(ByteBuffer buffer)
{
- return buffer.getInt();
+ return buffer.GetInt32();
}
public static void WriteInteger(ByteBuffer buffer, int value)
{
- buffer.putInt(value);
+ buffer.Put(value);
}
// UINT32
@@ -383,11 +383,11 @@
}
public static void WriteUnsignedInteger(ByteBuffer buffer, uint value)
{
- buffer.put(value);
+ buffer.Put(value);
}
public static uint ReadUnsignedInteger(ByteBuffer buffer)
{
- return buffer.getUnsignedInt();
+ return buffer.GetUInt32();
}
// INT64
@@ -397,11 +397,11 @@
}
public static ulong ReadUnsignedLong(ByteBuffer buffer)
{
- return buffer.GetUnsignedLong();
+ return buffer.GetUInt64();
}
public static void WriteUnsignedLong(ByteBuffer buffer, ulong value)
{
- buffer.put(value);
+ buffer.Put(value);
}
// UINT64
@@ -411,11 +411,11 @@
}
public static long ReadLong(ByteBuffer buffer)
{
- return buffer.getLong();
+ return buffer.GetInt64();
}
public static void WriteLong(ByteBuffer buffer, long value)
{
- buffer.putLong(value);
+ buffer.Put(value);
}
// FLOAT
@@ -425,11 +425,11 @@
}
public static void WriteFloat(ByteBuffer buffer, float value)
{
- buffer.putFloat(value);
+ buffer.Put(value);
}
public static float ReadFloat(ByteBuffer buffer)
{
- return buffer.getFloat();
+ return buffer.GetFloat();
}
// DOUBLE
@@ -439,11 +439,20 @@
}
public static void WriteDouble(ByteBuffer buffer, double value)
{
- buffer.putDouble(value);
+ buffer.Put(value);
}
public static double ReadDouble(ByteBuffer buffer)
{
- return buffer.getDouble();
+ return buffer.GetDouble();
+ }
+
+ // OTHER
+ public static long ReadLongAsShortString(ByteBuffer buffer)
+ {
+ string value = ReadShortString(buffer);
+ if ( value == null || value.Length == 0 )
+ return 0L;
+ return Convert.ToInt64(value, CultureInfo.InvariantCulture);
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/FieldTable.cs Mon Feb 26 09:46:07 2007
@@ -50,10 +50,10 @@
/// <exception cref="AMQFrameDecodingException">if there is an error decoding the table</exception>
public FieldTable(ByteBuffer buffer, uint length) : this()
{
- _encodedForm = buffer.slice();
- _encodedForm.limit((int)length);
+ _encodedForm = buffer.Slice();
+ _encodedForm.Limit = (int)length;
_encodedSize = length;
- buffer.skip((int)length);
+ buffer.Skip((int)length);
}
/// <summary>
@@ -312,6 +312,7 @@
/// <returns>The enumerator object</returns>
public IEnumerator GetEnumerator()
{
+ InitMapIfNecessary();
return _properties.GetEnumerator();
}
@@ -322,6 +323,7 @@
/// <returns>True if the property exists</returns>
public bool Contains(string s)
{
+ InitMapIfNecessary();
return _properties.Contains(s);
}
@@ -332,6 +334,7 @@
/// <returns>The internal dictionary</returns>
public IDictionary AsDictionary()
{
+ InitMapIfNecessary();
return _properties;
}
@@ -381,11 +384,11 @@
/// <returns>An array of bytes</returns>
public byte[] GetDataAsBytes()
{
- ByteBuffer buffer = ByteBuffer.allocate((int)_encodedSize);
+ ByteBuffer buffer = ByteBuffer.Allocate((int)_encodedSize);
WritePayload(buffer);
byte[] result = new byte[_encodedSize];
- buffer.flip();
- buffer.get(result);
+ buffer.Flip();
+ buffer.GetBytes(result);
//buffer.Release();
return result;
}
@@ -527,7 +530,7 @@
bool trace = _log.IsDebugEnabled;
if ( length > 0 )
{
- int expectedRemaining = buffer.remaining() - (int)length;
+ int expectedRemaining = buffer.Remaining - (int)length;
_properties = new LinkedHashtable();
do
@@ -540,7 +543,7 @@
}
_properties.Add(key, value);
- } while ( buffer.remaining() > expectedRemaining );
+ } while ( buffer.Remaining > expectedRemaining );
_encodedSize = length;
}
if ( trace )
@@ -595,7 +598,7 @@
{
if ( _encodedForm != null )
{
- buffer.put(_encodedForm);
+ buffer.Put(_encodedForm);
} else if ( _properties != null )
{
foreach ( DictionaryEntry de in _properties )
@@ -609,8 +612,8 @@
_log.Debug("Writing Property:" + key +
" Type:" + value.Type +
" Value:" + value.Value);
- _log.Debug("Buffer Position:" + buffer.position() +
- " Remaining:" + buffer.remaining());
+ _log.Debug("Buffer Position:" + buffer.Position +
+ " Remaining:" + buffer.Remaining);
}
//Write the actual parameter name
EncodingUtils.WriteShortStringBytes(buffer, key);
@@ -623,8 +626,8 @@
_log.Debug("Writing Property:" + key +
" Type:" + value.Type +
" Value:" + value.Value);
- _log.Debug("Buffer Position:" + buffer.position() +
- " Remaining:" + buffer.remaining());
+ _log.Debug("Buffer Position:" + buffer.Position +
+ " Remaining:" + buffer.Remaining);
}
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/HeartbeatBody.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/HeartbeatBody.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/HeartbeatBody.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/HeartbeatBody.cs Mon Feb 26 09:46:07 2007
@@ -52,7 +52,7 @@
if (size > 0)
{
//allow other implementations to have a payload, but ignore it:
- buffer.skip((int) size);
+ buffer.Skip((int) size);
}
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ProtocolInitiation.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ProtocolInitiation.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ProtocolInitiation.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Framing/ProtocolInitiation.cs Mon Feb 26 09:46:07 2007
@@ -72,12 +72,12 @@
{
foreach (char c in Header)
{
- buffer.put((byte) c);
+ buffer.Put((byte) c);
}
- buffer.put(ProtocolClass);
- buffer.put(ProtocolInstance);
- buffer.put(ProtocolMajor);
- buffer.put(ProtocolMinor);
+ buffer.Put(ProtocolClass);
+ buffer.Put(ProtocolInstance);
+ buffer.Put(ProtocolMajor);
+ buffer.Put(ProtocolMinor);
}
/// <summary>
@@ -99,7 +99,7 @@
{
return MessageDecoderResult.NOT_OK;
}
- if (inbuf.remaining() < 8)
+ if (inbuf.Remaining < 8)
{
return MessageDecoderResult.NEED_DATA;
}
@@ -108,7 +108,7 @@
char[] expected = new char[]{'A', 'M', 'Q', 'P'};
for (int i = 0; i < 4; i++)
{
- if (((char) inbuf.get()) != expected[i])
+ if (((char) inbuf.GetByte()) != expected[i])
{
return MessageDecoderResult.NOT_OK;
}
@@ -120,21 +120,19 @@
/// <summary>
/// Decodes the specified session.
/// </summary>
- /// <param name="session">The session.</param>
/// <param name="inbuf">The inbuf.</param>
- /// <param name="outbuf">The outbuf.</param>
+ /// <param name="output">The protocol output.</param>
/// <returns></returns>
- /// <exception cref="ProtocolViolationException">thrown if the frame violates the protocol</exception>
public MessageDecoderResult Decode(ByteBuffer inbuf, IProtocolDecoderOutput output)
{
byte[] header = new byte[4];
- inbuf.get(header);
+ inbuf.GetBytes(header);
ProtocolInitiation pi = new ProtocolInitiation();
pi.Header = new char[]{'A','M','Q','P'};
- pi.ProtocolClass = inbuf.get();
- pi.ProtocolInstance = inbuf.get();
- pi.ProtocolMajor = inbuf.get();
- pi.ProtocolMinor = inbuf.get();
+ pi.ProtocolClass = inbuf.GetByte();
+ pi.ProtocolInstance = inbuf.GetByte();
+ pi.ProtocolMajor = inbuf.GetByte();
+ pi.ProtocolMinor = inbuf.GetByte();
output.Write(pi);
return MessageDecoderResult.OK;
}
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Qpid.Common.csproj
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Qpid.Common.csproj?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Qpid.Common.csproj (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/Qpid.Common.csproj Mon Feb 26 09:46:07 2007
@@ -89,6 +89,7 @@
<Compile Include="generated\BasicQosBody.cs" />
<Compile Include="generated\BasicQosOkBody.cs" />
<Compile Include="generated\BasicRecoverBody.cs" />
+ <Compile Include="generated\BasicRecoverOkBody.cs" />
<Compile Include="generated\BasicRejectBody.cs" />
<Compile Include="generated\BasicReturnBody.cs" />
<Compile Include="generated\ChannelAlertBody.cs" />
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Common/stylesheets/utils.xsl
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Common/stylesheets/utils.xsl?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Common/stylesheets/utils.xsl (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Common/stylesheets/utils.xsl Mon Feb 26 09:46:07 2007
@@ -67,19 +67,19 @@
<xsl:param name="f"/>
<xsl:choose>
<xsl:when test="$f/@type='char'">
- <xsl:value-of select="concat('buffer.put(', $f/@name, ')')"/>
+ <xsl:value-of select="concat('buffer.Put(', $f/@name, ')')"/>
</xsl:when>
<xsl:when test="$f/@type='octet'">
- <xsl:value-of select="concat('buffer.put(', $f/@name, ')')"/>
+ <xsl:value-of select="concat('buffer.Put(', $f/@name, ')')"/>
</xsl:when>
<xsl:when test="$f/@type='short'">
- <xsl:value-of select="concat('buffer.put(', $f/@name, ')')"/>
+ <xsl:value-of select="concat('buffer.Put(', $f/@name, ')')"/>
</xsl:when>
<xsl:when test="$f/@type='long'">
- <xsl:value-of select="concat('buffer.put(', $f/@name, ')')"/>
+ <xsl:value-of select="concat('buffer.Put(', $f/@name, ')')"/>
</xsl:when>
<xsl:when test="$f/@type='longlong'">
- <xsl:value-of select="concat('buffer.put(', $f/@name, ')')"/>
+ <xsl:value-of select="concat('buffer.Put(', $f/@name, ')')"/>
</xsl:when>
<xsl:when test="$f/@type='shortstr'">
<xsl:value-of select="concat('EncodingUtils.WriteShortStringBytes(buffer, ', $f/@name, ')')"/>
@@ -108,16 +108,16 @@
<xsl:value-of select="concat($f/@name, ' = buffer.GetChar()')"/>
</xsl:when>
<xsl:when test="$f/@type='octet'">
- <xsl:value-of select="concat($f/@name, ' = buffer.get()')"/>
+ <xsl:value-of select="concat($f/@name, ' = buffer.GetByte()')"/>
</xsl:when>
<xsl:when test="$f/@type='short'">
- <xsl:value-of select="concat($f/@name, ' = buffer.GetUnsignedShort()')"/>
+ <xsl:value-of select="concat($f/@name, ' = buffer.GetUInt16()')"/>
</xsl:when>
<xsl:when test="$f/@type='long'">
- <xsl:value-of select="concat($f/@name, ' = buffer.GetUnsignedInt()')"/>
+ <xsl:value-of select="concat($f/@name, ' = buffer.GetUInt32()')"/>
</xsl:when>
<xsl:when test="$f/@type='longlong'">
- <xsl:value-of select="concat($f/@name, ' = buffer.GetUnsignedLong()')"/>
+ <xsl:value-of select="concat($f/@name, ' = buffer.GetUInt64()')"/>
</xsl:when>
<xsl:when test="$f/@type='shortstr'">
<xsl:value-of select="concat($f/@name, ' = EncodingUtils.ReadShortString(buffer)')"/>
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Messaging/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -1,2 +1,3 @@
*.pidb
bin
+obj
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.Messaging/IHeaders.cs
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.Messaging/IHeaders.cs?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.Messaging/IHeaders.cs (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.Messaging/IHeaders.cs Mon Feb 26 09:46:07 2007
@@ -32,6 +32,9 @@
byte GetByte(string name);
void SetByte(string name, byte value);
+ //sbyte GetSByte(string name);
+ //void SetSByte(string name, sbyte value);
+
short GetShort(string name);
void SetShort(string name, short value);
Modified: incubator/qpid/trunk/qpid/dotnet/Qpid.NET.sln
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/dotnet/Qpid.NET.sln?view=diff&rev=511923&r1=511922&r2=511923
==============================================================================
--- incubator/qpid/trunk/qpid/dotnet/Qpid.NET.sln (original)
+++ incubator/qpid/trunk/qpid/dotnet/Qpid.NET.sln Mon Feb 26 09:46:07 2007
@@ -18,6 +18,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Qpid.Sasl.Tests", "Qpid.Sasl.Tests\Qpid.Sasl.Tests.csproj", "{587B3520-EBB9-41ED-B019-E96116B651CE}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Qpid.Buffer.Tests", "Qpid.Buffer.Tests\Qpid.Buffer.Tests.csproj", "{74640962-99D0-4D06-B57A-9CD66517CF52}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -60,6 +62,10 @@
{587B3520-EBB9-41ED-B019-E96116B651CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{587B3520-EBB9-41ED-B019-E96116B651CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{587B3520-EBB9-41ED-B019-E96116B651CE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {74640962-99D0-4D06-B57A-9CD66517CF52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {74640962-99D0-4D06-B57A-9CD66517CF52}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {74640962-99D0-4D06-B57A-9CD66517CF52}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {74640962-99D0-4D06-B57A-9CD66517CF52}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Sasl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -0,0 +1,2 @@
+bin
+obj
Propchange: incubator/qpid/trunk/qpid/dotnet/Qpid.Sasl.Tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 26 09:46:07 2007
@@ -0,0 +1,2 @@
+bin
+obj