1#ifndef ROSE_BinaryAnalysis_Partitioner2_ModulesJvm_H 
    2#define ROSE_BinaryAnalysis_Partitioner2_ModulesJvm_H 
    3#include <featureTests.h> 
    4#ifdef ROSE_ENABLE_BINARY_ANALYSIS 
    6#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h> 
    7#include <Rose/BinaryAnalysis/Partitioner2/Modules.h> 
    8#include <sageContainer.h> 
   14namespace BinaryAnalysis {
 
   15namespace Partitioner2 {
 
   22void warn(
const std::string &msg);
 
   54  MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50,
 
   55  MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50,
 
   56  MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50,
 
   57  MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30,
 
   58  MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46,
 
   59  MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22,
 
   61  MZ_ZIP_CDH_SIG_OFS = 0,
 
   62  MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4,
 
   63  MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6,
 
   64  MZ_ZIP_CDH_BIT_FLAG_OFS = 8,
 
   65  MZ_ZIP_CDH_METHOD_OFS = 10,
 
   66  MZ_ZIP_CDH_FILE_TIME_OFS = 12,
 
   67  MZ_ZIP_CDH_FILE_DATE_OFS = 14,
 
   68  MZ_ZIP_CDH_CRC32_OFS = 16,
 
   69  MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20,
 
   70  MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24,
 
   71  MZ_ZIP_CDH_FILENAME_LEN_OFS = 28,
 
   72  MZ_ZIP_CDH_EXTRA_LEN_OFS = 30,
 
   73  MZ_ZIP_CDH_COMMENT_LEN_OFS = 32,
 
   74  MZ_ZIP_CDH_DISK_START_OFS = 34,
 
   75  MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36,
 
   76  MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38,
 
   77  MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42,
 
   79  MZ_ZIP_LDH_SIG_OFS = 0,
 
   80  MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4,
 
   81  MZ_ZIP_LDH_BIT_FLAG_OFS = 6,
 
   82  MZ_ZIP_LDH_METHOD_OFS = 8,
 
   83  MZ_ZIP_LDH_FILE_TIME_OFS = 10,
 
   84  MZ_ZIP_LDH_FILE_DATE_OFS = 12,
 
   85  MZ_ZIP_LDH_CRC32_OFS = 14,
 
   86  MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18,
 
   87  MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22,
 
   88  MZ_ZIP_LDH_FILENAME_LEN_OFS = 26,
 
   89  MZ_ZIP_LDH_EXTRA_LEN_OFS = 28,
 
   91  MZ_ZIP_ECDH_SIG_OFS = 0,
 
   92  MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4,
 
   93  MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6,
 
   94  MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8,
 
   95  MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10,
 
   96  MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12,
 
   97  MZ_ZIP_ECDH_CDIR_OFS_OFS = 16,
 
   98  MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20
 
  102  MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024,
 
  103  MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260,
 
  104  MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256
 
  151  uint16_t versionMadeBy_;
 
  152  uint16_t versionNeeded_;
 
  160  uint64_t uncompSize_;
 
  161  uint16_t fileNameLength_;
 
  162  uint16_t extraFieldLength_;
 
  163  uint16_t commentLength_;
 
  165  uint16_t internalAttr_;
 
  166  uint32_t externalAttr_;
 
  167  uint32_t localHeaderOfs_;
 
  168  char filename_[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE];
 
  169  char comment_[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE];
 
 
  178  const std::vector<FileStat> & 
files() 
const;
 
  180  bool present(
const std::string &name) 
const;
 
  181  size_t fileSize(
const std::string &name) 
const;
 
  182  size_t offset(
const char* file) 
const;
 
  184  uint8_t* decode(
const std::string &name, 
size_t &nbytes);
 
  189  const uint8_t* data()
 const {
 
  190    return buffer_.data();
 
  201  std::vector<uint8_t> buffer_;
 
  202  std::vector<FileStat> files_;
 
  203  std::map<std::string,size_t> offsetMap_;
 
  209    uint32_t numFiles() 
const;
 
  210    size_t cdirOffset() 
const;
 
  213    uint16_t diskNumber_; 
 
  214    uint16_t diskNumberStart_; 
 
  216    uint16_t numFilesTotal_; 
 
  219    uint16_t lenComment_; 
 
  223    ZipEnd(
const ZipEnd &) = 
delete;
 
  224    ZipEnd &operator=(
const ZipEnd &) = 
delete;
 
  229    size_t localHeaderSize() 
const;
 
  231    explicit LocalHeader(
const uint8_t* buf, 
size_t offset);
 
  242    uint64_t uncompSize_;
 
  243    uint16_t fileNameLength_;
 
  244    uint16_t extraFieldLength_;
 
  245    char filename_[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE];
 
  248    LocalHeader() = 
delete;
 
  249    LocalHeader(
const LocalHeader&) = 
delete;
 
  250    LocalHeader& operator=(
const LocalHeader&) = 
delete;
 
 
Base class for binary files.
 
std::enable_if< std::is_integral< T >::value, T >::type leToHost(const T &x)
Convert a little-endian integer to host order.
 
This class represents the contents of a central directory file header in a zip file.
 
size_t offset() const
Offset (in bytes) of the local headers.
 
size_t uncompressedSize() const
Uncompressed size of the file (bytes)
 
uint32_t centralHeaderSize() const
Size (in bytes) of the central directory header.
 
std::string filename() const
The name of the file.
 
size_t compressedSize() const
Compressed size of the file (bytes)
 
FileStat(const uint8_t *buf, size_t &offset, uint32_t fileIndex)
Constructor.
 
const std::vector< FileStat > & files() const
Listing of file names in the container.