#include <sys/types.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | ipod_io_struct |
the internal structure of an ipod_io device More... | |
Typedefs | |
typedef int(* | ipod_io_read_func )(void *data, size_t maxDataLen, size_t *dataRead, void *userData) |
Callback to implement reads for a device. | |
typedef int(* | ipod_io_write_func )(void *data, size_t dataLen, size_t *dataWritten, void *userData) |
Callback to implement writes to a device. | |
typedef int(* | ipod_io_tell_func )(size_t *offset, void *userData) |
The current location of the device mark. | |
typedef int(* | ipod_io_seek_func )(size_t offset, void *userData) |
Seeks the device to the given location. | |
typedef int(* | ipod_io_length_func )(size_t *offset, void *userData) |
The total amount of data on the device. | |
typedef ipod_io_struct * | ipod_io |
opaque reference to the device | |
Functions | |
int | ipod_io_read (ipod_io io, void *data, size_t maxDataLen, size_t *dataRead) |
Reads data from a device. | |
int | ipod_io_write (ipod_io io, void *data, size_t dataLen, size_t *dataWritten) |
Writes data to a device. | |
int8_t | ipod_io_getb (ipod_io io) |
Read a signed byte from the device. | |
void | ipod_io_putb (ipod_io io, int8_t b) |
Write a signed byte to the device. | |
uint8_t | ipod_io_getub (ipod_io io) |
Read an unsigned byte from the device. | |
void | ipod_io_putub (ipod_io io, uint8_t b) |
Write an unsigned byte to the device. | |
int16_t | ipod_io_getw (ipod_io io) |
Read a little-endian signed word from the device. | |
void | ipod_io_putw (ipod_io io, int16_t w) |
Write a little-endian signed word to the device. | |
uint16_t | ipod_io_getuw (ipod_io io) |
Read a little-endian unsigned word from the device. | |
void | ipod_io_putuw (ipod_io io, uint16_t w) |
Write a little-endian unsigned word to the device. | |
int16_t | ipod_io_getw_be (ipod_io io) |
Read a big-endian signed word from the device. | |
void | ipod_io_putw_be (ipod_io io, int16_t w) |
Write a big-endian signed word to the device. | |
uint16_t | ipod_io_getuw_be (ipod_io io) |
Read a big-endian unsigned word from the device. | |
void | ipod_io_putuw_be (ipod_io io, uint16_t w) |
Write a big-endian unsigned word to the device. | |
int32_t | ipod_io_getl (ipod_io io) |
Read a little-endian signed long word from the device. | |
void | ipod_io_putl (ipod_io io, int32_t l) |
Write a little-endian signed long word to the device. | |
uint32_t | ipod_io_getul (ipod_io io) |
Read a little-endian unsigned long word from the device. | |
void | ipod_io_putul (ipod_io io, uint32_t l) |
Write a little-endian unsigned long word to the device. | |
int32_t | ipod_io_getl_be (ipod_io io) |
Read a big-endian signed long word from the device. | |
void | ipod_io_putl_be (ipod_io io, int32_t l) |
Write a big-endian signed long word to the device. | |
uint32_t | ipod_io_getul_be (ipod_io io) |
Read a big-endian unsigned long word from the device. | |
void | ipod_io_putul_be (ipod_io io, uint32_t l) |
Write a big-endian unsigned long word to the device. | |
float | ipod_io_getf (ipod_io io) |
Read a little-endian single-precision float from the device. | |
void | ipod_io_putf (ipod_io io, float f) |
Write a little-endian single-precision float to the device. | |
uint32_t | ipod_io_get4cc (ipod_io io) |
Read a 4-character tag from the device. | |
void | ipod_io_put4cc (ipod_io io, uint32_t l) |
Write a 4-character tag to the device. | |
uint32_t | ipod_io_getul3 (ipod_io io) |
Read a 3-byte little-endian unsigned long word from the device. | |
void | ipod_io_putul3 (ipod_io io, uint32_t l) |
Write a 3-byte little-endian unsigned long word to the device. | |
uint32_t | ipod_io_getul_ss (ipod_io io) |
Read a synch-safe unsigned long word from the device. | |
void | ipod_io_seek (ipod_io io, size_t offset) |
Seek the device. | |
size_t | ipod_io_tell (ipod_io io) |
Return the current mark of the device. | |
size_t | ipod_io_length (ipod_io io) |
Return the total length of the data in this device. | |
void | ipod_io_skip (ipod_io io, size_t count) |
Seek the device relative to the current mark. | |
void | ipod_io_backpatch (ipod_io io, size_t mark) |
Backpatch a location in the file to offset to the current mark. | |
void | ipod_io_get_simple_header (ipod_io io, size_t *h1, size_t *h2) |
Read a simple ipod data atom header. | |
size_t | ipod_io_put_simple_header (ipod_io io, uint32_t tag, size_t size) |
Write a simple ipod data atom header. | |
size_t | ipod_io_get_list_header (ipod_io io) |
Read an ipod list atom header. | |
size_t | ipod_io_put_list_header (ipod_io io, uint32_t tag, size_t size) |
Write an ipod list atom header. | |
void | ipod_io_put_zeros (ipod_io io, unsigned int count) |
Write a ficed number of null bytes. | |
void | ipod_io_put_pad (ipod_io io, size_t mark, size_t size) |
Write out padding bytes to reach a particular offset from a particular mark. |
typedef int(* ipod_io_length_func)(size_t *offset, void *userData) |
The total amount of data on the device.
offset | a pointer to a loctio nin which to store the length of the data stream | |
userData | an opaque structure containing information about this device |
typedef int(* ipod_io_read_func)(void *data, size_t maxDataLen, size_t *dataRead, void *userData) |
Callback to implement reads for a device.
data | pointer to buffer in which to store the data that has been read | |
maxDataLen | the maximum amount of data to read | |
dataRead | a pointer in which to store the actual amount of data read | |
userData | an opaque structure containing information about this device |
typedef int(* ipod_io_seek_func)(size_t offset, void *userData) |
Seeks the device to the given location.
offset | the offset into the device to which to seek | |
userData | an opaque structure containing information about this device |
typedef int(* ipod_io_tell_func)(size_t *offset, void *userData) |
The current location of the device mark.
offset | a pointer to a location in which to write the mark | |
userData | an opaque structure containing information about this device |
typedef int(* ipod_io_write_func)(void *data, size_t dataLen, size_t *dataWritten, void *userData) |
Callback to implement writes to a device.
data | pointer to buffer from which to read the data to be written | |
dataLen | the amount of data to write | |
dataWritten | a pointer in which to store the actual amount of data written | |
userData | an opaque structure containing information about this device |
void ipod_io_backpatch | ( | ipod_io | io, | |
size_t | mark | |||
) |
Backpatch a location in the file to offset to the current mark.
io | the ipod_io device | |
mark | the location to fill in with the offset to the current mark |
uint32_t ipod_io_get4cc | ( | ipod_io | io | ) |
Read a 4-character tag from the device.
io | the ipod_io device |
size_t ipod_io_get_list_header | ( | ipod_io | io | ) |
Read an ipod list atom header.
io | the ipod_io device |
void ipod_io_get_simple_header | ( | ipod_io | io, | |
size_t * | h1, | |||
size_t * | h2 | |||
) |
Read a simple ipod data atom header.
io | the ipod_io device | |
h1 | pointer to location to store the atom header size | |
h2 | pointer to location to store the atom full size |
int8_t ipod_io_getb | ( | ipod_io | io | ) |
Read a signed byte from the device.
io | the ipod_io device |
float ipod_io_getf | ( | ipod_io | io | ) |
Read a little-endian single-precision float from the device.
io | the ipod_io device |
int32_t ipod_io_getl | ( | ipod_io | io | ) |
Read a little-endian signed long word from the device.
io | the ipod_io device |
int32_t ipod_io_getl_be | ( | ipod_io | io | ) |
Read a big-endian signed long word from the device.
io | the ipod_io device |
uint8_t ipod_io_getub | ( | ipod_io | io | ) |
Read an unsigned byte from the device.
io | the ipod_io device |
uint32_t ipod_io_getul | ( | ipod_io | io | ) |
Read a little-endian unsigned long word from the device.
io | the ipod_io device |
uint32_t ipod_io_getul3 | ( | ipod_io | io | ) |
Read a 3-byte little-endian unsigned long word from the device.
io | the ipod_io device |
uint32_t ipod_io_getul_be | ( | ipod_io | io | ) |
Read a big-endian unsigned long word from the device.
io | the ipod_io device |
uint32_t ipod_io_getul_ss | ( | ipod_io | io | ) |
Read a synch-safe unsigned long word from the device.
io | the ipod_io device |
uint16_t ipod_io_getuw | ( | ipod_io | io | ) |
Read a little-endian unsigned word from the device.
io | the ipod_io device |
uint16_t ipod_io_getuw_be | ( | ipod_io | io | ) |
Read a big-endian unsigned word from the device.
io | the ipod_io device |
int16_t ipod_io_getw | ( | ipod_io | io | ) |
Read a little-endian signed word from the device.
io | the ipod_io device |
int16_t ipod_io_getw_be | ( | ipod_io | io | ) |
Read a big-endian signed word from the device.
io | the ipod_io device |
size_t ipod_io_length | ( | ipod_io | io | ) |
Return the total length of the data in this device.
io | the ipod_io device |
void ipod_io_put4cc | ( | ipod_io | io, | |
uint32_t | l | |||
) |
Write a 4-character tag to the device.
io | the ipod_io device | |
l | the value to write |
size_t ipod_io_put_list_header | ( | ipod_io | io, | |
uint32_t | tag, | |||
size_t | size | |||
) |
Write an ipod list atom header.
io | the ipod_io device | |
tag | the 4-character tag for the atom | |
size | the size of the header |
void ipod_io_put_pad | ( | ipod_io | io, | |
size_t | mark, | |||
size_t | size | |||
) |
Write out padding bytes to reach a particular offset from a particular mark.
io | the ipod_io device | |
mark | the base location of the padding | |
size | the intended final size after padding with null bytes |
size_t ipod_io_put_simple_header | ( | ipod_io | io, | |
uint32_t | tag, | |||
size_t | size | |||
) |
Write a simple ipod data atom header.
io | the ipod_io device | |
tag | the 4-character tag for the atom | |
size | the size of the header |
void ipod_io_put_zeros | ( | ipod_io | io, | |
unsigned int | count | |||
) |
Write a ficed number of null bytes.
io | the ipod_io device | |
count | the number of null bytes to write |
void ipod_io_putb | ( | ipod_io | io, | |
int8_t | b | |||
) |
Write a signed byte to the device.
io | the ipod_io device | |
b | the value to write |
void ipod_io_putf | ( | ipod_io | io, | |
float | f | |||
) |
Write a little-endian single-precision float to the device.
io | the ipod_io device | |
f | the value to write |
void ipod_io_putl | ( | ipod_io | io, | |
int32_t | l | |||
) |
Write a little-endian signed long word to the device.
io | the ipod_io device | |
l | the value to write |
void ipod_io_putl_be | ( | ipod_io | io, | |
int32_t | l | |||
) |
Write a big-endian signed long word to the device.
io | the ipod_io device | |
l | the value to write |
void ipod_io_putub | ( | ipod_io | io, | |
uint8_t | b | |||
) |
Write an unsigned byte to the device.
io | the ipod_io device | |
b | the value to write |
void ipod_io_putul | ( | ipod_io | io, | |
uint32_t | l | |||
) |
Write a little-endian unsigned long word to the device.
io | the ipod_io device | |
l | the value to write |
void ipod_io_putul3 | ( | ipod_io | io, | |
uint32_t | l | |||
) |
Write a 3-byte little-endian unsigned long word to the device.
io | the ipod_io device | |
l | the value to write |
void ipod_io_putul_be | ( | ipod_io | io, | |
uint32_t | l | |||
) |
Write a big-endian unsigned long word to the device.
io | the ipod_io device | |
l | the value to write |
void ipod_io_putuw | ( | ipod_io | io, | |
uint16_t | w | |||
) |
Write a little-endian unsigned word to the device.
io | the ipod_io device | |
w | the value to write |
void ipod_io_putuw_be | ( | ipod_io | io, | |
uint16_t | w | |||
) |
Write a big-endian unsigned word to the device.
io | the ipod_io device | |
w | the value to write |
void ipod_io_putw | ( | ipod_io | io, | |
int16_t | w | |||
) |
Write a little-endian signed word to the device.
io | the ipod_io device | |
w | the value to write |
void ipod_io_putw_be | ( | ipod_io | io, | |
int16_t | w | |||
) |
Write a big-endian signed word to the device.
io | the ipod_io device | |
w | the value to write |
int ipod_io_read | ( | ipod_io | io, | |
void * | data, | |||
size_t | maxDataLen, | |||
size_t * | dataRead | |||
) |
Reads data from a device.
io | the ipod_io device | |
data | pointer to buffer in which to store the data that has been read | |
maxDataLen | the maximum amount of data to read | |
dataRead | a pointer in which to store the actual amount of data read |
void ipod_io_seek | ( | ipod_io | io, | |
size_t | offset | |||
) |
Seek the device.
io | the ipod_io device | |
offset | the location to which to seek |
void ipod_io_skip | ( | ipod_io | io, | |
size_t | count | |||
) |
Seek the device relative to the current mark.
io | the ipod_io device | |
count | the number of bytes to skip |
size_t ipod_io_tell | ( | ipod_io | io | ) |
Return the current mark of the device.
io | the ipod_io device |
int ipod_io_write | ( | ipod_io | io, | |
void * | data, | |||
size_t | dataLen, | |||
size_t * | dataWritten | |||
) |
Writes data to a device.
io | the ipod_io device | |
data | pointer to buffer from which to read the data to be written | |
dataLen | the amount of data to write | |
dataWritten | a pointer in which to store the actual amount of data written |