Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Jesper Juhl | 02c30a8 | 2005-05-05 16:16:16 -0700 | [diff] [blame] | 10 | * Authors: Ross Biro |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <linux/list.h> |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 26 | #include <net/inet_sock.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <net/sock.h> |
| 28 | #include <net/snmp.h> |
| 29 | #include <linux/seq_file.h> |
| 30 | |
| 31 | #define UDP_HTABLE_SIZE 128 |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
| 34 | extern rwlock_t udp_hash_lock; |
| 35 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | /* Note: this must match 'valbool' in sock_setsockopt */ |
| 38 | #define UDP_CSUM_NOXMIT 1 |
| 39 | |
| 40 | /* Used by SunRPC/xprt layer. */ |
| 41 | #define UDP_CSUM_NORCV 2 |
| 42 | |
| 43 | /* Default, as per the RFC, is to always do csums. */ |
| 44 | #define UDP_CSUM_DEFAULT 0 |
| 45 | |
| 46 | extern struct proto udp_prot; |
| 47 | |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 48 | struct sk_buff; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Gerrit Renker | 25030a7 | 2006-08-26 20:06:05 -0700 | [diff] [blame] | 50 | extern int udp_get_port(struct sock *sk, unsigned short snum, |
David S. Miller | e3b4ead | 2006-08-26 20:10:15 -0700 | [diff] [blame] | 51 | int (*saddr_cmp)(const struct sock *, const struct sock *)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | extern void udp_err(struct sk_buff *, u32); |
| 53 | |
| 54 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, |
| 55 | struct msghdr *msg, size_t len); |
| 56 | |
| 57 | extern int udp_rcv(struct sk_buff *skb); |
| 58 | extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
| 59 | extern int udp_disconnect(struct sock *sk, int flags); |
| 60 | extern unsigned int udp_poll(struct file *file, struct socket *sock, |
| 61 | poll_table *wait); |
| 62 | |
| 63 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); |
| 64 | #define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field) |
| 65 | #define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field) |
| 66 | #define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field) |
| 67 | |
| 68 | /* /proc */ |
| 69 | struct udp_seq_afinfo { |
| 70 | struct module *owner; |
| 71 | char *name; |
| 72 | sa_family_t family; |
| 73 | int (*seq_show) (struct seq_file *m, void *v); |
| 74 | struct file_operations *seq_fops; |
| 75 | }; |
| 76 | |
| 77 | struct udp_iter_state { |
| 78 | sa_family_t family; |
| 79 | int bucket; |
| 80 | struct seq_operations seq_ops; |
| 81 | }; |
| 82 | |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 83 | #ifdef CONFIG_PROC_FS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | extern int udp_proc_register(struct udp_seq_afinfo *afinfo); |
| 85 | extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 86 | |
| 87 | extern int udp4_proc_init(void); |
| 88 | extern void udp4_proc_exit(void); |
| 89 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | #endif /* _UDP_H */ |