Block
The Block element is a child element of DataModel or Block. Blocks are used to group one or more other data elements such as Number or String. Blocks and DataModels are very similar, the only difference is their location. Both Block and DataModel elements can be used as the "template" for other Blocks or DataModels.
<Block name="HelloWorld">
<String value="Hello world!" />
</Block>
Attributes:
name -- Name of the data model [required]
ref -- Reference to a data model to use as a template [optional]
minOccurs -- The minimum number of times this block must occur [optional]
maxOccurs -- The maximum number of times this block can occur [optional]
length -- Specify length of this block [optional]
lengthType -- Type of length, how length is specified [optional]
pointer -- (Peach 2.3) Is this a pointer to a structure (true|false), default is false [optional]
pointerDepth -- (Peach 2.3) How many levels of pointers (e.g. void** p is 2), default is 1 [optional]
mutable -- (Peach 2.3) Is data element changeable (should it be mutated), defaults to true [optional]
Valid Child-Elements:
If a reference (ref attribute) is supplied the contents of the reference are copied to create the base of the new Block. Any child elements in the Block will override elements that already existed with the same name.
<DataModel name="Template">
<String name="Key" />
<String value=": " token="true" />
<String name="Value" />
<String value="\r\n" token="true" />
</DataModel>
<DataModel name="OtherModel">
<String value="Hello World!" />
<Block name="Customized" ref="Template">
<String name="Key" value="Content-Length" />
<String name="Value">
<Relation type="size" of="HttpBody" />
</String>
</Block>
</DataModel>
When parsed into a data model, Customized will look like the combination of both data models.
<DataModel name="OtherModel">
<String value="Hello World!" />
<Block name="Customized" ref="Template">
<String name="Key" value="Content-Length" />
<String value=": " token="true" />
<String name="Value">
<Relation type="size" of="HttpBody" />
</String>
</Block>
<String value="\r\n" token="true" />
</DataModel>
Other examples of Blocks are as follows:
<Block>
<Block>
<Block>
<String value="1" />
</Block>
<Block>
<String value="2" />
</Block>
<String value="3" />
</Block>
<String value="4" />
</Block>
Will produce the following output:
1234
Peach Fuzzing Platform