Some laptops return other values for working toucpads. Allow test_aux_port to
[dragonfly.git] / sys / netinet / udp_var.h
1 /*
2  * Copyright (c) 2003-2004 Jeffrey M. Hsu.  All rights reserved.
3  * Copyright (c) 1982, 1986, 1989, 1993
4  *      The Regents of the University of California.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by the University of
17  *      California, Berkeley and its contributors.
18  * 4. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *      @(#)udp_var.h   8.1 (Berkeley) 6/10/93
35  * $FreeBSD: src/sys/netinet/udp_var.h,v 1.22.2.1 2001/02/18 07:12:25 luigi Exp $
36  * $DragonFly: src/sys/netinet/udp_var.h,v 1.11 2004/07/02 04:41:01 hsu Exp $
37  */
38
39 #ifndef _NETINET_UDP_VAR_H_
40 #define _NETINET_UDP_VAR_H_
41
42 /*
43  * UDP kernel structures and variables.
44  */
45 struct  udpiphdr {
46         struct  ipovly ui_i;            /* overlaid ip structure */
47         struct  udphdr ui_u;            /* udp header */
48 };
49 #define ui_x1           ui_i.ih_x1
50 #define ui_pr           ui_i.ih_pr
51 #define ui_len          ui_i.ih_len
52 #define ui_src          ui_i.ih_src
53 #define ui_dst          ui_i.ih_dst
54 #define ui_sport        ui_u.uh_sport
55 #define ui_dport        ui_u.uh_dport
56 #define ui_ulen         ui_u.uh_ulen
57 #define ui_sum          ui_u.uh_sum
58
59 struct  udpstat {
60                                 /* input statistics: */
61         u_long  udps_ipackets;          /* total input packets */
62         u_long  udps_hdrops;            /* packet shorter than header */
63         u_long  udps_badsum;            /* checksum error */
64         u_long  udps_nosum;             /* no checksum */
65         u_long  udps_badlen;            /* data length larger than packet */
66         u_long  udps_noport;            /* no socket on port */
67         u_long  udps_noportbcast;       /* of above, arrived as broadcast */
68         u_long  udps_fullsock;          /* not delivered, input socket full */
69         u_long  udpps_pcbcachemiss;     /* input packets missing pcb cache */
70         u_long  udpps_pcbhashmiss;      /* input packets not for hashed pcb */
71                                 /* output statistics: */
72         u_long  udps_opackets;          /* total output packets */
73         u_long  udps_fastout;           /* output packets on fast path */
74         /* of no socket on port, arrived as multicast */
75         u_long  udps_noportmcast;
76 };
77
78 /*
79  * Names for UDP sysctl objects
80  */
81 #define UDPCTL_CHECKSUM         1       /* checksum UDP packets */
82 #define UDPCTL_STATS            2       /* statistics (read-only) */
83 #define UDPCTL_MAXDGRAM         3       /* max datagram size */
84 #define UDPCTL_RECVSPACE        4       /* default receive buffer space */
85 #define UDPCTL_PCBLIST          5       /* list of PCBs for UDP sockets */
86 #define UDPCTL_MAXID            6
87
88 #define UDPCTL_NAMES { \
89         { 0, 0 }, \
90         { "checksum", CTLTYPE_INT }, \
91         { "stats", CTLTYPE_STRUCT }, \
92         { "maxdgram", CTLTYPE_INT }, \
93         { "recvspace", CTLTYPE_INT }, \
94         { "pcblist", CTLTYPE_STRUCT }, \
95 }
96
97 #ifdef _KERNEL
98 #ifdef SYSCTL_DECL
99 SYSCTL_DECL(_net_inet_udp);
100 #endif
101
102 extern struct   pr_usrreqs udp_usrreqs;
103 extern struct   inpcbinfo udbinfo;
104 extern u_long   udp_sendspace;
105 extern u_long   udp_recvspace;
106 extern struct   udpstat udpstat;
107 extern int      log_in_vain;
108
109 int                     udp_addrcpu (in_addr_t faddr, in_port_t fport,
110                                      in_addr_t laddr, in_port_t lport);
111 void                    udp_ctlinput (int, struct sockaddr *, void *);
112 void                    udp_init (void);
113 void                    udp_thread_init (void);
114 void                    udp_input (struct mbuf *, ...);
115 void                    udp_notify (struct inpcb *inp, int errno);
116 int                     udp_shutdown (struct socket *so);
117 struct lwkt_port        *udp_soport (struct socket *, struct sockaddr *, int);
118
119 #endif
120
121 #endif