Moving examples, mapgenerator, and VisualParamGenerator to Programs folder (SVN is seriously ruined still, don't check out yet)

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1961 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-07-22 23:21:49 +00:00
parent ef71c02528
commit f2dde3daae
153 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("mapgenerator")]
[assembly: AssemblyDescription("C# class generator from the message_template.msg format")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("openmetaverse.org")]
[assembly: AssemblyProduct("mapgenerator")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("87314973-b32d-4dab-b0da-ab3c5280d268")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,691 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace OpenMetaverse
{
/// <summary>
///
/// </summary>
public enum PacketFrequency
{
/// <summary></summary>
Low,
/// <summary></summary>
Medium,
/// <summary></summary>
High
}
/// <summary>
///
/// </summary>
public enum FieldType
{
/// <summary></summary>
U8,
/// <summary></summary>
U16,
/// <summary></summary>
U32,
/// <summary></summary>
U64,
/// <summary></summary>
S8,
/// <summary></summary>
S16,
/// <summary></summary>
S32,
/// <summary></summary>
F32,
/// <summary></summary>
F64,
/// <summary></summary>
LLUUID,
/// <summary></summary>
BOOL,
/// <summary></summary>
LLVector3,
/// <summary></summary>
LLVector3d,
/// <summary></summary>
LLVector4,
/// <summary></summary>
LLQuaternion,
/// <summary></summary>
IPADDR,
/// <summary></summary>
IPPORT,
/// <summary></summary>
Variable,
/// <summary></summary>
Fixed,
/// <summary></summary>
Single,
/// <summary></summary>
Multiple
}
/// <summary>
///
/// </summary>
public class MapField : IComparable
{
/// <summary></summary>
public int KeywordPosition;
/// <summary></summary>
public string Name;
/// <summary></summary>
public FieldType Type;
/// <summary></summary>
public int Count;
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public int CompareTo(object obj)
{
MapField temp = (MapField)obj;
if (this.KeywordPosition > temp.KeywordPosition)
{
return 1;
}
else
{
if(temp.KeywordPosition == this.KeywordPosition)
{
return 0;
}
else
{
return -1;
}
}
}
}
/// <summary>
///
/// </summary>
public class MapBlock : IComparable
{
/// <summary></summary>
public int KeywordPosition;
/// <summary></summary>
public string Name;
/// <summary></summary>
public int Count;
/// <summary></summary>
public List<MapField> Fields;
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public int CompareTo(object obj)
{
MapBlock temp = (MapBlock)obj;
if (this.KeywordPosition > temp.KeywordPosition)
{
return 1;
}
else
{
if(temp.KeywordPosition == this.KeywordPosition)
{
return 0;
}
else
{
return -1;
}
}
}
}
/// <summary>
///
/// </summary>
public class MapPacket
{
/// <summary></summary>
public ushort ID;
/// <summary></summary>
public string Name;
/// <summary></summary>
public PacketFrequency Frequency;
/// <summary></summary>
public bool Trusted;
/// <summary></summary>
public bool Encoded;
/// <summary></summary>
public List<MapBlock> Blocks;
}
/// <summary>
///
/// </summary>
public class ProtocolManager
{
/// <summary></summary>
public Dictionary<FieldType, int> TypeSizes;
/// <summary></summary>
public Dictionary<string, int> KeywordPositions;
/// <summary></summary>
public MapPacket[] LowMaps;
/// <summary></summary>
public MapPacket[] MediumMaps;
/// <summary></summary>
public MapPacket[] HighMaps;
/// <summary>
///
/// </summary>
/// <param name="keywordFile"></param>
/// <param name="mapFile"></param>
/// <param name="client"></param>
public ProtocolManager(string mapFile)
{
// Initialize the map arrays
LowMaps = new MapPacket[65536];
MediumMaps = new MapPacket[256];
HighMaps = new MapPacket[256];
// Build the type size hash table
TypeSizes = new Dictionary<FieldType,int>();
TypeSizes.Add(FieldType.U8, 1);
TypeSizes.Add(FieldType.U16, 2);
TypeSizes.Add(FieldType.U32, 4);
TypeSizes.Add(FieldType.U64, 8);
TypeSizes.Add(FieldType.S8, 1);
TypeSizes.Add(FieldType.S16, 2);
TypeSizes.Add(FieldType.S32, 4);
TypeSizes.Add(FieldType.F32, 4);
TypeSizes.Add(FieldType.F64, 8);
TypeSizes.Add(FieldType.LLUUID, 16);
TypeSizes.Add(FieldType.BOOL, 1);
TypeSizes.Add(FieldType.LLVector3, 12);
TypeSizes.Add(FieldType.LLVector3d, 24);
TypeSizes.Add(FieldType.LLVector4, 16);
TypeSizes.Add(FieldType.LLQuaternion, 16);
TypeSizes.Add(FieldType.IPADDR, 4);
TypeSizes.Add(FieldType.IPPORT, 2);
TypeSizes.Add(FieldType.Variable, -1);
TypeSizes.Add(FieldType.Fixed, -2);
KeywordPositions = new Dictionary<string, int>();
LoadMapFile(mapFile);
}
/// <summary>
///
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public MapPacket Command(string command)
{
foreach (MapPacket map in HighMaps)
{
if (map != null)
{
if (command == map.Name)
{
return map;
}
}
}
foreach (MapPacket map in MediumMaps)
{
if (map != null)
{
if (command == map.Name)
{
return map;
}
}
}
foreach (MapPacket map in LowMaps)
{
if (map != null)
{
if (command == map.Name)
{
return map;
}
}
}
throw new Exception("Cannot find map for command \"" + command + "\"");
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public MapPacket Command(byte[] data)
{
ushort command;
if (data.Length < 5)
{
return null;
}
if (data[4] == 0xFF)
{
if ((byte)data[5] == 0xFF)
{
// Low frequency
command = (ushort)(data[6] * 256 + data[7]);
return Command(command, PacketFrequency.Low);
}
else
{
// Medium frequency
command = (ushort)data[5];
return Command(command, PacketFrequency.Medium);
}
}
else
{
// High frequency
command = (ushort)data[4];
return Command(command, PacketFrequency.High);
}
}
/// <summary>
///
/// </summary>
/// <param name="command"></param>
/// <param name="frequency"></param>
/// <returns></returns>
public MapPacket Command(ushort command, PacketFrequency frequency)
{
switch (frequency)
{
case PacketFrequency.High:
return HighMaps[command];
case PacketFrequency.Medium:
return MediumMaps[command];
case PacketFrequency.Low:
return LowMaps[command];
}
throw new Exception("Cannot find map for command \"" + command + "\" with frequency \"" + frequency + "\"");
}
/// <summary>
///
/// </summary>
public void PrintMap(TextWriter writer)
{
PrintOneMap(writer, LowMaps, "Low ");
PrintOneMap(writer, MediumMaps, "Medium");
PrintOneMap(writer, HighMaps, "High ");
}
/// <summary>
///
/// </summary>
/// <param name="map"></param>
/// <param name="frequency"></param>
private void PrintOneMap(TextWriter writer, MapPacket[] map, string frequency) {
int i;
for (i = 0; i < map.Length; ++i)
{
if (map[i] != null)
{
writer.WriteLine("{0} {1,5} - {2} - {3} - {4}", frequency, i, map[i].Name,
map[i].Trusted ? "Trusted" : "Untrusted",
map[i].Encoded ? "Unencoded" : "Zerocoded");
foreach (MapBlock block in map[i].Blocks)
{
if (block.Count == -1)
{
writer.WriteLine("\t{0,4} {1} (Variable)", block.KeywordPosition, block.Name);
}
else
{
writer.WriteLine("\t{0,4} {1} ({2})", block.KeywordPosition, block.Name, block.Count);
}
foreach (MapField field in block.Fields)
{
writer.WriteLine("\t\t{0,4} {1} ({2} / {3})", field.KeywordPosition, field.Name,
field.Type, field.Count);
}
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="mapFile"></param>
/// <param name="outputFile"></param>
public static void DecodeMapFile(string mapFile, string outputFile)
{
byte magicKey = 0;
byte[] buffer = new byte[2048];
int nread;
BinaryReader map;
BinaryWriter output;
try
{
map = new BinaryReader(new FileStream(mapFile, FileMode.Open));
}
catch(Exception e)
{
throw new Exception("Map file error", e);
}
try
{
output = new BinaryWriter(new FileStream(outputFile, FileMode.CreateNew));
}
catch(Exception e)
{
throw new Exception("Map file error", e);
}
while ((nread = map.Read(buffer, 0, 2048)) != 0)
{
for (int i = 0; i < nread; ++i)
{
buffer[i] ^= magicKey;
magicKey += 43;
}
output.Write(buffer, 0, nread);
}
map.Close();
output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="mapFile"></param>
private void LoadMapFile(string mapFile)
{
FileStream map;
// Load the protocol map file
try
{
map = new FileStream(mapFile, FileMode.Open, FileAccess.Read);
}
catch(Exception e)
{
throw new Exception("Map file error", e);
}
try
{
StreamReader r = new StreamReader(map);
r.BaseStream.Seek(0, SeekOrigin.Begin);
string newline;
string trimmedline;
bool inPacket = false;
bool inBlock = false;
MapPacket currentPacket = null;
MapBlock currentBlock = null;
char[] trimArray = new char[] {' ', '\t'};
// While not at the end of the file
while (r.Peek() > -1)
{
#region ParseMap
newline = r.ReadLine();
trimmedline = System.Text.RegularExpressions.Regex.Replace(newline, @"\s+", " ");
trimmedline = trimmedline.Trim(trimArray);
if (!inPacket)
{
// Outside of all packet blocks
if (trimmedline == "{")
{
inPacket = true;
}
}
else
{
// Inside of a packet block
if (!inBlock)
{
// Inside a packet block, outside of the blocks
if (trimmedline == "{")
{
inBlock = true;
}
else if (trimmedline == "}")
{
// Reached the end of the packet
// currentPacket.Blocks.Sort();
inPacket = false;
}
else
{
// The packet header
#region ParsePacketHeader
// Splice the string in to tokens
string[] tokens = trimmedline.Split(new char[] {' ', '\t'});
if (tokens.Length > 3)
{
//Hash packet name to insure correct keyword ordering
KeywordPosition(tokens[0]);
uint packetID;
// Remove the leading "0x"
if (tokens[2].Length > 2 && tokens[2].Substring(0, 2) == "0x")
{
tokens[2] = tokens[2].Substring(2, tokens[2].Length - 2);
packetID = UInt32.Parse(tokens[2], System.Globalization.NumberStyles.HexNumber);
} else {
packetID = UInt32.Parse(tokens[2]);
}
if (tokens[1] == "Fixed")
{
// Truncate the id to a short
packetID &= 0xFFFF;
LowMaps[packetID] = new MapPacket();
LowMaps[packetID].ID = (ushort)packetID;
LowMaps[packetID].Frequency = PacketFrequency.Low;
LowMaps[packetID].Name = tokens[0];
LowMaps[packetID].Trusted = (tokens[3] == "Trusted");
LowMaps[packetID].Encoded = (tokens[4] == "Zerocoded");
LowMaps[packetID].Blocks = new List<MapBlock>();
currentPacket = LowMaps[packetID];
}
else if (tokens[1] == "Low")
{
LowMaps[packetID] = new MapPacket();
LowMaps[packetID].ID = (ushort)packetID;
LowMaps[packetID].Frequency = PacketFrequency.Low;
LowMaps[packetID].Name = tokens[0];
LowMaps[packetID].Trusted = (tokens[2] == "Trusted");
LowMaps[packetID].Encoded = (tokens[3] == "Zerocoded");
LowMaps[packetID].Blocks = new List<MapBlock>();
currentPacket = LowMaps[packetID];
}
else if (tokens[1] == "Medium")
{
MediumMaps[packetID] = new MapPacket();
MediumMaps[packetID].ID = (ushort)packetID;
MediumMaps[packetID].Frequency = PacketFrequency.Medium;
MediumMaps[packetID].Name = tokens[0];
MediumMaps[packetID].Trusted = (tokens[2] == "Trusted");
MediumMaps[packetID].Encoded = (tokens[3] == "Zerocoded");
MediumMaps[packetID].Blocks = new List<MapBlock>();
currentPacket = MediumMaps[packetID];
}
else if (tokens[1] == "High")
{
HighMaps[packetID] = new MapPacket();
HighMaps[packetID].ID = (ushort)packetID;
HighMaps[packetID].Frequency = PacketFrequency.High;
HighMaps[packetID].Name = tokens[0];
HighMaps[packetID].Trusted = (tokens[2] == "Trusted");
HighMaps[packetID].Encoded = (tokens[3] == "Zerocoded");
HighMaps[packetID].Blocks = new List<MapBlock>();
currentPacket = HighMaps[packetID];
}
else
{
//Client.Log("Unknown packet frequency", Helpers.LogLevel.Error);
throw new Exception("Unknown packet frequency");
}
}
#endregion
}
}
else
{
if (trimmedline.Length > 0 && trimmedline.Substring(0, 1) == "{")
{
// A field
#region ParseField
MapField field = new MapField();
// Splice the string in to tokens
string[] tokens = trimmedline.Split(new char[] {' ', '\t'});
field.Name = tokens[1];
field.KeywordPosition = KeywordPosition(field.Name);
field.Type = (FieldType)Enum.Parse(typeof(FieldType), tokens[2], true);
if (tokens[3] != "}")
{
field.Count = Int32.Parse(tokens[3]);
}
else
{
field.Count = 1;
}
// Save this field to the current block
currentBlock.Fields.Add(field);
#endregion
}
else if (trimmedline == "}")
{
// currentBlock.Fields.Sort();
inBlock = false;
}
else if (trimmedline.Length != 0 && trimmedline.Substring(0, 2) != "//")
{
// The block header
#region ParseBlockHeader
currentBlock = new MapBlock();
// Splice the string in to tokens
string[] tokens = trimmedline.Split(new char[] {' ', '\t'});
currentBlock.Name = tokens[0];
currentBlock.KeywordPosition = KeywordPosition(currentBlock.Name);
currentBlock.Fields = new List<MapField>();
currentPacket.Blocks.Add(currentBlock);
if (tokens[1] == "Single")
{
currentBlock.Count = 1;
}
else if (tokens[1] == "Multiple")
{
currentBlock.Count = Int32.Parse(tokens[2]);
}
else if (tokens[1] == "Variable")
{
currentBlock.Count = -1;
}
else
{
//Client.Log("Unknown block frequency", Helpers.LogLevel.Error);
throw new Exception("Unknown block frequency");
}
#endregion
}
}
}
#endregion
}
r.Close();
map.Close();
}
catch (Exception e)
{
throw e;
}
}
private int KeywordPosition(string keyword)
{
if (KeywordPositions.ContainsKey(keyword))
{
return KeywordPositions[keyword];
}
int hash = 0;
for (int i = 1; i < keyword.Length; i++)
{
hash = (hash + (int)(keyword[i])) * 2;
}
hash *= 2;
hash &= 0x1FFF;
int startHash = hash;
while (KeywordPositions.ContainsValue(hash))
{
hash++;
hash &= 0x1FFF;
if (hash == startHash)
{
//Give up looking, went through all values and they were all taken.
throw new Exception("All hash values are taken. Failed to add keyword: " + keyword);
}
}
KeywordPositions[keyword] = hash;
return hash;
}
}
}

View File

@@ -0,0 +1,981 @@
using System;
using System.Collections.Generic;
using System.IO;
using OpenMetaverse;
namespace mapgenerator
{
class mapgenerator
{
static void WriteFieldMember(TextWriter writer, MapField field)
{
string type = String.Empty;
switch (field.Type)
{
case FieldType.BOOL:
type = "bool";
break;
case FieldType.F32:
type = "float";
break;
case FieldType.F64:
type = "double";
break;
case FieldType.IPPORT:
case FieldType.U16:
type = "ushort";
break;
case FieldType.IPADDR:
case FieldType.U32:
type = "uint";
break;
case FieldType.LLQuaternion:
type = "LLQuaternion";
break;
case FieldType.LLUUID:
type = "LLUUID";
break;
case FieldType.LLVector3:
type = "LLVector3";
break;
case FieldType.LLVector3d:
type = "LLVector3d";
break;
case FieldType.LLVector4:
type = "LLVector4";
break;
case FieldType.S16:
type = "short";
break;
case FieldType.S32:
type = "int";
break;
case FieldType.S8:
type = "sbyte";
break;
case FieldType.U64:
type = "ulong";
break;
case FieldType.U8:
type = "byte";
break;
case FieldType.Fixed:
type = "byte[]";
break;
}
if (field.Type != FieldType.Variable)
{
//writer.WriteLine(" /// <summary>" + field.Name + " field</summary>");
writer.WriteLine(" public " + type + " " + field.Name + ";");
}
else
{
writer.WriteLine(" private byte[] _" + field.Name.ToLower() + ";");
//writer.WriteLine(" /// <summary>" + field.Name + " field</summary>");
writer.WriteLine(" public byte[] " + field.Name + Environment.NewLine + " {");
writer.WriteLine(" get { return _" + field.Name.ToLower() + "; }");
writer.WriteLine(" set" + Environment.NewLine + " {");
writer.WriteLine(" if (value == null) { _" +
field.Name.ToLower() + " = null; return; }");
writer.WriteLine(" if (value.Length > " +
((field.Count == 1) ? "255" : "1100") + ") { throw new OverflowException(" +
"\"Value exceeds " + ((field.Count == 1) ? "255" : "1100") + " characters\"); }");
writer.WriteLine(" else { _" + field.Name.ToLower() +
" = new byte[value.Length]; Buffer.BlockCopy(value, 0, _" +
field.Name.ToLower() + ", 0, value.Length); }");
writer.WriteLine(" }" + Environment.NewLine + " }");
}
}
static void WriteFieldFromBytes(TextWriter writer, MapField field)
{
switch (field.Type)
{
case FieldType.BOOL:
writer.WriteLine(" " +
field.Name + " = (bytes[i++] != 0) ? (bool)true : (bool)false;");
break;
case FieldType.F32:
writer.WriteLine(" " +
"if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 4);");
writer.WriteLine(" " +
field.Name + " = BitConverter.ToSingle(bytes, i); i += 4;");
break;
case FieldType.F64:
writer.WriteLine(" " +
"if (!BitConverter.IsLittleEndian) Array.Reverse(bytes, i, 8);");
writer.WriteLine(" " +
field.Name + " = BitConverter.ToDouble(bytes, i); i += 8;");
break;
case FieldType.Fixed:
writer.WriteLine(" " + field.Name + " = new byte[" + field.Count + "];");
writer.WriteLine(" Buffer.BlockCopy(bytes, i, " + field.Name +
", 0, " + field.Count + "); i += " + field.Count + ";");
break;
case FieldType.IPADDR:
case FieldType.U32:
writer.WriteLine(" " + field.Name +
" = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));");
break;
case FieldType.IPPORT:
// IPPORT is big endian while U16/S16 are little endian. Go figure
writer.WriteLine(" " + field.Name +
" = (ushort)((bytes[i++] << 8) + bytes[i++]);");
break;
case FieldType.U16:
writer.WriteLine(" " + field.Name +
" = (ushort)(bytes[i++] + (bytes[i++] << 8));");
break;
case FieldType.LLQuaternion:
writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i, true); i += 12;");
break;
case FieldType.LLUUID:
writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 16;");
break;
case FieldType.LLVector3:
writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 12;");
break;
case FieldType.LLVector3d:
writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 24;");
break;
case FieldType.LLVector4:
writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 16;");
break;
case FieldType.S16:
writer.WriteLine(" " + field.Name +
" = (short)(bytes[i++] + (bytes[i++] << 8));");
break;
case FieldType.S32:
writer.WriteLine(" " + field.Name +
" = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));");
break;
case FieldType.S8:
writer.WriteLine(" " + field.Name +
" = (sbyte)bytes[i++];");
break;
case FieldType.U64:
writer.WriteLine(" " + field.Name +
" = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + " +
"((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + " +
"((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + " +
"((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));");
break;
case FieldType.U8:
writer.WriteLine(" " + field.Name +
" = (byte)bytes[i++];");
break;
case FieldType.Variable:
if (field.Count == 1)
{
writer.WriteLine(" length = (ushort)bytes[i++];");
}
else
{
writer.WriteLine(" length = (ushort)(bytes[i++] + (bytes[i++] << 8));");
}
writer.WriteLine(" _" + field.Name.ToLower() + " = new byte[length];");
writer.WriteLine(" Buffer.BlockCopy(bytes, i, _" + field.Name.ToLower() +
", 0, length); i += length;");
break;
default:
writer.WriteLine("!!! ERROR: Unhandled FieldType: " + field.Type.ToString() + " !!!");
break;
}
}
static void WriteFieldToBytes(TextWriter writer, MapField field)
{
writer.Write(" ");
switch (field.Type)
{
case FieldType.BOOL:
writer.WriteLine("bytes[i++] = (byte)((" + field.Name + ") ? 1 : 0);");
break;
case FieldType.F32:
writer.WriteLine("ba = BitConverter.GetBytes(" + field.Name + ");" + Environment.NewLine +
" if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 4); }" + Environment.NewLine +
" Buffer.BlockCopy(ba, 0, bytes, i, 4); i += 4;");
break;
case FieldType.F64:
writer.WriteLine("ba = BitConverter.GetBytes(" + field.Name + ");" + Environment.NewLine +
" if(!BitConverter.IsLittleEndian) { Array.Reverse(ba, 0, 8); }" + Environment.NewLine +
" Buffer.BlockCopy(ba, 0, bytes, i, 8); i += 8;");
break;
case FieldType.Fixed:
writer.WriteLine(" Buffer.BlockCopy(" + field.Name + ", 0, bytes, i, " + field.Count + ");" +
"i += " + field.Count + ";");
break;
case FieldType.IPPORT:
// IPPORT is big endian while U16/S16 is little endian. Go figure
writer.WriteLine("bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);");
writer.WriteLine(" bytes[i++] = (byte)(" + field.Name + " % 256);");
break;
case FieldType.U16:
case FieldType.S16:
writer.WriteLine("bytes[i++] = (byte)(" + field.Name + " % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);");
break;
case FieldType.LLUUID:
writer.WriteLine("Buffer.BlockCopy(" + field.Name + ".GetBytes(), 0, bytes, i, 16); i += 16;");
break;
case FieldType.LLVector4:
writer.WriteLine("Buffer.BlockCopy(" + field.Name + ".GetBytes(), 0, bytes, i, 16); i += 16;");
break;
case FieldType.LLQuaternion:
case FieldType.LLVector3:
writer.WriteLine("Buffer.BlockCopy(" + field.Name + ".GetBytes(), 0, bytes, i, 12); i += 12;");
break;
case FieldType.LLVector3d:
writer.WriteLine("Buffer.BlockCopy(" + field.Name + ".GetBytes(), 0, bytes, i, 24); i += 24;");
break;
case FieldType.U8:
writer.WriteLine("bytes[i++] = " + field.Name + ";");
break;
case FieldType.S8:
writer.WriteLine("bytes[i++] = (byte)" + field.Name + ";");
break;
case FieldType.IPADDR:
case FieldType.U32:
case FieldType.S32:
writer.WriteLine("bytes[i++] = (byte)(" + field.Name + " % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 16) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 24) % 256);");
break;
case FieldType.U64:
writer.WriteLine("bytes[i++] = (byte)(" + field.Name + " % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 16) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 24) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 32) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 40) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 48) % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 56) % 256);");
break;
case FieldType.Variable:
writer.WriteLine("if(" + field.Name + " == null) { Console.WriteLine(\"Warning: " + field.Name + " is null, in \" + this.GetType()); }");
writer.Write(" ");
if (field.Count == 1)
{
writer.WriteLine("bytes[i++] = (byte)" + field.Name + ".Length;");
}
else
{
writer.WriteLine("bytes[i++] = (byte)(" + field.Name + ".Length % 256);");
writer.WriteLine(" bytes[i++] = (byte)((" +
field.Name + ".Length >> 8) % 256);");
}
writer.WriteLine(" Buffer.BlockCopy(" + field.Name + ", 0, bytes, i, " +
field.Name + ".Length); " + "i += " + field.Name + ".Length;");
break;
default:
writer.WriteLine("!!! ERROR: Unhandled FieldType: " + field.Type.ToString() + " !!!");
break;
}
}
static int GetFieldLength(TextWriter writer, MapField field)
{
switch(field.Type)
{
case FieldType.BOOL:
case FieldType.U8:
case FieldType.S8:
return 1;
case FieldType.U16:
case FieldType.S16:
case FieldType.IPPORT:
return 2;
case FieldType.U32:
case FieldType.S32:
case FieldType.F32:
case FieldType.IPADDR:
return 4;
case FieldType.U64:
case FieldType.F64:
return 8;
case FieldType.LLVector3:
case FieldType.LLQuaternion:
return 12;
case FieldType.LLUUID:
case FieldType.LLVector4:
//case FieldType.LLQuaternion:
return 16;
case FieldType.LLVector3d:
return 24;
case FieldType.Fixed:
return field.Count;
case FieldType.Variable:
return 0;
default:
writer.WriteLine("!!! ERROR: Unhandled FieldType " + field.Type.ToString() + " !!!");
return 0;
}
}
static void WriteBlockClass(TextWriter writer, MapBlock block, MapPacket packet)
{
bool variableFields = false;
bool floatFields = false;
//writer.WriteLine(" /// <summary>" + block.Name + " block</summary>");
writer.WriteLine(" /// <exclude/>");
//writer.WriteLine(" [XmlType(\"" + packet.Name.ToLower() + "_" + block.Name.ToLower() + "\")]");
writer.WriteLine(" public class " + block.Name + "Block" + Environment.NewLine + " {");
foreach (MapField field in block.Fields)
{
WriteFieldMember(writer, field);
if (field.Type == FieldType.Variable) { variableFields = true; }
if (field.Type == FieldType.F32 || field.Type == FieldType.F64) { floatFields = true; }
}
// Length property
writer.WriteLine("");
//writer.WriteLine(" /// <summary>Length of this block serialized in bytes</summary>");
writer.WriteLine(//" [XmlIgnore]" + Environment.NewLine +
" public int Length" + Environment.NewLine +
" {" + Environment.NewLine +
" get" + Environment.NewLine +
" {");
int length = 0;
// Figure out the length of this block
foreach (MapField field in block.Fields)
{
length += GetFieldLength(writer, field);
}
if (!variableFields)
{
writer.WriteLine(" return " + length + ";");
}
else
{
writer.WriteLine(" int length = " + length + ";");
foreach (MapField field in block.Fields)
{
if (field.Type == FieldType.Variable)
{
writer.WriteLine(" if (" + field.Name +
" != null) { length += " + field.Count + " + " + field.Name + ".Length; }");
}
}
writer.WriteLine(" return length;");
}
writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine);
// Default constructor
//writer.WriteLine(" /// <summary>Default constructor</summary>");
writer.WriteLine(" public " + block.Name + "Block() { }");
// Constructor for building the class from bytes
//writer.WriteLine(" /// <summary>Constructor for building the block from a byte array</summary>");
writer.WriteLine(" public " + block.Name + "Block(byte[] bytes, ref int i)" + Environment.NewLine +
" {" + Environment.NewLine +
" FromBytes(bytes, ref i);" + Environment.NewLine +
" }" + Environment.NewLine);
// Initiates instance variables from a byte message
writer.WriteLine(" public void FromBytes(byte[] bytes, ref int i)" + Environment.NewLine +
" {");
// Declare a length variable if we need it for variable fields in this constructor
if (variableFields) { writer.WriteLine(" int length;"); }
// Start of the try catch block
writer.WriteLine(" try" + Environment.NewLine + " {");
foreach (MapField field in block.Fields)
{
WriteFieldFromBytes(writer, field);
}
writer.WriteLine(" }" + Environment.NewLine +
" catch (Exception)" + Environment.NewLine +
" {" + Environment.NewLine +
" throw new MalformedDataException();" + Environment.NewLine +
" }" + Environment.NewLine + " }" + Environment.NewLine);
// ToBytes() function
//writer.WriteLine(" /// <summary>Serialize this block to a byte array</summary>");
writer.WriteLine(" public void ToBytes(byte[] bytes, ref int i)" + Environment.NewLine +
" {");
// Declare a byte[] variable if we need it for floating point field conversions
if (floatFields) { writer.WriteLine(" byte[] ba;"); }
foreach (MapField field in block.Fields)
{
WriteFieldToBytes(writer, field);
}
writer.WriteLine(" }" + Environment.NewLine);
// ToString() function
writer.WriteLine(" public override string ToString()" + Environment.NewLine + " {");
writer.WriteLine(" StringBuilder output = new StringBuilder();");
writer.WriteLine(" output.AppendLine(\"-- " + block.Name + " --\");");
for (int i = 0; i < block.Fields.Count; i++)
{
MapField field = block.Fields[i];
if (field.Type == FieldType.Variable || field.Type == FieldType.Fixed)
{
writer.WriteLine(" Helpers.FieldToString(output, " + field.Name + ", \"" + field.Name + "\");");
if (i != block.Fields.Count - 1) writer.WriteLine(" output.Append(Environment.NewLine);");
}
else
{
if (i != block.Fields.Count - 1) writer.WriteLine(" output.AppendLine(String.Format(\"" + field.Name + ": {0}\", " + field.Name + "));");
else writer.WriteLine(" output.Append(String.Format(\"" + field.Name + ": {0}\", " + field.Name + "));");
}
}
writer.WriteLine(" return output.ToString();" + Environment.NewLine + " }");
writer.WriteLine(" }" + Environment.NewLine);
}
static void WritePacketClass(TextWriter writer, MapPacket packet)
{
string sanitizedName;
//writer.WriteLine(" /// <summary>" + packet.Name + " packet</summary>");
writer.WriteLine(" /// <exclude/>");
writer.WriteLine(" public class " + packet.Name + "Packet : Packet" + Environment.NewLine + " {");
// Write out each block class
foreach (MapBlock block in packet.Blocks)
{
WriteBlockClass(writer, block, packet);
}
// Header member
writer.WriteLine(" private Header header;");
//writer.WriteLine(" /// <summary>The header for this packet</summary>");
writer.WriteLine(" public override Header Header { get { return header; } set { header = value; } }");
// PacketType member
//writer.WriteLine(" /// <summary>Will return PacketType." + packet.Name+ "</summary>");
writer.WriteLine(" public override PacketType Type { get { return PacketType." +
packet.Name + "; } }");
// Block members
foreach (MapBlock block in packet.Blocks)
{
// TODO: More thorough name blacklisting
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
//writer.WriteLine(" /// <summary>" + block.Name + " block</summary>");
writer.WriteLine(" public " + block.Name + "Block" +
((block.Count != 1) ? "[]" : "") + " " + sanitizedName + ";");
}
writer.WriteLine("");
// Default constructor
//writer.WriteLine(" /// <summary>Default constructor</summary>");
writer.WriteLine(" public " + packet.Name + "Packet()" + Environment.NewLine + " {");
writer.WriteLine(" Header = new " + packet.Frequency.ToString() + "Header();");
writer.WriteLine(" Header.ID = " + packet.ID + ";");
writer.WriteLine(" Header.Reliable = true;"); // Turn the reliable flag on by default
if (packet.Encoded) { writer.WriteLine(" Header.Zerocoded = true;"); }
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == 1)
{
// Single count block
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block();");
}
else if (block.Count == -1)
{
// Variable count block
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[0];");
}
else
{
// Multiple count block
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];");
}
}
writer.WriteLine(" }" + Environment.NewLine);
// Constructor that takes a byte array and beginning position only (no prebuilt header)
bool seenVariable = false;
//writer.WriteLine(" /// <summary>Constructor that takes a byte array and beginning position (no prebuilt header)</summary>");
writer.WriteLine(" public " + packet.Name + "Packet(byte[] bytes, ref int i) : this()" + Environment.NewLine +
" {" + Environment.NewLine +
" int packetEnd = bytes.Length - 1;" + Environment.NewLine +
" FromBytes(bytes, ref i, ref packetEnd, null);" + Environment.NewLine +
" }" + Environment.NewLine);
writer.WriteLine(" override public void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)" + Environment.NewLine + " {");
writer.WriteLine(" header.FromBytes(bytes, ref i, ref packetEnd);");
writer.WriteLine(" if (header.Zerocoded && zeroBuffer != null)");
writer.WriteLine(" {");
writer.WriteLine(" packetEnd = Helpers.ZeroDecode(bytes, packetEnd + 1, zeroBuffer) - 1;");
writer.WriteLine(" bytes = zeroBuffer;");
writer.WriteLine(" }");
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == 1)
{
// Single count block
writer.WriteLine(" " + sanitizedName + ".FromBytes(bytes, ref i);");
}
else if (block.Count == -1)
{
// Variable count block
if (!seenVariable)
{
writer.WriteLine(" int count = (int)bytes[i++];");
seenVariable = true;
}
else
{
writer.WriteLine(" count = (int)bytes[i++];");
}
writer.WriteLine(" if(" + sanitizedName + ".Length < count) {");
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[count];");
writer.WriteLine(" for(int j = 0; j < count; j++) " + sanitizedName + "[j] = new " + block.Name + "Block();");
writer.WriteLine(" }");
writer.WriteLine(" for (int j = 0; j < count; j++)");
writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }");
}
else
{
// Multiple count block
writer.WriteLine(" if(" + sanitizedName + ".Length < " + block.Count+") {");
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];");
writer.WriteLine(" for(int j = 0; j < " + block.Count + "; j++) " + sanitizedName + "[j] = new " + block.Name + "Block();");
writer.WriteLine(" }");
writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++)");
writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }");
}
}
writer.WriteLine(" }" + Environment.NewLine);
seenVariable = false;
// Constructor that takes a byte array and a prebuilt header
//writer.WriteLine(" /// <summary>Constructor that takes a byte array and a prebuilt header</summary>");
writer.WriteLine(" public " + packet.Name + "Packet(Header head, byte[] bytes, ref int i): this()" + Environment.NewLine +
" {" + Environment.NewLine +
" int packetEnd = bytes.Length - 1;" + Environment.NewLine +
" FromBytes(head, bytes, ref i, ref packetEnd, null);" + Environment.NewLine +
" }" + Environment.NewLine);
writer.WriteLine(" override public void FromBytes(Header head, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)" + Environment.NewLine + " {");
writer.WriteLine(" Header = head;");
writer.WriteLine(" if (head.Zerocoded && zeroBuffer != null)");
writer.WriteLine(" {");
writer.WriteLine(" packetEnd = Helpers.ZeroDecode(bytes, packetEnd + 1, zeroBuffer) - 1;");
writer.WriteLine(" bytes = zeroBuffer;");
writer.WriteLine(" }");
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == 1)
{
// Single count block
writer.WriteLine(" " + sanitizedName + ".FromBytes(bytes, ref i);");
}
else if (block.Count == -1)
{
// Variable count block
if (!seenVariable)
{
writer.WriteLine(" int count = (int)bytes[i++];");
seenVariable = true;
}
else
{
writer.WriteLine(" count = (int)bytes[i++];");
}
writer.WriteLine(" if(" + sanitizedName + ".Length < count) {");
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[count];");
writer.WriteLine(" for(int j = 0; j < count; j++) " + sanitizedName + "[j] = new " + block.Name + "Block();");
writer.WriteLine(" }");
writer.WriteLine(" for (int j = 0; j < count; j++)");
writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }");
}
else
{
// Multiple count block
writer.WriteLine(" if(" + sanitizedName + ".Length < " + block.Count+") {");
writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];");
writer.WriteLine(" for(int j = 0; j < " + block.Count + "; j++) " + sanitizedName + "[j] = new " + block.Name + "Block();");
writer.WriteLine(" }");
writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++)");
writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }");
}
}
writer.WriteLine(" }" + Environment.NewLine);
// ToBytes() function
//writer.WriteLine(" /// <summary>Serialize this packet to a byte array</summary><returns>A byte array containing the serialized packet</returns>");
writer.WriteLine(" public override byte[] ToBytes()" + Environment.NewLine + " {");
writer.Write(" int length = ");
if (packet.Frequency == PacketFrequency.Low) { writer.WriteLine("10;"); }
else if (packet.Frequency == PacketFrequency.Medium) { writer.WriteLine("8;"); }
else { writer.WriteLine("7;"); }
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == 1)
{
// Single count block
writer.Write(" length += " + sanitizedName + ".Length;");
}
}
writer.WriteLine(";");
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == -1)
{
writer.WriteLine(" length++;");
writer.WriteLine(" for (int j = 0; j < " + sanitizedName +
".Length; j++) { length += " + sanitizedName + "[j].Length; }");
}
else if (block.Count > 1)
{
writer.WriteLine(" for (int j = 0; j < " + block.Count +
"; j++) { length += " + sanitizedName + "[j].Length; }");
}
}
writer.WriteLine(" if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; }");
writer.WriteLine(" byte[] bytes = new byte[length];");
writer.WriteLine(" int i = 0;");
writer.WriteLine(" header.ToBytes(bytes, ref i);");
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == -1)
{
// Variable count block
writer.WriteLine(" bytes[i++] = (byte)" + sanitizedName + ".Length;");
writer.WriteLine(" for (int j = 0; j < " + sanitizedName +
".Length; j++) { " + sanitizedName + "[j].ToBytes(bytes, ref i); }");
}
else if (block.Count == 1)
{
writer.WriteLine(" " + sanitizedName + ".ToBytes(bytes, ref i);");
}
else
{
// Multiple count block
writer.WriteLine(" for (int j = 0; j < " + block.Count +
"; j++) { " + sanitizedName + "[j].ToBytes(bytes, ref i); }");
}
}
writer.WriteLine(" if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); }");
writer.WriteLine(" return bytes;" + Environment.NewLine + " }" + Environment.NewLine);
// ToString() function
//writer.WriteLine(" /// <summary>Serialize this packet to a string</summary><returns>A string containing the serialized packet</returns>");
writer.WriteLine(" public override string ToString()" + Environment.NewLine + " {");
writer.WriteLine(" string output = \"--- " + packet.Name + " ---\" + Environment.NewLine;");
foreach (MapBlock block in packet.Blocks)
{
if (block.Name == "Header") { sanitizedName = "_" + block.Name; }
else { sanitizedName = block.Name; }
if (block.Count == -1)
{
// Variable count block
writer.WriteLine(" for (int j = 0; j < " +
sanitizedName + ".Length; j++)" + Environment.NewLine + " {");
writer.WriteLine(" output += " + sanitizedName +
"[j].ToString() + Environment.NewLine;" + Environment.NewLine + " }");
}
else if (block.Count == 1)
{
writer.WriteLine(" output += " + sanitizedName + ".ToString() + Environment.NewLine;");
}
else
{
// Multiple count block
writer.WriteLine(" for (int j = 0; j < " +
block.Count + "; j++)" + Environment.NewLine + " {");
writer.WriteLine(" output += " + sanitizedName +
"[j].ToString() + Environment.NewLine;" + Environment.NewLine + " }");
}
}
writer.WriteLine(" return output;" + Environment.NewLine + " }" + Environment.NewLine);
// Closing function bracket
writer.WriteLine(" }" + Environment.NewLine);
}
static int Main(string[] args)
{
ProtocolManager protocol;
List<string> unused = new List<string>();
TextWriter writer;
try
{
if (args.Length != 4)
{
Console.WriteLine("Usage: [message_template.msg] [template.cs] [unusedpackets.txt] [_Packets_.cs]");
return -1;
}
writer = new StreamWriter(args[3]);
protocol = new ProtocolManager(args[0]);
// Build a list of unused packets
using (StreamReader unusedReader = new StreamReader(args[2]))
{
while (unusedReader.Peek() >= 0)
{
unused.Add(unusedReader.ReadLine().Trim());
}
}
// Read in the template.cs file and write it to our output
TextReader reader = new StreamReader(args[1]);
writer.WriteLine(reader.ReadToEnd());
reader.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return -2;
}
// Prune all of the unused packets out of the protocol
int i = 0;
foreach (MapPacket packet in protocol.LowMaps)
{
if (packet != null && unused.Contains(packet.Name))
protocol.LowMaps[i] = null;
i++;
}
i = 0;
foreach (MapPacket packet in protocol.MediumMaps)
{
if (packet != null && unused.Contains(packet.Name))
protocol.MediumMaps[i] = null;
i++;
}
i = 0;
foreach (MapPacket packet in protocol.HighMaps)
{
if (packet != null && unused.Contains(packet.Name))
protocol.HighMaps[i] = null;
i++;
}
// Write the PacketType enum
writer.WriteLine(" public enum PacketType" + Environment.NewLine + " {" + Environment.NewLine +
" /// <summary>A generic value, not an actual packet type</summary>" + Environment.NewLine +
" Default,");
foreach (MapPacket packet in protocol.LowMaps)
if (packet != null)
writer.WriteLine(" " + packet.Name + " = " + (0x10000 | packet.ID) + ",");
foreach (MapPacket packet in protocol.MediumMaps)
if (packet != null)
writer.WriteLine(" " + packet.Name + " = " + (0x20000 | packet.ID) + ",");
foreach (MapPacket packet in protocol.HighMaps)
if (packet != null)
writer.WriteLine(" " + packet.Name + " = " + (0x30000 | packet.ID) + ",");
writer.WriteLine(" }" + Environment.NewLine);
// Write all of the XmlInclude statements for the Packet class to allow packet serialization
//writer.WriteLine("#if PACKETSERIALIZE");
//foreach (MapPacket packet in protocol.LowMaps)
// if (packet != null)
// writer.WriteLine(" [XmlInclude(typeof(" + packet.Name + "Packet))]");
//foreach (MapPacket packet in protocol.MediumMaps)
// if (packet != null)
// writer.WriteLine(" [XmlInclude(typeof(" + packet.Name + "Packet))]");
//foreach (MapPacket packet in protocol.HighMaps)
// if (packet != null)
// writer.WriteLine(" [XmlInclude(typeof(" + packet.Name + "Packet))]");
//writer.WriteLine("#endif");
// Write the base Packet class
writer.WriteLine(
" public abstract partial class Packet" + Environment.NewLine + " {" + Environment.NewLine +
" public abstract Header Header { get; set; }" + Environment.NewLine +
" public abstract PacketType Type { get; }" + Environment.NewLine +
" public abstract void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer);" + Environment.NewLine +
" public abstract void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer);" + Environment.NewLine +
" public int ResendCount;" + Environment.NewLine +
" public int TickCount;" + Environment.NewLine + Environment.NewLine +
" public abstract byte[] ToBytes();" //+ Environment.NewLine + Environment.NewLine +
//" public void ToXml(XmlWriter xmlWriter)" + Environment.NewLine +
//" {" + Environment.NewLine +
//" XmlSerializer serializer = new XmlSerializer(typeof(Packet));" + Environment.NewLine +
//" serializer.Serialize(xmlWriter, this);" + Environment.NewLine +
//" }");
);
// Write the Packet.GetType() function
writer.WriteLine(
" public static PacketType GetType(ushort id, PacketFrequency frequency)" + Environment.NewLine +
" {" + Environment.NewLine +
" switch (frequency)" + Environment.NewLine +
" {" + Environment.NewLine +
" case PacketFrequency.Low:" + Environment.NewLine +
" switch (id)" + Environment.NewLine +
" {");
foreach (MapPacket packet in protocol.LowMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";");
writer.WriteLine(" }" + Environment.NewLine +
" break;" + Environment.NewLine +
" case PacketFrequency.Medium:" + Environment.NewLine +
" switch (id)" + Environment.NewLine + " {");
foreach (MapPacket packet in protocol.MediumMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";");
writer.WriteLine(" }" + Environment.NewLine +
" break;" + Environment.NewLine +
" case PacketFrequency.High:" + Environment.NewLine +
" switch (id)" + Environment.NewLine + " {");
foreach (MapPacket packet in protocol.HighMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";");
writer.WriteLine(" }" + Environment.NewLine +
" break;" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine +
" return PacketType.Default;" + Environment.NewLine + " }" + Environment.NewLine);
// TODO: Not sure if this function is useful to anyone, but if it is it needs to be
// rewritten to not overwrite passed in pointers and decode the entire packet just
// to read the header
// Write the Packet.GetType() function
//writer.WriteLine(
// " public static PacketType GetType(byte[] bytes, int packetEnd, byte[] zeroBuffer)" + Environment.NewLine +
// " {" + Environment.NewLine + " ushort id; PacketFrequency freq;" + Environment.NewLine +
// " int i = 0, end = packetEnd;" + Environment.NewLine +
// " Header header = Header.BuildHeader(bytes, ref i, ref end);" + Environment.NewLine +
// " if (header.Zerocoded)" + Environment.NewLine + " {" + Environment.NewLine +
// " end = Helpers.ZeroDecode(bytes, end + 1, zeroBuffer) - 1;" + Environment.NewLine +
// " bytes = zeroBuffer;" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine +
// " if (bytes[6] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine +
// " if (bytes[7] == 0xFF)" + Environment.NewLine + " {" + Environment.NewLine +
// " id = (ushort)((bytes[8] << 8) + bytes[9]); freq = PacketFrequency.Low;" + Environment.NewLine +
// " }" + Environment.NewLine +
// " else" + Environment.NewLine +
// " {" + Environment.NewLine + " id = (ushort)bytes[7]; freq = PacketFrequency.Medium;" +
// Environment.NewLine + " }" + Environment.NewLine + " }" + Environment.NewLine +
// " else" + Environment.NewLine + " {" + Environment.NewLine +
// " id = (ushort)bytes[6]; freq = PacketFrequency.High;" + Environment.NewLine +
// " }" + Environment.NewLine +
// " return GetType(id, freq);" + Environment.NewLine +
// " }" + Environment.NewLine);
// Write the Packet.BuildPacket(PacketType) function
writer.WriteLine(" public static Packet BuildPacket(PacketType type)");
writer.WriteLine(" {");
foreach (MapPacket packet in protocol.HighMaps)
if (packet != null)
writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name +"Packet();");
foreach (MapPacket packet in protocol.MediumMaps)
if (packet != null)
writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name +"Packet();");
foreach (MapPacket packet in protocol.LowMaps)
if (packet != null)
writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name +"Packet();");
writer.WriteLine(" return null;" + Environment.NewLine);
writer.WriteLine(" }" + Environment.NewLine);
// Write the Packet.BuildPacket() function
writer.WriteLine(
" public static Packet BuildPacket(byte[] packetBuffer, ref int packetEnd, byte[] zeroBuffer)" + Environment.NewLine +
" {" + Environment.NewLine +
" byte[] bytes; ushort id; PacketFrequency freq;" + Environment.NewLine +
" int i = 0;" + Environment.NewLine +
" Header header = Header.BuildHeader(packetBuffer, ref i, ref packetEnd);" + Environment.NewLine +
" if (header.Zerocoded)" + Environment.NewLine +
" {" + Environment.NewLine +
" packetEnd = Helpers.ZeroDecode(packetBuffer, packetEnd + 1, zeroBuffer) - 1;" + Environment.NewLine +
" bytes = zeroBuffer;" + Environment.NewLine +
" }" + Environment.NewLine +
" else" + Environment.NewLine +
" {" + Environment.NewLine +
" bytes = packetBuffer;" + Environment.NewLine +
" }" + Environment.NewLine + Environment.NewLine +
" if (bytes[6] == 0xFF)" + Environment.NewLine +
" {" + Environment.NewLine +
" if (bytes[7] == 0xFF)" + Environment.NewLine +
" {" + Environment.NewLine +
" id = (ushort)((bytes[8] << 8) + bytes[9]); freq = PacketFrequency.Low;" + Environment.NewLine +
" switch (id)" + Environment.NewLine +
" {");
foreach (MapPacket packet in protocol.LowMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);");
writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine +
" else" + Environment.NewLine +
" {" + Environment.NewLine + " id = (ushort)bytes[7]; freq = PacketFrequency.Medium;" + Environment.NewLine +
" switch (id)" + Environment.NewLine + " {");
foreach (MapPacket packet in protocol.MediumMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);");
writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine + " }" + Environment.NewLine +
" else" + Environment.NewLine + " {" + Environment.NewLine +
" id = (ushort)bytes[6]; freq = PacketFrequency.High;" + Environment.NewLine +
" switch (id)" + Environment.NewLine + " {");
foreach (MapPacket packet in protocol.HighMaps)
if (packet != null)
writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);");
writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine +
" throw new MalformedDataException(\"Unknown packet ID \"+freq+\" \"+id);" + Environment.NewLine +
" }" + Environment.NewLine + " }" + Environment.NewLine);
// Write the packet classes
foreach (MapPacket packet in protocol.LowMaps)
if (packet != null) { WritePacketClass(writer, packet); }
foreach (MapPacket packet in protocol.MediumMaps)
if (packet != null) { WritePacketClass(writer, packet); }
foreach (MapPacket packet in protocol.HighMaps)
if (packet != null) { WritePacketClass(writer, packet); }
// Finish up
writer.WriteLine("}");
writer.Close();
return 0;
}
}
}

