* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / net / udp.h
blobe082a4a9b29ce1d304aad54b2e6eaf270c273b83
1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Definitions for the UDP module.
8 * Version: @(#)udp.h 1.0.2 05/07/93
10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
13 * Fixes:
14 * Alan Cox : Turned on udp checksums. I don't want to
15 * chase 'memory corruption' bugs that aren't!
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
22 #ifndef _UDP_H
23 #define _UDP_H
25 #include <linux/udp.h>
26 #include <net/sock.h>
28 #define UDP_HTABLE_SIZE 128
30 /* udp.c: This needs to be shared by v4 and v6 because the lookup
31 * and hashing code needs to work with different AF's yet
32 * the port space is shared.
34 extern struct sock *udp_hash[UDP_HTABLE_SIZE];
35 extern rwlock_t udp_hash_lock;
37 extern int udp_port_rover;
39 static inline int udp_lport_inuse(u16 num)
41 struct sock *sk = udp_hash[num & (UDP_HTABLE_SIZE - 1)];
43 for(; sk != NULL; sk = sk->next) {
44 if(sk->num == num)
45 return 1;
47 return 0;
50 /* Note: this must match 'valbool' in sock_setsockopt */
51 #define UDP_CSUM_NOXMIT 1
53 /* Used by SunRPC/xprt layer. */
54 #define UDP_CSUM_NORCV 2
56 /* Default, as per the RFC, is to always do csums. */
57 #define UDP_CSUM_DEFAULT 0
59 extern struct proto udp_prot;
62 extern void udp_err(struct sk_buff *, unsigned char *, int);
63 extern int udp_connect(struct sock *sk,
64 struct sockaddr *usin, int addr_len);
66 extern int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len);
68 extern int udp_rcv(struct sk_buff *skb, unsigned short len);
69 extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
70 extern int udp_disconnect(struct sock *sk, int flags);
72 #endif /* _UDP_H */