Main Page | Class Hierarchy | Class List | File List | Class Members

Common/Message.cs

00001 using System;
00002 using System.Text;
00003 
00004 namespace Common {
00005         
00006         /************************************************************************/
00010         public abstract class Message {
00015                 public abstract byte[] RawData {
00016                         get;
00017                 }
00019 
00020 
00021 
00022                 protected MessageType type;
00026                 protected ushort destination;
00027 
00032                 public ushort source;
00033 
00035 
00036 
00037 
00038                 public MessageType Type {
00039                         get { return type; }
00040                         set { type = value; }
00041                 }
00042 
00043                 public ushort Destination {
00044                         get { return destination; }
00045                         set { destination = value; }
00046                 }
00047 
00048                 public bool isLowPriority = false;
00049 
00051 
00052 
00053 
00054                 public Message() {}
00055 
00060                 public Message(MessageType type) {
00061                         this.type = type;
00062                 }
00063 
00065                 public byte[] ToByteArray() {
00066                         byte[] dataBuffer = RawData;
00067                         byte[] resultBuffer = new byte[dataBuffer.Length + 1]; 
00068                         resultBuffer[0] = (byte)Type;
00069                         Array.Copy(dataBuffer, 0, resultBuffer, 1, dataBuffer.Length);
00070                         return resultBuffer;
00071                 }
00072         }
00073 
00074         /************************************************************************/
00078         public enum MessageType : byte { 
00082                 Noop,
00086                 Retransmission,
00090                 String,
00094                 HTTPRequest,
00098                 HTTPResponse,
00102                 NoChange,
00106                 CacheIndex,
00110                 CacheUpdateNoChange,
00114                 CacheUpdateHTTPResponse,
00118                 Chunk,
00122                 CacheIndexRequest,
00123         }
00124         
00125 
00126         public interface IContainsCallback {
00127                 int CallbackReceipt {
00128                         get;
00129                 }
00130         }
00131 }

Generated on Mon May 8 22:07:27 2006 by  doxygen 1.3.9.1