Jump to content
  • 0

Help with Establishing Presence in the SLGrid


TestChalet
 Share

You are about to reply to a thread that has been inactive for 1263 days.

Please take a moment to consider if this thread is worth bumping.

Question

I am working in a Second Life viewer for Android devices and I am following the wiki's documentation about login protocols ( Link to Wiki ). I have the XMLRPC call working but I have a problem understanding the presence code (step 5 of the Authentication Flow), I am also looking at the Presence Code example done in Python ( Link to Wiki ), and here is the snippet of the code that handles the initial send:

data = pack('>BLBL',0x00,0x01,00,0xffff0003) + pack('<L',circuit_code) + uuid.UUID(result["session_id"]).bytes+uuid.UUID(result["agent_id"]).bytes

From what I can understand from the snippet, there is some sort of header information at the start of the send, the 0x01 might be a sequence number to identify the packet to be send. But beside that, I don't understand the '>BLBL' , '<L' and the rest of the hex codes. I also have seen the Second Life's viewer source code, but since it is a huge code to read, I haven't found the class that does all the communications with the server, so far what I have seen in the source code is that LLMessage class is preparing the information before sending it to the server, but not how it is changing the information. So if someone can help me understanding the code snippet, or maybe show me the place where the communication it is done at the viewer's code, or even if there is a documentation at the wiki that I am missing; I will be really thankful.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
20 minutes ago, TestChalet said:

I am working in a Second Life viewer for Android devices and I am following the wiki's documentation about login protocols ( Link to Wiki ). I have the XMLRPC call working but I have a problem understanding the presence code (step 5 of the Authentication Flow), I am also looking at the Presence Code example done in Python ( Link to Wiki ), and here is the snippet of the code that handles the initial send:


data = pack('>BLBL',0x00,0x01,00,0xffff0003) + pack('<L',circuit_code) + uuid.UUID(result["session_id"]).bytes+uuid.UUID(result["agent_id"]).bytes

From what I can understand from the snippet, there is some sort of header information at the start of the send, the 0x01 might be a sequence number to identify the packet to be send. But beside that, I don't understand the '>BLBL' , '<L' and the rest of the hex codes. I also have seen the Second Life's viewer source code, but since it is a huge code to read, I haven't found the class that does all the communications with the server, so far what I have seen in the source code is that LLMessage class is preparing the information before sending it to the server, but not how it is changing the information. So if someone can help me understanding the code snippet, or maybe show me the place where the communication it is done at the viewer's code, or even if there is a documentation at the wiki that I am missing; I will be really thankful.

Rather than trying to get help here -- the Answers section is really more for questions related to how to do things in SecondLife -- I'd advise trying the Technology section for the Mobile viewer:   https://community.secondlife.com/forums/forum/359-mobile/

Link to comment
Share on other sites

  • 0
6 hours ago, TestChalet said:

I am working in a Second Life viewer for Android devices and I am following the wiki's documentation about login protocols ( Link to Wiki ). I have the XMLRPC call working but I have a problem understanding the presence code (step 5 of the Authentication Flow), I am also looking at the Presence Code example done in Python ( Link to Wiki ), and here is the snippet of the code that handles the initial send:


data = pack('>BLBL',0x00,0x01,00,0xffff0003) + pack('<L',circuit_code) + uuid.UUID(result["session_id"]).bytes+uuid.UUID(result["agent_id"]).bytes

From what I can understand from the snippet, there is some sort of header information at the start of the send, the 0x01 might be a sequence number to identify the packet to be send. But beside that, I don't understand the '>BLBL' , '<L' and the rest of the hex codes. I also have seen the Second Life's viewer source code, but since it is a huge code to read, I haven't found the class that does all the communications with the server, so far what I have seen in the source code is that LLMessage class is preparing the information before sending it to the server, but not how it is changing the information. So if someone can help me understanding the code snippet, or maybe show me the place where the communication it is done at the viewer's code, or even if there is a documentation at the wiki that I am missing; I will be really thankful.

OK. "Pack" is a function in Python for making binary structures. ">BLBL" is an instruction to the Python packer on how to pack up that data as raw bytes. I'm amazed that they got far enough to send a UDP datagram to a sim correctly with so little code.

What's going on here is that you did the XMLRPC call to the login server. It then replies, and tells you the address info for the sim running the region into which  you are logging.

From that point forward, most of the communication with the sim uses binary UDP packets. These are encoded in a format described here.The actual binary format of blocks is defined by a huge machine-readable text file called "message_template.msg", which you can find in the viewer sources. Decoding this format is Not Fun. Each UDP packet contains multiple SL messages. The messages are just run together; there's no structure that lets you pick out just the ones you want without decoding all of them. There's Lua code to do this in the Open Simulator world, and C++ code inside the viewer. Probably C# code in Open Simulator.

SL has other communication protocols. There's a serialization protocol called LLSD. It comes in two flavors, XML and binary. It's self-describing, like JSON and Google protocol buffers. That is, the names and types of the fields are in the data.

Once upon a time, around 2009, there were apparently people interested in this level of detail about the system. That was before my time, but you can go back and find info. There was an Architecture Working Group, and Project Snowglobe, and much interest in building the Metaverse. There's a monument to Project Snowglobe in Hippotropolis. Go visit and read the posters.

 

snowglobe.thumb.jpg.24505dc8bf25b8519c4b78f9453350b3.jpg

That totally ended by 2008.

But the documentation is still around, there's Open Simulator, and there are third party viewers.

  • Thanks 1
Link to comment
Share on other sites

  • 0
4 hours ago, animats said:

OK. "Pack" is a function in Python for making binary structures. ">BLBL" is an instruction to the Python packer on how to pack up that data as raw bytes. I'm amazed that they got far enough to send a UDP datagram to a sim correctly with so little code.

What's going on here is that you did the XMLRPC call to the login server. It then replies, and tells you the address info for the sim running the region into which  you are logging.

From that point forward, most of the communication with the sim uses binary UDP packets. These are encoded in a format described here.The actual binary format of blocks is defined by a huge machine-readable text file called "message_template.msg", which you can find in the viewer sources. Decoding this format is Not Fun. Each UDP packet contains multiple SL messages. The messages are just run together; there's no structure that lets you pick out just the ones you want without decoding all of them. There's Lua code to do this in the Open Simulator world, and C++ code inside the viewer. Probably C# code in Open Simulator.

SL has other communication protocols. There's a serialization protocol called LLSD. It comes in two flavors, XML and binary. It's self-describing, like JSON and Google protocol buffers. That is, the names and types of the fields are in the data.

Once upon a time, around 2009, there were apparently people interested in this level of detail about the system. That was before my time, but you can go back and find info. There was an Architecture Working Group, and Project Snowglobe, and much interest in building the Metaverse. There's a monument to Project Snowglobe in Hippotropolis. Go visit and read the posters.

 

snowglobe.thumb.jpg.24505dc8bf25b8519c4b78f9453350b3.jpg

That totally ended by 2008.

But the documentation is still around, there's Open Simulator, and there are third party viewers.

Thank you for the reply, it was really helpful, I will start reading the documentation and see how I can implement the rest of the authentication flow in my project.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1263 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...