udp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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
  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. #include <linux/list.h>
  25. #include <net/inet_sock.h>
  26. #include <net/sock.h>
  27. #include <net/snmp.h>
  28. #include <linux/seq_file.h>
  29. #define UDP_HTABLE_SIZE 128
  30. extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
  31. extern rwlock_t udp_hash_lock;
  32. /* Note: this must match 'valbool' in sock_setsockopt */
  33. #define UDP_CSUM_NOXMIT 1
  34. /* Used by SunRPC/xprt layer. */
  35. #define UDP_CSUM_NORCV 2
  36. /* Default, as per the RFC, is to always do csums. */
  37. #define UDP_CSUM_DEFAULT 0
  38. extern struct proto udp_prot;
  39. struct sk_buff;
  40. extern int udp_get_port(struct sock *sk, unsigned short snum,
  41. int (*saddr_cmp)(const struct sock *, const struct sock *));
  42. extern void udp_err(struct sk_buff *, u32);
  43. extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
  44. struct msghdr *msg, size_t len);
  45. extern int udp_rcv(struct sk_buff *skb);
  46. extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
  47. extern int udp_disconnect(struct sock *sk, int flags);
  48. extern unsigned int udp_poll(struct file *file, struct socket *sock,
  49. poll_table *wait);
  50. DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
  51. #define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field)
  52. #define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field)
  53. #define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field)
  54. /* /proc */
  55. struct udp_seq_afinfo {
  56. struct module *owner;
  57. char *name;
  58. sa_family_t family;
  59. int (*seq_show) (struct seq_file *m, void *v);
  60. struct file_operations *seq_fops;
  61. };
  62. struct udp_iter_state {
  63. sa_family_t family;
  64. int bucket;
  65. struct seq_operations seq_ops;
  66. };
  67. #ifdef CONFIG_PROC_FS
  68. extern int udp_proc_register(struct udp_seq_afinfo *afinfo);
  69. extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo);
  70. extern int udp4_proc_init(void);
  71. extern void udp4_proc_exit(void);
  72. #endif
  73. #endif /* _UDP_H */