[XBUP] XBUP - Extensible Binary Universal Protocol

ยป Concepts

Concept: Type System

This concept describes basic type system, which extends data structure concept to support definition of data representation.

Processing Levels

To allow additional data processing on top of data structure, there are processing levels declared. This allows to distinguish processing methods depending on supported functionality.

Basic block structure is considered to be level 0 and can be used, but protocol defines additional levels which are build on top of it. Type system described in this concept defines level 1: type-aware processing. This should provide more restricted use with should provide additional functionality for better interoperability.

Further levels should build on top of this type system and cover various areas:

Block Type

For all blocks with attributes, first two attributes are reserved for block type:

UBNatural - TypeGroup
UBNatural - BlockType

Blocks are organized by type into groups and the TypeGroup value determines to which group the block belongs to. The value 0 means that it is a basic group is used, which built-in group accessible all the time. The BlockType determines the specific type of block in the group. Allowed ranges of block type values for other than basic group and therefore the meaning of groups of blocks is defined using declaration block, which is in basic group.

Type Declaration

To define type, there are two kinds of possible operations available. For block type declaration consist operation defines type of next subblock, while join operation performs inclusion of definition for both attributes and subblocks from given block type. Same two operations can be used for declaration of the format and the group.

For the block specification, target block types for these two operations are not required and there are also defined two additional operations for finite and infinite list, which means there is 8 operations in total:

The block definition allows to define the attributes and parameters, while group and format definitions provides list of block declarations or other groups or block to merge.

Type Catalog

To store types, there is catalog of types provided, where various type declarations or other data can be stored.

The following chart shows the ER diagram of the type definition in the catalog of types, including the tree hierarchy of categories of the definitions:

Type definition's ER diagram

Diagram source file diagram4.dia

Basic Group

Basic group uses TypeGroup = 0. Basic blocks provides ability to store block type declarations, definitions and links to catalog.

Undefined Block Type

This block is used for unknown block types or data padding.

Block: Basic (0) / Unknown (0)

Declaration

Declaration block determines the allowed range of groups. This block should be located at the beginning of each file, if the application didn't provide any static/special meaning, but it might be used anywhere inside document as well.

Block: Basic (0) / Document Declaration (1)

+Natural groupsCount - The number of allocated groups
+Natural preserveGroups - The number of groups to keep from previous declarations
FormatDeclaration formatDeclaration - Declaration of format
Any documentRoot - Root node of document

For subblocks of this block there is permitted range of values in the interval group preserveGroups + 1 .. preserveGroups + groupsCount + 1. preservedGroups + groupsCount + 1. If the value reserveGroups = 0, takes the highest not yet reserved group in the current or parental blocks + 1. For all values of zero and the application of rules of cutting the block of zeros coincides with the data block.

Format Declaration

Format declaration allows you use either declaration from catalog or local format definition or both.

Block: Basic (0) / Format Declaration (2)

+CatalogFormatSpecPath catalogFormatSpecPath - Specification of format defined as path in catalog
+Natural formatSpecRevision - Specification's revision number
FormatDefinition formatDefinition

Format Definition

This block allows to specify the basic structure of format specification. Specifies the sequence of parameters using either join or consist operation.

Block: Basic (0) / Format Definition (3)

Any[] formatParameters - Join or Consist format parameters
+RevisionDefinition[] revisions

Block: Basic (0) / Format Join Parameter (4)

+FormatDeclaration formatDeclaration

Block: Basic (0) / Format Consist Parameter (5)

+GroupDeclaration groupDeclaration

Group Declaration

Group declaration allows you use either declaration from catalog or local group definition or both.

Block: Basic (0) / Group Declaration (6)

+CatalogGroupSpecPath catalogGroupSpecPath - Specification of format defined as path in catalog
+Natural groupSpecRevision - Specification's revision number
GroupDefinition groupDefinition

Group Definition

This block allows to specify the basic structure of group specification. Specifies the sequence of parameters using either join or consist operation.

Block: Basic (0) / Group Definition (7)

Any[] groupParameters - Join or Consist group parameters
+RevisionDefinition[] revisions

Block: Basic (0) / Group Join Parameter (8)

+GroupDeclaration groupDeclaration

Block: Basic (0) / Group Consist Parameter (9)

+BlockDeclaration blockDeclaration

Block Declaration

Block declaration allows you use either declaration from catalog or local block definition or both.

Block: Basic (0) / Group Declaration (10)

+CatalogBlockSpecPath catalogBlockSpecPath - Specification of format defined as path in catalog
+Natural blockSpecRevision - Specification's revision number
BlockDefinition blockDefinition

Block Definition

This block allows to specify the basic structure of block specification. Specifies the sequence of parameters using either join, consist, list join or list consist operation.

Block: Basic (0) / Block Definition (11)

Any[] blockParameters - Join or Consist or List Join or List Consist block parameters
+RevisionDefinition[] revisions

Block: Basic (0) / Block Join Parameter (12)

+BlockDeclaration blockDeclaration

Block: Basic (0) / Block Consist Parameter (13)

+BlockDeclaration blockDeclaration

Block: Basic (0) / Block List Join Parameter (14)

+BlockDeclaration blockDeclaration

Block: Basic (0) / Block List Consist Parameter (15)

+BlockDeclaration blockDeclaration

Revision Definition

Block allows to define parameters count for particular specification definition.

Block: Basic (0) / Revision Definition (16)

+Natural parametersCount

Type Context

For each block, there is type context which provides mapping of particular block type (as defined above) to particular declaration/definition. Context is typically same for block and it's children, except for declaration block and it's formatDeclaration parameter, which affects context of documentRoot block and also incrementally affects group and block definitions which can use block types already defined in currently processed declaration.

Document Validity

The document is valid if it is properly created and all types of blocks and their attributes are properly defined. This precisely means: