llc.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef LLC_H
  2. #define LLC_H
  3. /*
  4. * Copyright (c) 1997 by Procom Technology, Inc.
  5. * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  6. *
  7. * This program can be redistributed or modified under the terms of the
  8. * GNU General Public License as published by the Free Software Foundation.
  9. * This program is distributed without any warranty or implied warranty
  10. * of merchantability or fitness for a particular purpose.
  11. *
  12. * See the GNU General Public License for more details.
  13. */
  14. #include <linux/if.h>
  15. #include <linux/if_ether.h>
  16. #include <linux/list.h>
  17. #include <linux/spinlock.h>
  18. struct net_device;
  19. struct packet_type;
  20. struct sk_buff;
  21. struct llc_addr {
  22. unsigned char lsap;
  23. unsigned char mac[IFHWADDRLEN];
  24. };
  25. #define LLC_SAP_STATE_INACTIVE 1
  26. #define LLC_SAP_STATE_ACTIVE 2
  27. /**
  28. * struct llc_sap - Defines the SAP component
  29. *
  30. * @station - station this sap belongs to
  31. * @state - sap state
  32. * @p_bit - only lowest-order bit used
  33. * @f_bit - only lowest-order bit used
  34. * @laddr - SAP value in this 'lsap'
  35. * @node - entry in station sap_list
  36. * @sk_list - LLC sockets this one manages
  37. */
  38. struct llc_sap {
  39. unsigned char state;
  40. unsigned char p_bit;
  41. unsigned char f_bit;
  42. int (*rcv_func)(struct sk_buff *skb,
  43. struct net_device *dev,
  44. struct packet_type *pt,
  45. struct net_device *orig_dev);
  46. struct llc_addr laddr;
  47. struct list_head node;
  48. struct {
  49. rwlock_t lock;
  50. struct hlist_head list;
  51. } sk_list;
  52. };
  53. #define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
  54. #define LLC_DEST_SAP 1 /* Type 1 goes here */
  55. #define LLC_DEST_CONN 2 /* Type 2 goes here */
  56. extern struct list_head llc_sap_list;
  57. extern rwlock_t llc_sap_list_lock;
  58. extern unsigned char llc_station_mac_sa[ETH_ALEN];
  59. extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
  60. struct packet_type *pt, struct net_device *orig_dev);
  61. extern int llc_mac_hdr_init(struct sk_buff *skb,
  62. unsigned char *sa, unsigned char *da);
  63. extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
  64. struct sk_buff *skb));
  65. extern void llc_remove_pack(int type);
  66. extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
  67. extern struct llc_sap *llc_sap_open(unsigned char lsap,
  68. int (*rcv)(struct sk_buff *skb,
  69. struct net_device *dev,
  70. struct packet_type *pt,
  71. struct net_device *orig_dev));
  72. extern void llc_sap_close(struct llc_sap *sap);
  73. extern struct llc_sap *llc_sap_find(unsigned char sap_value);
  74. extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
  75. unsigned char *dmac, unsigned char dsap);
  76. extern int llc_station_init(void);
  77. extern void llc_station_exit(void);
  78. #ifdef CONFIG_PROC_FS
  79. extern int llc_proc_init(void);
  80. extern void llc_proc_exit(void);
  81. #else
  82. #define llc_proc_init() (0)
  83. #define llc_proc_exit() do { } while(0)
  84. #endif /* CONFIG_PROC_FS */
  85. #endif /* LLC_H */