]> granicus.if.org Git - ipset/commitdiff
Support linking libipset to C++ programs
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 18 Mar 2015 19:58:25 +0000 (20:58 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 18 Mar 2015 19:58:25 +0000 (20:58 +0100)
Issue reported by Pavel Odintsov.

include/libipset/data.h
include/libipset/errcode.h
include/libipset/icmp.h
include/libipset/icmpv6.h
include/libipset/mnl.h
include/libipset/parse.h
include/libipset/print.h
include/libipset/session.h
include/libipset/types.h
include/libipset/ui.h

index 945df54f793b28bdec1dd4b9a01d1b3ff8434870..ca218901a09f580a3c42e0d7b005beb2dae61e1d 100644 (file)
@@ -131,6 +131,10 @@ enum ipset_opt {
 
 struct ipset_data;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void ipset_strlcpy(char *dst, const char *src, size_t len);
 extern void ipset_strlcat(char *dst, const char *src, size_t len);
 extern bool ipset_data_flags_test(const struct ipset_data *data,
@@ -164,4 +168,8 @@ extern void ipset_data_fini(struct ipset_data *data);
 
 extern size_t ipset_data_sizeof(enum ipset_opt opt, uint8_t family);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_DATA_H */
index 1593d893d29120b5544a2fd75295cdf89db32702..6b9dfe08ea9a98f5037162a55ec5363b1a18f1b0 100644 (file)
@@ -18,7 +18,15 @@ struct ipset_errcode_table {
        const char *message;    /* error message the code translated to */
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int ipset_errcode(struct ipset_session *session, enum ipset_cmd cmd,
                         int errcode);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_ERRCODE_H */
index e27fd4a7172f8dd83b0912d108e02af3cbbc0c0b..914b5e87bc1465c24f0be014a07e492c1774a5d7 100644 (file)
@@ -9,8 +9,16 @@
 
 #include <stdint.h>                            /* uintxx_t */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char *id_to_icmp(uint8_t id);
 extern const char *icmp_to_name(uint8_t type, uint8_t code);
 extern int name_to_icmp(const char *str, uint16_t *typecode);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_ICMP_H */
index 8295445ad51f35ffa1ae386a324aa85e740976e6..69c1119aee057b63bc2405ac1d3771fe9c4661dc 100644 (file)
@@ -9,8 +9,16 @@
 
 #include <stdint.h>                            /* uintxx_t */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char *id_to_icmpv6(uint8_t id);
 extern const char *icmpv6_to_name(uint8_t type, uint8_t code);
 extern int name_to_icmpv6(const char *str, uint16_t *typecode);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_ICMPV6_H */
index 0516ec7fe63b27e1488950dd04f62184e6d49812..7aaf44e13546c3398ed5a991da97e9979b6bbfa2 100644 (file)
@@ -22,8 +22,15 @@ struct nfgenmsg {
 };
 #endif
 
-extern int ipset_get_nlmsg_type(const struct nlmsghdr *nlh);
+#ifdef __cplusplus
+extern "C" {
+#endif
 
+extern int ipset_get_nlmsg_type(const struct nlmsghdr *nlh);
 extern const struct ipset_transport ipset_mnl_transport;
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_MNL_H */
index 810ea2860af154445b23794a846ee4f54ba97957..9223eeb20a48d71f9823d343afbe3c451dda5fd6 100644 (file)
@@ -24,6 +24,10 @@ struct ipset_arg;
 typedef int (*ipset_parsefn)(struct ipset_session *s,
                             enum ipset_opt opt, const char *str);
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int ipset_parse_ether(struct ipset_session *session,
                             enum ipset_opt opt, const char *str);
 extern int ipset_parse_port(struct ipset_session *session,
@@ -116,4 +120,8 @@ extern int ipset_parse_iptimeout(struct ipset_session *session,
 extern int ipset_parse_name_compat(struct ipset_session *session,
                                   enum ipset_opt opt, const char *str);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_PARSE_H */
index 8f672c312cec58bbe8e0702347bf89f2ebe4737e..2103ce12ad07caa782134cda8f94bde42e5f7cc3 100644 (file)
@@ -13,6 +13,10 @@ typedef int (*ipset_printfn)(char *buf, unsigned int len,
                             const struct ipset_data *data,
                             enum ipset_opt opt, uint8_t env);
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int ipset_print_ether(char *buf, unsigned int len,
                             const struct ipset_data *data,
                             enum ipset_opt opt, uint8_t env);
@@ -77,4 +81,8 @@ extern int ipset_print_data(char *buf, unsigned int len,
                            const struct ipset_data *data,
                            enum ipset_opt opt, uint8_t env);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_PRINT_H */
index 988233e9ce9d4daa743271d688a87a1f3f3ec0c5..833f763a3940f29c6d2e875095fa11ca96e8628f 100644 (file)
@@ -21,6 +21,10 @@ struct ipset_session;
 struct ipset_data;
 struct ipset_handle;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern struct ipset_data *
        ipset_session_data(const struct ipset_session *session);
 extern struct ipset_handle *
@@ -104,4 +108,8 @@ extern int ipset_session_fini(struct ipset_session *session);
 
 extern void ipset_debug_msg(const char *dir, void *buffer, int len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_SESSION_H */
index c98855e14713dc740093748dc22b77a52882a88f..7f41afca77263e3667c86f5572da2e4bc139937b 100644 (file)
@@ -86,6 +86,10 @@ struct ipset_type {
        const char *alias[];                    /* name alias(es) */
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int ipset_cache_add(const char *name, const struct ipset_type *type,
                           uint8_t family);
 extern int ipset_cache_del(const char *name);
@@ -107,6 +111,10 @@ extern bool ipset_match_typename(const char *str,
                                 const struct ipset_type *t);
 extern void ipset_load_types(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #ifdef TYPE_INCLUSIVE
 #      ifdef _INIT
 #              undef _init
index 2b7119e13712e950e00045ff87f4f2ce61c581fc..4846dc19324a6151b774710c395e067f03e9d91a 100644 (file)
@@ -20,6 +20,10 @@ struct ipset_commands {
        const char *help;
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const struct ipset_commands ipset_commands[];
 
 struct ipset_session;
@@ -45,4 +49,8 @@ extern void ipset_shift_argv(int *argc, char *argv[], int from);
 extern void ipset_port_usage(void);
 extern int ipset_parse_file(struct ipset_session *s, int opt, const char *str);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* LIBIPSET_UI_H */