From nobody@FreeBSD.org  Tue Nov 29 19:14:02 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2F14106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 29 Nov 2011 19:14:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id B1EA18FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 29 Nov 2011 19:14:02 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pATJE2hX005921
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 29 Nov 2011 19:14:02 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pATJE2s3005905;
	Tue, 29 Nov 2011 19:14:02 GMT
	(envelope-from nobody)
Message-Id: <201111291914.pATJE2s3005905@red.freebsd.org>
Date: Tue, 29 Nov 2011 19:14:02 GMT
From: Emil <the_mix_room@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Problems including netinet/tcp_var.h
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         162952
>Category:       kern
>Synopsis:       [headers] Problems including netinet/tcp_var.h
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 29 19:20:08 UTC 2011
>Closed-Date:    
>Last-Modified:  Thu Dec 01 02:20:58 UTC 2011
>Originator:     Emil
>Release:        8.2-RELEASE
>Organization:
>Environment:
FreeBSD $HOSTNAME.local 8.2-RELEASE FreeBSD 8.2-RELEASE #3: Sat Apr 16 09:20:53 CEST 2011     emil@$HOSTNAME.local:/usr/obj/usr/src/sys/IPSEC  i386

>Description:
When attempting to include netinet/tcp_var.h in a c++ file, the compiler throws a number of errors. 

"In file included from INPUT.cpp:1:
/usr/include/netinet/tcp_var.h:51: error: expected ';' before 'tqe_q'
/usr/include/netinet/tcp_var.h:56: error: expected constructor, destructor, or type conversion before '(' token
/usr/include/netinet/tcp_var.h:67: error: expected ';' before 'scblink'
/usr/include/netinet/tcp_var.h:102: error: field 't_segq' has incomplete type
/usr/include/netinet/tcp_var.h:184: error: 'sackhole_head' has not been declared
/usr/include/netinet/tcp_var.h:184: error: expected ';' before 'snd_holes'
/usr/include/netinet/tcp_var.h:318: error: expected ';' before 'tw_2msl'"

I am assuming that I am missing an include, as such I have filed this as a documentation bug. 
>How-To-Repeat:
execute "c++ INPUT" 

INPUT.cpp

1 #include <netinet/tcp_var.h>
2
3 using namespace std;
4
5 int main() {
6             return 0;
7 }

>Fix:


>Release-Note:
>Audit-Trail:

From: Bruce Evans <brde@optusnet.com.au>
To: Emil <the_mix_room@hotmail.com>
Cc: freebsd-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject: Re: misc/162952: Problems including netinet/tcp_var.h
Date: Wed, 30 Nov 2011 16:41:32 +1100 (EST)

 > 1 #include <netinet/tcp_var.h>
 
 Most networking headers have _many_ undocumented prerequisites.
 tcp_var.h itself is is not really documented, so you just have to know
 what its prerequisites are and shouldn't expect it to work for C++.
 You have to be a networking person or use trial and error to know the
 prerequisites.  (In 2004, tcp_var.h was not mentioned in any man page.
 Now it is mentioned in siftr.4 and hhook.9, and these references are
 only usable for human readers of tcp_var.h.  hhook.9 has a synopsis
 that can't possibly work due to missing prerequisites for the 1 header
 that it satisifies, despite massive pollution internal to this header.)
 
 When I stopped policing prerequisites in 1999, minimal prerequisites
 for <netinet/tcp_var.h> were
 
  	#include <sys/types.h>
  	#include <netinet/in.h>
  	#include <netinet/in_systm.h>
  	#include <netinet/ip_var.h>
  	#include <netinet/tcp.h>
 
 in that order.  These were found by trial and error (many trials and
 many errors for each file tested.  The trials included complete tests
 of subsets to find a minimum that worked for a range of compilers and
 compiler options, and incomplete tests of ordering).  These still work,
 at least with gcc and normal compiler options.  They happen to work
 for C++ too.
 
 Bruce
>Unformatted:
