ROSE 0.11.145.267
Classes | Enumerations | Functions
Rose::BinaryAnalysis::Partitioner2::ModulesJvm Namespace Reference

Description

Disassembly and partitioning utility functions for JVM.

Utility functions, primarily for handling Java jar files.

Classes

struct  FileStat
 This class represents the contents of a central directory file header in a zip file. More...
 
struct  Zipper
 

Enumerations

enum  {
  MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIG = 0x06054b50 ,
  MZ_ZIP_CENTRAL_DIR_HEADER_SIG = 0x02014b50 ,
  MZ_ZIP_LOCAL_DIR_HEADER_SIG = 0x04034b50 ,
  MZ_ZIP_LOCAL_DIR_HEADER_SIZE = 30 ,
  MZ_ZIP_CENTRAL_DIR_HEADER_SIZE = 46 ,
  MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE = 22 ,
  MZ_ZIP_CDH_SIG_OFS = 0 ,
  MZ_ZIP_CDH_VERSION_MADE_BY_OFS = 4 ,
  MZ_ZIP_CDH_VERSION_NEEDED_OFS = 6 ,
  MZ_ZIP_CDH_BIT_FLAG_OFS = 8 ,
  MZ_ZIP_CDH_METHOD_OFS = 10 ,
  MZ_ZIP_CDH_FILE_TIME_OFS = 12 ,
  MZ_ZIP_CDH_FILE_DATE_OFS = 14 ,
  MZ_ZIP_CDH_CRC32_OFS = 16 ,
  MZ_ZIP_CDH_COMPRESSED_SIZE_OFS = 20 ,
  MZ_ZIP_CDH_DECOMPRESSED_SIZE_OFS = 24 ,
  MZ_ZIP_CDH_FILENAME_LEN_OFS = 28 ,
  MZ_ZIP_CDH_EXTRA_LEN_OFS = 30 ,
  MZ_ZIP_CDH_COMMENT_LEN_OFS = 32 ,
  MZ_ZIP_CDH_DISK_START_OFS = 34 ,
  MZ_ZIP_CDH_INTERNAL_ATTR_OFS = 36 ,
  MZ_ZIP_CDH_EXTERNAL_ATTR_OFS = 38 ,
  MZ_ZIP_CDH_LOCAL_HEADER_OFS = 42 ,
  MZ_ZIP_LDH_SIG_OFS = 0 ,
  MZ_ZIP_LDH_VERSION_NEEDED_OFS = 4 ,
  MZ_ZIP_LDH_BIT_FLAG_OFS = 6 ,
  MZ_ZIP_LDH_METHOD_OFS = 8 ,
  MZ_ZIP_LDH_FILE_TIME_OFS = 10 ,
  MZ_ZIP_LDH_FILE_DATE_OFS = 12 ,
  MZ_ZIP_LDH_CRC32_OFS = 14 ,
  MZ_ZIP_LDH_COMPRESSED_SIZE_OFS = 18 ,
  MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS = 22 ,
  MZ_ZIP_LDH_FILENAME_LEN_OFS = 26 ,
  MZ_ZIP_LDH_EXTRA_LEN_OFS = 28 ,
  MZ_ZIP_ECDH_SIG_OFS = 0 ,
  MZ_ZIP_ECDH_NUM_THIS_DISK_OFS = 4 ,
  MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS = 6 ,
  MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS = 8 ,
  MZ_ZIP_ECDH_CDIR_TOTAL_ENTRIES_OFS = 10 ,
  MZ_ZIP_ECDH_CDIR_SIZE_OFS = 12 ,
  MZ_ZIP_ECDH_CDIR_OFS_OFS = 16 ,
  MZ_ZIP_ECDH_COMMENT_SIZE_OFS = 20
}
 
enum  {
  MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024 ,
  MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260 ,
  MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256
}
 

Functions

bool isJavaClassFile (const boost::filesystem::path &)
 True if named file exists and is a Java class file.
 
bool isJavaJarFile (const boost::filesystem::path &)
 True if named file exists and is a Java jar file.
 
boost::filesystem::path pathToClassFile (const std::string &fqcn, const std::vector< std::string > &cp)
 Searchs the classpath setting for the path to a fully qualified class name.
 
bool present (const std::string &fqcn, const std::string &path)
 Searchs the path for the presence of a fully qualified class name.
 
void warn (const std::string &msg)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 52 of file ModulesJvm.h.

◆ anonymous enum

anonymous enum

Definition at line 101 of file ModulesJvm.h.

Function Documentation

◆ isJavaClassFile()

bool Rose::BinaryAnalysis::Partitioner2::ModulesJvm::isJavaClassFile ( const boost::filesystem::path &  )
protected

True if named file exists and is a Java class file.

Class files usually have names with a ".class" extension, although this function actually tries to open the file and parse the file header to make that determination.

References isJavaClassFile().

Referenced by isJavaClassFile().

◆ isJavaJarFile()

bool Rose::BinaryAnalysis::Partitioner2::ModulesJvm::isJavaJarFile ( const boost::filesystem::path &  )
protected

True if named file exists and is a Java jar file.

Jar files usually have names with a ".jar" extension, although this function actually tries to open the file and parse the file header to make that determination.

References isJavaJarFile().

Referenced by isJavaJarFile().

◆ pathToClassFile()

boost::filesystem::path Rose::BinaryAnalysis::Partitioner2::ModulesJvm::pathToClassFile ( const std::string &  fqcn,
const std::vector< std::string > &  cp 
)
protected

Searchs the classpath setting for the path to a fully qualified class name.

This function takes a fully qualified class name (FQCN) and converts it into a corresponding filesystem path by replacing the namespace separators ('.') with directory separators appropriate for the operating system. It then searches for the class in the classpath setting. If found, the resulting path can be used to locate the class file within a directory structure, either in the file system or within a jar file. If the class can't be located, an empty path is returned.

Parameters
fqcnThe fully qualified class name, e.g., "com.example.MyClass".
cpThe classpath. A ':' separated list of paths to jar files or directories". @return A boost::filesystem::path representing the location of the class file, e.g., "com/example/MyClass.class".

References pathToClassFile().

Referenced by pathToClassFile().

◆ present()

bool Rose::BinaryAnalysis::Partitioner2::ModulesJvm::present ( const std::string &  fqcn,
const std::string &  path 
)
protected

Searchs the path for the presence of a fully qualified class name.

Searches all classes and jar files found in the path for the fully qualified class name (FQCN). Namespace separators in the class name may be '.' or '/'. Path separator in the classpath is ':'.

Parameters
fqcnThe fully qualified class name, e.g., "com.example.MyClass".
pathPath to a jar file, class file, or directory.
Returns
true if the class is found.

References present().

Referenced by present().