elftosb::EncoreBootImage::BootSection Class Reference

A bootable section of an Encore boot image. More...

`#include <EncoreBootImage.h>`

Inheritance diagram for elftosb::EncoreBootImage::BootSection:
[legend]
Collaboration diagram for elftosb::EncoreBootImage::BootSection:
[legend]

## Public Types

typedef std::list< BootCommand * > | command_list_t
typedef command_list_t::iterator | iterator_t
typedef command_list_t::const_iterator | const_iterator_t

## Public Member Functions

| BootSection ()
| Default constructor.
| BootSection (uint32_t identifier)
| Constructor taking the unique identifier for this section.
virtual | ~BootSection ()
| Destructor.
virtual void | fillFromData (const cipher_block_t *blocks, unsigned count)
| Load the section from raw data. More...
virtual void | debugPrint () const
| Print out a string representation of the object.
Header
virtual uint32_t | getFlags () const
| Returns the flags for this section.
Commands
void | addCommand (BootCommand *command)
| Append a new command to the section. More...
unsigned | getCommandCount () const
| Returns the number of commands in this section, excluding the tag command.
iterator_t | begin ()
iterator_t | end ()
const_iterator_t | begin () const
const_iterator_t | end () const
Cipher blocks
virtual unsigned | getBlockCount () const
| Returns the total number of cipher blocks occupied by this section. More...
virtual unsigned | getBlocks (unsigned offset, unsigned maxCount, cipher_block_t *data)
| Returns the contents of up to maxCount cipher blocks. More...
Public Member Functions inherited from elftosb::EncoreBootImage::Section
| Section ()
| Default constructor.
| Section (uint32_t identifier)
| Constructor taking the unique identifier for this section.
void | setIdentifier (uint32_t identifier)
uint32_t | getIdentifier () const
virtual void | setFlags (uint32_t flags)
| Sets explicit flags for this section.
virtual void | fillSectionHeader (section_header_t &header)
| Pure virtual method to construct the header for this section. More...
void | setImage (EncoreBootImage *image)
| Called when the section is added to an image.
EncoreBootImage * | getImage () const
| Returns a pointer to the image that this section belongs to.
void | setAlignment (unsigned alignment)
| Sets the required alignment in the output file for this section. More...
unsigned | getAlignment () const
| Returns the current alignment, the minimum of which will be 16.
unsigned | getPadBlockCountForOffset (unsigned offset)
| Computes padding amount for alignment requirement. More...
void | setLeaveUnencrypted (unsigned flag)
| Sets whether the section will be left unencrypted.
bool | getLeaveUnencrypted () const
| Returns true if the section will remain unencrypted.
Cipher blocks

## Protected Member Functions

void | deleteCommands ()
| Remove all commands from the section.

## Protected Attributes

command_list_t | m_commands
| Commands held in this section.
Protected Attributes inherited from elftosb::EncoreBootImage::Section
uint32_t | m_identifier
| Unique identifier for this section.
EncoreBootImage * | m_image
| The image to which this section belongs.
unsigned | m_alignment
| Alignment requirement for the start of this section.
uint32_t | m_flags
| Section flags set by the user.
bool | m_leaveUnencrypted
| Set to true to prevent this section from being encrypted.

## Detailed Description

A bootable section of an Encore boot image.

## Member Function Documentation

void elftosb::EncoreBootImage::BootSection::addCommand | ( | BootCommand * | command | ) |

inline

Append a new command to the section.

The section takes ownership of the command and will delete it when the section is destroyed.

void EncoreBootImage::BootSection::fillFromData | ( | const cipher_block_t * | blocks,
|  | unsigned | count
| ) |  |

virtual

Load the section from raw data.

The entire contents of the section must be in memory, pointed to by blocks. Any commands that had previously been added to the section are disposed of.

Parameters

  blocks | Pointer to the section contents.
  count | Number of blocks pointed to by blocks.

Exceptions

  std::runtime_error | Thrown if a boot command cannot be created from the cipher block stream.

unsigned EncoreBootImage::BootSection::getBlockCount | ( |  | ) | const

virtual

Returns the total number of cipher blocks occupied by this section.

Always returns at least 1 for the required tag command.

Reimplemented from elftosb::EncoreBootImage::CipherBlockGenerator.

unsigned EncoreBootImage::BootSection::getBlocks | ( | unsigned | offset,
|  | unsigned | maxCount,
|  | cipher_block_t * | data
| ) |  |

virtual

Returns the contents of up to maxCount cipher blocks.

Up to maxCount cipher blocks are copied into the buffer pointed to by the data argument. A return value of 0 indicates that no more blocks are available. The index of the first block to copy is held in the offset argument.

Parameters

  offset | Starting block number to copy. Zero means the first available block.
  maxCount | Up to this number of blocks may be copied into data.
  data | Buffer for outgoing cipher blocks. Must have enough room to hold maxCount blocks.

Returns
  The number of cipher blocks copied into data.

Return values

  0 | No more blocks are available and nothing was written to data.

Reimplemented from elftosb::EncoreBootImage::CipherBlockGenerator.

The documentation for this class was generated from the following files:

- EncoreBootImage.h
- EncoreBootImage.cpp