/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MAR_PRIVATE_H__ #define MAR_PRIVATE_H__
#include <assert.h> // for C11 static_assert #include"limits.h" #include <stdint.h>
/* The signature block comes directly after the header block
which is 16 bytes */ #define SIGNATURE_BLOCK_OFFSET 16
/* Make sure the file is less than 500MB. We do this to protect against
invalid MAR files. */ #define MAX_SIZE_OF_MAR_FILE ((int64_t)524288000)
/* Existing code makes assumptions that the file size is
smaller than LONG_MAX. */
static_assert(MAX_SIZE_OF_MAR_FILE < ((int64_t)LONG_MAX), "max mar file size is too big");
/* We store at most the size up to the signature block + 4
bytes per BLOCKSIZE bytes */
static_assert(sizeof(BLOCKSIZE) < (SIGNATURE_BLOCK_OFFSET + sizeof(uint32_t)), "BLOCKSIZE is too big");
/* The maximum size of any signature supported by current and future
implementations of the signmar program. */ #define MAX_SIGNATURE_LENGTH 2048
/* Each additional block has a unique ID.
The product information block has an ID of 1. */ #define PRODUCT_INFO_BLOCK_ID 1
/* The mar program is compiled as a host bin so we don't have access to NSPR at runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64
instead of the NSPR equivalents. */ #ifdef XP_WIN # include <winsock2.h> /* Include stdio.h before redefining ftello and fseeko to avoid clobbering
* the ftello() and fseeko() function declarations in MinGW's stdio.h. */ # include <stdio.h> # define ftello _ftelli64 # define fseeko _fseeki64 #else # define _FILE_OFFSET_BITS 64 # include <netinet/in.h> # include <unistd.h> # include <stdio.h> #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.