sc_iovec_ptr: Supports iterating over a 'struct iovec'.
More...
#include <string.h>
|
| static void | sc_iovec_ptr_init (struct sc_iovec_ptr *iovp, const struct iovec *iov, int iovlen) |
| | Initialise a struct sc_iovec_ptr. More...
|
| |
| static void | sc_iovec_ptr_init_buf (struct sc_iovec_ptr *iovp, void *buf, int len) |
| | Initialise a struct sc_iovec_ptr with a contiguous buffer. More...
|
| |
| static void | sc_iovec_ptr_init_packet (struct sc_iovec_ptr *iovp, const struct sc_packet *packet) |
| | Initialise a struct sc_iovec_ptr to point at packet data. More...
|
| |
| static int | sc_iovec_ptr_bytes (const struct sc_iovec_ptr *iovp) |
| | Returns the number of bytes represented by an sc_iovec_ptr. More...
|
| |
| int | sc_iovec_ptr_skip (struct sc_iovec_ptr *iovp, int bytes_to_skip) |
| | Skip forward over an iovec. More...
|
| |
| int | sc_iovec_ptr_find_chr (const struct sc_iovec_ptr *iovp, int c) |
| | Find offset of character in iovec. More...
|
| |
| int | sc_iovec_ptr_copy_out (void *dest, struct sc_iovec_ptr *iovp, int max_bytes) |
| | Copy data out of an sc_iovec_ptr. More...
|
| |
| static void | sc_iovec_copy_from_end_offset (void *dest_buf, const struct iovec *iov, int iovlen, int bytes, int offset) |
| | Copy data out of the end with the offset of a sc_iovec_ptr. More...
|
| |
| static void | sc_iovec_copy_to_end_offset (struct iovec *iov, const void *src_buf, int iovlen, int bytes, int offset) |
| | Copy data to the end with the offset of a sc_iovec_ptr, overwriting any existing data. More...
|
| |
| static void | sc_iovec_copy_from_end (void *dest_buf, const struct iovec *iov, int iovlen, int bytes) |
| | Copy data out of the end of a sc_iovec_ptr. More...
|
| |
| static void | sc_iovec_trim_end (struct iovec *iov, uint8_t *iovlen, int bytes) |
| | Remove data from the end of an iovec. More...
|
| |
sc_iovec_ptr: Supports iterating over a 'struct iovec'.
| static void sc_iovec_copy_from_end |
( |
void * |
dest_buf, |
|
|
const struct iovec * |
iov, |
|
|
int |
iovlen, |
|
|
int |
bytes |
|
) |
| |
|
inlinestatic |
Copy data out of the end of a sc_iovec_ptr.
- Parameters
-
| dest_buf | Buffer to copy to. |
| iov | A pointer to an array of iovec objects. |
| iovlen | The number of iovec objects in iov. This must be > 0. |
| bytes | Number of bytes to copy. |
Note: The caller must ensure that at least bytes of data are available in iov
| static void sc_iovec_copy_from_end_offset |
( |
void * |
dest_buf, |
|
|
const struct iovec * |
iov, |
|
|
int |
iovlen, |
|
|
int |
bytes, |
|
|
int |
offset |
|
) |
| |
|
inlinestatic |
Copy data out of the end with the offset of a sc_iovec_ptr.
- Parameters
-
| dest_buf | Buffer to copy to. |
| iov | A pointer to an array of iovec objects. |
| iovlen | The number of iovec objects in iov. This must be > 0. |
| bytes | Number of bytes to copy. |
| offset | Number of bytes to offset. |
Note: The caller must ensure that at least bytes + offset of data are available in iov
| static void sc_iovec_copy_to_end_offset |
( |
struct iovec * |
iov, |
|
|
const void * |
src_buf, |
|
|
int |
iovlen, |
|
|
int |
bytes, |
|
|
int |
offset |
|
) |
| |
|
inlinestatic |
Copy data to the end with the offset of a sc_iovec_ptr, overwriting any existing data.
- Parameters
-
| iov | A pointer to an array of iovec objects. |
| src_buf | Buffer to copy from. |
| iovlen | The number of iovec objects in iov. This must be > 0. |
| bytes | Number of bytes to copy. |
| offset | Number of bytes to offset. |
Note: The caller must ensure that at least bytes + offset of data are available in iov
| static int sc_iovec_ptr_bytes |
( |
const struct sc_iovec_ptr * |
iovp | ) |
|
|
inlinestatic |
Returns the number of bytes represented by an sc_iovec_ptr.
- Parameters
-
- Returns
- The number of bytes represented by the sc_iovec_ptr
| int sc_iovec_ptr_copy_out |
( |
void * |
dest, |
|
|
struct sc_iovec_ptr * |
iovp, |
|
|
int |
max_bytes |
|
) |
| |
Copy data out of an sc_iovec_ptr.
- Parameters
-
| dest | Buffer to copy to |
| iovp | An sc_iovec_ptr |
| max_bytes | Max number of bytes to copy (length of dest) |
- Returns
- The number of bytes copied.
| int sc_iovec_ptr_find_chr |
( |
const struct sc_iovec_ptr * |
iovp, |
|
|
int |
c |
|
) |
| |
Find offset of character in iovec.
- Parameters
-
- Returns
- The offset of first occurrence of character
c in the memory reference by iovp, or -1 if not found.
| static void sc_iovec_ptr_init |
( |
struct sc_iovec_ptr * |
iovp, |
|
|
const struct iovec * |
iov, |
|
|
int |
iovlen |
|
) |
| |
|
inlinestatic |
Initialise a struct sc_iovec_ptr.
- Parameters
-
| iovp | The sc_iovec_ptr to initialise |
| iov | Pointer to array of 'struct iovec's |
| iovlen | Length of the iov array |
| static void sc_iovec_ptr_init_buf |
( |
struct sc_iovec_ptr * |
iovp, |
|
|
void * |
buf, |
|
|
int |
len |
|
) |
| |
|
inlinestatic |
Initialise a struct sc_iovec_ptr with a contiguous buffer.
- Parameters
-
| iovp | The sc_iovec_ptr to initialise |
| buf | Pointer to the start of the buffer |
| len | Length of the buffer |
Initialise a struct sc_iovec_ptr to point at packet data.
- Parameters
-
| int sc_iovec_ptr_skip |
( |
struct sc_iovec_ptr * |
iovp, |
|
|
int |
bytes_to_skip |
|
) |
| |
Skip forward over an iovec.
- Parameters
-
| iovp | An sc_iovec_ptr |
| bytes_to_skip | Number of bytes to skip over |
- Returns
- The number of bytes skipped, which may be fewer than
bytes_to_skip if the total amount of memory referenced by iovp is less.
| static void sc_iovec_trim_end |
( |
struct iovec * |
iov, |
|
|
uint8_t * |
iovlen, |
|
|
int |
bytes |
|
) |
| |
|
inlinestatic |
Remove data from the end of an iovec.
- Parameters
-
| iov | A pointer to an array of iovec objects. |
| iovlen | The number of iovec objects in iov. |
| bytes | The number of bytes to trim. |
Note: Caller must ensure that at least bytes of data are available in iov.