fu-chunk: fwupd Reference Manual

## fu-chunk fu-chunk |

## Functions

FuChunk * | fu_chunk_new ()
gchar * | fu_chunk_to_string ()
gchar * | fu_chunk_array_to_string ()
GPtrArray * | fu_chunk_array_new ()
GPtrArray * | fu_chunk_array_new_from_bytes ()

## Types and Values

| FuChunk

## Description

## Functions

### fu_chunk_new ()

    FuChunk *
    fu_chunk_new (guint32 idx,
                  guint32 page,
                  guint32 address,
                  const guint8 *data,
                  guint32 data_sz);

Creates a new packet of chunked data.

#### Parameters

idx | the packet number |
page | the hardware memory page |
address | the address *within* the page |
data | the data |
data_sz | size of `data_sz` |

#### Returns

a FuChunk.

[transfer full]

### fu_chunk_to_string ()

    gchar *
    fu_chunk_to_string (FuChunk *item);

Converts the chunked packet to a string representation.

#### Parameters

item | a FuChunk |

#### Returns

A string.

[transfer full]

### fu_chunk_array_to_string ()

    gchar *
    fu_chunk_array_to_string (GPtrArray *chunks);

Converts all the chunked packets in an array to a string representation.

#### Parameters

chunks | array of packets. | [element-type FuChunk]

#### Returns

A string.

[transfer full]

### fu_chunk_array_new ()

    GPtrArray *
    fu_chunk_array_new (const guint8 *data,
                        guint32 data_sz,
                        guint32 addr_start,
                        guint32 page_sz,
                        guint32 packet_sz);

Chunks a linear blob of memory into packets, ensuring each packet does not cross a package boundary and is less that a specific transfer size.

#### Parameters

data | a linear blob of memory, or `NULL` |
data_sz | size of `data_sz` |
addr_start | the hardware address offset, or 0 |
page_sz | the hardware page size, or 0 |
packet_sz | the transfer size, or 0 |

#### Returns

array of packets.

[element-type FuChunk]

### fu_chunk_array_new_from_bytes ()

    GPtrArray *
    fu_chunk_array_new_from_bytes (GBytes *blob,
                                   guint32 addr_start,
                                   guint32 page_sz,
                                   guint32 packet_sz);

Chunks a linear blob of memory into packets, ensuring each packet does not cross a package boundary and is less that a specific transfer size.

#### Parameters

blob | a GBytes |
addr_start | the hardware address offset, or 0 |
page_sz | the hardware page size, or 0 |
packet_sz | the transfer size, or 0 |

#### Returns

array of packets.

[element-type FuChunk]

## Types and Values

### FuChunk

    typedef struct {
    	guint32		 idx;
    	guint32		 page;
    	guint32		 address;
    	const guint8 *data;
    	guint32		 data_sz;
    } FuChunk;