Safeheron-SGX-Native-Development-Framework v1.2.0
Loading...
Searching...
No Matches
ssgx::filesystem_t::ProtectedFileReader Class Reference

A ProtectedFileReader for reading from the Intel SGX Protected File System. More...

#include <ssgx_filesystem_t.h>

Public Member Functions

 ProtectedFileReader (const ProtectedFileReader &)=delete
 
ProtectedFileReaderoperator= (const ProtectedFileReader &)=delete
 
 ProtectedFileReader (const char *file_name)
 Opens a file for reading.
 
 ~ProtectedFileReader ()
 
size_t Read (void *buffer, size_t size) const
 Reads data from the file into the given buffer.
 
int64_t Tell () const
 Returns the current file position.
 
void Seek (int64_t offset, int origin) const
 Moves the file position.
 
void Close ()
 Closes the file.
 

Detailed Description

A ProtectedFileReader for reading from the Intel SGX Protected File System.

Constructor & Destructor Documentation

◆ ProtectedFileReader() [1/2]

ssgx::filesystem_t::ProtectedFileReader::ProtectedFileReader ( const ProtectedFileReader & )
delete

◆ ProtectedFileReader() [2/2]

ssgx::filesystem_t::ProtectedFileReader::ProtectedFileReader ( const char * file_name)
explicit

Opens a file for reading.

Parameters
file_nameThe name of the file to open (must be a valid, non-null C-string).
Exceptions
FileSystemExceptionIf the file cannot be opened.

◆ ~ProtectedFileReader()

ssgx::filesystem_t::ProtectedFileReader::~ProtectedFileReader ( )

Member Function Documentation

◆ Close()

void ssgx::filesystem_t::ProtectedFileReader::Close ( )

Closes the file.

Exceptions
FileSystemExceptionIf closing fails.

◆ operator=()

ProtectedFileReader & ssgx::filesystem_t::ProtectedFileReader::operator= ( const ProtectedFileReader & )
delete

◆ Read()

size_t ssgx::filesystem_t::ProtectedFileReader::Read ( void * buffer,
size_t size ) const

Reads data from the file into the given buffer.

Parameters
bufferPointer to a valid memory location where data will be stored (must not be null).
sizeMaximum number of bytes to read (must be > 0). For small files, the recommended size is 4KB; For big files, the recommended size is 64KB; Don't set size >= 256KB.
Returns
Number of bytes actually read (0 if EOF is reached).
Exceptions
FileSystemExceptionIf the file is not open or a read error occurs.

◆ Seek()

void ssgx::filesystem_t::ProtectedFileReader::Seek ( int64_t offset,
int origin ) const

Moves the file position.

Parameters
offsetOffset from the origin (can be negative).
originOne of SEEK_SET, SEEK_CUR, SEEK_END.
Exceptions
FileSystemExceptionIf origin is invalid or seeking fails.

◆ Tell()

int64_t ssgx::filesystem_t::ProtectedFileReader::Tell ( ) const

Returns the current file position.

Returns
Current file position.
Exceptions
FileSystemExceptionIf the file is not open or an error occurs.

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