diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-02-07 23:10:31 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-02-12 01:34:12 +0100 |
commit | 5e2444690bd0d2003e7d283f890b33e11ddd371f (patch) | |
tree | 2db840e94412a306855cc344d5e2b696c86aed19 | |
parent | lib: remove unnamed struct in qobj for C++ (diff) | |
download | frr-5e2444690bd0d2003e7d283f890b33e11ddd371f.tar.xz frr-5e2444690bd0d2003e7d283f890b33e11ddd371f.zip |
lib: add extern "C" {} blocks to all libfrr headers
These are necessary to use functions defined in these headers from C++.
Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
93 files changed, 758 insertions, 0 deletions
diff --git a/lib/agg_table.h b/lib/agg_table.h index dc2ff03b6..40ffe8c75 100644 --- a/lib/agg_table.h +++ b/lib/agg_table.h @@ -23,6 +23,10 @@ #include "prefix.h" #include "table.h" +#ifdef __cplusplus +extern "C" { +#endif + struct agg_table { struct route_table *route_table; @@ -150,4 +154,9 @@ static inline struct agg_table *agg_get_table(struct agg_node *node) { return (struct agg_table *)route_table_get_info(node->table); } + +#ifdef __cplusplus +} +#endif + #endif @@ -26,6 +26,10 @@ #include "lib/json.h" #include "lib/zclient.h" +#ifdef __cplusplus +extern "C" { +#endif + #define BFD_DEF_MIN_RX 300 #define BFD_MIN_MIN_RX 50 #define BFD_MAX_MIN_RX 60000 @@ -104,4 +108,8 @@ extern void bfd_gbl_init(void); extern void bfd_gbl_exit(void); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_BFD_H */ diff --git a/lib/bitfield.h b/lib/bitfield.h index 0e031ccc4..eebfc049d 100644 --- a/lib/bitfield.h +++ b/lib/bitfield.h @@ -44,6 +44,10 @@ #include <string.h> #include <stdlib.h> +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned int word_t; #define WORD_MAX 0xFFFFFFFF #define WORD_SIZE (sizeof(word_t) * 8) @@ -153,4 +157,8 @@ typedef unsigned int word_t; } \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/buffer.h b/lib/buffer.h index 0c945a2ac..8b5a89825 100644 --- a/lib/buffer.h +++ b/lib/buffer.h @@ -22,6 +22,10 @@ #ifndef _ZEBRA_BUFFER_H #define _ZEBRA_BUFFER_H +#ifdef __cplusplus +extern "C" { +#endif + /* Create a new buffer. Memory will be allocated in chunks of the given size. If the argument is 0, the library will supply a reasonable default size suitable for buffering socket I/O. */ @@ -99,4 +103,8 @@ extern buffer_status_t buffer_flush_all(struct buffer *, int fd); extern buffer_status_t buffer_flush_window(struct buffer *, int fd, int width, int height, int erase, int no_more); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_BUFFER_H */ diff --git a/lib/checksum.h b/lib/checksum.h index c2764e35f..7d5037143 100644 --- a/lib/checksum.h +++ b/lib/checksum.h @@ -1,4 +1,12 @@ +#ifdef __cplusplus +extern "C" { +#endif + extern int in_cksum(void *, int); #define FLETCHER_CHECKSUM_VALIDATE 0xffff extern uint16_t fletcher_checksum(uint8_t *, const size_t len, const uint16_t offset); + +#ifdef __cplusplus +} +#endif diff --git a/lib/clippy.h b/lib/clippy.h index 8df98cbb8..be4db6e63 100644 --- a/lib/clippy.h +++ b/lib/clippy.h @@ -22,7 +22,15 @@ #include <Python.h> +#ifdef __cplusplus +extern "C" { +#endif + extern PyObject *clippy_parse(PyObject *self, PyObject *args); extern PyMODINIT_FUNC command_py_init(void); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_CLIPPY_H */ diff --git a/lib/command.h b/lib/command.h index 11514fd5e..0faaa426a 100644 --- a/lib/command.h +++ b/lib/command.h @@ -30,6 +30,10 @@ #include "hash.h" #include "command_graph.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(HOST) DECLARE_MTYPE(COMPLETION) @@ -488,4 +492,9 @@ cmd_variable_handler_register(const struct cmd_variable_handler *cvh); extern char *cmd_variable_comp2str(vector comps, unsigned short cols); extern void command_setup_early_logging(const char *dest, const char *level); + +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_COMMAND_H */ diff --git a/lib/command_graph.h b/lib/command_graph.h index 82d562694..cfacad43e 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -32,6 +32,10 @@ #include "vector.h" #include "graph.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(CMD_ARG) struct vty; @@ -133,4 +137,8 @@ extern void cmd_graph_node_print_cb(struct graph_node *gn, struct buffer *buf); */ char *cmd_graph_dump_dot(struct graph *cmdgraph); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_COMMAND_GRAPH_H */ diff --git a/lib/command_match.h b/lib/command_match.h index c636d2dd9..547f6f3b6 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -28,6 +28,10 @@ #include "linklist.h" #include "command.h" +#ifdef __cplusplus +extern "C" { +#endif + /* These definitions exist in command.c in the current engine but should be * relocated here in the new engine */ @@ -98,4 +102,8 @@ enum matcher_rv command_match(struct graph *cmdgraph, vector vline, enum matcher_rv command_complete(struct graph *cmdgraph, vector vline, struct list **completions); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_COMMAND_MATCH_H */ diff --git a/lib/compiler.h b/lib/compiler.h index 24b8fafd1..cb4f7531e 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -17,6 +17,10 @@ #ifndef _FRR_COMPILER_H #define _FRR_COMPILER_H +#ifdef __cplusplus +extern "C" { +#endif + /* function attributes, use like * void prototype(void) __attribute__((_CONSTRUCTOR(100))); */ @@ -88,4 +92,8 @@ #define CPP_NOTICE(text) #endif +#ifdef __cplusplus +} +#endif + #endif /* _FRR_COMPILER_H */ @@ -70,6 +70,10 @@ #include <stdarg.h> #include <sys/queue.h> +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _csv_field_t_ csv_field_t; typedef struct _csv_record_t_ csv_record_t; typedef struct _csv_t_ csv_t; @@ -185,4 +189,8 @@ void csv_clone_record(csv_t *csv, csv_record_t *in_rec, csv_record_t **out_rec); */ int csv_num_records(csv_t *csv); +#ifdef __cplusplus +} +#endif + #endif @@ -38,6 +38,10 @@ #include <sqlite3.h> +#ifdef __cplusplus +extern "C" { +#endif + extern int db_init(const char *path_fmt, ...); extern int db_close(void); extern int db_bindf(struct sqlite3_stmt *ss, const char *fmt, ...); @@ -48,5 +52,9 @@ extern int db_loadf(struct sqlite3_stmt *ss, const char *fmt, ...); extern void db_finalize(struct sqlite3_stmt **ss); extern int db_execute(const char *stmt_fmt, ...); +#ifdef __cplusplus +} +#endif + #endif /* HAVE_SQLITE3 */ #endif /* _FRR_DB_H_ */ diff --git a/lib/debug.h b/lib/debug.h index 2b389e3d4..ace060d05 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -24,6 +24,10 @@ #include "command.h" #include "frratomic.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * Debugging modes. * @@ -231,4 +235,8 @@ struct debug_callbacks { */ void debug_init(const struct debug_callbacks *cb); +#ifdef __cplusplus +} +#endif + #endif /* _FRRDEBUG_H */ diff --git a/lib/distribute.h b/lib/distribute.h index 44c699b38..4016d3b13 100644 --- a/lib/distribute.h +++ b/lib/distribute.h @@ -25,6 +25,10 @@ #include "if.h" #include "filter.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Disctirubte list types. */ enum distribute_type { DISTRIBUTE_V4_IN, @@ -81,4 +85,8 @@ extern enum filter_type distribute_apply_in(struct interface *, extern enum filter_type distribute_apply_out(struct interface *, struct prefix *); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_DISTRIBUTE_H */ diff --git a/lib/event_counter.h b/lib/event_counter.h index de5dbc066..8ae276ffe 100644 --- a/lib/event_counter.h +++ b/lib/event_counter.h @@ -43,6 +43,10 @@ #ifndef _ZEBRA_EVENT_COUNTER_H #define _ZEBRA_EVENT_COUNTER_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_counter { unsigned long long count; time_t last; @@ -51,4 +55,8 @@ struct event_counter { void event_counter_inc(struct event_counter *counter); const char *event_counter_format(const struct event_counter *counter); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/ferr.h b/lib/ferr.h index 335875c16..93d0ced53 100644 --- a/lib/ferr.h +++ b/lib/ferr.h @@ -27,6 +27,10 @@ #include "vty.h" +#ifdef __cplusplus +extern "C" { +#endif + /* return type when this error indication stuff is used. * * guaranteed to have boolean evaluation to "false" when OK, "true" when error @@ -253,4 +257,8 @@ DEFUN("bla") #endif /* THIS_IS_AN_EXAMPLE */ +#ifdef __cplusplus +} +#endif + #endif /* _FERR_H */ diff --git a/lib/fifo.h b/lib/fifo.h index f59e4dc6c..6f9c59b5c 100644 --- a/lib/fifo.h +++ b/lib/fifo.h @@ -20,6 +20,10 @@ #ifndef __LIB_FIFO_H__ #define __LIB_FIFO_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* FIFO -- first in first out structure and macros. */ struct fifo { struct fifo *next; @@ -55,4 +59,8 @@ struct fifo { #define FIFO_TOP(F) (FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next) +#ifdef __cplusplus +} +#endif + #endif /* __LIB_FIFO_H__ */ diff --git a/lib/filter.h b/lib/filter.h index 97854b1e9..3dd2eaaf1 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -24,6 +24,10 @@ #include "if.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Maximum ACL name length */ #define ACL_NAMSIZ 128 @@ -62,4 +66,8 @@ extern struct access_list *access_list_lookup(afi_t, const char *); extern enum filter_type access_list_apply(struct access_list *access, const void *object); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_FILTER_H */ diff --git a/lib/freebsd-queue.h b/lib/freebsd-queue.h index 4fcfe85a6..793cfff8d 100644 --- a/lib/freebsd-queue.h +++ b/lib/freebsd-queue.h @@ -33,6 +33,10 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. @@ -675,4 +679,8 @@ struct qm_trace { (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* !_SYS_QUEUE_H_ */ diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index d487c738a..9bc7b9403 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -25,6 +25,10 @@ #include "memory.h" #include "thread.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(FRR_PTHREAD); DECLARE_MTYPE(PTHREAD_PRIM); @@ -211,4 +215,8 @@ void frr_pthread_stop_all(void); #define pthread_condattr_setclock(A, B) #endif +#ifdef __cplusplus +} +#endif + #endif /* _FRR_PTHREAD_H */ diff --git a/lib/frr_zmq.h b/lib/frr_zmq.h index 1146b8796..4303df9cc 100644 --- a/lib/frr_zmq.h +++ b/lib/frr_zmq.h @@ -23,6 +23,10 @@ #include "thread.h" #include <zmq.h> +#ifdef __cplusplus +extern "C" { +#endif + /* linking/packaging note: this is a separate library that needs to be * linked into any daemon/library/module that wishes to use its * functionality. The purpose of this is to encapsulate the libzmq @@ -124,4 +128,8 @@ extern void frrzmq_thread_cancel(struct frrzmq_cb **cb, struct cb_core *core); extern void frrzmq_check_events(struct frrzmq_cb **cbp, struct cb_core *core, int event); +#ifdef __cplusplus +} +#endif + #endif /* _FRRZMQ_H */ diff --git a/lib/frrstr.h b/lib/frrstr.h index 891a3f337..8b591849a 100644 --- a/lib/frrstr.h +++ b/lib/frrstr.h @@ -27,6 +27,10 @@ #include "vector.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * Tokenizes a string, storing tokens in a vector. Whitespace is ignored. * Delimiter characters are not included. @@ -108,4 +112,8 @@ bool begins_with(const char *str, const char *prefix); */ int all_digit(const char *str); +#ifdef __cplusplus +} +#endif + #endif /* _FRRSTR_H_ */ diff --git a/lib/graph.h b/lib/graph.h index 87262a07b..8e126e6be 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -28,6 +28,10 @@ #include "vector.h" #include "buffer.h" +#ifdef __cplusplus +extern "C" { +#endif + struct graph { vector nodes; }; @@ -164,4 +168,9 @@ char *graph_dump_dot(struct graph *graph, struct graph_node *start, void (*pcb)(struct graph_node *, struct buffer *buf)); #endif /* BUILDING_CLIPPY */ + +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_COMMAND_GRAPH_H */ diff --git a/lib/hash.h b/lib/hash.h index aca2590a9..8c695d238 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -24,6 +24,10 @@ #include "memory.h" #include "frratomic.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(HASH) DECLARE_MTYPE(HASH_BACKET) @@ -325,4 +329,8 @@ extern unsigned int string_hash_make(const char *); */ extern void hash_cmd_init(void); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_HASH_H */ diff --git a/lib/hook.h b/lib/hook.h index 96fec97d7..f7fb7b8a5 100644 --- a/lib/hook.h +++ b/lib/hook.h @@ -22,6 +22,10 @@ #include "module.h" #include "memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* type-safe subscribable hook points * * where "type-safe" applies to the function pointers used for subscriptions @@ -219,4 +223,8 @@ extern void _hook_unregister(struct hook *hook, void *funcptr, void *arg, #define DEFINE_KOOH(hookname, arglist, passlist) \ DEFINE_HOOK_INT(hookname, arglist, passlist, true) +#ifdef __cplusplus +} +#endif + #endif /* _FRR_HOOK_H */ diff --git a/lib/id_alloc.h b/lib/id_alloc.h index efe355658..8705ffb37 100644 --- a/lib/id_alloc.h +++ b/lib/id_alloc.h @@ -24,6 +24,10 @@ #include <limits.h> #include <stdint.h> +#ifdef __cplusplus +extern "C" { +#endif + #define IDALLOC_INVALID 0 #define IDALLOC_DIR_BITS 8 @@ -87,4 +91,8 @@ uint32_t idalloc_reserve(struct id_alloc *alloc, uint32_t id); struct id_alloc *idalloc_new(const char *name); void idalloc_destroy(struct id_alloc *alloc); +#ifdef __cplusplus +} +#endif + #endif @@ -27,6 +27,10 @@ #include "qobj.h" #include "hook.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(IF) DECLARE_MTYPE(CONNECTED_LABEL) @@ -545,4 +549,8 @@ void if_link_params_free(struct interface *); extern void if_cmd_init(void); extern const struct frr_yang_module_info frr_interface_info; +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_IF_H */ diff --git a/lib/if_rmap.h b/lib/if_rmap.h index 4468b9fb9..8dded2cb4 100644 --- a/lib/if_rmap.h +++ b/lib/if_rmap.h @@ -21,6 +21,10 @@ #ifndef _ZEBRA_IF_RMAP_H #define _ZEBRA_IF_RMAP_H +#ifdef __cplusplus +extern "C" { +#endif + enum if_rmap_type { IF_RMAP_IN, IF_RMAP_OUT, IF_RMAP_MAX }; struct if_rmap { @@ -37,4 +41,8 @@ extern void if_rmap_hook_delete(void (*)(struct if_rmap *)); extern struct if_rmap *if_rmap_lookup(const char *); extern int config_write_if_rmap(struct vty *); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_IF_RMAP_H */ diff --git a/lib/imsg.h b/lib/imsg.h index eed7074e4..3f81b76be 100644 --- a/lib/imsg.h +++ b/lib/imsg.h @@ -21,6 +21,10 @@ #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 @@ -108,4 +112,8 @@ void imsg_free(struct imsg *); int imsg_flush(struct imsgbuf *); void imsg_clear(struct imsgbuf *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/ipaddr.h b/lib/ipaddr.h index 7f2d06548..f4ddadc66 100644 --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@ -25,6 +25,10 @@ #include <zebra.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * Generic IP address - union of IPv4 and IPv6 address. */ @@ -112,4 +116,8 @@ static inline void ipv4_mapped_ipv6_to_ipv4(struct in6_addr *in6, memcpy(in, (char *)in6 + 12, sizeof(struct in_addr)); } +#ifdef __cplusplus +} +#endif + #endif /* __IPADDR_H__ */ diff --git a/lib/jhash.h b/lib/jhash.h index f8ab4209a..977421495 100644 --- a/lib/jhash.h +++ b/lib/jhash.h @@ -20,6 +20,10 @@ #ifndef _QUAGGA_JHASH_H #define _QUAGGA_JHASH_H +#ifdef __cplusplus +extern "C" { +#endif + /* The most generic version, hashes an arbitrary sequence * of bytes. No alignment or length assumptions are made about * the input key. @@ -42,4 +46,8 @@ extern uint32_t jhash_3words(uint32_t a, uint32_t b, uint32_t c, extern uint32_t jhash_2words(uint32_t a, uint32_t b, uint32_t initval); extern uint32_t jhash_1word(uint32_t a, uint32_t initval); +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_JHASH_H */ diff --git a/lib/json.h b/lib/json.h index d34916230..a5251662b 100644 --- a/lib/json.h +++ b/lib/json.h @@ -21,6 +21,10 @@ #ifndef _QUAGGA_JSON_H #define _QUAGGA_JSON_H +#ifdef __cplusplus +extern "C" { +#endif + #if defined(HAVE_JSON_C_JSON_H) #include <json-c/json.h> @@ -81,4 +85,8 @@ extern void json_object_free(struct json_object *obj); #define JSON_C_TO_STRING_NOSLASHESCAPE (1<<4) #endif +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_JSON_H */ diff --git a/lib/keychain.h b/lib/keychain.h index 49da9ba45..e5cf39f7c 100644 --- a/lib/keychain.h +++ b/lib/keychain.h @@ -23,6 +23,10 @@ #include "qobj.h" +#ifdef __cplusplus +extern "C" { +#endif + struct keychain { char *name; @@ -57,4 +61,8 @@ extern struct key *key_lookup_for_accept(const struct keychain *, uint32_t); extern struct key *key_match_for_accept(const struct keychain *, const char *); extern struct key *key_lookup_for_send(const struct keychain *); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_KEYCHAIN_H */ diff --git a/lib/lib_errors.h b/lib/lib_errors.h index 86a83df46..fc405c209 100644 --- a/lib/lib_errors.h +++ b/lib/lib_errors.h @@ -23,6 +23,10 @@ #include "lib/ferr.h" +#ifdef __cplusplus +extern "C" { +#endif + enum lib_log_refs { EC_LIB_PRIVILEGES = LIB_FERR_START, EC_LIB_VRF_START, @@ -82,4 +86,8 @@ enum lib_log_refs { extern void lib_error_init(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/libfrr.h b/lib/libfrr.h index 2705397b8..891e2c128 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -30,6 +30,10 @@ #include "hook.h" #include "northbound.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The following options disable specific command line options that * are not applicable for a particular daemon. */ @@ -152,4 +156,8 @@ extern char frr_protonameinst[]; extern bool debug_memstats_at_exit; +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_FRR_H */ diff --git a/lib/libospf.h b/lib/libospf.h index 45aedb6a7..d2bb29d80 100644 --- a/lib/libospf.h +++ b/lib/libospf.h @@ -22,6 +22,10 @@ #ifndef _LIBOSPFD_H #define _LIBOSPFD_H +#ifdef __cplusplus +extern "C" { +#endif + /* IP precedence. */ #ifndef IPTOS_PREC_INTERNETCONTROL #define IPTOS_PREC_INTERNETCONTROL 0xC0 @@ -94,4 +98,8 @@ #define OSPF_LSA_MAXAGE_CHECK_INTERVAL 30 #define OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT 60 +#ifdef __cplusplus +} +#endif + #endif /* _LIBOSPFD_H */ diff --git a/lib/linklist.h b/lib/linklist.h index 0475391e9..5908e97a1 100644 --- a/lib/linklist.h +++ b/lib/linklist.h @@ -21,6 +21,10 @@ #ifndef _ZEBRA_LINKLIST_H #define _ZEBRA_LINKLIST_H +#ifdef __cplusplus +extern "C" { +#endif + /* listnodes must always contain data to be valid. Adding an empty node * to a list is invalid */ @@ -336,4 +340,8 @@ extern void list_add_list(struct list *list, struct list *add); (L)->count--; \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_LINKLIST_H */ @@ -29,6 +29,10 @@ #include <stdarg.h> #include "lib/hook.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Hook for external logging function */ DECLARE_HOOK(zebra_ext_log, (int priority, const char *format, va_list args), (priority, format, args)); @@ -196,4 +200,8 @@ struct timestamp_control { "Local use\n" \ "Local use\n" +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_LOG_H */ diff --git a/lib/log_int.h b/lib/log_int.h index a7f8be9ae..58ae031e1 100644 --- a/lib/log_int.h +++ b/lib/log_int.h @@ -24,6 +24,10 @@ #include "log.h" +#ifdef __cplusplus +extern "C" { +#endif + struct zlog { const char *ident; /* daemon name (first arg to openlog) */ const char *protoname; @@ -49,4 +53,8 @@ extern const char *zlog_priority[]; extern void vzlog(int priority, const char *format, va_list args); extern void zlog(int priority, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_LOG_PRIVATE_H */ diff --git a/lib/logicalrouter.h b/lib/logicalrouter.h index 5a0780c00..d18832ef7 100644 --- a/lib/logicalrouter.h +++ b/lib/logicalrouter.h @@ -20,6 +20,10 @@ #ifndef _ZEBRA_LOGICAL_ROUTER_H #define _ZEBRA_LOGICAL_ROUTER_H +#ifdef __cplusplus +extern "C" { +#endif + /* Logical Router Backend defines */ #define LOGICALROUTER_BACKEND_OFF 0 #define LOGICALROUTER_BACKEND_NETNS 1 @@ -38,4 +42,8 @@ extern void logicalrouter_terminate(void); */ extern void logicalrouter_configure_backend(int backend_netns); +#ifdef __cplusplus +} +#endif + #endif /*_ZEBRA_LOGICAL_ROUTER_H*/ @@ -29,6 +29,10 @@ #include <lualib.h> #include <lauxlib.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * These functions are helper functions that * try to glom some of the lua_XXX functionality @@ -75,5 +79,10 @@ enum lua_rm_status lua_run_rm_rule(lua_State *L, const char *rule); */ const char *get_string(lua_State *L, const char *key); int get_integer(lua_State *L, const char *key); + +#ifdef __cplusplus +} +#endif + #endif #endif @@ -38,6 +38,10 @@ #ifndef _LIBZEBRA_MD5_H_ #define _LIBZEBRA_MD5_H_ +#ifdef __cplusplus +extern "C" { +#endif + #define MD5_BUFLEN 64 typedef struct { @@ -82,4 +86,8 @@ extern void md5_result(uint8_t *, md5_ctxt *); void hmac_md5(unsigned char *text, int text_len, unsigned char *key, int key_len, uint8_t *digest); +#ifdef __cplusplus +} +#endif + #endif /* ! _LIBZEBRA_MD5_H_*/ diff --git a/lib/memory.h b/lib/memory.h index 40b9d36ee..91a02b796 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -22,6 +22,10 @@ #include <frratomic.h> #include "compiler.h" +#ifdef __cplusplus +extern "C" { +#endif + #define array_size(ar) (sizeof(ar) / sizeof(ar[0])) #if defined(HAVE_MALLOC_SIZE) && !defined(HAVE_MALLOC_USABLE_SIZE) @@ -176,4 +180,8 @@ extern int log_memstats(FILE *fp, const char *); extern void memory_oom(size_t size, const char *name); +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_MEMORY_H */ diff --git a/lib/memory_vty.h b/lib/memory_vty.h index b66c3b6d6..941255be1 100644 --- a/lib/memory_vty.h +++ b/lib/memory_vty.h @@ -23,9 +23,18 @@ #include "memory.h" +#ifdef __cplusplus +extern "C" { +#endif + extern void memory_init(void); /* Human friendly string for given byte count */ #define MTYPE_MEMSTR_LEN 20 extern const char *mtype_memstr(char *, size_t, unsigned long); + +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_MEMORY_VTY_H */ diff --git a/lib/mlag.h b/lib/mlag.h index 73725ca3f..2b904d44f 100644 --- a/lib/mlag.h +++ b/lib/mlag.h @@ -22,6 +22,10 @@ #ifndef __MLAG_H__ #define __MLAG_H__ +#ifdef __cplusplus +extern "C" { +#endif + enum mlag_role { MLAG_ROLE_NONE, MLAG_ROLE_PRIMARY, @@ -29,4 +33,9 @@ enum mlag_role { }; extern char *mlag_role2str(enum mlag_role role, char *buf, size_t size); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/module.h b/lib/module.h index 68ed95927..73ba8665e 100644 --- a/lib/module.h +++ b/lib/module.h @@ -20,6 +20,10 @@ #include <stdint.h> #include <stdbool.h> +#ifdef __cplusplus +extern "C" { +#endif + #if !defined(__GNUC__) #error module code needs GCC visibility extensions #elif __GNUC__ < 4 @@ -95,4 +99,8 @@ extern struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, extern void frrmod_unload(struct frrmod_runtime *module); #endif +#ifdef __cplusplus +} +#endif + #endif /* _FRR_MODULE_H */ diff --git a/lib/monotime.h b/lib/monotime.h index 00b940046..6aac966ea 100644 --- a/lib/monotime.h +++ b/lib/monotime.h @@ -21,6 +21,10 @@ #include <time.h> #include <sys/time.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifndef TIMESPEC_TO_TIMEVAL /* should be in sys/time.h on BSD & Linux libcs */ #define TIMESPEC_TO_TIMEVAL(tv, ts) \ @@ -91,4 +95,8 @@ static inline char *time_to_string(time_t ts) return ctime(&tbuf); } +#ifdef __cplusplus +} +#endif + #endif /* _FRR_MONOTIME_H */ diff --git a/lib/mpls.h b/lib/mpls.h index 614698561..b140c8e31 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -25,6 +25,10 @@ #include <zebra.h> #include <arpa/inet.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifdef MPLS_LABEL_MAX #undef MPLS_LABEL_MAX #endif @@ -209,4 +213,8 @@ int mpls_str2label(const char *label_str, uint8_t *num_labels, char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf, int len, int pretty); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/network.h b/lib/network.h index 4703dc9b6..a00c5a0a6 100644 --- a/lib/network.h +++ b/lib/network.h @@ -22,6 +22,10 @@ #ifndef _ZEBRA_NETWORK_H #define _ZEBRA_NETWORK_H +#ifdef __cplusplus +extern "C" { +#endif + /* Both readn and writen are deprecated and will be removed. They are not suitable for use with non-blocking file descriptors. */ @@ -41,4 +45,8 @@ extern int set_cloexec(int fd); extern float htonf(float); extern float ntohf(float); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_NETWORK_H */ diff --git a/lib/nexthop.h b/lib/nexthop.h index e4af405d5..c79ec590a 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -26,6 +26,10 @@ #include "prefix.h" #include "mpls.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Maximum next hop string length - gateway + ifindex */ #define NEXTHOP_STRLEN (INET6_ADDRSTRLEN + 30) @@ -146,4 +150,9 @@ extern int nexthop_same_firsthop(struct nexthop *next1, struct nexthop *next2); extern const char *nexthop2str(const struct nexthop *nexthop, char *str, int size); extern struct nexthop *nexthop_next(struct nexthop *nexthop); extern unsigned int nexthop_level(struct nexthop *nexthop); + +#ifdef __cplusplus +} +#endif + #endif /*_LIB_NEXTHOP_H */ diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h index b31ec7f06..b14cbb5b5 100644 --- a/lib/nexthop_group.h +++ b/lib/nexthop_group.h @@ -23,6 +23,10 @@ #include <vty.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * What is a nexthop group? * @@ -110,4 +114,9 @@ extern struct nexthop *nexthop_exists(struct nexthop_group *nhg, extern struct nexthop_group_cmd *nhgc_find(const char *name); extern void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/northbound.h b/lib/northbound.h index 4d760e2d3..bb6b62af7 100644 --- a/lib/northbound.h +++ b/lib/northbound.h @@ -27,6 +27,10 @@ #include "yang.h" #include "yang_translator.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Forward declaration(s). */ struct vty; @@ -839,4 +843,8 @@ extern void nb_init(struct thread_master *tm, const struct frr_yang_module_info */ extern void nb_terminate(void); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_NORTHBOUND_H_ */ diff --git a/lib/northbound_cli.h b/lib/northbound_cli.h index 884f25094..209239ca6 100644 --- a/lib/northbound_cli.h +++ b/lib/northbound_cli.h @@ -22,6 +22,10 @@ #include "northbound.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Possible formats in which a configuration can be displayed. */ enum nb_cfg_format { NB_CFG_FMT_CMDS = 0, @@ -111,4 +115,8 @@ extern void nb_cli_install_default(int node); extern void nb_cli_init(struct thread_master *tm); extern void nb_cli_terminate(void); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_NORTHBOUND_CLI_H_ */ diff --git a/lib/northbound_db.h b/lib/northbound_db.h index ad6096644..14df09caa 100644 --- a/lib/northbound_db.h +++ b/lib/northbound_db.h @@ -22,6 +22,10 @@ #include "northbound.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * Initialize the northbound database. * @@ -101,4 +105,8 @@ extern int nb_db_transactions_iterate( const char *date, const char *comment), void *arg); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_NORTHBOUND_DB_H_ */ @@ -26,6 +26,10 @@ #include "linklist.h" #include "vty.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef uint32_t ns_id_t; /* the default NS ID */ @@ -174,4 +178,8 @@ extern int ns_enable(struct ns *ns, void (*func)(ns_id_t, void *)); extern struct ns *ns_get_created(struct ns *ns, char *name, ns_id_t ns_id); extern void ns_disable(struct ns *ns); +#ifdef __cplusplus +} +#endif + #endif /*_ZEBRA_NS_H*/ diff --git a/lib/openbsd-queue.h b/lib/openbsd-queue.h index e09cc3d4e..d4c08a3be 100644 --- a/lib/openbsd-queue.h +++ b/lib/openbsd-queue.h @@ -35,6 +35,10 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues and XOR simple queues. @@ -572,4 +576,8 @@ } \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* !_SYS_QUEUE_H_ */ diff --git a/lib/openbsd-tree.h b/lib/openbsd-tree.h index b3efe4cbd..d2f078133 100644 --- a/lib/openbsd-tree.h +++ b/lib/openbsd-tree.h @@ -27,6 +27,10 @@ #ifndef _SYS_TREE_H_ #define _SYS_TREE_H_ +#ifdef __cplusplus +extern "C" { +#endif + /* * This file defines data structures for different types of trees: * splay trees and red-black trees. @@ -567,4 +571,8 @@ int _rb_check(const struct rb_type *, void *, unsigned long); for ((_e) = RB_MAX(_name, (_head)); \ (_e) != NULL && ((_n) = RB_PREV(_name, (_e)), 1); (_e) = (_n)) +#ifdef __cplusplus +} +#endif + #endif /* _SYS_TREE_H_ */ @@ -24,6 +24,10 @@ #include "stream.h" #include "prefix.h" +#ifdef __cplusplus +extern "C" { +#endif + #define PBR_STR "Policy Based Routing\n" /* @@ -121,4 +125,8 @@ struct pbr_rule { extern int zapi_pbr_rule_encode(uint8_t cmd, struct stream *s, struct pbr_rule *zrule); +#ifdef __cplusplus +} +#endif + #endif /* _PBR_H */ diff --git a/lib/plist.h b/lib/plist.h index 8a4fa8d3c..ba2846d74 100644 --- a/lib/plist.h +++ b/lib/plist.h @@ -27,6 +27,10 @@ #include "stream.h" #include "vty.h" +#ifdef __cplusplus +extern "C" { +#endif + enum prefix_list_type { PREFIX_DENY, PREFIX_PERMIT, @@ -75,4 +79,8 @@ extern void prefix_bgp_orf_remove_all(afi_t, char *); extern int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, bool use_json); +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_PLIST_H */ diff --git a/lib/plist_int.h b/lib/plist_int.h index 6bc2d034d..443b0c614 100644 --- a/lib/plist_int.h +++ b/lib/plist_int.h @@ -22,6 +22,10 @@ #ifndef _QUAGGA_PLIST_INT_H #define _QUAGGA_PLIST_INT_H +#ifdef __cplusplus +extern "C" { +#endif + enum prefix_name_type { PREFIX_TYPE_STRING, PREFIX_TYPE_NUMBER }; struct pltrie_table; @@ -68,4 +72,8 @@ struct prefix_list_entry { struct prefix_list_entry *next_best; }; +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_PLIST_INT_H */ diff --git a/lib/pqueue.h b/lib/pqueue.h index 53e5aa833..032ee9db4 100644 --- a/lib/pqueue.h +++ b/lib/pqueue.h @@ -21,6 +21,10 @@ #ifndef _ZEBRA_PQUEUE_H #define _ZEBRA_PQUEUE_H +#ifdef __cplusplus +extern "C" { +#endif + struct pqueue { void **array; int array_size; @@ -43,4 +47,8 @@ extern void pqueue_remove(void *data, struct pqueue *queue); extern void trickle_down(int index, struct pqueue *queue); extern void trickle_up(int index, struct pqueue *queue); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_PQUEUE_H */ diff --git a/lib/prefix.h b/lib/prefix.h index 231a407cc..ae931288c 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -35,6 +35,10 @@ #include "ipaddr.h" #include "compiler.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef ETH_ALEN #define ETH_ALEN 6 #endif @@ -506,4 +510,9 @@ static inline int is_host_route(struct prefix *p) return (p->prefixlen == IPV6_MAX_BITLEN); return 0; } + +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_PREFIX_H */ diff --git a/lib/privs.h b/lib/privs.h index b061370b7..1fee423a9 100644 --- a/lib/privs.h +++ b/lib/privs.h @@ -23,6 +23,10 @@ #ifndef _ZEBRA_PRIVS_H #define _ZEBRA_PRIVS_H +#ifdef __cplusplus +extern "C" { +#endif + /* list of zebra capabilities */ typedef enum { ZCAP_SETID, @@ -120,4 +124,8 @@ extern void _zprivs_lower(struct zebra_privs_t **privs); _zprivs_raise(privs, __func__); \ _once == NULL; _once = (void *)1) +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_PRIVS_H */ diff --git a/lib/ptm_lib.h b/lib/ptm_lib.h index fc4d520dc..c2170407c 100644 --- a/lib/ptm_lib.h +++ b/lib/ptm_lib.h @@ -20,6 +20,10 @@ #ifndef __PTM_LIB_H__ #define __PTM_LIB_H__ +#ifdef __cplusplus +extern "C" { +#endif + #define PTMLIB_MSG_SZ 1024 #define PTMLIB_MSG_HDR_LEN 37 #define PTMLIB_MSG_VERSION 2 @@ -65,4 +69,8 @@ int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *); int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *); int ptm_lib_cleanup_msg(ptm_lib_handle_t *, void *); +#ifdef __cplusplus +} +#endif + #endif @@ -20,6 +20,10 @@ #ifndef _FRR_PW_H #define _FRR_PW_H +#ifdef __cplusplus +extern "C" { +#endif + /* L2VPN name length. */ #define L2VPN_NAME_LEN 32 @@ -49,4 +53,8 @@ union pw_protocol_fields { } bgp; }; +#ifdef __cplusplus +} +#endif + #endif /* _FRR_PW_H */ diff --git a/lib/qobj.h b/lib/qobj.h index a109bf4a7..d63988cba 100644 --- a/lib/qobj.h +++ b/lib/qobj.h @@ -21,6 +21,10 @@ #include <stdlib.h> #include <stddef.h> +#ifdef __cplusplus +extern "C" { +#endif + /* reserve a specific amount of bytes for a struct, which can grow up to * that size (or be dummy'd out if not needed) * @@ -133,4 +137,8 @@ void *qobj_get_typed(uint64_t id, struct qobj_nodetype *type); void qobj_init(void); void qobj_finish(void); +#ifdef __cplusplus +} +#endif + #endif /* _QOBJ_H */ diff --git a/lib/queue.h b/lib/queue.h index 11e28b4c9..dab43e3c5 100644 --- a/lib/queue.h +++ b/lib/queue.h @@ -19,6 +19,10 @@ #ifndef _FRR_QUEUE_H #define _FRR_QUEUE_H +#ifdef __cplusplus +extern "C" { +#endif + #if defined(__OpenBSD__) && !defined(STAILQ_HEAD) #include "openbsd-queue.h" @@ -85,4 +89,8 @@ }; _elm; }) #endif +#ifdef __cplusplus +} +#endif + #endif /* _FRR_QUEUE_H */ diff --git a/lib/ringbuf.h b/lib/ringbuf.h index 15049e3ee..b8f4d9798 100644 --- a/lib/ringbuf.h +++ b/lib/ringbuf.h @@ -25,6 +25,10 @@ #include "memory.h" +#ifdef __cplusplus +extern "C" { +#endif + struct ringbuf { size_t size; ssize_t start; @@ -122,4 +126,8 @@ void ringbuf_reset(struct ringbuf *buf); */ void ringbuf_wipe(struct ringbuf *buf); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_RINGBUF_H_ */ diff --git a/lib/routemap.h b/lib/routemap.h index 6fd88ba5d..e43e74a63 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -26,6 +26,10 @@ #include "qobj.h" #include "vty.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(ROUTE_MAP_NAME) DECLARE_MTYPE(ROUTE_MAP_RULE) DECLARE_MTYPE(ROUTE_MAP_COMPILED) @@ -388,4 +392,8 @@ extern void route_map_counter_increment(struct route_map *map); /* Decrement the route-map used counter */ extern void route_map_counter_decrement(struct route_map *map); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_ROUTEMAP_H */ diff --git a/lib/sbuf.h b/lib/sbuf.h index c38e96912..b1518a3aa 100644 --- a/lib/sbuf.h +++ b/lib/sbuf.h @@ -23,6 +23,10 @@ #ifndef SBUF_H #define SBUF_H +#ifdef __cplusplus +extern "C" { +#endif + /* * sbuf provides a simple string buffer. One application where this comes * in handy is the parsing of binary data: If there is an error in the parsing @@ -76,4 +80,8 @@ void sbuf_free(struct sbuf *buf); void sbuf_push(struct sbuf *buf, int indent, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/sha256.h b/lib/sha256.h index 2473da7bd..c93d25305 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -29,6 +29,10 @@ #ifndef _SHA256_H_ #define _SHA256_H_ +#ifdef __cplusplus +extern "C" { +#endif + typedef struct SHA256Context { uint32_t state[8]; uint32_t count[2]; @@ -55,4 +59,8 @@ void HMAC__SHA256_Final(unsigned char[32], HMAC_SHA256_CTX *); void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, uint8_t *, size_t); +#ifdef __cplusplus +} +#endif + #endif /* !_SHA256_H_ */ diff --git a/lib/sigevent.h b/lib/sigevent.h index d4ab5741a..a0ad88fca 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -25,6 +25,10 @@ #include <thread.h> +#ifdef __cplusplus +extern "C" { +#endif + #define QUAGGA_SIGNAL_TIMER_INTERVAL 2L struct quagga_signal_t { @@ -47,4 +51,8 @@ extern void signal_init(struct thread_master *m, int sigc, /* check whether there are signals to handle, process any found */ extern int quagga_sigevent_process(void); +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_SIGNAL_H */ diff --git a/lib/skiplist.h b/lib/skiplist.h index a2e8c374b..2ab37331c 100644 --- a/lib/skiplist.h +++ b/lib/skiplist.h @@ -31,6 +31,10 @@ #ifndef _ZEBRA_SKIPLIST_H #define _ZEBRA_SKIPLIST_H +#ifdef __cplusplus +extern "C" { +#endif + #define SKIPLIST_0TIMER_DEBUG 1 /* @@ -122,4 +126,8 @@ extern void skiplist_debug(struct vty *vty, struct skiplist *l); extern void skiplist_test(struct vty *vty); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_SKIPLIST_H */ diff --git a/lib/smux.h b/lib/smux.h index 9adfacb3e..3f860db0d 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -26,6 +26,10 @@ #include "thread.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Structures here are mostly compatible with UCD SNMP 4.1.1 */ #define MATCH_FAILED (-1) #define MATCH_SUCCEEDED 0 @@ -103,4 +107,8 @@ extern void oid2in_addr(oid[], int, struct in_addr *); extern void *oid_copy(void *, const void *, size_t); extern void oid_copy_addr(oid[], struct in_addr *, int); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_SNMP_H */ diff --git a/lib/sockopt.h b/lib/sockopt.h index f54f60ffd..8fa5987cf 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -23,6 +23,10 @@ #include "sockunion.h" +#ifdef __cplusplus +extern "C" { +#endif + extern void setsockopt_so_recvbuf(int sock, int size); extern void setsockopt_so_sendbuf(const int sock, int size); extern int getsockopt_so_sendbuf(const int sock); @@ -98,4 +102,9 @@ extern void sockopt_iphdrincl_swab_systoh(struct ip *iph); extern int sockopt_tcp_rtt(int); extern int sockopt_tcp_signature(int sock, union sockunion *su, const char *password); + +#ifdef __cplusplus +} +#endif + #endif /*_ZEBRA_SOCKOPT_H */ diff --git a/lib/sockunion.h b/lib/sockunion.h index b585aee5b..d7d26ba85 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -28,6 +28,10 @@ #include <netmpls/mpls.h> #endif +#ifdef __cplusplus +extern "C" { +#endif + union sockunion { struct sockaddr sa; struct sockaddr_in sin; @@ -99,4 +103,8 @@ extern union sockunion *sockunion_dup(const union sockunion *); extern void sockunion_free(union sockunion *); extern void sockunion_init(union sockunion *); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_SOCKUNION_H */ diff --git a/lib/spf_backoff.h b/lib/spf_backoff.h index 6de5804ac..11b2701e3 100644 --- a/lib/spf_backoff.h +++ b/lib/spf_backoff.h @@ -26,6 +26,10 @@ #ifndef _ZEBRA_SPF_BACKOFF_H #define _ZEBRA_SPF_BACKOFF_H +#ifdef __cplusplus +extern "C" { +#endif + struct spf_backoff; struct thread_master; struct vty; @@ -58,4 +62,8 @@ long spf_backoff_long_delay(struct spf_backoff *backoff); long spf_backoff_holddown(struct spf_backoff *backoff); long spf_backoff_timetolearn(struct spf_backoff *backoff); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/srcdest_table.h b/lib/srcdest_table.h index 6f9457826..8845931de 100644 --- a/lib/srcdest_table.h +++ b/lib/srcdest_table.h @@ -46,6 +46,10 @@ #include "prefix.h" #include "table.h" +#ifdef __cplusplus +extern "C" { +#endif + #define SRCDEST2STR_BUFFER (2*PREFIX2STR_BUFFER + sizeof(" from ")) /* extended route node for IPv6 srcdest routing */ @@ -96,4 +100,8 @@ static inline void *srcdest_rnode_table_info(struct route_node *rn) return route_table_get_info(srcdest_rnode_table(rn)); } +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_SRC_DEST_TABLE_H */ diff --git a/lib/stream.h b/lib/stream.h index 20c5d3d77..5341bfa40 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -28,6 +28,10 @@ #include "mpls.h" #include "prefix.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * A stream is an arbitrary buffer, whose contents generally are assumed to * be in network order. @@ -404,4 +408,8 @@ static inline uint8_t *ptr_get_be32(uint8_t *ptr, uint32_t *out) goto stream_failure; \ } while (0) +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_STREAM_H */ diff --git a/lib/systemd.h b/lib/systemd.h index a13ea7bfd..6e43df527 100644 --- a/lib/systemd.h +++ b/lib/systemd.h @@ -19,6 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Wrapper functions to systemd calls. * @@ -37,3 +41,7 @@ void systemd_send_stopping(void); * process? */ void systemd_send_started(struct thread_master *master, int the_process); + +#ifdef __cplusplus +} +#endif diff --git a/lib/table.h b/lib/table.h index 541d74d77..ce578e795 100644 --- a/lib/table.h +++ b/lib/table.h @@ -25,6 +25,11 @@ #include "memory.h" #include "hash.h" #include "prefix.h" + +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(ROUTE_TABLE) DECLARE_MTYPE(ROUTE_NODE) @@ -318,4 +323,8 @@ static inline int route_table_iter_started(route_table_iter_t *iter) return iter->state != RT_ITER_STATE_INIT; } +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_TABLE_H */ diff --git a/lib/termtable.h b/lib/termtable.h index ca5cc1df9..491010a85 100644 --- a/lib/termtable.h +++ b/lib/termtable.h @@ -22,6 +22,10 @@ #include <zebra.h> +#ifdef __cplusplus +extern "C" { +#endif + enum ttable_align { LEFT, RIGHT, @@ -294,4 +298,8 @@ void ttable_rowseps(struct ttable *tt, unsigned int row, */ char *ttable_dump(struct ttable *tt, const char *newline); +#ifdef __cplusplus +} +#endif + #endif /* _TERMTABLE_H */ diff --git a/lib/thread.h b/lib/thread.h index 036e39f77..ec774a654 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -27,6 +27,10 @@ #include "monotime.h" #include "frratomic.h" +#ifdef __cplusplus +extern "C" { +#endif + struct rusage_t { struct rusage cpu; struct timeval real; @@ -233,4 +237,8 @@ extern unsigned long thread_consumed_time(RUSAGE_T *after, RUSAGE_T *before, /* only for use in logging functions! */ extern pthread_key_t thread_current; +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_THREAD_H */ diff --git a/lib/vector.h b/lib/vector.h index 97e15da04..d5857eb59 100644 --- a/lib/vector.h +++ b/lib/vector.h @@ -24,6 +24,10 @@ #include "memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* struct for vector */ struct _vector { unsigned int active; /* number of active slots */ @@ -63,4 +67,9 @@ extern void *vector_lookup(vector, unsigned int); extern void *vector_lookup_ensure(vector, unsigned int); extern void vector_to_array(vector v, void ***dest, int *argc); extern vector array_to_vector(void **src, int argc); + +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_VECTOR_H */ diff --git a/lib/vlan.h b/lib/vlan.h index 6d15e62df..eea2633d4 100644 --- a/lib/vlan.h +++ b/lib/vlan.h @@ -22,8 +22,16 @@ #ifndef __VLAN_H__ #define __VLAN_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* VLAN Identifier */ typedef uint16_t vlanid_t; #define VLANID_MAX 4095 +#ifdef __cplusplus +} +#endif + #endif /* __VLAN_H__ */ @@ -28,6 +28,10 @@ #include "vty.h" #include "ns.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The default VRF ID */ #define VRF_UNKNOWN UINT32_MAX @@ -292,4 +296,8 @@ extern int vrf_enable(struct vrf *vrf); extern void vrf_delete(struct vrf *vrf); extern vrf_id_t vrf_generate_id(void); +#ifdef __cplusplus +} +#endif + #endif /*_ZEBRA_VRF_H*/ diff --git a/lib/vrf_int.h b/lib/vrf_int.h index d7fe73581..8dc078e4f 100644 --- a/lib/vrf_int.h +++ b/lib/vrf_int.h @@ -25,6 +25,10 @@ #include "vrf.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * These functions should only be called by: * zebra/if_netlink.c -> The interface from OS into Zebra @@ -52,4 +56,8 @@ extern int vrf_enable(struct vrf *); */ extern void vrf_delete(struct vrf *); +#ifdef __cplusplus +} +#endif + #endif @@ -31,6 +31,10 @@ #include "compiler.h" #include "northbound.h" +#ifdef __cplusplus +extern "C" { +#endif + #define VTY_BUFSIZ 4096 #define VTY_MAXHIST 20 #define VTY_MAXDEPTH 8 @@ -333,4 +337,8 @@ extern void vty_stdio_close(void); an async-signal-safe function. */ extern void vty_log_fixed(char *buf, size_t len); +#ifdef __cplusplus +} +#endif + #endif /* _ZEBRA_VTY_H */ diff --git a/lib/vxlan.h b/lib/vxlan.h index bcf835453..2a8077f8c 100644 --- a/lib/vxlan.h +++ b/lib/vxlan.h @@ -22,6 +22,10 @@ #ifndef __VXLAN_H__ #define __VXLAN_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* VxLAN Network Identifier - 24-bit (RFC 7348) */ typedef uint32_t vni_t; #define VNI_MAX 16777215 /* (2^24 - 1) */ @@ -35,4 +39,9 @@ enum vxlan_flood_control { VXLAN_FLOOD_HEAD_END_REPL = 0, VXLAN_FLOOD_DISABLED, }; + +#ifdef __cplusplus +} +#endif + #endif /* __VXLAN_H__ */ diff --git a/lib/wheel.h b/lib/wheel.h index c8e83fafc..e66751c1d 100644 --- a/lib/wheel.h +++ b/lib/wheel.h @@ -20,6 +20,10 @@ #ifndef __WHEEL_H__ #define __WHEEL_H__ +#ifdef __cplusplus +extern "C" { +#endif + struct timer_wheel { char *name; struct thread_master *master; @@ -115,4 +119,8 @@ int wheel_add_item(struct timer_wheel *wheel, void *item); */ int wheel_remove_item(struct timer_wheel *wheel, void *item); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/workqueue.h b/lib/workqueue.h index cbbacc056..7c610f5dd 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -25,6 +25,11 @@ #include "memory.h" #include "queue.h" + +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(WORK_QUEUE) /* Hold time for the initial schedule of a queue run, in millisec */ @@ -176,4 +181,8 @@ extern int work_queue_run(struct thread *); extern void workqueue_cmd_init(void); +#ifdef __cplusplus +} +#endif + #endif /* _QUAGGA_WORK_QUEUE_H */ diff --git a/lib/yang.h b/lib/yang.h index 3259189e9..4680db08d 100644 --- a/lib/yang.h +++ b/lib/yang.h @@ -29,6 +29,10 @@ #include "yang_wrappers.h" +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_MTYPE(YANG_MODULE) DECLARE_MTYPE(YANG_DATA) @@ -521,4 +525,8 @@ extern void yang_init(void); */ extern void yang_terminate(void); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_YANG_H_ */ diff --git a/lib/yang_translator.h b/lib/yang_translator.h index 6b49d1acf..55f396a43 100644 --- a/lib/yang_translator.h +++ b/lib/yang_translator.h @@ -20,6 +20,10 @@ #ifndef _FRR_YANG_TRANSLATOR_H_ #define _FRR_YANG_TRANSLATOR_H_ +#ifdef __cplusplus +extern "C" { +#endif + #define YANG_TRANSLATE_TO_NATIVE 0 #define YANG_TRANSLATE_FROM_NATIVE 1 #define YANG_TRANSLATE_MAX 2 @@ -141,4 +145,8 @@ extern void yang_translator_init(void); */ extern void yang_translator_terminate(void); +#ifdef __cplusplus +} +#endif + #endif /* _FRR_YANG_TRANSLATOR_H_ */ |