1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
/// # Disable Simulator
/// <https://wiki.secondlife.com/wiki/DisableSimulator>
///
/// A packet sent by the server to inform the viewer of disconnection. This packet has no body, and
/// is functionally just a header.
///
/// ## Header
/// | DisableSimulator | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:152 | reliable: false| zerocoded: false | frequency: Low |
/// # Logout Request
/// <https://wiki.secondlife.com/wiki/LogoutRequest>
///
/// Logs out user from the simulator and ends the session
///
/// ## Header
/// |CompleteAgentMovement |||||
/// |----------------------|---------|-----------------|------------------|-----------------|
/// | Packet Header | id: 252 | reliable: true | zerocoded: false | frequency: Low |
///
/// ## Packet Structure
/// | LogoutRequest | | | |
/// |-----------------------|----------|--------------------|---------------------------------|
/// | AgentID | 16 bytes | [Uuid](uuid::Uuid) | The ID of the user agent |
/// | SessionID | 16 bytes | [Uuid](uuid::Uuid) | The ID of the current session |
///
/// # Packet Ack
/// <https://wiki.secondlife.com/wiki/PacketAck>
///
/// The acknowledgement packet sent from the viewer to verify receiving reliable packets.
///
/// ## Header
/// | PacketAck | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:251 | reliable: false| zerocoded: false | frequency: Fixed |
///
///
/// ## Packet Structure
/// | PacketAck ||||
/// |--------|--------|------|-----|
/// | count | 1 byte | [u8] | number of ack IDs contained in the packet|
/// | Packet Ids| variable bytes | ID | List of IDs that need to be acked |
/// | ID | 4 bytes | [u32] | Sequence numbers of packets to be acked |
/// # Region Handshake
/// <https://wiki.secondlife.com/wiki/RegionHandshake>
///
/// The packet sent from the server in response to CompleteAgentMovement. The viewer responds to
/// this with RegionHandshakeReply, which finishes the handshakes and begins object updats with
/// CoarseLocationUpdate.
///
/// ## Header
/// | Region Handshake | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:80 | reliable: false| zerocoded: false | frequency: Low |
///
/// ## Packet Structure
/// | Region Handshake | | | |
/// |----------------------|---------|-------|--------------|
/// | RegionFlags | 4 bytes | [u32] | Region flags |
/// | Unused byte | 1 byte | | unknown, but must be read to keep alignment |
/// | SimAccess | 1 byte | [u8] | The access level of the viewer |
/// | NameLength | 1 byte | [u8] | the length in bytes of the sim name |
/// | SimName | variable bytes| [String] | The name of the simulator |
/// | SimOwner | 4 bytes | [Uuid](uuid::Uuid) | The user ID of the owner of the sim|
/// | IsEstateManager | 4 bytes | [bool]| is the user an estate manager of this sim |
/// | WaterHeight | 4 bytes | [f32] | the height of the water in the sim |
/// | Billablefactor | 4 bytes | [f32] | undocumented |
/// | CacheID | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainBase0 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainBase1 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainBase2 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainBase3 | 16 btyes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainDetail0 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainDetail1 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainDetail2 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainDetail3 | 16 bytes | [Uuid](uuid::Uuid) | undocumented |
/// | TerrainStartHeight0 | 4 bytes | [f32] | undocumented |
/// | TerrainStartheight1 | 4 bytes | [f32] | undocumented |
/// | TerrainStartheight2 | 4 bytes | [f32] | undocumented |
/// | TerrainStartheight3 | 4 bytes | [f32] | undocumented |
/// | TerrainHeightRange0 | 4 bytes | [f32] | undocumented |
/// | TerrainHeightRange1 | 4 bytes | [f32] | undocumented |
/// | TerrainHeightRange2 | 4 bytes | [f32] | undocumented |
/// | TerrainHeightRange3 | 4 bytes | [f32] | undocumented |
/// # Region Handshake Reply
/// <https://wiki.secondlife.com/wiki/RegionHandshakeReply>
///
/// The viewer sends this in response to RegionHandshake, which begins object updates via
/// CoarseLocationUpdate. This finishes the login handshake.
///
/// ## Header
/// | Region Handshake Reply | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:149 | reliable: false| zerocoded: false | frequency: Low |
///
/// ## Packet Structure
/// | Region Handshake | | | |
/// |------------------|----------|-------|--------------|
/// | AgentID | 16 bytes | [Uuid](uuid::Uuid) | user's agent ID |
/// | SessionID | 16 bytes | [Uuid](uuid::Uuid) | User's session ID |
/// | Flags | 4 bytes | [u32] | undocumented |
/// # Start Ping Check
/// <https://wiki.secondlife.com/wiki/StartPingCheck>
///
/// Used to emasure ping times. PingId is increased by 1 each time StartPingCheck is sent. at 255
/// it rolls over to 0.
///
/// ## Header
/// | StartPingCheck | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:1 | reliable: false| zerocoded: false | frequency: High |
///
/// ## Packet Structure
/// | PingCheck ||||
/// |--------|--------|------|-----|
/// | PingID | 1 byte | [u8] | the ID of the ping being sent. Used by complete ping check to verify it was received.|
/// | OldestUnacked | 4 bytes | [u32] | The sequence number of the most recent message sent by the source, stored as little-endian |
/// # Complete Ping Check
/// <https://wiki.secondlife.com/wiki/CompletePingCheck>
///
/// The response sent by the viewer when receiving a ping check packet from the server.
/// Completes the check started by the viewer.
///
/// ## Header
/// | CompletePingCheck | | | | |
/// |--------------|-------------|----------------|-------------------|---------------------|
/// | Packet Header| id:2 | reliable: false| zerocoded: false | frequency: High |
///
///
/// ## Packet Structure
/// | PingCheck ||||
/// |--------|--------|------|-----|
/// | PingID | 1 byte | [u8] | the value received during StartPingCheck. Lets server know which ping was completed. |
/// # Circuit Code
/// <https://wiki.secondlife.com/wiki/UseCircuitCode>
///
/// Sent from the viewer to establish a circuit connection with a simulator. This is necessary
/// before any other circuit commmunication is possible.
/// The simulator will start sending StartPingCheck messages after this is sent
///
/// ## Header
/// | UseCircuitCode |||||
/// |--------------|---------------|----------------|-------------------|---------------------|
/// | Packet Header| id:3 | reliable: false| zerocoded: false | frequency: Low |
///
/// ## Packet Structure
/// | CircuitCodeData | | | |
/// |-----------------|---------|-------|---------------|
/// | Code | 4 bytes | [u32] | The code the server will check against other trusted packets |
/// | SessionID | 16 bytes| [Uuid](uuid::Uuid) | The ID of the session |
/// | ID | 16 bytes| [Uuid](uuid::Uuid) | undocumented |
/// # Complete Agent Movement
/// <https://wiki.secondlife.com/wiki/CompleteAgentMovement>
///
/// This establishes the avatar presence in a region. If this packet is not sent, the avatar never
/// appears, and the login does not fully succeed.
///
/// ## Header
/// |CompleteAgentMovement |||||
/// |----------------------|---------|-----------------|------------------|-----------------|
/// | Packet Header | id: 249 | reliable: false | zerocoded: false | frequency: Low |
///
/// ## Packet Structure
/// | CompleteAgentMovement | | | |
/// |-----------------------|----------|--------------------|---------------------------------|
/// | agent_id | 16 bytes | [Uuid](uuid::Uuid) | The ID of the user agent (sent from server to viwer with login)|
/// | session_id | 16 bytes | [Uuid](uuid::Uuid) | The ID of the user session (sent from server to client with login)|
/// | circuit_code | 4 bytes | [u32] | The CircuitCode (sent from server to client with login) |
/// # Agent Throttle
/// <https://wiki.secondlife.com/wiki/AgentThrottle>
///
/// This packet is sent to inform the server of the viewer's maximum bandwidth. If this packet is
/// never sent, the server may be slow to respond, and throttle the amount of data it sends to the
/// viewer, leading to long loading times.
///
/// The maximum and minimum values are:
/// Resend - Max: 150,000
/// Land - Max: 170,000
/// Wind - Max: 34,000
/// Cloud - Max: 34,000
/// Task - Max: 446,000
/// Texture - Max: 446,000
/// Asset - Max: 220,000
///
/// ## Header
/// |AgentThrottle |||||
/// |----------------------|---------|-----------------|------------------|-----------------|
/// | Packet Header | id: 81 | reliable: false | zerocoded: false | frequency: Low |
///
///
/// ## Packet Structure
/// | AgentThrottle | | | |
/// |-----------------------|----------|--------------------|---------------------------------|
/// | agent_id | 16 bytes | [Uuid](uuid::Uuid) | The ID of the user agent |
/// | session_id | 16 bytes | [Uuid](uuid::Uuid) | The ID of the user session |
/// | circuit_code | 4 bytes | [u32]| The CircuitCode |
/// | gen_id | 4 bytes | [u32]| label to inform the viewer that one packet is more recent than the other. Can be set to 0. |
/// | resend | 4 bytes | [f32]| maximum bytes per second for resent packets |
/// | land | 4 bytes | [f32]| maximum bytes per second for land packets |
/// | wind | 4 bytes | [f32]| maximum bytes per second for wind packets |
/// | cloud | 4 bytes | [f32]| maximum bytes per second for cloud packets |
/// | task | 4 bytes | [f32]| maximum bytes per second for task packets |
/// | texture | 4 bytes | [f32]| maximum bytes per second for texture packets |
/// | asset | 4 bytes | [f32]| maximum bytes per second for asset packets |
/// # Enable Simulator
/// <https://wiki.secondlife.com/wiki/EnableSimulator>
///
/// This packet is sent to tell the server the viewer is ready to retrieve region data.
///
/// ## Header
/// |EnableSimulator |||||
/// |----------------------|---------|-----------------|------------------|-----------------|
/// | Packet Header | id: 151 | reliable: false | zerocoded: false | frequency: Low |
///
///
/// ## Packet Structure
/// | AgentThrottle | | | |
/// |-----------------------|----------|--------------------|---------------------------------|
/// | handle | 8 bytes | [u64]| ID of the region |
/// | ip | 4 bytes | [String] | IP address of the ready viewer |
/// | port | 2 bytes | [u16]| port the ready viewer is connected to |
/// TODO: UNIMPLEMENTED
/// TODO: UNIMPLEMENTED
/// TODO: UNIMPLEMENTED
/// TODO: UNIMPLEMENTED
/// TODO: UNIMPLEMENTED
/// TODO: UNIMPLEMENTED