version 1.3, 2010/04/27 21:04:04 |
version 1.4, 2010/05/26 13:56:07 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
|
|
#define READ_BUF_SIZE 65535 |
#define IBUF_READ_SIZE 65535 |
#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr) |
#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr) |
#define MAX_IMSGSIZE 16384 |
#define MAX_IMSGSIZE 16384 |
|
|
struct buf { |
struct ibuf { |
TAILQ_ENTRY(buf) entry; |
TAILQ_ENTRY(ibuf) entry; |
u_char *buf; |
u_char *buf; |
size_t size; |
size_t size; |
size_t max; |
size_t max; |
|
|
}; |
}; |
|
|
struct msgbuf { |
struct msgbuf { |
TAILQ_HEAD(, buf) bufs; |
TAILQ_HEAD(, ibuf) bufs; |
u_int32_t queued; |
u_int32_t queued; |
int fd; |
int fd; |
}; |
}; |
|
|
struct buf_read { |
struct ibuf_read { |
u_char buf[READ_BUF_SIZE]; |
u_char buf[IBUF_READ_SIZE]; |
u_char *rptr; |
u_char *rptr; |
size_t wpos; |
size_t wpos; |
}; |
}; |
|
|
|
|
struct imsgbuf { |
struct imsgbuf { |
TAILQ_HEAD(, imsg_fd) fds; |
TAILQ_HEAD(, imsg_fd) fds; |
struct buf_read r; |
struct ibuf_read r; |
struct msgbuf w; |
struct msgbuf w; |
int fd; |
int fd; |
pid_t pid; |
pid_t pid; |
|
|
|
|
|
|
/* buffer.c */ |
/* buffer.c */ |
struct buf *buf_open(size_t); |
struct ibuf *ibuf_open(size_t); |
struct buf *buf_dynamic(size_t, size_t); |
struct ibuf *ibuf_dynamic(size_t, size_t); |
int buf_add(struct buf *, const void *, size_t); |
int ibuf_add(struct ibuf *, const void *, size_t); |
void *buf_reserve(struct buf *, size_t); |
void *ibuf_reserve(struct ibuf *, size_t); |
void *buf_seek(struct buf *, size_t, size_t); |
void *ibuf_seek(struct ibuf *, size_t, size_t); |
size_t buf_size(struct buf *); |
size_t ibuf_size(struct ibuf *); |
size_t buf_left(struct buf *); |
size_t ibuf_left(struct ibuf *); |
void buf_close(struct msgbuf *, struct buf *); |
void ibuf_close(struct msgbuf *, struct ibuf *); |
int buf_write(struct msgbuf *); |
int ibuf_write(struct msgbuf *); |
void buf_free(struct buf *); |
void ibuf_free(struct ibuf *); |
void msgbuf_init(struct msgbuf *); |
void msgbuf_init(struct msgbuf *); |
void msgbuf_clear(struct msgbuf *); |
void msgbuf_clear(struct msgbuf *); |
int msgbuf_write(struct msgbuf *); |
int msgbuf_write(struct msgbuf *); |
|
|
int, void *, u_int16_t); |
int, void *, u_int16_t); |
int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, |
int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, |
int, const struct iovec *, int); |
int, const struct iovec *, int); |
struct buf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, |
struct ibuf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, |
u_int16_t); |
u_int16_t); |
int imsg_add(struct buf *, void *, u_int16_t); |
int imsg_add(struct ibuf *, void *, u_int16_t); |
void imsg_close(struct imsgbuf *, struct buf *); |
void imsg_close(struct imsgbuf *, struct ibuf *); |
void imsg_free(struct imsg *); |
void imsg_free(struct imsg *); |
int imsg_flush(struct imsgbuf *); |
int imsg_flush(struct imsgbuf *); |
void imsg_clear(struct imsgbuf *); |
void imsg_clear(struct imsgbuf *); |