Changes

Jump to navigation Jump to search
1,403 bytes added ,  03:55, 18 December 2019
Line 253: Line 253:  
== GetApplyDeltaTaskInfo ==
 
== GetApplyDeltaTaskInfo ==
 
Takes an input [[#ApplyDeltaTask]], returns an output [[#ApplyDeltaTaskInfo]].
 
Takes an input [[#ApplyDeltaTask]], returns an output [[#ApplyDeltaTaskInfo]].
 +
 +
== Cmd53 ==
 +
Takes an input [[NCM_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an u32 '''unk''', an u64 <code>nn::ncm::ApplicationId</code>, a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output [[#ReceiveApplicationTask]].
 +
 +
This is the ReceiveApplication version of [[#Cmd69]].
 +
 +
The wrapper used by official sw passes hard-coded value 0x2 for '''unk'''.
 +
 +
== Cmd56 ==
 +
Takes an input [[#ReceiveApplicationTask]], returns an output Event and an [[#IAsyncResult]].
 +
 +
This is the ReceiveApplication version of [[#Cmd72]].
    
== Cmd57 ==
 
== Cmd57 ==
Line 258: Line 270:     
This is the ReceiveApplication version of [[#GetSystemUpdateTaskInfo]].
 
This is the ReceiveApplication version of [[#GetSystemUpdateTaskInfo]].
 +
 +
== Cmd60 ==
 +
Takes an input u16 port, an u32 Ipv4Address, an u64 <code>nn::ncm::ApplicationId</code>, a type-0x5 input buffer containing an array of {unknown}, returns an output [[#SendApplicationTask]].
 +
 +
This is the SendApplication version of [[#Cmd69]].
 +
 +
== Cmd61 ==
 +
Takes an input [[#SendApplicationTask]], returns an output Event and an [[#IAsyncResult]].
 +
 +
This is the SendApplicationTask version of [[#Cmd72]].
    
== Cmd63 ==
 
== Cmd63 ==
Line 384: Line 406:  
| 0x24 || 0x4 || ?
 
| 0x24 || 0x4 || ?
 
|-
 
|-
| 0x28 || 0x8 || Unknown
+
| 0x28 || 0x8 || BytesPerSecond
 
|-
 
|-
| 0x30 || 0x8 || Unknown
+
| 0x30 || 0x8 || BytesPerMB
 
|-
 
|-
 
| 0x38 || 0x8 || ?
 
| 0x38 || 0x8 || ?
Line 722: Line 744:     
= Contents Delivery =
 
= Contents Delivery =
Content can be transferred with a custom protocol over the network. This is intended for use with local [[LDN_services|ldn]] networks, however the used IP addresses can be arbitary. This can be used for SystemUpdates via the above Send/Receive commands (which are then used via [[NS_Services#ns:su|ns:su]]). Application content can also be transferred, which uses a similar (?) protocol.
+
Content can be transferred with a custom protocol over the network. This is intended for use with local [[LDN_services|ldn]] networks, however the used IP addresses can be arbitrary. This can be used for SystemUpdates via the above Send/Receive commands (which are then used via [[NS_Services#ns:su|ns:su]]). Application Patch content can also be transferred with this.
    
See [[#Cmd69]]/[[#Cmd76]] for the socket setup during Receive/Send task creation. Receive system = client, while Send system = server.
 
See [[#Cmd69]]/[[#Cmd76]] for the socket setup during Receive/Send task creation. Receive system = client, while Send system = server.
Line 733: Line 755:  
** This handles installation, with messages being used via vtable funcptrs.
 
** This handles installation, with messages being used via vtable funcptrs.
   −
The Send async [[#Cmd77|thread]] does the following:
+
The Send async [[#Cmd77|thread]] does the following (the SendApplication [[#Cmd61|thread]] is identical except it uses different previously setup state):
 
* This is identical to the Receive thread except the called func is different.
 
* This is identical to the Receive thread except the called func is different.
 
** That func does:
 
** That func does:
Line 744: Line 766:  
*** This repeatedly receives requests, processes them, and sends the replies. This loop (and func) will only exit when an error occurs, or when request ID 0x0 is used (the latter causes the func to return 0).
 
*** This repeatedly receives requests, processes them, and sends the replies. This loop (and func) will only exit when an error occurs, or when request ID 0x0 is used (the latter causes the func to return 0).
 
*** This handles the requests as required by the ID, no particular order is required by the server.
 
*** This handles the requests as required by the ID, no particular order is required by the server.
*** All IDs in the below table are implemented by the server, even 0x3 for SystemUpdate.
+
*** All IDs in the below table are implemented by the server, for both SystemUpdate and Application.
*** An error is thrown if the ID is unrecognized. An error is thrown if the value of the request size1 doesn't match the expected fixed value (except for ID 0x0).
+
*** An error is thrown if the ID is unrecognized.
    
The above socket setup for the Send async thread does the following:
 
The above socket setup for the Send async thread does the following:
Line 778: Line 800:  
| 0x5 || 0x1 || Padding
 
| 0x5 || 0x1 || Padding
 
|-
 
|-
| 0x6 || 0x2 || u16 size0. Must be <=0x1000.
+
| 0x6 || 0x2 || u16 meta_size. Must be <=0x1000.
 
|-
 
|-
| 0x8 || 0x8 || s64 size1. Must not be negative.
+
| 0x8 || 0x8 || s64 data_size. Must not be negative. During message-specific handling with request/reply this must also match the expected value (except for ID 0x0 which is ignored in this case).
 
|}
 
|}
   −
After the header is the associated data for size0 and size1. The functions which generate the header always leave size0 at value 0, when receiving the data for size0 the received data is unused.
+
After the header is the associated data for meta_size and data_size. The functions which generate the header always leave meta_size at value 0, when receiving the data for meta_size the received data is unused.
    
The first message used by the client with SystemUpdate is ID 0x1.
 
The first message used by the client with SystemUpdate is ID 0x1.
   −
With SystemUpdate the server only uses StorageId=NandSystem.
+
With SystemUpdate the server only uses StorageId=BuiltInSystem.
    
Messages:
 
Messages:
Line 793: Line 815:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! ID || Request size1 / data || Reply size1 / data || Description
+
! ID || Request data_size / data || Reply data_size / data || Description
 
|-
 
|-
 
| 0x0 || 0x0 || 0x0 || Tells the server to exit. When handling this the handler func will immediately return 0, without sending a reply.
 
| 0x0 || 0x0 || 0x0 || Tells the server to exit. When handling this the handler func will immediately return 0, without sending a reply.
 
|-
 
|-
| 0x1 || [[NCM_services#ContentMetaKey|ContentMetaKey]] || 0x38-byte [[CNMT#Content_Records|Content Record]] || Gets the Content Record with type==Meta for the specified ContentMetaKey. The SystemUpdate client uses the ContentMetaKey from [[#Cmd69]].
+
| 0x1 || [[NCM_services#ContentMetaKey|ContentMetaKey]] || [[CNMT#Content_Records|PackagedContentInfo]] || Gets the PackagedContentInfo with type==Meta for the specified ContentMetaKey. The SystemUpdate client uses the ContentMetaKey from [[#Cmd69]].
 
|-
 
|-
| 0x2 || 0x18-bytes: [[NCM_services#ContentId|ContentId]] u8 flag, u8 pad[7]. When flag is 0, during the transfer [[#SendSystemUpdateTaskInfo]] [[NS_Services#SystemUpdateProgress|SystemUpdateProgress]] total_size is increased using the size of the current chunk. Once the transfer is finished, the end result is that it would be increased by the total content-size. || Size from [[NCM_services#GetSizeFromContentId|GetSizeFromContentId]] with data from [[NCM_services#ReadContentIdFile|ReadContentIdFile]]. || Gets the entire content data for the specified ContentId.
+
| 0x2 || 0x18-bytes: [[NCM_services#ContentId|ContentId]], u8 flag, u8 pad[7]. When flag is 0, during the transfer [[#SendSystemUpdateTaskInfo]] [[NS_Services#SystemUpdateProgress|SystemUpdateProgress]] current_size is increased using the size of the current chunk. Once the transfer is finished, the end result is that it would be increased by the total content-size. The only time the nim client sets this flag to 1 with SystemUpdate is with the SystemUpdate Meta content. || Size from [[NCM_services#GetSizeFromContentId|GetSizeFromContentId]] with data from [[NCM_services#ReadContentIdFile|ReadContentIdFile]]. || Gets the entire content data for the specified ContentId. The client uses each received chunk of data during the transfer with [[NCM_services|WritePlaceHolder]].
 
|-
 
|-
| 0x3 || 0x10-byte input for [[ETicket_services|es]] GetCommonTicketAndCertificateSize/GetCommonTicketAndCertificateData. || 0x8-bytes: two size u32s. Then two blocks of data with the sizes specified by the u32s. The server loads the sizes and data from [[ETicket_services|es]] GetCommonTicketAndCertificateSize/GetCommonTicketAndCertificateData. || This is presumably used by the client for Application-Delivery. The two blocks of data are used as the buffers for [[ETicket_services|es]] ImportTicket by the client.
+
| 0x3 || 0x10-byte input for [[ETicket_services|es]] GetCommonTicketAndCertificateSize/GetCommonTicketAndCertificateData. || 0x8-bytes: two size u32s. Then two blocks of data with the sizes specified by the u32s. The server loads the sizes and data from [[ETicket_services|es]] GetCommonTicketAndCertificateSize/GetCommonTicketAndCertificateData. || The two blocks of data are used as the buffers for [[ETicket_services|es]] ImportTicket by the client. This is used for transferring the specified Application Patch CommonTicket.
 
|-
 
|-
| 0x4 || s64 current_size || 0x0 || The input data is copied into the server state, for [[#SendSystemUpdateTaskInfo]] [[NS_Services#SystemUpdateProgress|SystemUpdateProgress]] current_size.
+
| 0x4 || s64 total_size || 0x0 || The input data is copied into the server state, for [[#SendSystemUpdateTaskInfo]] [[NS_Services#SystemUpdateProgress|SystemUpdateProgress]] total_size.
 
|}
 
|}
    
[[Category:Services]]
 
[[Category:Services]]

Navigation menu