00001 /* 00002 * Copyright (c) 1982, 1986, 1989, 1993 00003 * The Regents of the University of California. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 3. All advertising materials mentioning features or use of this software 00014 * must display the following acknowledgement: 00015 * This product includes software developed by the University of 00016 * California, Berkeley and its contributors. 00017 * 4. Neither the name of the University nor the names of its contributors 00018 * may be used to endorse or promote products derived from this software 00019 * without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00024 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00025 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00026 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00027 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00028 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00029 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00030 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 * 00033 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 00034 */ 00035 00036 /* 00037 * UDP kernel structures and variables. 00038 */ 00039 struct udpiphdr { 00040 struct ipovly ui_i; /* overlaid ip structure */ 00041 struct udphdr ui_u; /* udp header */ 00042 }; 00043 #define ui_next ui_i.ih_next 00044 #define ui_prev ui_i.ih_prev 00045 #define ui_x1 ui_i.ih_x1 00046 #define ui_pr ui_i.ih_pr 00047 #define ui_len ui_i.ih_len 00048 #define ui_src ui_i.ih_src 00049 #define ui_dst ui_i.ih_dst 00050 #define ui_sport ui_u.uh_sport 00051 #define ui_dport ui_u.uh_dport 00052 #define ui_ulen ui_u.uh_ulen 00053 #define ui_sum ui_u.uh_sum 00054 00055 struct udpstat { 00056 /* input statistics: */ 00057 n_long udps_ipackets; /* total input packets */ 00058 n_long udps_hdrops; /* packet shorter than header */ 00059 n_long udps_badsum; /* checksum error */ 00060 n_long udps_badlen; /* data length larger than packet */ 00061 n_long udps_noport; /* no socket on port */ 00062 n_long udps_noportbcast; /* of above, arrived as broadcast */ 00063 n_long udps_fullsock; /* not delivered, input socket full */ 00064 n_long udpps_pcbcachemiss; /* input packets missing pcb cache */ 00065 /* output statistics: */ 00066 n_long udps_opackets; /* total output packets */ 00067 }; 00068 00069 /* 00070 * Names for UDP sysctl objects 00071 */ 00072 #define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ 00073 #define UDPCTL_MAXID 2 00074 00075 #define UDPCTL_NAMES { \ 00076 { 0, 0 }, \ 00077 { "checksum", CTLTYPE_INT }, \ 00078 } 00079 00080 #ifdef KERNEL 00081 struct inpcb udb; 00082 struct udpstat udpstat; 00083 00084 void udp_ctlinput __P((int, struct sockaddr *, struct ip *)); 00085 void udp_init __P((void)); 00086 void udp_input __P((struct mbuf *, int)); 00087 int udp_output __P((struct inpcb *, 00088 struct mbuf *, struct mbuf *, struct mbuf *)); 00089 int udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); 00090 int udp_usrreq __P((struct socket *, 00091 int, struct mbuf *, struct mbuf *, struct mbuf *)); 00092 #endif