Mozilla ARchive: GraphViz block diagram (.dot) source

Mozilla ARchive file is Mozilla's own archive format to distribute software updates. Test files can be found on Mozilla's FTP site, for example:

http://ftp.mozilla.org/pub/firefox/nightly/partials/

File extension

mar

KS implementation details

License: CC0-1.0

This page hosts a formal specification of Mozilla ARchive using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

GraphViz block diagram source

mozilla_mar.dot

digraph {
	rankdir=LR;
	node [shape=plaintext];
	subgraph cluster__mozilla_mar {
		label="MozillaMar";
		graph[style=dotted];

		mozilla_mar__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="magic_pos">0</TD><TD PORT="magic_size">4</TD><TD></TD><TD PORT="magic_type">magic</TD></TR>
			<TR><TD PORT="ofs_index_pos">4</TD><TD PORT="ofs_index_size">4</TD><TD>u4be</TD><TD PORT="ofs_index_type">ofs_index</TD></TR>
			<TR><TD PORT="file_size_pos">8</TD><TD PORT="file_size_size">8</TD><TD>u8be</TD><TD PORT="file_size_type">file_size</TD></TR>
			<TR><TD PORT="len_signatures_pos">16</TD><TD PORT="len_signatures_size">4</TD><TD>u4be</TD><TD PORT="len_signatures_type">len_signatures</TD></TR>
			<TR><TD PORT="signatures_pos">20</TD><TD PORT="signatures_size">...</TD><TD>Signature</TD><TD PORT="signatures_type">signatures</TD></TR>
			<TR><TD COLSPAN="4" PORT="signatures__repeat">repeat len_signatures times</TD></TR>
			<TR><TD PORT="len_additional_sections_pos">...</TD><TD PORT="len_additional_sections_size">4</TD><TD>u4be</TD><TD PORT="len_additional_sections_type">len_additional_sections</TD></TR>
			<TR><TD PORT="additional_sections_pos">...</TD><TD PORT="additional_sections_size">...</TD><TD>AdditionalSection</TD><TD PORT="additional_sections_type">additional_sections</TD></TR>
			<TR><TD COLSPAN="4" PORT="additional_sections__repeat">repeat len_additional_sections times</TD></TR>
		</TABLE>>];
		mozilla_mar__inst__index [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
			<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
			<TR><TD PORT="index_pos">ofs_index</TD><TD PORT="index_size">...</TD><TD>MarIndex</TD><TD PORT="index_type">index</TD></TR>
		</TABLE>>];
		subgraph cluster__mar_index {
			label="MozillaMar::MarIndex";
			graph[style=dotted];

			mar_index__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="len_index_pos">0</TD><TD PORT="len_index_size">4</TD><TD>u4be</TD><TD PORT="len_index_type">len_index</TD></TR>
				<TR><TD PORT="index_entries_pos">4</TD><TD PORT="index_entries_size">len_index</TD><TD>IndexEntries</TD><TD PORT="index_entries_type">index_entries</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__index_entries {
			label="MozillaMar::IndexEntries";
			graph[style=dotted];

			index_entries__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="index_entry_pos">0</TD><TD PORT="index_entry_size">...</TD><TD>IndexEntry</TD><TD PORT="index_entry_type">index_entry</TD></TR>
				<TR><TD COLSPAN="4" PORT="index_entry__repeat">repeat to end of stream</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__signature {
			label="MozillaMar::Signature";
			graph[style=dotted];

			signature__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="algorithm_pos">0</TD><TD PORT="algorithm_size">4</TD><TD>u4be→SignatureAlgorithms</TD><TD PORT="algorithm_type">algorithm</TD></TR>
				<TR><TD PORT="len_signature_pos">4</TD><TD PORT="len_signature_size">4</TD><TD>u4be</TD><TD PORT="len_signature_type">len_signature</TD></TR>
				<TR><TD PORT="signature_pos">8</TD><TD PORT="signature_size">len_signature</TD><TD></TD><TD PORT="signature_type">signature</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__product_information_block {
			label="MozillaMar::ProductInformationBlock";
			graph[style=dotted];

			product_information_block__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="mar_channel_name_pos">0</TD><TD PORT="mar_channel_name_size">64</TD><TD>str(UTF-8)</TD><TD PORT="mar_channel_name_type">mar_channel_name</TD></TR>
				<TR><TD PORT="product_version_pos">64</TD><TD PORT="product_version_size">32</TD><TD>str(UTF-8)</TD><TD PORT="product_version_type">product_version</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__index_entry {
			label="MozillaMar::IndexEntry";
			graph[style=dotted];

			index_entry__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="ofs_content_pos">0</TD><TD PORT="ofs_content_size">4</TD><TD>u4be</TD><TD PORT="ofs_content_type">ofs_content</TD></TR>
				<TR><TD PORT="len_content_pos">4</TD><TD PORT="len_content_size">4</TD><TD>u4be</TD><TD PORT="len_content_type">len_content</TD></TR>
				<TR><TD PORT="flags_pos">8</TD><TD PORT="flags_size">4</TD><TD>u4be</TD><TD PORT="flags_type">flags</TD></TR>
				<TR><TD PORT="file_name_pos">12</TD><TD PORT="file_name_size">...</TD><TD>str(UTF-8)</TD><TD PORT="file_name_type">file_name</TD></TR>
			</TABLE>>];
			index_entry__inst__body [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="body_pos">ofs_content</TD><TD PORT="body_size">len_content</TD><TD></TD><TD PORT="body_type">body</TD></TR>
			</TABLE>>];
		}
		subgraph cluster__additional_section {
			label="MozillaMar::AdditionalSection";
			graph[style=dotted];

			additional_section__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
				<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
				<TR><TD PORT="len_block_pos">0</TD><TD PORT="len_block_size">4</TD><TD>u4be</TD><TD PORT="len_block_type">len_block</TD></TR>
				<TR><TD PORT="block_identifier_pos">4</TD><TD PORT="block_identifier_size">4</TD><TD>u4be→BlockIdentifiers</TD><TD PORT="block_identifier_type">block_identifier</TD></TR>
				<TR><TD PORT="bytes_pos">8</TD><TD PORT="bytes_size">...</TD><TD>switch (block_identifier)</TD><TD PORT="bytes_type">bytes</TD></TR>
			</TABLE>>];
additional_section__seq_bytes_switch [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
	<TR><TD BGCOLOR="#F0F2E4">case</TD><TD BGCOLOR="#F0F2E4">type</TD></TR>
	<TR><TD>:block_identifiers_product_information</TD><TD PORT="case0">ProductInformationBlock</TD></TR>
</TABLE>>];
		}
	}
	mozilla_mar__seq:signatures_type -> signature__seq [style=bold];
	mozilla_mar__seq:len_signatures_type -> mozilla_mar__seq:signatures__repeat [color="#404040"];
	mozilla_mar__seq:additional_sections_type -> additional_section__seq [style=bold];
	mozilla_mar__seq:len_additional_sections_type -> mozilla_mar__seq:additional_sections__repeat [color="#404040"];
	mozilla_mar__seq:ofs_index_type -> mozilla_mar__inst__index:index_pos [color="#404040"];
	mozilla_mar__inst__index:index_type -> mar_index__seq [style=bold];
	mar_index__seq:len_index_type -> mar_index__seq:index_entries_size [color="#404040"];
	mar_index__seq:index_entries_type -> index_entries__seq [style=bold];
	index_entries__seq:index_entry_type -> index_entry__seq [style=bold];
	signature__seq:len_signature_type -> signature__seq:signature_size [color="#404040"];
	index_entry__seq:ofs_content_type -> index_entry__inst__body:body_pos [color="#404040"];
	index_entry__seq:len_content_type -> index_entry__inst__body:body_size [color="#404040"];
	additional_section__seq:bytes_type -> additional_section__seq_bytes_switch [style=bold];
	additional_section__seq_bytes_switch:case0 -> product_information_block__seq [style=bold];
	additional_section__seq:block_identifier_type -> additional_section__seq:bytes_type [color="#404040"];
}