]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/imsg.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / imsg.h
index ddaf71344e0088cfaacc3a481dbe4e2feaca3d2d..4651eeea96e3c13ebc4327160e425f18591b1022 100644 (file)
@@ -1,33 +1,26 @@
+// SPDX-License-Identifier: ISC
 /*     $OpenBSD$       */
 
 /*
  * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
  * Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #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 +30,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 +56,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 +90,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