StreetPass: Difference between revisions

m I added the meaning of some fields of the probe request/response that were still "unknown" (it's a Type-length-value structure). I also added that the SEND_ONLY mode is used when the inbox is full. Although it may be used in other cases too?
 
(5 intermediate revisions by 2 users not shown)
Line 56: Line 56:
==== Nintendo Tag Format ====
==== Nintendo Tag Format ====


The offsets, in bytes, mentioned in the table below start at the beginning of the Nintendo tag ID, which is variable in length, and can be found right after the Vendor Specific OUI type of the 802.11 frame, which is often seen as a byte of "01". Each one of the elements are discussed in more detail after the table. Note that this table represents a current theory on what each of the fields represent, with the argument stated in the corresponding sections.
The offsets, in bytes, mentioned in the table below start at the beginning of the Nintendo tag ID, which is variable in length, and can be found right after the Vendor Specific OUI type of the 802.11 frame, which is often seen as a byte of "01". Each one of the elements are discussed in more detail after the table. Note that this table represents a current theory on what each of the fields represent, with the argument stated in the corresponding sections. It seems to follow a "Type–length–value" structure.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 68: Line 68:
|  0x00
|  0x00
|  0x01
|  0x01
|  '''Protocol Identification'''
|  '''StreetPass Service Tag'''
May be for protocol identification. All captures thus far show this value at 17, hexadecimal 11.
The identifier of the StreetPass Service. All captures thus far show this value at 17, hexadecimal 11.
| 11
| 11
|-
|-
Line 84: Line 84:
|  00 02 08 00 00
|  00 02 08 00 00
|-
|-
varies
-0x10
0x02
0x1
|  '''Unknown'''
|  '''StreetPass consoleID Tag'''
At the end of the StreetPass Services field is a two byte field that is the same among all devices thus far. Its purpose is unknown.
The identifier of the StreetPass consoleID, it is always the same value.
f0 08
|  f0
|-
|  -0x09
|  0x01
|  '''StreetPass consoleID Length'''
|  The length of the StreetPass consoleID field, which is also always the same value.
|  08
|-
|-
|  -0x08
|  -0x08
Line 97: Line 103:
|}
|}


===== Protocol Version =====
===== StreetPass Service Tag =====


Appears to represent a protocol version, or device identification. This field remains consistent on all devices, despite variable enabled StreetPass services or length of the tag. Could also represent region.
This field indicates that the following data is of type StreetPass services. It is the same across all devices.


===== StreetPass Service Length =====
===== StreetPass Service Length =====
Line 113: Line 119:
   Sims 3: 00 03 65 00 30
   Sims 3: 00 03 65 00 30
   Street Fighter: 00 03 05 00 02 (FF FF FF FF FF FF)
   Street Fighter: 00 03 05 00 02 (FF FF FF FF FF FF)
  Tomodachi life: 00 08 C5 00 30 (Tested on EUR region)
  Animal crossing new leaf: 00 19 8D 00 30 (Tested on EUR region)


The first 4 bytes are the titleID of the service, the last byte seems to contain flags.
The first 4 bytes are the titleID of the service, the last byte seems to contain flags.
Line 126: Line 134:


Only the bits 2,5,6 were used.
Only the bits 2,5,6 were used.
When set, the bit n°2 indicates the presence of a followinf 6-byte field filled with 0xff.
When set, the bit n°2 indicates the presence of a following 6-byte field filled with 0xff.


Some services have a 6-byte field succeeding the StreetPass service that is just FF bytes (e.g. FF FF FF FF FF FF). The purpose of these is unknown, although may be used as data for a service, or as separator of some sort for different types of StreetPass services.
Some services have a 6-byte field succeeding the StreetPass service that is just FF bytes (e.g. FF FF FF FF FF FF). The purpose of these is unknown, although may be used as data for a service, or as separator of some sort for different types of StreetPass services.
Line 388: Line 396:
|}
|}


===== Unknown 2-byte Field =====
===== StreetPass consoleID Tag =====


The purpose of this field is not known yet. It has remained the same across all devices thus far. The value has always been observed as '''f008'''.
It has remained the same across all devices thus far, '''f0'''. It identifies the StreetPass consoleID field.
 
===== StreetPass consoleID Length =====
 
Since the StreetPass consoleID length is always 0x08, this field is always '''08'''.


