ppp_channel.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _PPP_CHANNEL_H_
  2. #define _PPP_CHANNEL_H_
  3. /*
  4. * Definitions for the interface between the generic PPP code
  5. * and a PPP channel.
  6. *
  7. * A PPP channel provides a way for the generic PPP code to send
  8. * and receive packets over some sort of communications medium.
  9. * Packets are stored in sk_buffs and have the 2-byte PPP protocol
  10. * number at the start, but not the address and control bytes.
  11. *
  12. * Copyright 1999 Paul Mackerras.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version
  17. * 2 of the License, or (at your option) any later version.
  18. *
  19. * ==FILEVERSION 20000322==
  20. */
  21. #include <linux/list.h>
  22. #include <linux/skbuff.h>
  23. #include <linux/poll.h>
  24. struct ppp_channel;
  25. struct ppp_channel_ops {
  26. /* Send a packet (or multilink fragment) on this channel.
  27. Returns 1 if it was accepted, 0 if not. */
  28. int (*start_xmit)(struct ppp_channel *, struct sk_buff *);
  29. /* Handle an ioctl call that has come in via /dev/ppp. */
  30. int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long);
  31. };
  32. struct ppp_channel {
  33. void *private; /* channel private data */
  34. struct ppp_channel_ops *ops; /* operations for this channel */
  35. int mtu; /* max transmit packet size */
  36. int hdrlen; /* amount of headroom channel needs */
  37. void *ppp; /* opaque to channel */
  38. /* the following are not used at present */
  39. int speed; /* transfer rate (bytes/second) */
  40. int latency; /* overhead time in milliseconds */
  41. };
  42. #ifdef __KERNEL__
  43. /* Called by the channel when it can send some more data. */
  44. extern void ppp_output_wakeup(struct ppp_channel *);
  45. /* Called by the channel to process a received PPP packet.
  46. The packet should have just the 2-byte PPP protocol header. */
  47. extern void ppp_input(struct ppp_channel *, struct sk_buff *);
  48. /* Called by the channel when an input error occurs, indicating
  49. that we may have missed a packet. */
  50. extern void ppp_input_error(struct ppp_channel *, int code);
  51. /* Attach a channel to a given PPP unit. */
  52. extern int ppp_register_channel(struct ppp_channel *);
  53. /* Detach a channel from its PPP unit (e.g. on hangup). */
  54. extern void ppp_unregister_channel(struct ppp_channel *);
  55. /* Get the channel number for a channel */
  56. extern int ppp_channel_index(struct ppp_channel *);
  57. /* Get the unit number associated with a channel, or -1 if none */
  58. extern int ppp_unit_number(struct ppp_channel *);
  59. /*
  60. * SMP locking notes:
  61. * The channel code must ensure that when it calls ppp_unregister_channel,
  62. * nothing is executing in any of the procedures above, for that
  63. * channel. The generic layer will ensure that nothing is executing
  64. * in the start_xmit and ioctl routines for the channel by the time
  65. * that ppp_unregister_channel returns.
  66. */
  67. #endif /* __KERNEL__ */
  68. #endif