1 |
27 |
unneback |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/netinet/udp_var.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
//####BSDCOPYRIGHTBEGIN####
|
9 |
|
|
//
|
10 |
|
|
// -------------------------------------------
|
11 |
|
|
//
|
12 |
|
|
// Portions of this software may have been derived from OpenBSD or other sources,
|
13 |
|
|
// and are covered by the appropriate copyright disclaimers included herein.
|
14 |
|
|
//
|
15 |
|
|
// -------------------------------------------
|
16 |
|
|
//
|
17 |
|
|
//####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
//#####DESCRIPTIONBEGIN####
|
20 |
|
|
//
|
21 |
|
|
// Author(s): gthomas
|
22 |
|
|
// Contributors: gthomas
|
23 |
|
|
// Date: 2000-01-10
|
24 |
|
|
// Purpose:
|
25 |
|
|
// Description:
|
26 |
|
|
//
|
27 |
|
|
//
|
28 |
|
|
//####DESCRIPTIONEND####
|
29 |
|
|
//
|
30 |
|
|
//==========================================================================
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/* $OpenBSD: udp_var.h,v 1.9 1999/12/08 06:50:20 itojun Exp $ */
|
34 |
|
|
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
|
35 |
|
|
|
36 |
|
|
/*
|
37 |
|
|
* Copyright (c) 1982, 1986, 1989, 1993
|
38 |
|
|
* The Regents of the University of California. All rights reserved.
|
39 |
|
|
*
|
40 |
|
|
* Redistribution and use in source and binary forms, with or without
|
41 |
|
|
* modification, are permitted provided that the following conditions
|
42 |
|
|
* are met:
|
43 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
44 |
|
|
* notice, this list of conditions and the following disclaimer.
|
45 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
46 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
47 |
|
|
* documentation and/or other materials provided with the distribution.
|
48 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
49 |
|
|
* must display the following acknowledgement:
|
50 |
|
|
* This product includes software developed by the University of
|
51 |
|
|
* California, Berkeley and its contributors.
|
52 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
53 |
|
|
* may be used to endorse or promote products derived from this software
|
54 |
|
|
* without specific prior written permission.
|
55 |
|
|
*
|
56 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
57 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
58 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
59 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
60 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
61 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
62 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
63 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
64 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
65 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
66 |
|
|
* SUCH DAMAGE.
|
67 |
|
|
*
|
68 |
|
|
* @(#)udp_var.h 8.1 (Berkeley) 6/10/93
|
69 |
|
|
*/
|
70 |
|
|
|
71 |
|
|
#ifndef _NETINET_UDP_VAR_H_
|
72 |
|
|
#define _NETINET_UDP_VAR_H_
|
73 |
|
|
|
74 |
|
|
/*
|
75 |
|
|
* UDP kernel structures and variables.
|
76 |
|
|
*/
|
77 |
|
|
struct udpiphdr {
|
78 |
|
|
/* overlaid ip structure */
|
79 |
|
|
struct ipovly ui_i __attribute__ ((aligned(1), packed));
|
80 |
|
|
struct udphdr ui_u; /* udp header */
|
81 |
|
|
};
|
82 |
|
|
#define ui_x1 ui_i.ih_x1
|
83 |
|
|
#define ui_pr ui_i.ih_pr
|
84 |
|
|
#define ui_len ui_i.ih_len
|
85 |
|
|
#define ui_src ui_i.ih_src
|
86 |
|
|
#define ui_dst ui_i.ih_dst
|
87 |
|
|
#define ui_sport ui_u.uh_sport
|
88 |
|
|
#define ui_dport ui_u.uh_dport
|
89 |
|
|
#define ui_ulen ui_u.uh_ulen
|
90 |
|
|
#define ui_sum ui_u.uh_sum
|
91 |
|
|
|
92 |
|
|
struct udpstat {
|
93 |
|
|
/* input statistics: */
|
94 |
|
|
u_long udps_ipackets; /* total input packets */
|
95 |
|
|
u_long udps_hdrops; /* packet shorter than header */
|
96 |
|
|
u_long udps_badsum; /* checksum error */
|
97 |
|
|
u_long udps_nosum; /* no checksum */
|
98 |
|
|
u_long udps_badlen; /* data length larger than packet */
|
99 |
|
|
u_long udps_noport; /* no socket on port */
|
100 |
|
|
u_long udps_noportbcast; /* of above, arrived as broadcast */
|
101 |
|
|
u_long udps_nosec; /* dropped for lack of ipsec */
|
102 |
|
|
u_long udps_fullsock; /* not delivered, input socket full */
|
103 |
|
|
u_long udps_pcbhashmiss; /* input packets missing pcb hash */
|
104 |
|
|
/* output statistics: */
|
105 |
|
|
u_long udps_opackets; /* total output packets */
|
106 |
|
|
};
|
107 |
|
|
|
108 |
|
|
/*
|
109 |
|
|
* Names for UDP sysctl objects
|
110 |
|
|
*/
|
111 |
|
|
#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
|
112 |
|
|
#define UDPCTL_BADDYNAMIC 2 /* return bad dynamic port bitmap */
|
113 |
|
|
#define UDPCTL_RECVSPACE 3 /* receive buffer space */
|
114 |
|
|
#define UDPCTL_SENDSPACE 4 /* send buffer space */
|
115 |
|
|
#define UDPCTL_MAXID 5
|
116 |
|
|
|
117 |
|
|
#define UDPCTL_NAMES { \
|
118 |
|
|
{ 0, 0 }, \
|
119 |
|
|
{ "checksum", CTLTYPE_INT }, \
|
120 |
|
|
{ "baddynamic", CTLTYPE_STRUCT }, \
|
121 |
|
|
{ "recvspace", CTLTYPE_INT }, \
|
122 |
|
|
{ "sendspace", CTLTYPE_INT }, \
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
#ifdef _KERNEL
|
126 |
|
|
struct inpcbtable udbtable;
|
127 |
|
|
struct udpstat udpstat;
|
128 |
|
|
|
129 |
|
|
#if defined(INET6) && !defined(TCP6)
|
130 |
|
|
void udp6_ctlinput __P((int, struct sockaddr *, void *));
|
131 |
|
|
int udp6_input __P((struct mbuf **, int *, int));
|
132 |
|
|
int udp6_usrreq __P((struct socket *,
|
133 |
|
|
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
|
134 |
|
|
#endif
|
135 |
|
|
void *udp_ctlinput __P((int, struct sockaddr *, void *));
|
136 |
|
|
void udp_init __P((void));
|
137 |
|
|
void udp_input __P((struct mbuf *, ...));
|
138 |
|
|
int udp_output __P((struct mbuf *, ...));
|
139 |
|
|
int udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
|
140 |
|
|
int udp_usrreq __P((struct socket *,
|
141 |
|
|
int, struct mbuf *, struct mbuf *, struct mbuf *));
|
142 |
|
|
#endif
|
143 |
|
|
|
144 |
|
|
#endif // _NETINET_UDP_VAR_H_
|