===== StreetPass consoleID =====
===== StreetPass consoleID =====
Line 417: Line 429:
|1||RECV_ONLY||3DS doesn't have anything in its outbox so it is only receiving messages.
|1||RECV_ONLY||3DS doesn't have anything in its outbox so it is only receiving messages.
|-
|-
|2||SEND_ONLY||
|2||SEND_ONLY||3DS inbox is full so it is only sending messages.
|-
|-
|3||SEND_RECV||
|3||SEND_RECV||
Line 500: Line 512:
The body is expected to contain binary data with the same structure as the spr-slotXX files in the request. The order of these must be the same as the reponse header order.
The body is expected to contain binary data with the same structure as the spr-slotXX files in the request. The order of these must be the same as the reponse header order.


== Structs, Data Types ==
Streetpass uses multiple different structs and data types for storing and transporting data.
=== MessageId ===
This datatype holds a per-console-per-title unique message id.
{| class="wikitable" border="1"
! Type
! Description
|-
| u8[8]
| The message id
|}
=== Timestamp12 ===
This holds a timestamp in 12 bytes
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
|-
| 0x0
| 0x4
| u32
| Year
|-
| 0x4
| 0x1
| u8
| Month
|-
| 0x5
| 0x1
| u8
| Day
|-
| 0x6
| 0x1
| u8
| Weekday
|-
| 0x7
| 0x1
| u8
| Hour
|-
| 0x8
| 0x1
| u8
| Minute
|-
| 0x9
| 0x1
| u8
| Second
|-
| 0xA
| 0x2
| u16
| Millisecond
|}
=== Message (0x6060) ===
MessageHeader:
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x2
| u16
| magic
| Equals 0x6060 (<code>``</code>)
|-
| 0x02
| 0x2
| u16
| Padding
|
|-
| 0x04
| 0x04
| u32
| message_size
| The size in bytes of the entire message, including all headers and hmac
|-
| 0x08
| 0x04
| u32
| total_header_size
| The size in bytes of all headers, including the extra headers
|-
| 0x0C
| 0x04
| u32
| body_size
| The size in bytes of the body of the message
|-
| 0x10
| 0x04
| u32
| title_id
| The title id of the message
|-
| 0x14
| 0x04
| u32
| title_id2
| ???
|-
| 0x18
| 0x04
| u32
| batch_id
| The sending client sets an ID here if multiple messages should be batched together into one transaction
|-
| 0x1C
| 0x04
| u32
| transfer_id
| All messages from the same transfer (That is, sending the messages) contain the same transfer id
|-
| 0x20
| 0x08
| MessageId
| message_id
| The ID of the sending message
|-
| 0x28
| 0x04
| u32
| message_version
| ???
|-
| 0x2C
| 0x08
| MessageId
| message_id_2
| The message ID that this message is referring to, e.g. the individual responses in Streetpass Mii Plaza
|-
| 0x34
| 0x01
| u8
| recipients
| bitfield: 0x01: everyone; 0x02: friends
|-
| 0x35
| 0x01
| SendMethod
| send_method
|
|-
| 0x36
| 0x01
| bool
| unopened
| Set if the message hasn't been opened yet
|-
| 0x37
| 0x01
| bool
| is_new
| Set if the message is new
|-
| 0x38
| 0x08
| u64
| sender_id
|
|-
| 0x40
| 0x08
| u64
| sender_id_2
|
|-
| 0x48
| 0x0C
| Timestamp12
| sent
|
|-
| 0x54
| 0x0C
| Timestamp12
| received
|
|-
| 0x60
| 0x0C
| Timestamp12
| created
|
|-
| 0x6C
| 0x01
| u8
| send_count
| How often this message can be sent
|-
| 0x6D
| 0x01
| u8
| forward_count
| How often this message can be forwarded
|-
| 0x6E
| 0x02
| u16
| user_data
| ???
|}
ExtMessageHeader:
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x04
| u32
| type
| The type of the extra header
|-
| 0x04
| 0x04
| u32
| size
| Size, in bytes, of the extra header
|-
| 0x08
|
|
| body
| The body of the extra header
|}
Message:
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x70
| MessageHeader
| header
| The header of the message
|-
| 0x70
|
| ExtMessageHeader[]
| ext_headers
| An array of the extra headers for the message. The array keeps filling until the length no more until <code>header.total_header_size</code>
|-
|
|
|
| body
| The actual body/payload of the message
|-
|
| 0x20
| u8[0x20]
| hmac
| The hmac over the body with the hmac_key
|}
=== Slot (0x6161) ===
The slot groups multiple messages of one title id together into a single struct
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6161 (<code>aa</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x04
| u32
| size
| The size of bytes of the entire slot, including the header and all messages it contains
|-
| 0x08
| 0x04
| u32
| title_id
| The title id of the slot
|-
| 0x0C
| 0x04
| u32
| batch_id
| If the slot contains batched messages, the batch id is set to the same one as those messages
|-
| 0x10
| 0x04
| u32
| message_count
| The total number of messages in this slot
|-
| 0x14
|
| Message[]
| messages
| An array of length <code>message_count</code> all the messages of this slot
|}
=== BoxInfo (0x6262) ===
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6262 (<code>bb</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x04
| u32
| file_size
| The size of the box info in bytes
|-
| 0x08
| 0x04
| u32
| max_box_size
| The maximum allowed size of the box in bytes
|-
| 0x0C
| 0x04
| u32
| box_size
| The current size of the box in bytes
|-
| 0x10
| 0x04
| u32
| max_num_messages
| The maximum number of messages that the box can hold
|-
| 0x14
| 0x04
| u32
| num_messages
| The current number of messages in the box
|-
| 0x18
| 0x04
| u32
| max_batch_size
| The maximum size of a bach, in number of messages
|-
| 0x1C
| 0x04
| u32
| max_message_size
| The maximum size of a message, in bytes
|-
| 0x20
|
| MessageHeader[]
| message_headers
| An array of all message headers in this box of length <code>num_messages</code>
|}
=== MBoxInfo (0x6363) ===
This holds information on the message box, including both inbox and outbox
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6363 (<code>cc</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x04
| u32
| title_id
| The title id for this mbox
|-
| 0x08
| 0x04
| u32
| private_id
| ???
|-
| 0x0C
| 0x01
| u8
| mbox_type_flags
| 0x01: normal programs, 0x06: system programs, 0x80: silent notif
|-
| 0x0D
| 0x01
| bool
| enabled
| Weather this message box is enabled
|-
| 0x0E
| 0x02
| u16
| padding
|
|-
| 0x10
| 0x20
| u8[0x20]
| hmac_key
| The hmac key to make hmacs for messages. These are unique per title, however they are the same for all consoles.
|-
| 0x30
| 0x04
| u32
| padding
|
|-
| 0x34
| 0x0C
| Timestamp12
| last_accessed
|
|-
| 0x40
| 0x01
| bool
| flag_unread
| Does this message box contain unread messages?
|-
| 0x41
| 0x01
| bool
| flag_new
| Does this message box contain new messages?
|-
| 0x42
| 0x01
| bool
| flag_unknown
| ???
|-
| 0x43
| 0x01
| bool
| flag_unknown
| ???
|-
| 0x44
| 0x0C
| Timestamp12
| last_received
|
|-
| 0x50
| 0x04
| u32
| padding
|
|-
| 0x54
| 0x0C
| Timestamp12
| unknown_timestamp
| ???
|}
=== 0x6565 ===
SlotMetadata:
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x04
| u32
| title_id
| The title id of the slot
|-
| 0x04
| 0x04
| SendMethod
| send_method
| The send method for the slot
|-
| 0x08
| 0x04
| u32
| body_size
| The size of the slot body in bytes
|-
| 0x0C
| 0x04
| u32
| count
| Number of messages
|-
| 0x10
| 0x14
| '''unknown'''
| '''unknown'''
|
|}
Struct:
{| class="wikitable" border="1"
! Offset
! Length
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6565 (<code>ee</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x28
| '''unknown'''
| '''unknown'''
|
|-
| 0x2C
| 0x360
| SlotMetadata[0x18]
| slots
| Metadata of all slots
|}
=== OBIndex (0x6767) ===
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6767 (<code>gg</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x04
| u32
| num_messages
| The number of messages in the outbox
|-
| 0x08
|
| MessageId[]
| message_ids
| An array of the message IDs in the outbox, of length <code>num_messages</code>
|}
=== MBoxList (0x6868) ===
{| class="wikitable" border="1"
! Offset
! Size
! Type
! Name
! Description
|-
| 0x00
| 0x02
| u16
| magic
| Equals 0x6868 (<code>hh</code>)
|-
| 0x02
| 0x02
| u16
| padding
|
|-
| 0x04
| 0x04
| u32
| version
|
|-
| 0x08
| 0x04
| u32
| num_boxes
| The number of boxes (= games with streetpass enabled)
|-
| 0x0C
| 0x180
| char[0x18][0x10]
| box_names
| A 0x18-long array of all the box names (= hex encoded title ids) of games with streetpass enabled
|}


[[Category:Nintendo Software]]
[[Category:Nintendo Software]]