<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.swganh.org/index.php?action=history&amp;feed=atom&amp;title=Packet%3ASWGPacket</id>
		<title>Packet:SWGPacket - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.swganh.org/index.php?action=history&amp;feed=atom&amp;title=Packet%3ASWGPacket"/>
		<link rel="alternate" type="text/html" href="https://wiki.swganh.org/index.php?title=Packet:SWGPacket&amp;action=history"/>
		<updated>2026-04-07T02:15:01Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.4</generator>

	<entry>
		<id>https://wiki.swganh.org/index.php?title=Packet:SWGPacket&amp;diff=1665&amp;oldid=prev</id>
		<title>Snow at 00:40, 9 December 2006</title>
		<link rel="alternate" type="text/html" href="https://wiki.swganh.org/index.php?title=Packet:SWGPacket&amp;diff=1665&amp;oldid=prev"/>
				<updated>2006-12-09T00:40:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;SWG Packets are the actual packets of data that are within the SOE Protocol. They follow a general trend, and then have &lt;br /&gt;
their own specific breakdowns as to what data is where.&lt;br /&gt;
&lt;br /&gt;
All SWG Packets consist of an opperand count, and an opcode. An opcode is a number to help identify what type of data the packet &lt;br /&gt;
contains, and the opperand count is to know how many variables are within the packet. The format is as follows:&lt;br /&gt;
&lt;br /&gt;
[Opperand Count:Host Byte SHORT]&lt;br /&gt;
[Opcode:INT]&lt;br /&gt;
[DATA...]&lt;br /&gt;
&lt;br /&gt;
Opcodes appear as very large integer, and there is no pattern between them, so&lt;br /&gt;
we recognize them as just an INT data type that is 4 bytes in size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MULTIPLE SWG PACKETS&lt;br /&gt;
&lt;br /&gt;
There is a special case within an SWG Packet which allows multiple SWG Packets to be combined into one. This can be identified &lt;br /&gt;
when there is an opperand count of 0x0019 (in a packet, you would see 00 19 versues 02 00 or some other host byte number that is a count).&lt;br /&gt;
 The format then follows the same as the Multiple SOE Protocols Opcode.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[special opperand count of 00 19]&lt;br /&gt;
&lt;br /&gt;
[Size1:Byte]&lt;br /&gt;
[Data1..]&lt;br /&gt;
&lt;br /&gt;
[Size2:Byte]&lt;br /&gt;
[Data2..]&lt;br /&gt;
&lt;br /&gt;
[Repeat..]&lt;br /&gt;
&lt;br /&gt;
Again, if the packet must exceed 255, the same format is used as the SOE Multiple Protocols opcode. &lt;br /&gt;
The first byte is FF for 255, the next byte is how many bytes to add to that value (so 01) and the byte after that is the &lt;br /&gt;
actual number to add.&lt;br /&gt;
&lt;br /&gt;
so 256 would appear as FF 01 01 or FF + 01 or 255 + 1.&lt;br /&gt;
265 would appear as FF 01 0A or FF + 0A or 255 + 10.&lt;br /&gt;
&lt;br /&gt;
Because no packet can exceed 496 bytes (because that is the set buffer), at most 1 byte will be &lt;br /&gt;
added to 255, so FF 01 __ is the general format for every byte 255 and above.&lt;br /&gt;
&lt;br /&gt;
NOTE: As stated in the SOE Protocol documentation, we have not seen a case for a size of 255. &lt;br /&gt;
There are a few ways that this MAY be done, but we believe FF 01 00 is the correct method, where FF + 00 or 255 + 0 is computed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
COMMON SWG DATA TYPES&lt;br /&gt;
&lt;br /&gt;
The following data types are what commonly appear in SWG packets, and each count as 1 opperand. &lt;br /&gt;
Note: (HB) is short for (Host Byte) (NB) is short for (Net Byte). This is assumed throughout the rest of the packet documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BYTE			(a 1 byte integer number)&lt;br /&gt;
(HB)SHORT		(a 2 byte integer number)&lt;br /&gt;
(HB)INT			(a 4 byte integer number)&lt;br /&gt;
(HB)LONG	       (an 8 byte integer number)&lt;br /&gt;
(NB)FLOAT		(a 4 byte floating point number)&lt;br /&gt;
A_STRING		(an ASCII string)&lt;br /&gt;
U_STRING		(a UNICODE string)&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
There are a few other ways an &amp;quot;opperand&amp;quot; can be counted. Lists that have a counter preceeding them is&lt;br /&gt;
 also a common &amp;quot;opperand&amp;quot;. So seeing something like this:&lt;br /&gt;
&lt;br /&gt;
04 00 00 00 (HB)INT - a counter for some list&lt;br /&gt;
DATA1..&lt;br /&gt;
DATA2..&lt;br /&gt;
DATA3..&lt;br /&gt;
DATA4..&lt;br /&gt;
&lt;br /&gt;
that would all count as a single opperand. &lt;br /&gt;
Opperand counting really helps when reversing a packet as you know how many data peices to break it into.&lt;br /&gt;
 There is no real use to them beyond that. Also opperands will be marked in the packet breakdowns if needed.&lt;br /&gt;
 They are more a reversing tool for the packet analyzer than neccesary in the server. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCII STRINGS&lt;br /&gt;
&lt;br /&gt;
A_STRING data types have the following format. Instead of being null terminated, the string size &lt;br /&gt;
preceeds the data as a (HB)SHORT. So the string &amp;quot;ABC&amp;quot; in binary would be: &lt;br /&gt;
&lt;br /&gt;
&amp;quot;ABC&amp;quot;&lt;br /&gt;
03 00 65 66 67&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
where 03 00 is the integer number 3, and each byte is a character of the string.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
UNICODE STRINGS&lt;br /&gt;
&lt;br /&gt;
U_STRING follow the same format as A_STRING, however, there are 2 bytes to each character, &lt;br /&gt;
instead of 1 like in Ascii. Each unicode character is represented as a (HB)SHORT so &amp;quot;ABC&amp;quot; as a U_STRING would be:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;ABC&amp;quot;&lt;br /&gt;
03 00 65 00 66 00 67 00&lt;br /&gt;
&lt;br /&gt;
where 03 00 is the size, and each following (HB)SHORT is a character of the string.&lt;/div&gt;</summary>
		<author><name>Snow</name></author>	</entry>

	</feed>