aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/udp.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/net/udp.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/net/udp.h')
-rw-r--r--include/net/udp.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/include/net/udp.h b/include/net/udp.h
new file mode 100644
index 000000000000..c496d10101db
--- /dev/null
+++ b/include/net/udp.h
@@ -0,0 +1,99 @@
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.
5 *
6 * Definitions for the UDP module.
7 *
8 * Version: @(#)udp.h 1.0.2 05/07/93
9 *
10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Fixes:
14 * Alan Cox : Turned on udp checksums. I don't want to
15 * chase 'memory corruption' bugs that aren't!
16 *
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.
21 */
22#ifndef _UDP_H
23#define _UDP_H
24
25#include <linux/udp.h>
26#include <linux/ip.h>
27#include <linux/list.h>
28#include <net/sock.h>
29#include <net/snmp.h>
30#include <linux/seq_file.h>
31
32#define UDP_HTABLE_SIZE 128
33
34/* udp.c: This needs to be shared by v4 and v6 because the lookup
35 * and hashing code needs to work with different AF's yet
36 * the port space is shared.
37 */
38extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
39extern rwlock_t udp_hash_lock;
40
41extern int udp_port_rover;
42
43static inline int udp_lport_inuse(u16 num)
44{
45 struct sock *sk;
46 struct hlist_node *node;
47
48 sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)])
49 if (inet_sk(sk)->num == num)
50 return 1;
51 return 0;
52}
53
54/* Note: this must match 'valbool' in sock_setsockopt */
55#define UDP_CSUM_NOXMIT 1
56
57/* Used by SunRPC/xprt layer. */
58#define UDP_CSUM_NORCV 2
59
60/* Default, as per the RFC, is to always do csums. */
61#define UDP_CSUM_DEFAULT 0
62
63extern struct proto udp_prot;
64
65
66extern void udp_err(struct sk_buff *, u32);
67
68extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
69 struct msghdr *msg, size_t len);
70
71extern int udp_rcv(struct sk_buff *skb);
72extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
73extern int udp_disconnect(struct sock *sk, int flags);
74extern unsigned int udp_poll(struct file *file, struct socket *sock,
75 poll_table *wait);
76
77DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
78#define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field)
79#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field)
80#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field)
81
82/* /proc */
83struct udp_seq_afinfo {
84 struct module *owner;
85 char *name;
86 sa_family_t family;
87 int (*seq_show) (struct seq_file *m, void *v);
88 struct file_operations *seq_fops;
89};
90
91struct udp_iter_state {
92 sa_family_t family;
93 int bucket;
94 struct seq_operations seq_ops;
95};
96
97extern int udp_proc_register(struct udp_seq_afinfo *afinfo);
98extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo);
99#endif /* _UDP_H */