Main Page   Modules   Data Structures   File List   Data Fields   Examples  

The Manipulate ELF library.


Modules

ELF Header
Section Headers
Program Headers
ELF Resources

Data Structures

struct  _elf_section_entry
struct  _elf_spec_header
 ELF Specific header. More...

struct  _elf_spec_header_list
 Specific header list. More...

struct  _melf
 MELF context. More...


Defines

#define IS_OVERFLOW(melf, base, addr)   ((melf)->imageSize < ((unsigned long)(addr) - (unsigned long)(base)))
#define MELF_ACCESS_READ   (1 << 0)
#define MELF_ACCESS_WRITE   (1 << 1)
#define MELF_ACCESS_ALL   (MELF_ACCESS_READ | MELF_ACCESS_WRITE)
#define MELF_HAS_ACCESS(ctx, flag)   ((ctx)->access & (flag))

Typedefs

typedef _elf_spec_header ELF_SPEC_HEADER
 ELF Specific header. More...

typedef _elf_spec_header_list ELF_SPEC_HEADER_LIST
 Specific header list. More...

typedef _elf_section_entry ELF_SECTION_ENTRY
typedef _melf MELF
 MELF context. More...


Enumerations

enum  ElfHeaderType { ELF_HEADER_TYPE_SECTION = 0, ELF_HEADER_TYPE_PROGRAM = 1 }

Functions

MELFmelf_new ()
MELFmelf_open (const char *image, int access)
void melf_destroy (MELF *melf)
unsigned long melf_synchronize (MELF *melf)
unsigned long melf_save (MELF *melf, const char *path)
unsigned long melf_version ()

Detailed Description

The manipulate ELF library.

Define Documentation

#define MELF_ACCESS_ALL   (MELF_ACCESS_READ | MELF_ACCESS_WRITE)
 

Opening the ELF object for reading and writing.

#define MELF_ACCESS_READ   (1 << 0)
 

Opening the ELF object for reading.

#define MELF_ACCESS_WRITE   (1 << 1)
 

Opening the ELF object for writing.

#define MELF_HAS_ACCESS ctx,
flag       ((ctx)->access & (flag))
 

Checks to see if the context has been opened readonly


Typedef Documentation

typedef struct _elf_spec_header ELF_SPEC_HEADER
 

ELF Specific header.

Wrappers both section and program headers.

typedef struct _elf_spec_header_list ELF_SPEC_HEADER_LIST
 

Specific header list.

A list that contains one or more specific headers.

typedef struct _melf MELF
 

MELF context.

The melf context used to hold the path to an image as well as the elf, program and section headers.


Enumeration Type Documentation

enum ElfHeaderType
 

The ELF header type enumeration includes section and program.


Function Documentation

void melf_destroy MELF   melf
 

Destroys a MELF context, deallocating all memory associated with it.

Parameters:
melf  [in] The context to destroy.
Examples:
new.c.

MELF* melf_new  
 

Creates a blank MELF context.

Returns:
On success, a newly allocated MELF context is returned, otherwise NULL is returned.
Examples:
new.c.

MELF* melf_open const char *    image,
int    access
 

Translates an ELF image into a MELF context which can then be editted.

The access parameter can be one of the following:

  • MELF_ACCESS_READ Read access.
  • MELF_ACCESS_WRITE Write access.
  • MELF_ACCESS_ALL Read and Write access.
Parameters:
image  [in] The path to the image to edit.
access  [in] What type of access to open the image with.
Returns:
On success, a newly allocated MELF context is returned, otherwise NULL is returned.

unsigned long melf_save MELF   melf,
const char *    path
 

Saves a MELF context in ELF format to the specified path.

Parameters:
melf  [in] The context to translate from.
path  [in] The path to the image to write to.
Returns:
On success, 1 is returned.
Examples:
new.c.

unsigned long melf_synchronize MELF   melf
 

Synchronizes the section and program headers as far as alignment and offsetting is concerned. This is an integral part of the saving process and can be used to make the in-memory version of the library appear as it would on disk if it were to be saved.

Parameters:
melf  [in] The melf context.
Returns:
The size, in bytes, of the image.

unsigned long melf_version  
 

Returns the version of the melf library.

Returns:
The version of the melf library.


Generated on Tue May 4 00:14:34 2004 for libmelf by doxygen1.2.15