Structures


Data Structures

struct  _ntar_file_handlers
 This structure contains the read/write/seek callbacks that ntar uses to manage an ntar file when the application provides its own read/write/seek functions to deal with the underlying storage. More...
struct  _ntar_option
 This structure represents an option of a block, at the user level. More...

Typedefs

typedef _ntar_block_handle ntar_block_handle
 This structure represents a generic block contained in a section.
typedef _ntar_file_handle ntar_file_handle
 This structure represents the handle to a dump file.
typedef _ntar_file_handlers ntar_file_handlers
 This structure contains the read/write/seek callbacks that ntar uses to manage an ntar file when the application provides its own read/write/seek functions to deal with the underlying storage.
typedef _ntar_option ntar_option
 This structure represents an option of a block, at the user level.
typedef int(* ntar_read_handler )(void *handle, void *buffer, size_t size, size_t *read_bytes)
 This is the callback that is called when the library needs to read some data from the underlying storage. This callback should be defined when the storage (file, or memory) is opened (with ntar_open_by_handlers) in read mode.
typedef _ntar_section_handle ntar_section_handle
 This structure represents the root block for a file. It corresponds to a Section Header Block of the draft, see 3.1.
typedef int(* ntar_seek_handler )(void *handle, ntar_foff new_position, int origin, ntar_foff *pold_position)
 This is the callback that is called when the library needs to obtain the current position in the file, and eventually seek to a new position. This callback is optional (both in read and write mode). Nonetheless, if this callback is not defined, not all the features of the library are available, in particular WRITE MODE
  • The section header block length is not written to file (the magic value 0xFFFFFFFFFFFFFFFF is written, instead). READ MODE
  • It is not possible to perform any backward seek in the file (i.e. only a sequential read of the trace file is possible).
  • Read operations can be slower, since the library uses empty reads to jump between blocks and sections.

typedef int(* ntar_write_handler )(void *handle, void *buffer, size_t size)
 This is the callback that is called when the library needs to write some data to the underlying storage. This callback should be defined when the storage (file, or memory) is opened (with ntar_open_by_handlers) in write mode.


Typedef Documentation

typedef struct _ntar_block_handle ntar_block_handle
 

This structure represents a generic block contained in a section.

typedef struct _ntar_file_handle ntar_file_handle
 

This structure represents the handle to a dump file.

typedef struct _ntar_file_handlers ntar_file_handlers
 

This structure contains the read/write/seek callbacks that ntar uses to manage an ntar file when the application provides its own read/write/seek functions to deal with the underlying storage.

These callbacks are useful when the application wants to read and write data from non-standard files, or compressed/cripted files, or directly to memory.

typedef struct _ntar_option ntar_option
 

This structure represents an option of a block, at the user level.

typedef int(* ntar_read_handler)(void *handle, void *buffer, size_t size, size_t *read_bytes)
 

This is the callback that is called when the library needs to read some data from the underlying storage. This callback should be defined when the storage (file, or memory) is opened (with ntar_open_by_handlers) in read mode.

Parameters:
handle This opaque parameter is the one assigned to ntar_file_handlers::handle when the file (or any other storage) was opened with ntar_open_by_handlers. The library takes care to passing this parameter untouched to the callback.
buffer Pointer to the user allocated buffer that will receive the data read from the file. The buffer should be large enough to contain at least size bytes.
size Size of the data that should be read from file.
read_bytes Pointer to a user allocated variable that will contain the number of actually read bytes, or NULL.
Returns:
The function should return one of the following error codes:

typedef struct _ntar_section_handle ntar_section_handle
 

This structure represents the root block for a file. It corresponds to a Section Header Block of the draft, see 3.1.

typedef int(* ntar_seek_handler)(void *handle, ntar_foff new_position, int origin, ntar_foff *pold_position)
 

This is the callback that is called when the library needs to obtain the current position in the file, and eventually seek to a new position. This callback is optional (both in read and write mode). Nonetheless, if this callback is not defined, not all the features of the library are available, in particular WRITE MODE

  • The section header block length is not written to file (the magic value 0xFFFFFFFFFFFFFFFF is written, instead). READ MODE
  • It is not possible to perform any backward seek in the file (i.e. only a sequential read of the trace file is possible).
  • Read operations can be slower, since the library uses empty reads to jump between blocks and sections.

Parameters:
handle This opaque parameter is the one assigned to ntar_file_handlers::handle when the file (or any other storage) was opened with ntar_open_by_handlers. The library takes care to passing this parameter untouched to the callback.
new_position New position in file. Parameter "origin" describes the origin for this new position.
origin One of:
  • SEEK_SET Parameter "new_position" is the absolute position in the file from its beginning.
  • SEEK_CUR Parameter "new_position" is the relative position in the file from the current position.
  • SEEK_END Parameter "new_position" is the relative position in the file from its current end.
pold_position Pointer to a user allocate variable that will receive the absolute position in the file (i.e. from the beginning of the file) before the seek operation takes place, or NULL. NOTE: in order to obtain the current position in the file, the library calls this callback with new_position = 0 and origin=SEEK_CUR.
Returns:
The function should return one of the following error codes:

typedef int(* ntar_write_handler)(void *handle, void *buffer, size_t size)
 

This is the callback that is called when the library needs to write some data to the underlying storage. This callback should be defined when the storage (file, or memory) is opened (with ntar_open_by_handlers) in write mode.

Parameters:
handle This opaque parameter is the one assigned to ntar_file_handlers::handle when the file (or any other storage) was opened with ntar_open_by_handlers. The library takes care to passing this parameter untouched to the callback.
buffer Pointer to the buffer containing the raw data that have to be written on file.
size Size of the data pointed by parameter buffer.
Returns:
The function should return one of the following error codes:


NTAR documentation. Copyright (c) 2004 - 2005 Condor Engineering, Inc. All rights reserved.