OpenCore
1.0.4
OpenCore Bootloader
|
#include <Library/BaseOverflowLib.h>
Go to the source code of this file.
Macros | |
#define | XML_PARSER_NEST_LEVEL 32ULL |
#define | XML_PARSER_NODE_COUNT 32768ULL |
#define | XML_PARSER_MAX_REFERENCE_COUNT (32ULL*1024) |
#define | XML_PARSER_MAX_SIZE (32ULL*1024*1024) |
Typedefs | |
typedef enum PLIST_NODE_TYPE_ | PLIST_NODE_TYPE |
typedef struct XML_DOCUMENT_ | XML_DOCUMENT |
typedef struct XML_NODE_ | XML_NODE |
Functions | |
XML_DOCUMENT * | XmlDocumentParse (IN OUT CHAR8 *Buffer, IN UINT32 Length, IN BOOLEAN WithRefs) |
CHAR8 * | XmlDocumentExport (IN CONST XML_DOCUMENT *Document, OUT UINT32 *Length OPTIONAL, IN UINT32 Skip, IN BOOLEAN PrependPlistInfo) |
VOID | XmlDocumentFree (IN OUT XML_DOCUMENT *Document) |
XML_NODE * | XmlDocumentRoot (IN CONST XML_DOCUMENT *Document) |
CONST CHAR8 * | XmlNodeName (IN CONST XML_NODE *Node) |
CONST CHAR8 * | XmlNodeContent (IN CONST XML_NODE *Node) |
VOID | XmlNodeChangeContent (IN OUT XML_NODE *Node, IN CONST CHAR8 *Content) |
UINT32 | XmlNodeChildren (IN CONST XML_NODE *Node) |
XML_NODE * | XmlNodeChild (IN CONST XML_NODE *Node, IN UINT32 Child) |
XML_NODE *EFIAPI | XmlEasyChild (IN OUT XML_NODE *Node, IN CONST CHAR8 *ChildName,...) |
XML_NODE * | XmlNodeAppend (IN OUT XML_NODE *Node, IN CONST CHAR8 *Name, IN CONST CHAR8 *Attributes OPTIONAL, IN CONST CHAR8 *Content OPTIONAL) |
XML_NODE * | XmlNodePrepend (IN OUT XML_NODE *Node, IN CONST CHAR8 *Name, IN CONST CHAR8 *Attributes, IN CONST CHAR8 *Content) |
VOID | XmlNodeRemoveByIndex (IN OUT XML_NODE *Node, IN UINT32 Index) |
VOID | XmlNodeRemove (IN OUT XML_NODE *Node, IN XML_NODE *ChildNode) |
CONST CHAR8 * | XmlUnescapeString (IN CONST CHAR8 *String) |
XML_NODE * | PlistDocumentRoot (IN CONST XML_DOCUMENT *Document) |
XML_NODE * | PlistNodeCast (IN XML_NODE *Node OPTIONAL, IN PLIST_NODE_TYPE Type) |
UINT32 | PlistDictChildren (IN CONST XML_NODE *Node) |
XML_NODE * | PlistDictChild (IN CONST XML_NODE *Node, IN UINT32 Child, OUT XML_NODE **Value OPTIONAL) |
CONST CHAR8 * | PlistKeyValue (IN XML_NODE *Node OPTIONAL) |
BOOLEAN | PlistStringValue (IN XML_NODE *Node OPTIONAL, OUT CHAR8 *Value, IN OUT UINT32 *Size) |
BOOLEAN | PlistDataValue (IN XML_NODE *Node OPTIONAL, OUT UINT8 *Buffer, IN OUT UINT32 *Size) |
BOOLEAN | PlistBooleanValue (IN XML_NODE *Node OPTIONAL, OUT BOOLEAN *Value) |
BOOLEAN | PlistIntegerValue (IN XML_NODE *Node OPTIONAL, OUT VOID *Value, IN UINT32 Size, IN BOOLEAN Hex) |
BOOLEAN | PlistMultiDataValue (IN XML_NODE *Node OPTIONAL, OUT VOID *Buffer, IN OUT UINT32 *Size) |
BOOLEAN | PlistStringSize (IN XML_NODE *Node OPTIONAL, OUT UINT32 *Size) |
BOOLEAN | PlistDataSize (IN XML_NODE *Node OPTIONAL, OUT UINT32 *Size) |
BOOLEAN | PlistMultiDataSize (IN XML_NODE *Node OPTIONAL, OUT UINT32 *Size) |
OcXmlLib
Copyright (c) 2018, vit9696
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcXmlLib.h.
#define XML_PARSER_MAX_REFERENCE_COUNT (32ULL*1024) |
Maximum reference count. XML_PARSER_MAX_REFERENCE_COUNT*2 is required to fit into INT32.
Definition at line 68 of file OcXmlLib.h.
#define XML_PARSER_MAX_SIZE (32ULL*1024*1024) |
Maximum input data size, currently 32 MB. XML_PARSER_MAX_SIZE is required to fit into INT32.
Definition at line 76 of file OcXmlLib.h.
#define XML_PARSER_NEST_LEVEL 32ULL |
Maximum nest level. XML_PARSER_NEST_LEVEL is required to fit into INT32.
Definition at line 52 of file OcXmlLib.h.
#define XML_PARSER_NODE_COUNT 32768ULL |
Maximum child node count. XML_PARSER_NODE_COUNT*2 is required to fit into INT32.
Definition at line 60 of file OcXmlLib.h.
typedef enum PLIST_NODE_TYPE_ PLIST_NODE_TYPE |
Debug controls. Plist node types.
typedef struct XML_DOCUMENT_ XML_DOCUMENT |
Definition at line 108 of file OcXmlLib.h.
Definition at line 109 of file OcXmlLib.h.
enum PLIST_NODE_TYPE_ |
Debug controls. Plist node types.
Definition at line 88 of file OcXmlLib.h.
BOOLEAN PlistBooleanValue | ( | IN XML_NODE *Node | OPTIONAL, |
OUT BOOLEAN * | Value ) |
Get the value of a plist boolean.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Value | Value of plist boolean. |
Definition at line 1922 of file OcXmlLib.c.
BOOLEAN PlistDataSize | ( | IN XML_NODE *Node | OPTIONAL, |
OUT UINT32 * | Size ) |
Get size of a plist data.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Size | Size of data. |
Definition at line 2102 of file OcXmlLib.c.
BOOLEAN PlistDataValue | ( | IN XML_NODE *Node | OPTIONAL, |
OUT UINT8 * | Buffer, | ||
IN OUT UINT32 * | Size ) |
Decode data content for valid type or set *Size to 0.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Buffer | Buffer of plist data. |
[in,out] | Size | Size of Buffer. |
Definition at line 1886 of file OcXmlLib.c.
XML_NODE * PlistDictChild | ( | IN CONST XML_NODE * | Node, |
IN UINT32 | Child, | ||
OUT XML_NODE **Value | OPTIONAL ) |
Get the specific child node under a plist dictionary.
[in] | Node | A pointer to the XML node. |
[in] | Child | Index of children of Node. |
[out] | Value | Value of the returned Node. Optional. |
Definition at line 1823 of file OcXmlLib.c.
UINT32 PlistDictChildren | ( | IN CONST XML_NODE * | Node | ) |
Get the number of plist dictionary entries.
[in] | Node | A pointer to the XML node. |
Definition at line 1813 of file OcXmlLib.c.
XML_NODE * PlistDocumentRoot | ( | IN CONST XML_DOCUMENT * | Document | ) |
Get the root node of the plist document.
[in] | Document | A pointer to the plist document. |
Definition at line 1736 of file OcXmlLib.c.
BOOLEAN PlistIntegerValue | ( | IN XML_NODE *Node | OPTIONAL, |
OUT VOID * | Value, | ||
IN UINT32 | Size, | ||
IN BOOLEAN | Hex ) |
Get the value of a plist integer.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Value | Value of plist integer. |
[in] | Size | Size of Value to be casted to (UINT8, UINT16, UINT32, or UINT64). |
[in] | Hex | TRUE to interpret the value as hexadecimal values, decimal otherwise. |
Definition at line 1943 of file OcXmlLib.c.
CONST CHAR8 * PlistKeyValue | ( | IN XML_NODE *Node | OPTIONAL | ) |
Get the value of a plist key.
[in] | Node | A pointer to the XML node. Optional. |
Definition at line 1841 of file OcXmlLib.c.
BOOLEAN PlistMultiDataSize | ( | IN XML_NODE *Node | OPTIONAL, |
OUT UINT32 * | Size ) |
Get size of multiple types of data that are valid.
Valid type for MultiData is DATA itself, STRING, INTEGER, or BOOLEAN (as 1 byte with 1 or 0 value).
[in] | Node | A pointer to the XML node. Optional. |
[out] | Size | Size of MultiData. |
Definition at line 2126 of file OcXmlLib.c.
BOOLEAN PlistMultiDataValue | ( | IN XML_NODE *Node | OPTIONAL, |
OUT VOID * | Buffer, | ||
IN OUT UINT32 * | Size ) |
Get the values of multiple types of data that are valid.
Valid type for MultiData is DATA itself, STRING, INTEGER, or BOOLEAN (as 1 byte with 1 or 0 value).
[in] | Node | A pointer to the XML node. Optional. |
[out] | Buffer | Buffer of plist MultiData. |
[in,out] | Size | Size of Buffer. |
Definition at line 2008 of file OcXmlLib.c.
XML_NODE * PlistNodeCast | ( | IN XML_NODE *Node | OPTIONAL, |
IN PLIST_NODE_TYPE | Type ) |
Basic type casting (up to PLIST_NODE_TYPE_MAX).
Guarantees that node represents passed type. Guarantees that arrays and dicts have valid amount of children, while others have 0. Guarantees that keys have names and integers have values.
[in] | Node | A pointer to the XML node. Optional. |
[in] | Type | Plist node type to be casted to. |
Definition at line 1760 of file OcXmlLib.c.
BOOLEAN PlistStringSize | ( | IN XML_NODE *Node | OPTIONAL, |
OUT UINT32 * | Size ) |
Get size of a plist string, including the '\0' terminator.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Size | Size of string. |
Definition at line 2078 of file OcXmlLib.c.
BOOLEAN PlistStringValue | ( | IN XML_NODE *Node | OPTIONAL, |
OUT CHAR8 * | Value, | ||
IN OUT UINT32 * | Size ) |
Get the value of a plist string.
[in] | Node | A pointer to the XML node. Optional. |
[out] | Value | Value of plist string. |
[in,out] | Size | Size of Value, including the '\0' terminator. |
Definition at line 1853 of file OcXmlLib.c.
CHAR8 * XmlDocumentExport | ( | IN CONST XML_DOCUMENT * | Document, |
OUT UINT32 *Length | OPTIONAL, | ||
IN UINT32 | Skip, | ||
IN BOOLEAN | PrependPlistInfo ) |
Export parsed document into the buffer.
[in] | Document | XML_DOCUMENT to export. |
[out] | Length | Resulting length of the buffer without trailing '\0'. Optional. |
[in] | Skip | Number of root levels to be skipped before exporting, normally 0. |
[in] | PrependPlistInfo | TRUE to prepend XML plist doc info to exported document. |
Definition at line 1367 of file OcXmlLib.c.
VOID XmlDocumentFree | ( | IN OUT XML_DOCUMENT * | Document | ) |
Free all resources associated with the document. All XML_NODE references obtained through the document will be invalidated.
[in,out] | Document | XML document to be freed. |
Definition at line 1435 of file OcXmlLib.c.
XML_DOCUMENT * XmlDocumentParse | ( | IN OUT CHAR8 * | Buffer, |
IN UINT32 | Length, | ||
IN BOOLEAN | WithRefs ) |
Parse the XML fragment in buffer. References in the document to allow deduplicated node reading: <integer ID="0" size="64">0x0</integer> <integer IDREF="0" size="64">
[in,out] | Buffer | Chunk to be parsed. |
[in] | Length | Size of the buffer. |
[in] | WithRef | TRUE to enable reference lookup support. |
Buffer
will be referenced by the document, it may not be freed until XML_DOCUMENT is freed. Buffer
contents are permanently modified during parsingDefinition at line 1308 of file OcXmlLib.c.
XML_NODE * XmlDocumentRoot | ( | IN CONST XML_DOCUMENT * | Document | ) |
Get the root of the XML document.
[in] | Document | A pointer to the XML document. |
Definition at line 1447 of file OcXmlLib.c.
Get the child node specified by the list of names.
[in,out] | Node | A pointer to the XML node. |
[in] | ChildName | List of child names. |
Definition at line 1515 of file OcXmlLib.c.
XML_NODE * XmlNodeAppend | ( | IN OUT XML_NODE * | Node, |
IN CONST CHAR8 * | Name, | ||
IN CONST CHAR8 *Attributes | OPTIONAL, | ||
IN CONST CHAR8 *Content | OPTIONAL ) |
Append new node to current node.
[in,out] | Node | Current node. |
[in] | Name | Name of the new node. |
[in] | Attributes | Attributes of the new node. Optional. |
[in] | Content | New node content. Optional. |
Definition at line 1581 of file OcXmlLib.c.
VOID XmlNodeChangeContent | ( | IN OUT XML_NODE * | Node, |
IN CONST CHAR8 * | Content ) |
Change the string content of an XML node.
[in,out] | Node | A pointer to the XML node. |
[in] | Content | New node content. |
Definition at line 1477 of file OcXmlLib.c.
Get the specific child node.
[in] | Node | A pointer to the XML node. |
[in] | Child | Index of children of Node. |
Definition at line 1503 of file OcXmlLib.c.
UINT32 XmlNodeChildren | ( | IN CONST XML_NODE * | Node | ) |
Get the number of child nodes under an XML node.
[in] | Node | A pointer to the XML node. |
Definition at line 1493 of file OcXmlLib.c.
CONST CHAR8 * XmlNodeContent | ( | IN CONST XML_NODE * | Node | ) |
Get the content of an XML node.
[in] | Node | A pointer to the XML node. |
Definition at line 1467 of file OcXmlLib.c.
CONST CHAR8 * XmlNodeName | ( | IN CONST XML_NODE * | Node | ) |
Get the name of an XML node.
[in] | Node | A pointer to the XML node. |
Definition at line 1457 of file OcXmlLib.c.
XML_NODE * XmlNodePrepend | ( | IN OUT XML_NODE * | Node, |
IN CONST CHAR8 * | Name, | ||
IN CONST CHAR8 * | Attributes, | ||
IN CONST CHAR8 * | Content ) |
Prepend new node to current node.
[in,out] | Node | Current node. |
[in] | Name | Name of the new node. |
[in] | Attributes | Attributes of the new node. Optional. |
[in] | Content | New node content. Optional. |
Definition at line 1607 of file OcXmlLib.c.
Remove the child node from the current node.
[in,out] | Node | Current node. |
[in] | ChildNode | Child node to be removed. |
Definition at line 1664 of file OcXmlLib.c.
VOID XmlNodeRemoveByIndex | ( | IN OUT XML_NODE * | Node, |
IN UINT32 | Index ) |
Remove the Index-th child node inside an XML node.
[in,out] | Node | Current node. |
[in] | Index | Index-th child node to be removed. |
Definition at line 1633 of file OcXmlLib.c.
CONST CHAR8 * XmlUnescapeString | ( | IN CONST CHAR8 * | String | ) |
Unescape XML string.
[in] | String | Escaped string to be converted to unescaped. |
Definition at line 1687 of file OcXmlLib.c.