All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libnetfilter_conntrack: add extern C's to public headers
@ 2007-03-20  6:07 Phil Dibowitz
  2007-03-29  5:55 ` Phil Dibowitz
  2007-03-29 22:05 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 6+ messages in thread
From: Phil Dibowitz @ 2007-03-20  6:07 UTC (permalink / raw)
  To: netfilter-devel


[-- Attachment #1.1: Type: text/plain, Size: 742 bytes --]

The attached patch adds:

  extern "C" {...}

to all of the public headers in libnetfilter_conntrack's public headers. It
is, of course, #ifdef __cplusplus'd.

This will make it more straight forward for C++ developers to use
libnetfilter_conntrack in their applications.

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: libnetfilter_conntrack-0.0.50_extern_c.patch --]
[-- Type: text/x-patch; name="libnetfilter_conntrack-0.0.50_extern_c.patch", Size: 5072 bytes --]

--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack.h.orig	2007-03-19 22:44:24.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack.h	2007-03-19 23:04:09.000000000 -0700
@@ -13,6 +13,10 @@
 #include <libnfnetlink/libnfnetlink.h>
 #include <libnetfilter_conntrack/linux_nfnetlink_conntrack.h> 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum {
 	CONNTRACK = NFNL_SUBSYS_CTNETLINK,
 	EXPECT = NFNL_SUBSYS_CTNETLINK_EXP
@@ -549,4 +553,8 @@
 			    void *req,
 			    unsigned int size);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif	/* _LIBNETFILTER_CONNTRACK_H_ */
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_icmp.h.orig	2007-03-19 22:47:42.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_icmp.h	2007-03-19 22:48:06.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_ICMP_H_
 #define _LIBNETFILTER_CONNTRACK_ICMP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum icmp_flags {
 	ICMP_TYPE_BIT = 0,
 	ICMP_TYPE = (1 << ICMP_TYPE_BIT),
@@ -19,4 +23,8 @@
 	ICMP_ID = (1 << ICMP_ID_BIT)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_ipv4.h.orig	2007-03-19 22:48:16.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_ipv4.h	2007-03-19 22:49:51.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_IPV4_H_
 #define _LIBNETFILTER_CONNTRACK_IPV4_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum ipv4_flags {
 	IPV4_ORIG_SRC_BIT = 0,
 	IPV4_ORIG_SRC = (1 << IPV4_ORIG_SRC_BIT),
@@ -26,4 +30,8 @@
 	IPV4_REPL = (IPV4_REPL_SRC | IPV4_REPL_DST)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_ipv6.h.orig	2007-03-19 22:49:57.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_ipv6.h	2007-03-19 22:50:44.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_IPV6_H_
 #define _LIBNETFILTER_CONNTRACK_IPV6_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum ipv6_flags {
 	IPV6_ORIG_SRC_BIT = 0,
 	IPV6_ORIG_SRC = (1 << IPV6_ORIG_SRC_BIT),
@@ -26,4 +30,8 @@
 	IPV6_REPL = (IPV6_REPL_SRC | IPV6_REPL_DST)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_sctp.h.orig	2007-03-19 22:50:52.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_sctp.h	2007-03-19 22:51:28.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_SCTP_H_
 #define _LIBNETFILTER_CONNTRACK_SCTP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum sctp_flags {
 	SCTP_ORIG_SPORT_BIT = 0,
 	SCTP_ORIG_SPORT = (1 << SCTP_ORIG_SPORT_BIT),
@@ -37,4 +41,8 @@
 	SCTP_EXPTUPLE_DPORT = (1 << SCTP_EXPTUPLE_DPORT_BIT)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_tcp.h.orig	2007-03-19 22:51:33.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_tcp.h	2007-03-19 22:52:08.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_TCP_H_
 #define _LIBNETFILTER_CONNTRACK_TCP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum tcp_state {
 	TCP_CONNTRACK_NONE,
 	TCP_CONNTRACK_SYN_SENT,
@@ -52,4 +56,8 @@
 	TCP_EXPTUPLE_DPORT = (1 << TCP_EXPTUPLE_DPORT_BIT)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_udp.h.orig	2007-03-19 22:52:15.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/libnetfilter_conntrack_udp.h	2007-03-19 22:52:51.000000000 -0700
@@ -8,6 +8,10 @@
 #ifndef _LIBNETFILTER_CONNTRACK_UDP_H_
 #define _LIBNETFILTER_CONNTRACK_UDP_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum udp_flags {
 	UDP_ORIG_SPORT_BIT = 0,
 	UDP_ORIG_SPORT = (1 << UDP_ORIG_SPORT_BIT),
@@ -34,4 +38,8 @@
 	UDP_EXPTUPLE_DPORT = (1 << UDP_EXPTUPLE_DPORT_BIT)
 };
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
--- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h.orig	2007-03-19 22:53:08.000000000 -0700
+++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h	2007-03-19 22:53:30.000000000 -0700
@@ -2,6 +2,10 @@
 #define _IPCONNTRACK_NETLINK_H
 #include <libnfnetlink/linux_nfnetlink.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum cntl_msg_types {
 	IPCTNL_MSG_CT_NEW,
 	IPCTNL_MSG_CT_GET,
@@ -134,4 +138,8 @@
 };
 #define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _IPCONNTRACK_NETLINK_H */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] libnetfilter_conntrack: add extern C's to public headers
  2007-03-20  6:07 [PATCH] libnetfilter_conntrack: add extern C's to public headers Phil Dibowitz
@ 2007-03-29  5:55 ` Phil Dibowitz
  2007-03-29 22:05 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 6+ messages in thread
