The Labs \ Source Viewer \ SSCLI \ System.Runtime.Remoting.Channels.Tcp \ TcpStatusCode

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. //==========================================================================
  16. // File: TcpWireProtocol.cs
  17. //
  18. // Summary: Class for managing a socket connection.
  19. //
  20. //==========================================================================
  21. using System;
  22. using System.IO;
  23. using System.Net.Sockets;
  24. using System.Text;
  25. using System.Threading;
  26. namespace System.Runtime.Remoting.Channels.Tcp
  27. {
  28.    
  29.     // After the version, one of the following 16-bit opcodes will appear.
  30.     static internal class TcpOperations
  31.     {
  32.         internal const UInt16 Request = 0;
  33.         internal const UInt16 OneWayRequest = 1;
  34.         internal const UInt16 Reply = 2;
  35.     }
  36.     // TcpOpcodes
  37.     static internal class TcpContentDelimiter
  38.     {
  39.         internal const UInt16 ContentLength = 0;
  40.         internal const UInt16 Chunked = 1;
  41.     }
  42.    
  43.     // These are special header values. (Custom can be used for arbitrary
  44.     // pairs).
  45.     static internal class TcpHeaders
  46.     {
  47.         internal const UInt16 EndOfHeaders = 0;
  48.         // (can appear once at end of headers)
  49.         internal const UInt16 Custom = 1;
  50.         internal const UInt16 StatusCode = 2;
  51.         internal const UInt16 StatusPhrase = 3;
  52.         internal const UInt16 RequestUri = 4;
  53.         internal const UInt16 CloseConnection = 5;
  54.         internal const UInt16 ContentType = 6;
  55.     }
  56.     // TcpHeaders
  57.     // These are used by special headers (non-Custom) to indicate the format of the data,
  58.     // so that unknown special headers added in the future can be ignored.
  59.     static internal class TcpHeaderFormat
  60.     {
  61.         internal const byte Void = 0;
  62.         // There is no further data.
  63.         internal const byte CountedString = 1;
  64.         // A single counted string follows.
  65.         internal const byte Byte = 2;
  66.         // A single byte follows
  67.         internal const byte UInt16 = 3;
  68.         // A single unsigned 16-bit int follows.
  69.         internal const byte Int32 = 4;
  70.         // A single 32-bit int follows.
  71.     }
  72.     // TcpHeaderFormat
  73.    
  74.     // status codes only apply to the transmission of data itself.
  75.     static internal class TcpStatusCode
  76.     {
  77.         internal const UInt16 Success = 0;
  78.         // data was successfully received
  79.         internal const UInt16 GenericError = 1;
  80.         // an unknown error occurred
  81.     }
  82.     // TcpStatusCode
  83.    
  84.     // string format indicators
  85.     // (strings have the following format on the wire:
  86.     // [format (1-byte)][encoded-size (int32)][string data (encoded-size bytes in length)]
  87.     static internal class TcpStringFormat
  88.     {
  89.         internal const byte Unicode = 0;
  90.         internal const byte UTF8 = 1;
  91.     }
  92.     // TcpStringFormat
  93.    
  94.    
  95. }
  96. // namespace System.Runtime.Remoting.Channels.Tcp

Developer Fusion