Begin RFC draft

This commit is contained in:
Lucidiot 2019-12-21 08:00:39 +00:00
parent 3fb82e41b5
commit d47e3a16f1
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 495 additions and 0 deletions

495
radio/rfc.txt Normal file
View File

@ -0,0 +1,495 @@
PSP Research Project Working Group ~lucidiot
PRP-Draft tilde.town
Intended status: Standards Track December 2019
Sony Compact XML Format
draft-cxml-01
Status of this Memo
This document specifies a PRP standards track protocol for the PRP
community, and requests discussion and suggestions for improvements.
Please refer to the current edition of the "Internet Official
Protocol Standards" (STD 1) for the standardization state and status
of this protocol. Distribution of this memo is unlimited.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<http://tilde.town/~lucidiot/psp/radio/>.
Copyright Notice
Copyright (c) 2019 ~lucidiot and any other persons identified as the
document authors. Some rights reserved.
This work is licensed under the Creative Commons Attribution-
NonCommercial 4.0 International License. To view a copy of this
license, visit <http://creativecommons.org/licenses/by-nc/4.0/>.
"PlayStation" and "PSP" are registered trademarks or trademarks of
Sony Computer Entertainment Inc.
"SONY" and "Memory Stick" are registered trademarks or trademarks of
Sony Corporation.
SHOUTCAST is a trademark of AOL LLC.
Abstract
The Sony Compact XML Format is defined from the results of a reverse
engineering project on the Internet Radio feature provided by the
PlayStation Portable (PSP) consoles. The name is unofficial and
extrapolated from the "CXML" magic header.
Compact XML allows both encoding and decoding an XML file with its
tag tree structure, without requiring consumers to know the schema
when decoding, and using specific types such as binary files as
values in XML elements and attributes.
This specification could open new ways to read through other system
files on a PSP or a PlayStation 3 (PS3).
~lucidiot Standards Track [Page 1]
PRP-Draft Compact XML Format December 2019
Table of Contents
1. Introduction .................................................3
1.1. Notational Conventions ......................................3
1.2. Terminology .................................................3
1.3. Design Overview .............................................3
2. File Structure ...............................................4
2.1. File Header .................................................4
2.2. Tree ........................................................5
2.2.1. Element ....................................................6
2.2.2. Attribute ..................................................7
2.3. ID Table ....................................................7
2.4. String Table ................................................7
2.5. Integer Array Table .........................................7
2.6. Float Array Table ...........................................7
2.7. File Table ..................................................7
3. Encoding and Decoding ........................................7
4. Research Opportunities........................................7
5. Security Considerations ......................................7
6. IANA Considerations ..........................................7
7. Acknowledgements .............................................8
8. References ...................................................8
8.1. Normative References ........................................8
8.2. Informative References ......................................9
9. Author's Address .............................................9
10. Warranty Exclusion Statement .................................9
~lucidiot Standards Track [Page 2]
PRP-Draft Compact XML Format December 2019
1. Introduction
TODO
1.1. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here.
1.2. Terminology
ASCII: Coded Character Set -- 7-bit American Standard Code for
Information Interchange, ANSI X3.4-1986 [ASCII]
DTD: Document Type Definition [XML]
PS3: abbreviation of PlayStation 3
PSP: abbreviation of PlayStation Portable
schema: A specific XML tree structure that MAY be defined by a DTD.
XML: Extensible Markup Language [XML]
1.3. Design Overview
TODO
~lucidiot Standards Track [Page 3]
PRP-Draft Compact XML Format December 2019
2. File Structure
A Compact XML file is structured in a succession of components,
henceforth referenced as "blocks", some of which are optional:
* A File Header that include magic numbers, a version number, and
offsets and sizes of every other block
* A Tree that describes the XML tree structure
* An OPTIONAL String Table that holds element and attribute names
and values
* An OPTIONAL Integer Array Table that holds values for elements and
attributes of the integer array type
* An OPTIONAL Float Array Table that holds values of the float array
type
* An OPTIONAL File Table that holds arbitrary binary or text files
as values of elements or attributes.
Each block is described in more detail below.
2.1. File Header
The file header MUST use the following structure:
0 bytes 4 8
0 bits 32 64
├─────┴─────┴─────┴─────┼─────┴─────┴─────┴─────┤
│ Magic Header │ Version Number │
├───────────────────────┼───────────────────────┤
│ Tree Offset │ Tree Size │
├───────────────────────┼───────────────────────┤
│ ID Table Offset │ ID Table Size │
├───────────────────────┼───────────────────────┤
│ String Table Offset │ String Table Size │
├───────────────────────┼───────────────────────┤
│Int Array Table Offset │ Int Array Table Size │
├───────────────────────┼───────────────────────┤
│Float Array Tbl. Offset│Float Array Table Size │
├───────────────────────┼───────────────────────┤
│ File Table Offset │ File Table Size │
├───────────────────────┴───────────────────────┤
│ Padding │
└───────────────────────────────────────────────┘
Figure 1
~lucidiot Standards Track [Page 4]
PRP-Draft Compact XML Format December 2019
The Magic Header MUST be an ASCII-encoded 4-byte string. Specific
Magic Headers MAY be used to distinguish specific XML schemas.
The default value for a Magic Header is "CXML".
The Version Number MUST be an unsigned 32-bit little endian integer.
Its value for the current version of this RFC MUST be 256, or 0100 in
hexadecimal notation.
Offsets and sizes MUST be unsigned 32-bit little endian integers and
MUST express their values in bytes.
All fields in this structure are REQUIRED. If an optional block is
absent, its size MUST be zero, and its offset SHOULD be the offset of
the next block, or of the byte after the last byte of the file if
there are no more blocks following it.
Blocks SHOULD be written to the file in the order provided by this
header structure.
This file header allows for a theoretical maximum file size of
8,589,934,592 bytes, although a PSP would be restricted by its Memory
Stick's file system, FAT32 [FAT32].
2.2. Tree
The Tree block describes the XML element tree structure, an element's
attributes, and the 32-bit integer or floating point values on
attributes of those types.
Although a Tree block could be optional and a Tree's size in the File
Header could be set to zero, implementations MAY NOT support this
case, as this would be interpreted as a completely empty file,
without an XML root element.
The Tree is a sequence of elements. Each element is followed by zero
or more attributes.
~lucidiot Standards Track [Page 5]
PRP-Draft Compact XML Format December 2019
2.2.1. Element
Elements MUST use the following structure:
0 bytes 4 8
0 bits 32 64
├─────┴─────┴─────┴─────┼─────┴─────┴─────┴─────┤
│Str. Table Name Offset │ Attribute Count │
├───────────────────────┼───────────────────────┤
│ Parent Offset │Previous Element Offset│
├───────────────────────┼───────────────────────┤
│ Next Element Offset │ First Child Offset │
├───────────────────────┼───────────────────────┘
│ Last Child Offset │
└───────────────────────┘
Figure 2
Every field in this structure MUST be an unsigned 32-bit integer in
little endian.
The String Table Name Offset is the relative offset in the String
Table, in bytes, of the string associated with the element's name.
The Attribute Count is the number of attributes for this element.
The Parent Offset is the relative offset in the Tree, in bytes,
of the parent element that holds this element. If this element is a
root element and does not have a parent, the Parent Offset MUST be
set to 0xFFFFFFFF (all bits at 1).
The Previous Element Offset and Next Element Offset are the relative
offsets in the Tree, in bytes, of the previous and next elements. If
there is no previous or next element, the corresponding offsets MUST
be set to 0xFFFFFFFF (all bits at 1).
The First Child Offset and Last Child Offset are the relative offsets
in the Tree, in bytes, of the first and last child elements. If there
are no children, both offsets MUST be set to 0xFFFFFFFF (all bits at
1). If there is only one children, both offsets MUST be the same.
Note that elements holding character data are indistinguishable from
attributes, because they would be represented as an attribute on
their parent element. This makes a Compact XML structure closer to
JSON than to XML.
~lucidiot Standards Track [Page 6]
PRP-Draft Compact XML Format December 2019
2.2.2. Attribute
TODO
2.3. ID Table
TODO
2.4. String Table
TODO
2.5. Integer Array Table
TODO
2.6. Float Array Table
TODO
2.7. File Table
TODO
3. Encoding and Decoding
TODO
4. Research Opportunities
TODO
5. Security Considerations
TODO
6. IANA Considerations
This document registers the "application/vnd.sony.cxml" media type.
Type name: application
Subtype name: vnd.sony.cxml
Required parameters: n/a
Optional parameters: n/a
Encoding considerations: Binary. See Section 3 of this RFC.
~lucidiot Standards Track [Page 7]
PRP-Draft Compact XML Format December 2019
Security considerations: See Section 5 of this RFC.
Interoperability considerations: This document specifies the format
of conforming files and the interpretation thereof, as understood
from the reverse engineering process. Interoperability can therefore
not be fully guaranteed for devices other than the PSP.
Published specification: TBD
Applications that use this media type: n/a
Additional information:
Magic numbers: 43 58 4d 4c 00 01 00 00
See Section 2.1 of this RFC.
File extension(s): n/a
Macintosh file type code(s): n/a
Fragment identifier considerations: n/a
Person & email address to contact for further information: See
Author's Address section.
Intended usage: Limited Use
Use of this format SHOULD be restricted to platform-specific projects
on the PlayStation Portable.
Restrictions on usage: none
Author: Sony Computer Entertainment Inc.
Change controller: See Author's Address section.
7. Acknowledgements
The author would like to thank valentintintin for their valuable help
in the research that went into learning about this file format.
8. References
8.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>.
~lucidiot Standards Track [Page 8]
PRP-Draft Compact XML Format December 2019
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[XML] World Wide Web Consortium, "Extensible Markup Language
(XML) 1.1", Second Edition, August 2006,
<https://www.w3.org/TR/xml11/>.
8.2. Informative References
[ASCII] Cerf, V., "ASCII format for Network Interchange", RFC 20,
October 1969.
[FAT32] Microsoft Corporation, "Microsoft Extensible Firmware
Initiative FAT32 File System Specification", Version 1.03,
December 2000.
9. Author's Address
~lucidiot
tilde.town
104.248.107.166
The Internet
EMail: lucidiot@brainshit.fr
10. Warranty Exclusion Statement
This document and the information contained herein is provided on an
"AS IS" basis and TILDE.TOWN DISCLAIMS ALL WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
~lucidiot Standards Track [Page 9]