xref: /original-bsd/sys/netinet/udp_var.h (revision e46fd6c1)
1 /*
2  * Copyright (c) 1982, 1986, 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)udp_var.h	8.1 (Berkeley) 06/10/93
8  */
9 
10 /*
11  * UDP kernel structures and variables.
12  */
13 struct	udpiphdr {
14 	struct 	ipovly ui_i;		/* overlaid ip structure */
15 	struct	udphdr ui_u;		/* udp header */
16 };
17 #define	ui_next		ui_i.ih_next
18 #define	ui_prev		ui_i.ih_prev
19 #define	ui_x1		ui_i.ih_x1
20 #define	ui_pr		ui_i.ih_pr
21 #define	ui_len		ui_i.ih_len
22 #define	ui_src		ui_i.ih_src
23 #define	ui_dst		ui_i.ih_dst
24 #define	ui_sport	ui_u.uh_sport
25 #define	ui_dport	ui_u.uh_dport
26 #define	ui_ulen		ui_u.uh_ulen
27 #define	ui_sum		ui_u.uh_sum
28 
29 struct	udpstat {
30 				/* input statistics: */
31 	u_long	udps_ipackets;		/* total input packets */
32 	u_long	udps_hdrops;		/* packet shorter than header */
33 	u_long	udps_badsum;		/* checksum error */
34 	u_long	udps_badlen;		/* data length larger than packet */
35 	u_long	udps_noport;		/* no socket on port */
36 	u_long	udps_noportbcast;	/* of above, arrived as broadcast */
37 	u_long	udps_fullsock;		/* not delivered, input socket full */
38 	u_long	udpps_pcbcachemiss;	/* input packets missing pcb cache */
39 				/* output statistics: */
40 	u_long	udps_opackets;		/* total output packets */
41 };
42 
43 /*
44  * Names for UDP sysctl objects
45  */
46 #define	UDPCTL_CHECKSUM		1	/* checksum UDP packets */
47 #define UDPCTL_MAXID		2
48 
49 #define UDPCTL_NAMES { \
50 	{ 0, 0 }, \
51 	{ "checksum", CTLTYPE_INT }, \
52 }
53 
54 #ifdef KERNEL
55 struct	inpcb udb;
56 struct	udpstat udpstat;
57 
58 void	 udp_ctlinput __P((int, struct sockaddr *, struct ip *));
59 void	 udp_init __P((void));
60 void	 udp_input __P((struct mbuf *, int));
61 int	 udp_output __P((struct inpcb *,
62 	    struct mbuf *, struct mbuf *, struct mbuf *));
63 int	 udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
64 int	 udp_usrreq __P((struct socket *,
65 	    int, struct mbuf *, struct mbuf *, struct mbuf *));
66 #endif
67