syncppp.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Defines for synchronous PPP/Cisco link level subroutines.
  3. *
  4. * Copyright (C) 1994 Cronyx Ltd.
  5. * Author: Serge Vakulenko, <vak@zebub.msk.su>
  6. *
  7. * This software is distributed with NO WARRANTIES, not even the implied
  8. * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. *
  10. * Authors grant any other persons or organizations permission to use
  11. * or modify this software as long as this message is kept with the software,
  12. * all derivative works or modified versions.
  13. *
  14. * Version 1.7, Wed Jun 7 22:12:02 MSD 1995
  15. *
  16. *
  17. *
  18. */
  19. #ifndef _SYNCPPP_H_
  20. #define _SYNCPPP_H_ 1
  21. #ifdef __KERNEL__
  22. struct slcp {
  23. u16 state; /* state machine */
  24. u32 magic; /* local magic number */
  25. u_char echoid; /* id of last keepalive echo request */
  26. u_char confid; /* id of last configuration request */
  27. };
  28. struct sipcp {
  29. u16 state; /* state machine */
  30. u_char confid; /* id of last configuration request */
  31. };
  32. struct sppp
  33. {
  34. struct sppp * pp_next; /* next interface in keepalive list */
  35. u32 pp_flags; /* use Cisco protocol instead of PPP */
  36. u16 pp_alivecnt; /* keepalive packets counter */
  37. u16 pp_loopcnt; /* loopback detection counter */
  38. u32 pp_seq; /* local sequence number */
  39. u32 pp_rseq; /* remote sequence number */
  40. struct slcp lcp; /* LCP params */
  41. struct sipcp ipcp; /* IPCP params */
  42. u32 ibytes,obytes; /* Bytes in/out */
  43. u32 ipkts,opkts; /* Packets in/out */
  44. struct timer_list pp_timer;
  45. struct net_device *pp_if;
  46. char pp_link_state; /* Link status */
  47. spinlock_t lock;
  48. };
  49. struct ppp_device
  50. {
  51. struct net_device *dev; /* Network device pointer */
  52. struct sppp sppp; /* Synchronous PPP */
  53. };
  54. static inline struct sppp *sppp_of(struct net_device *dev)
  55. {
  56. struct ppp_device **ppp = dev->priv;
  57. BUG_ON((*ppp)->dev != dev);
  58. return &(*ppp)->sppp;
  59. }
  60. #define PP_KEEPALIVE 0x01 /* use keepalive protocol */
  61. #define PP_CISCO 0x02 /* use Cisco protocol instead of PPP */
  62. #define PP_TIMO 0x04 /* cp_timeout routine active */
  63. #define PP_DEBUG 0x08
  64. #define PPP_MTU 1500 /* max. transmit unit */
  65. #define LCP_STATE_CLOSED 0 /* LCP state: closed (conf-req sent) */
  66. #define LCP_STATE_ACK_RCVD 1 /* LCP state: conf-ack received */
  67. #define LCP_STATE_ACK_SENT 2 /* LCP state: conf-ack sent */
  68. #define LCP_STATE_OPENED 3 /* LCP state: opened */
  69. #define IPCP_STATE_CLOSED 0 /* IPCP state: closed (conf-req sent) */
  70. #define IPCP_STATE_ACK_RCVD 1 /* IPCP state: conf-ack received */
  71. #define IPCP_STATE_ACK_SENT 2 /* IPCP state: conf-ack sent */
  72. #define IPCP_STATE_OPENED 3 /* IPCP state: opened */
  73. #define SPPP_LINK_DOWN 0 /* link down - no keepalive */
  74. #define SPPP_LINK_UP 1 /* link is up - keepalive ok */
  75. void sppp_attach (struct ppp_device *pd);
  76. void sppp_detach (struct net_device *dev);
  77. int sppp_do_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
  78. struct sk_buff *sppp_dequeue (struct net_device *dev);
  79. int sppp_isempty (struct net_device *dev);
  80. void sppp_flush (struct net_device *dev);
  81. int sppp_open (struct net_device *dev);
  82. int sppp_reopen (struct net_device *dev);
  83. int sppp_close (struct net_device *dev);
  84. #endif
  85. #define SPPPIOCCISCO (SIOCDEVPRIVATE)
  86. #define SPPPIOCPPP (SIOCDEVPRIVATE+1)
  87. #define SPPPIOCDEBUG (SIOCDEVPRIVATE+2)
  88. #define SPPPIOCSFLAGS (SIOCDEVPRIVATE+3)
  89. #define SPPPIOCGFLAGS (SIOCDEVPRIVATE+4)
  90. #endif /* _SYNCPPP_H_ */