View File

@@ -0,0 +1,60 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>mapgenerator</RootNamespace>
<AssemblyName>mapgenerator</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-docs|AnyCPU' ">
<OutputPath>bin\Release-docs\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="mapgenerator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolManager.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="unusedpackets.txt" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mapgenerator", "mapgenerator.csproj", "{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C59B1312-57EF-4146-B6B2-1C7B6DC4638B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,379 @@
/*
* Copyright (c) 2006-2008, openmetaverse.org
* All rights reserved.
*
* - Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Neither the name of the Second Life Reverse Engineering Team nor the names
* of its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Text;
using OpenMetaverse;
namespace OpenMetaverse.Packets
{
/// <summary>
/// Thrown when a packet could not be successfully deserialized
/// </summary>
public class MalformedDataException : ApplicationException
{
/// <summary>
/// Default constructor
/// </summary>
public MalformedDataException() { }
/// <summary>
/// Constructor that takes an additional error message
/// </summary>
/// <param name="Message">An error message to attach to this exception</param>
public MalformedDataException(string Message)
: base(Message)
{
this.Source = "Packet decoding";
}
}
/// <summary>
/// The header of a message template packet. Either 5, 6, or 8 bytes in
/// length at the beginning of the packet, and encapsulates any
/// appended ACKs at the end of the packet as well
/// </summary>
public abstract class Header
{
/// <summary>Raw header data, does not include appended ACKs</summary>
public byte[] Data;
/// <summary>Raw value of the flags byte</summary>
public byte Flags
{
get { return Data[0]; }
set { Data[0] = value; }
}
/// <summary>Reliable flag, whether this packet requires an ACK</summary>
public bool Reliable
{
get { return (Data[0] & Helpers.MSG_RELIABLE) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_RELIABLE; } else { byte mask = (byte)Helpers.MSG_RELIABLE ^ 0xFF; Data[0] &= mask; } }
}
/// <summary>Resent flag, whether this same packet has already been
/// sent</summary>
public bool Resent
{
get { return (Data[0] & Helpers.MSG_RESENT) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_RESENT; } else { byte mask = (byte)Helpers.MSG_RESENT ^ 0xFF; Data[0] &= mask; } }
}
/// <summary>Zerocoded flag, whether this packet is compressed with
/// zerocoding</summary>
public bool Zerocoded
{
get { return (Data[0] & Helpers.MSG_ZEROCODED) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_ZEROCODED; } else { byte mask = (byte)Helpers.MSG_ZEROCODED ^ 0xFF; Data[0] &= mask; } }
}
/// <summary>Appended ACKs flag, whether this packet has ACKs appended
/// to the end</summary>
public bool AppendedAcks
{
get { return (Data[0] & Helpers.MSG_APPENDED_ACKS) != 0; }
set { if (value) { Data[0] |= (byte)Helpers.MSG_APPENDED_ACKS; } else { byte mask = (byte)Helpers.MSG_APPENDED_ACKS ^ 0xFF; Data[0] &= mask; } }
}
/// <summary>Packet sequence number, three bytes long</summary>
public uint Sequence
{
get { return (uint)((Data[1] << 24) + (Data[2] << 16) + (Data[3] << 8) + Data[4]); }
set
{
Data[1] = (byte)(value >> 24); Data[2] = (byte)(value >> 16);
Data[3] = (byte)(value >> 8); Data[4] = (byte)(value % 256);
}
}
/// <summary>Numeric ID number of this packet</summary>
public abstract ushort ID { get; set; }
/// <summary>Frequency classification of this packet, Low Medium or
/// High</summary>
public abstract PacketFrequency Frequency { get; }
/// <summary>Convert this header to a byte array, not including any
/// appended ACKs</summary>
public abstract void ToBytes(byte[] bytes, ref int i);
/// <summary>Array containing all the appended ACKs of this packet</summary>
public uint[] AckList;
public abstract void FromBytes(byte[] bytes, ref int pos, ref int packetEnd);
/// <summary>
/// Convert the AckList to a byte array, used for packet serializing
/// </summary>
/// <param name="bytes">Reference to the target byte array</param>
/// <param name="i">Beginning position to start writing to in the byte
/// array, will be updated with the ending position of the ACK list</param>
public void AcksToBytes(byte[] bytes, ref int i)
{
foreach (uint ack in AckList)
{
bytes[i++] = (byte)((ack >> 24) % 256);
bytes[i++] = (byte)((ack >> 16) % 256);
bytes[i++] = (byte)((ack >> 8) % 256);
bytes[i++] = (byte)(ack % 256);
}
if (AckList.Length > 0) { bytes[i++] = (byte)AckList.Length; }
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="pos"></param>
/// <param name="packetEnd"></param>
/// <returns></returns>
public static Header BuildHeader(byte[] bytes, ref int pos, ref int packetEnd)
{
if (bytes[6] == 0xFF)
{
if (bytes[7] == 0xFF)
{
return new LowHeader(bytes, ref pos, ref packetEnd);
}
else
{
return new MediumHeader(bytes, ref pos, ref packetEnd);
}
}
else
{
return new HighHeader(bytes, ref pos, ref packetEnd);
}
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="packetEnd"></param>
protected void CreateAckList(byte[] bytes, ref int packetEnd)
{
if (AppendedAcks)
{
try
{
int count = bytes[packetEnd--];
AckList = new uint[count];
for (int i = 0; i < count; i++)
{
AckList[i] = (uint)(
(bytes[(packetEnd - i * 4) - 3] << 24) |
(bytes[(packetEnd - i * 4) - 2] << 16) |
(bytes[(packetEnd - i * 4) - 1] << 8) |
(bytes[(packetEnd - i * 4) ]));
}
packetEnd -= (count * 4);
}
catch (Exception)
{
AckList = new uint[0];
throw new MalformedDataException();
}
}
else
{
AckList = new uint[0];
}
}
}
/// <summary>
///
/// </summary>
public class LowHeader : Header
{
/// <summary></summary>
public override ushort ID
{
get { return (ushort)((Data[8] << 8) + Data[9]); }
set { Data[8] = (byte)(value >> 8); Data[9] = (byte)(value % 256); }
}
/// <summary></summary>
public override PacketFrequency Frequency { get { return PacketFrequency.Low; } }
/// <summary>
///
/// </summary>
public LowHeader()
{
Data = new byte[10];
Data[6] = Data[7] = 0xFF;
AckList = new uint[0];
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="pos"></param>
/// <param name="packetEnd"></param>
public LowHeader(byte[] bytes, ref int pos, ref int packetEnd)
{
FromBytes(bytes, ref pos, ref packetEnd);
}
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
{
if (bytes.Length < 10) { throw new MalformedDataException(); }
Data = new byte[10];
Buffer.BlockCopy(bytes, 0, Data, 0, 10);
if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0 && bytes[8] == 0)
{
if (bytes[9] == 1)
{
Data[9] = bytes[10];
}
else
{
throw new MalformedDataException();
}
}
pos = 10;
CreateAckList(bytes, ref packetEnd);
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="i"></param>
public override void ToBytes(byte[] bytes, ref int i)
{
Buffer.BlockCopy(Data, 0, bytes, i, 10);
i += 10;
}
}
/// <summary>
///
/// </summary>
public class MediumHeader : Header
{
/// <summary></summary>
public override ushort ID
{
get { return (ushort)Data[7]; }
set { Data[7] = (byte)value; }
}
/// <summary></summary>
public override PacketFrequency Frequency { get { return PacketFrequency.Medium; } }
/// <summary>
///
/// </summary>
public MediumHeader()
{
Data = new byte[8];
Data[6] = 0xFF;
AckList = new uint[0];
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="pos"></param>
/// <param name="packetEnd"></param>
public MediumHeader(byte[] bytes, ref int pos, ref int packetEnd)
{
FromBytes(bytes, ref pos, ref packetEnd);
}
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
{
if (bytes.Length < 8) { throw new MalformedDataException(); }
Data = new byte[8];
Buffer.BlockCopy(bytes, 0, Data, 0, 8);
pos = 8;
CreateAckList(bytes, ref packetEnd);
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="i"></param>
public override void ToBytes(byte[] bytes, ref int i)
{
Buffer.BlockCopy(Data, 0, bytes, i, 8);
i += 8;
}
}
/// <summary>
///
/// </summary>
public class HighHeader : Header
{
/// <summary></summary>
public override ushort ID
{
get { return (ushort)Data[6]; }
set { Data[6] = (byte)value; }
}
/// <summary></summary>
public override PacketFrequency Frequency { get { return PacketFrequency.High; } }
/// <summary>
///
/// </summary>
public HighHeader()
{
Data = new byte[7];
AckList = new uint[0];
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="pos"></param>
/// <param name="packetEnd"></param>
public HighHeader(byte[] bytes, ref int pos, ref int packetEnd)
{
FromBytes(bytes, ref pos, ref packetEnd);
}
override public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd)
{
if (bytes.Length < 7) { throw new MalformedDataException(); }
Data = new byte[7];
Buffer.BlockCopy(bytes, 0, Data, 0, 7);
pos = 7;
CreateAckList(bytes, ref packetEnd);
}
/// <summary>
///
/// </summary>
/// <param name="bytes"></param>
/// <param name="i"></param>
public override void ToBytes(byte[] bytes, ref int i)
{
Buffer.BlockCopy(Data, 0, bytes, i, 7);
i += 7;
}
}

View File

@@ -0,0 +1,115 @@
AddCircuitCode
RelayLogControl
NeighborList
SimulatorAssign
SpaceServerSimulatorTimeMessage
ClosestSimulator
AvatarTextureUpdate
SimulatorMapUpdate
SimulatorSetMap
SubscribeLoad
UnsubscribeLoad
SimulatorStart
SimulatorReady
SimulatorPresentAtLocation
SimulatorLoad
SimulatorShutdownRequest
RegionPresenceRequestByRegionID
RegionPresenceRequestByHandle
RegionPresenceResponse
RecordAgentPresence
EraseAgentPresence
AgentPresenceRequest
AgentPresenceResponse
UpdateSimulator
TrackAgentSession
ClearAgentSessions
LogDwellTime
FeatureDisabled
LogFailedMoneyTransaction
UserReportInternal
SetSimStatusInDatabase
SetSimPresenceInDatabase
AvatarPickerRequestBackend
DirFindQueryBackend
DirPlacesQueryBackend
DirClassifiedQueryBackend
DirPicksQueryBackend
DirLandQueryBackend
DirPopularQueryBackend
OnlineStatusRequest
OnlineStatusReply
GroupNoticeAdd
DataHomeLocationRequest
DataHomeLocationReply
SpaceLocationTeleportRequest
SpaceLocationTeleportReply
CompleteLure
AddModifyAbility
RemoveModifyAbility
NearestLandingRegionRequest
NearestLandingRegionReply
NearestLandingPointUpdated
TeleportLandingStatusChanged
SystemKickUser
AvatarPropertiesRequestBackend
RequestParcelTransfer
UpdateParcel
RemoveParcel
MergeParcel
LogParcelChanges
CheckParcelSales
ParcelSales
StartAuction
ConfirmAuctionStart
CompleteAuction
CancelAuction
CheckParcelAuctions
ParcelAuctions
ChatPass
EdgeDataPacket
SimStatus
PassObject
AtomicPassObject
KillChildAgents
LogLogin
DataServerLogout
TransferInventory
TransferInventoryAck
EventLocationRequest
EventLocationReply
MoneyTransferBackend
BulkMoneyTransfer
SetStartLocation
NetTest
SetCPURatio
SimCrashed
NameValuePair
RemoveNameValuePair
GetNameValuePair
UpdateAttachment
RemoveAttachment
EmailMessageRequest
EmailMessageReply
InternalScriptMail
ScriptDataRequest
ScriptDataReply
InviteGroupResponse
TallyVotes
LogTextMessage
StartExpungeProcess
StartExpungeProcessAck
StartParcelRename
StartParcelRenameAck
BulkParcelRename
ParcelRename
StartParcelRemove
BulkParcelRemove
RpcChannelRequest
RpcChannelReply
RpcScriptRequestInbound
RpcScriptRequestInboundForward
RpcScriptReplyInbound
MailTaskSimRequest
MailTaskSimReply
ScriptMailRegistration