if_frad.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are
  3. * created for each DLCI associated with a FRAD. The FRAD driver
  4. * is not truly a network device, but the lower level device
  5. * handler. This allows other FRAD manufacturers to use the DLCI
  6. * code, including its RFC1490 encapsulation alongside the current
  7. * implementation for the Sangoma cards.
  8. *
  9. * Version: @(#)if_ifrad.h 0.15 31 Mar 96
  10. *
  11. * Author: Mike McLagan <mike.mclagan@linux.org>
  12. *
  13. * Changes:
  14. * 0.15 Mike McLagan changed structure defs (packed)
  15. * re-arranged flags
  16. * added DLCI_RET vars
  17. *
  18. * This program is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU General Public License
  20. * as published by the Free Software Foundation; either version
  21. * 2 of the License, or (at your option) any later version.
  22. */
  23. #ifndef _FRAD_H_
  24. #define _FRAD_H_
  25. #include <uapi/linux/if_frad.h>
  26. #if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
  27. /* these are the fields of an RFC 1490 header */
  28. struct frhdr
  29. {
  30. unsigned char control;
  31. /* for IP packets, this can be the NLPID */
  32. unsigned char pad;
  33. unsigned char NLPID;
  34. unsigned char OUI[3];
  35. __be16 PID;
  36. #define IP_NLPID pad
  37. } __packed;
  38. /* see RFC 1490 for the definition of the following */
  39. #define FRAD_I_UI 0x03
  40. #define FRAD_P_PADDING 0x00
  41. #define FRAD_P_Q933 0x08
  42. #define FRAD_P_SNAP 0x80
  43. #define FRAD_P_CLNP 0x81
  44. #define FRAD_P_IP 0xCC
  45. struct dlci_local
  46. {
  47. struct net_device *master;
  48. struct net_device *slave;
  49. struct dlci_conf config;
  50. int configured;
  51. struct list_head list;
  52. /* callback function */
  53. void (*receive)(struct sk_buff *skb, struct net_device *);
  54. };
  55. struct frad_local
  56. {
  57. struct net_device_stats stats;
  58. /* devices which this FRAD is slaved to */
  59. struct net_device *master[CONFIG_DLCI_MAX];
  60. short dlci[CONFIG_DLCI_MAX];
  61. struct frad_conf config;
  62. int configured; /* has this device been configured */
  63. int initialized; /* mem_start, port, irq set ? */
  64. /* callback functions */
  65. int (*activate)(struct net_device *, struct net_device *);
  66. int (*deactivate)(struct net_device *, struct net_device *);
  67. int (*assoc)(struct net_device *, struct net_device *);
  68. int (*deassoc)(struct net_device *, struct net_device *);
  69. int (*dlci_conf)(struct net_device *, struct net_device *, int get);
  70. /* fields that are used by the Sangoma SDLA cards */
  71. struct timer_list timer;
  72. int type; /* adapter type */
  73. int state; /* state of the S502/8 control latch */
  74. int buffer; /* current buffer for S508 firmware */
  75. };
  76. #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
  77. extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
  78. #endif