]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/imsg.h
Merge pull request #13278 from FRRouting/mergify/bp/stable/8.5/pr-13269
[mirror_frr.git] / lib / imsg.h
index ddaf71344e0088cfaacc3a481dbe4e2feaca3d2d..3f81b76bea084e2c05aac7d972471e3bdcdf3156 100644 (file)
 #ifndef _IMSG_H_
 #define _IMSG_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define IBUF_READ_SIZE         65535
 #define IMSG_HEADER_SIZE       sizeof(struct imsg_hdr)
 #define MAX_IMSGSIZE           16384
 
 struct ibuf {
        TAILQ_ENTRY(ibuf) entry;
-       u_char *buf;
+       uint8_t *buf;
        size_t size;
        size_t max;
        size_t wpos;
@@ -37,13 +41,13 @@ struct ibuf {
 
 struct msgbuf {
        TAILQ_HEAD(, ibuf) bufs;
-       u_int32_t queued;
+       uint32_t queued;
        int fd;
 };
 
 struct ibuf_read {
-       u_char buf[IBUF_READ_SIZE];
-       u_char *rptr;
+       uint8_t buf[IBUF_READ_SIZE];
+       uint8_t *rptr;
        size_t wpos;
 };
 
@@ -63,11 +67,11 @@ struct imsgbuf {
 #define IMSGF_HASFD    1
 
 struct imsg_hdr {
-       u_int32_t type;
-       u_int16_t len;
-       u_int16_t flags;
-       u_int32_t peerid;
-       u_int32_t pid;
+       uint32_t type;
+       uint16_t len;
+       uint16_t flags;
+       uint32_t peerid;
+       uint32_t pid;
 };
 
 struct imsg {
@@ -97,16 +101,19 @@ void msgbuf_drain(struct msgbuf *, size_t);
 void imsg_init(struct imsgbuf *, int);
 ssize_t imsg_read(struct imsgbuf *);
 ssize_t imsg_get(struct imsgbuf *, struct imsg *);
-int imsg_compose(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int,
-                const void *, u_int16_t);
-int imsg_composev(struct imsgbuf *, u_int32_t, u_int32_t, pid_t, int,
+int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, const void *,
+                uint16_t);
+int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int,
                  const struct iovec *, int);
-struct ibuf *imsg_create(struct imsgbuf *, u_int32_t, u_int32_t, pid_t,
-                        u_int16_t);
-int imsg_add(struct ibuf *, const void *, u_int16_t);
+struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, uint16_t);
+int imsg_add(struct ibuf *, const void *, uint16_t);
 void imsg_close(struct imsgbuf *, struct ibuf *);
 void imsg_free(struct imsg *);
 int imsg_flush(struct imsgbuf *);
 void imsg_clear(struct imsgbuf *);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif