8 #ifndef __SOLAR_CAPTURE_IOVEC_H__
9 #define __SOLAR_CAPTURE_IOVEC_H__
19 const struct iovec* iov;
35 static inline void __sc_iovec_ptr_init(
struct sc_iovec_ptr* iovp,
36 const struct iovec* iov,
int iovlen)
38 iovp->iovlen = iovlen;
53 const struct iovec* iov,
int iovlen)
55 iovp->iovlen = iovlen;
74 iovp->io.iov_base = buf;
75 iovp->io.iov_len = len;
88 __sc_iovec_ptr_init(iovp, packet->
iov, packet->
iovlen);
101 bytes += iovp->io.iov_len;
102 for( i = 1; i < iovp->iovlen; ++i )
103 bytes += iovp->iov[i].iov_len;
165 const struct iovec* iov,
166 int iovlen,
int bytes)
171 if( n > iov->iov_len )
173 memcpy((
char*) dest_buf + bytes - n,
174 (
const char*) iov->iov_base + iov->iov_len - n, n);
175 if( (bytes -= n) == 0 )
197 if( bytes < (
int) iov->iov_len ) {
198 iov->iov_len -= bytes;
201 bytes -= iov->iov_len;
static int sc_iovec_ptr_bytes(const struct sc_iovec_ptr *iovp)
Returns the number of bytes represented by an sc_iovec_ptr.
Definition: iovec.h:97
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.
Definition: iovec.h:69
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.
Definition: iovec.h:164
static void sc_iovec_trim_end(struct iovec *iov, uint8_t *iovlen, int bytes)
Remove data from the end of an iovec.
Definition: iovec.h:192
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.
Definition: iovec.h:85
int sc_iovec_ptr_skip(struct sc_iovec_ptr *iovp, int bytes_to_skip)
Skip forward over an iovec.
static void sc_iovec_ptr_init(struct sc_iovec_ptr *iovp, const struct iovec *iov, int iovlen)
Initialise a struct sc_iovec_ptr.
Definition: iovec.h:52
struct iovec * iov
Definition: ext_packet.h:68
Representation of a packet.
Definition: ext_packet.h:56
int sc_iovec_ptr_find_chr(const struct sc_iovec_ptr *iovp, int c)
Find offset of character in iovec.
int sc_iovec_ptr_copy_out(void *dest, struct sc_iovec_ptr *iovp, int max_bytes)
Copy data out of an sc_iovec_ptr.
uint8_t iovlen
Definition: ext_packet.h:63