VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/udp.h@ 95573

Last change on this file since 95573 was 95573, checked in by vboxsync, 2 years ago

Network/slirp: Advertising clause for Danny Gasparovsky was unintentional, should have always been 3-clause BSD. Replace 4-clause BSD license by 3-clause, see retroactive license change by UC Berkeley https://www.freebsd.org/copyright/license/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: udp.h 95573 2022-07-08 18:16:35Z vboxsync $ */
2/** @file
3 * NAT - UDP protocol (declarations/defines).
4 */
5
6/*
7 * Copyright (C) 2006-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*
20 * This code is based on:
21 *
22 * Copyright (c) 1982, 1986, 1993
23 * The Regents of the University of California. All rights reserved.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 * 1. Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 * 2. Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the distribution.
33 * 3. Neither the name of the University nor the names of its contributors
34 * may be used to endorse or promote products derived from this software
35 * without specific prior written permission.
36 *
37 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
38 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * @(#)udp.h 8.1 (Berkeley) 6/10/93
50 * udp.h,v 1.3 1994/08/21 05:27:41 paul Exp
51 */
52
53#ifndef _UDP_H_
54#define _UDP_H_
55
56#define UDP_TTL 0x60
57#define UDP_UDPDATALEN 16192
58
59extern struct socket *udp_last_so;
60
61/*
62 * Udp protocol header.
63 * Per RFC 768, September, 1981.
64 */
65struct udphdr
66{
67 uint16_t uh_sport; /* source port */
68 uint16_t uh_dport; /* destination port */
69 int16_t uh_ulen; /* udp length */
70 uint16_t uh_sum; /* udp checksum */
71};
72AssertCompileSize(struct udphdr, 8);
73
74/*
75 * UDP kernel structures and variables.
76 */
77struct udpiphdr
78{
79 struct ipovly ui_i; /* overlaid ip structure */
80 struct udphdr ui_u; /* udp header */
81};
82AssertCompileSize(struct udpiphdr, 28);
83#define ui_next ui_i.ih_next
84#define ui_prev ui_i.ih_prev
85#define ui_x1 ui_i.ih_x1
86#define ui_pr ui_i.ih_pr
87#define ui_len ui_i.ih_len
88#define ui_src ui_i.ih_src
89#define ui_dst ui_i.ih_dst
90#define ui_sport ui_u.uh_sport
91#define ui_dport ui_u.uh_dport
92#define ui_ulen ui_u.uh_ulen
93#define ui_sum ui_u.uh_sum
94
95struct udpstat_t
96{
97 /* input statistics: */
98 u_long udps_ipackets; /* total input packets */
99 u_long udps_hdrops; /* packet shorter than header */
100 u_long udps_badsum; /* checksum error */
101 u_long udps_badlen; /* data length larger than packet */
102 u_long udps_noport; /* no socket on port */
103 u_long udps_noportbcast; /* of above, arrived as broadcast */
104 u_long udps_fullsock; /* not delivered, input socket full */
105 u_long udpps_pcbcachemiss; /* input packets missing pcb cache */
106 /* output statistics: */
107 u_long udps_opackets; /* total output packets */
108};
109
110/*
111 * Names for UDP sysctl objects
112 */
113#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
114#define UDPCTL_MAXID 2
115
116extern struct udpstat udpstat;
117extern struct socket udb;
118struct mbuf;
119
120void udp_init (PNATState);
121void udp_input (PNATState, register struct mbuf *, int);
122int udp_output (PNATState, struct socket *, struct mbuf *, struct sockaddr_in *);
123int udp_attach (PNATState, struct socket *);
124void udp_detach (PNATState, struct socket *);
125u_int8_t udp_tos (struct socket *);
126void udp_emu (PNATState, struct socket *, struct mbuf *);
127struct socket * udp_listen (PNATState, u_int32_t, u_int, u_int32_t, u_int, int);
128int udp_output2(PNATState pData, struct socket *so, struct mbuf *m,
129 struct sockaddr_in *saddr, struct sockaddr_in *daddr,
130 int iptos);
131
132#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette