• Welcome to Valhalla Legends Archive.
 

Packet question

Started by MoNksBaNe_Agahnim, December 07, 2003, 08:56 AM

Previous topic - Next topic

MoNksBaNe_Agahnim

this is a prob a noob question but i simply can't find the answer to it...

when sending SID_AUTH_INFO you need a couple of things such as platform ID, version, program ID ect...how do you do that?

How do you send all that info in the form of SID_AUTH_INFO, make it a function or would you use a switch case sorta like what was used in greetbot


switch (nEventId)
{
    case EID_INFO: send what you need to
         break;
}


he uses EID_INFO for SID_AUTH_INFO...because aren't I supposed to define it as its hexadecimal equivalent?

Finally how do I find my platform information? I am using PC but is that what i send in the form of DWORD (platform id), simply DWORD PC?

thanks for any help givin

edit: Typos

Arta

Greetbot is a chat client, not a game client. EID_INFO and SID_AUTH_INFO are completely different things.

BnetDocs has information about SID_AUTH_INFO, and about Platform & Product IDs.

Most people use a class to put packets together. Some write their own, a lot use DarkMinion's PacketBuffer or code based on it. These classes usually operate something like this:


Packet.AddDword(123);
Packet.AddString("asd");
Packet.AddByte(5);

Packet.Send(PACKET_ID);


EID_INFO & SID_AUTH_INFO are indeed constants. They have been previously defined to stand for some value. In C/C++, you would do that like this:


#define SID_AUTH_INFO 0x50


In VB:


Const SID_AUTH_INFO& = &H50


These constants are also available to download from BnetDocs.

Lastly, perhaps this example SID_AUTH_INFO packet might help clarify what things should look like:


FF 50 3B 00 00 00 00 00 36 38 58 49 50 58 45 53 ÿP;·····68XIPXES
C5 00 00 00 00 00 00 00 7F 00 00 01 C4 FF FF FF Å··········Äÿÿÿ
09 08 00 00 09 08 00 00 47 42 52 00 55 6E 69 74 ········GBR·Unit
65 64 20 4B 69 6E 67 64 6F 6D 00                ed Kingdom·


Using this packet format, we can see that, from the beginning of the packet:

FF 50 3B 00 is the header, comprising of the magic byte (0xFF), the ID (0x50), and the length (0x003B).
00 00 00 00 is the Protocol ID.
36 38 58 49 is the Platform ID.
50 58 45 53 is the Program ID.
C5 00 00 00 is the Version Byte.
00 00 00 00 is the Product Language
7F 00 00 01 is the Local IP. Notice that this is 127 0 0 1 in decimal.
C4 FF FF FF is the timezone bias.
09 08 00 00 is the Locale ID.
09 08 00 00 is the Language ID.
47 42 52 00 is the country abrreviation ('GBR').
55 6E 69 74 65 64 20 4B 69 6E 67 64 6F 6D 00 is the Country name ('United Kingdom').

It's important to understand also that packets are not sent 'in hex'. The information above is simply a hexadecimal representation of the data that is sent. In other words, for Locale ID, 4 bytes are sent - in decimal, one has the value 9, the next, 8, and the following two are 0. The characters '09 08 00 00' are merely a representation of this. A way of displaying that data to make it easily understandable.

Hope this helps clear things up a little.

Soul Taker

Just to add to what Arta said, EID (probably) means Event ID, because all constants prefixed with EID are chat events.

ObsidianWolf

Glad it wasnt IED (Improvised Explosive Device).