]>
git.proxmox.com Git - mirror_frr.git/blob - lib/imsg.h
1 // SPDX-License-Identifier: ISC
5 * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
6 * Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
7 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
17 #define IBUF_READ_SIZE 65535
18 #define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
19 #define MAX_IMSGSIZE 16384
22 TAILQ_ENTRY(ibuf
) entry
;
32 TAILQ_HEAD(, ibuf
) bufs
;
38 uint8_t buf
[IBUF_READ_SIZE
];
44 TAILQ_ENTRY(imsg_fd
) entry
;
49 TAILQ_HEAD(, imsg_fd
) fds
;
74 struct ibuf
*ibuf_open(size_t);
75 struct ibuf
*ibuf_dynamic(size_t, size_t);
76 int ibuf_add(struct ibuf
*, const void *, size_t);
77 void *ibuf_reserve(struct ibuf
*, size_t);
78 void *ibuf_seek(struct ibuf
*, size_t, size_t);
79 size_t ibuf_size(struct ibuf
*);
80 size_t ibuf_left(struct ibuf
*);
81 void ibuf_close(struct msgbuf
*, struct ibuf
*);
82 int ibuf_write(struct msgbuf
*);
83 void ibuf_free(struct ibuf
*);
84 void msgbuf_init(struct msgbuf
*);
85 void msgbuf_clear(struct msgbuf
*);
86 int msgbuf_write(struct msgbuf
*);
87 void msgbuf_drain(struct msgbuf
*, size_t);
90 void imsg_init(struct imsgbuf
*, int);
91 ssize_t
imsg_read(struct imsgbuf
*);
92 ssize_t
imsg_get(struct imsgbuf
*, struct imsg
*);
93 int imsg_compose(struct imsgbuf
*, uint32_t, uint32_t, pid_t
, int, const void *,
95 int imsg_composev(struct imsgbuf
*, uint32_t, uint32_t, pid_t
, int,
96 const struct iovec
*, int);
97 struct ibuf
*imsg_create(struct imsgbuf
*, uint32_t, uint32_t, pid_t
, uint16_t);
98 int imsg_add(struct ibuf
*, const void *, uint16_t);
99 void imsg_close(struct imsgbuf
*, struct ibuf
*);
100 void imsg_free(struct imsg
*);
101 int imsg_flush(struct imsgbuf
*);
102 void imsg_clear(struct imsgbuf
*);