if_pppol2tp.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /***************************************************************************
  2. * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
  3. *
  4. * This file supplies definitions required by the PPP over L2TP driver
  5. * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c
  6. *
  7. * License:
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. *
  13. */
  14. #ifndef _UAPI__LINUX_IF_PPPOL2TP_H
  15. #define _UAPI__LINUX_IF_PPPOL2TP_H
  16. #include <linux/types.h>
  17. #include <linux/in.h>
  18. #include <linux/in6.h>
  19. /* Structure used to connect() the socket to a particular tunnel UDP
  20. * socket over IPv4.
  21. */
  22. struct pppol2tp_addr {
  23. __kernel_pid_t pid; /* pid that owns the fd.
  24. * 0 => current */
  25. int fd; /* FD of UDP socket to use */
  26. struct sockaddr_in addr; /* IP address and port to send to */
  27. __u16 s_tunnel, s_session; /* For matching incoming packets */
  28. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  29. };
  30. /* Structure used to connect() the socket to a particular tunnel UDP
  31. * socket over IPv6.
  32. */
  33. struct pppol2tpin6_addr {
  34. __kernel_pid_t pid; /* pid that owns the fd.
  35. * 0 => current */
  36. int fd; /* FD of UDP socket to use */
  37. __u16 s_tunnel, s_session; /* For matching incoming packets */
  38. __u16 d_tunnel, d_session; /* For sending outgoing packets */
  39. struct sockaddr_in6 addr; /* IP address and port to send to */
  40. };
  41. /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
  42. * bits. So we need a different sockaddr structure.
  43. */
  44. struct pppol2tpv3_addr {
  45. __kernel_pid_t pid; /* pid that owns the fd.
  46. * 0 => current */
  47. int fd; /* FD of UDP or IP socket to use */
  48. struct sockaddr_in addr; /* IP address and port to send to */
  49. __u32 s_tunnel, s_session; /* For matching incoming packets */
  50. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  51. };
  52. struct pppol2tpv3in6_addr {
  53. __kernel_pid_t pid; /* pid that owns the fd.
  54. * 0 => current */
  55. int fd; /* FD of UDP or IP socket to use */
  56. __u32 s_tunnel, s_session; /* For matching incoming packets */
  57. __u32 d_tunnel, d_session; /* For sending outgoing packets */
  58. struct sockaddr_in6 addr; /* IP address and port to send to */
  59. };
  60. /* Socket options:
  61. * DEBUG - bitmask of debug message categories
  62. * SENDSEQ - 0 => don't send packets with sequence numbers
  63. * 1 => send packets with sequence numbers
  64. * RECVSEQ - 0 => receive packet sequence numbers are optional
  65. * 1 => drop receive packets without sequence numbers
  66. * LNSMODE - 0 => act as LAC.
  67. * 1 => act as LNS.
  68. * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder.
  69. */
  70. enum {
  71. PPPOL2TP_SO_DEBUG = 1,
  72. PPPOL2TP_SO_RECVSEQ = 2,
  73. PPPOL2TP_SO_SENDSEQ = 3,
  74. PPPOL2TP_SO_LNSMODE = 4,
  75. PPPOL2TP_SO_REORDERTO = 5,
  76. };
  77. /* Debug message categories for the DEBUG socket option */
  78. enum {
  79. PPPOL2TP_MSG_DEBUG = (1 << 0), /* verbose debug (if
  80. * compiled in) */
  81. PPPOL2TP_MSG_CONTROL = (1 << 1), /* userspace - kernel
  82. * interface */
  83. PPPOL2TP_MSG_SEQ = (1 << 2), /* sequence numbers */
  84. PPPOL2TP_MSG_DATA = (1 << 3), /* data packets */
  85. };
  86. #endif /* _UAPI__LINUX_IF_PPPOL2TP_H */