From: Phil Dibowitz @ 2007-03-29  5:55 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

Phil Dibowitz wrote:
> The attached patch adds:
> 
>   extern "C" {...}
> 
> to all of the public headers in libnetfilter_conntrack's public headers. It
> is, of course, #ifdef __cplusplus'd.
> 
> This will make it more straight forward for C++ developers to use
> libnetfilter_conntrack in their applications.

I never saw a response to this patch... I was wondering if there was an
objection to it, or if it got accepted, or forgotten, or...?

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] libnetfilter_conntrack: add extern C's to public headers
  2007-03-20  6:07 [PATCH] libnetfilter_conntrack: add extern C's to public headers Phil Dibowitz
  2007-03-29  5:55 ` Phil Dibowitz
@ 2007-03-29 22:05 ` Pablo Neira Ayuso
  2007-03-29 22:12   ` Phil Dibowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2007-03-29 22:05 UTC (permalink / raw)
  To: Phil Dibowitz; +Cc: netfilter-devel

Sorry for the late reply.

Phil Dibowitz wrote:
> --- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h.orig	2007-03-19 22:53:08.000000000 -0700
> +++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h	2007-03-19 22:53:30.000000000 -0700
> @@ -2,6 +2,10 @@
>  #define _IPCONNTRACK_NETLINK_H
>  #include <libnfnetlink/linux_nfnetlink.h>
>  
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +

Do you really need to include the extern "C" in linux_nfnetlink_conntrack.h?

-- 
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] libnetfilter_conntrack: add extern C's to public headers
  2007-03-29 22:05 ` Pablo Neira Ayuso
@ 2007-03-29 22:12   ` Phil Dibowitz
  2007-03-29 22:35     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Dibowitz @ 2007-03-29 22:12 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

On Fri, Mar 30, 2007 at 12:05:34AM +0200, Pablo Neira Ayuso wrote:
> Sorry for the late reply.
> 
> Phil Dibowitz wrote:
> > --- libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h.orig	2007-03-19 22:53:08.000000000 -0700
> > +++ libnetfilter_conntrack-0.0.50/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h	2007-03-19 22:53:30.000000000 -0700
> > @@ -2,6 +2,10 @@
> >  #define _IPCONNTRACK_NETLINK_H
> >  #include <libnfnetlink/linux_nfnetlink.h>
> >  
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> 
> Do you really need to include the extern "C" in linux_nfnetlink_conntrack.h?

I believe so, yes. The alternative is to put it around the #include of
linux_nfnetlink_conntrack.h inside of libnetfilter_conntrack.h, but that isn't
as clean and prevents anyone from using it directly. Anything in /usr/include
is fair game for using in an #include, and thus should be extern-C-safe.

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] libnetfilter_conntrack: add extern C's to public headers
  2007-03-29 22:12   ` Phil Dibowitz
@ 2007-03-29 22:35     ` Pablo Neira Ayuso
  2007-03-29 23:11       ` Phil Dibowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2007-03-29 22:35 UTC (permalink / raw)
  To: Phil Dibowitz; +Cc: netfilter-devel

Phil Dibowitz wrote:
> On Fri, Mar 30, 2007 at 12:05:34AM +0200, Pablo Neira Ayuso wrote:
>> Do you really need to include the extern "C" in linux_nfnetlink_conntrack.h?
> 
> I believe so, yes. The alternative is to put it around the #include of
> linux_nfnetlink_conntrack.h inside of libnetfilter_conntrack.h, but that isn't
> as clean and prevents anyone from using it directly. Anything in /usr/include
> is fair game for using in an #include, and thus should be extern-C-safe.

Applied. Thanks Phil.

BTW, got no reply on my suggestion about your project name. Thoughts?

-- 
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] libnetfilter_conntrack: add extern C's to public headers
  2007-03-29 22:35     ` Pablo Neira Ayuso
@ 2007-03-29 23:11       ` Phil Dibowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Phil Dibowitz @ 2007-03-29 23:11 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

On Fri, Mar 30, 2007 at 12:35:49AM +0200, Pablo Neira Ayuso wrote:
> Phil Dibowitz wrote:
> > On Fri, Mar 30, 2007 at 12:05:34AM +0200, Pablo Neira Ayuso wrote:
> >> Do you really need to include the extern "C" in linux_nfnetlink_conntrack.h?
> > 
> > I believe so, yes. The alternative is to put it around the #include of
> > linux_nfnetlink_conntrack.h inside of libnetfilter_conntrack.h, but that isn't
> > as clean and prevents anyone from using it directly. Anything in /usr/include
> > is fair game for using in an #include, and thus should be extern-C-safe.
> 
> Applied. Thanks Phil.
> 
> BTW, got no reply on my suggestion about your project name. Thoughts?

While I understand the point you were making, my project has been around for
years - I'm not renaming it. That'll cause more confusion than anything else,
IMO. It's in all major distros and many people are well acquanted with what
the software is and is not...

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-29 23:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20  6:07 [PATCH] libnetfilter_conntrack: add extern C's to public headers Phil Dibowitz
2007-03-29  5:55 ` Phil Dibowitz
2007-03-29 22:05 ` Pablo Neira Ayuso
2007-03-29 22:12   ` Phil Dibowitz
2007-03-29 22:35     ` Pablo Neira Ayuso
2007-03-29 23:11       ` Phil Dibowitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.