00001
00022 #ifndef L2_PACKET_H
00023 #define L2_PACKET_H
00024
00025 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
00026 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
00027
00028 #ifndef ETH_P_EAPOL
00029 #define ETH_P_EAPOL 0x888e
00030 #endif
00031
00032 #ifndef ETH_P_RSN_PREAUTH
00033 #define ETH_P_RSN_PREAUTH 0x88c7
00034 #endif
00035
00045 struct l2_packet_data;
00046
00047 struct l2_ethhdr {
00048 u8 h_dest[ETH_ALEN];
00049 u8 h_source[ETH_ALEN];
00050 u16 h_proto;
00051 } __attribute__ ((packed));
00052
00071 struct l2_packet_data * l2_packet_init(
00072 const char *ifname, const u8 *own_addr, unsigned short protocol,
00073 void (*rx_callback)(void *ctx, const u8 *src_addr,
00074 const u8 *buf, size_t len),
00075 void *rx_callback_ctx, int l2_hdr);
00076
00082 void l2_packet_deinit(struct l2_packet_data *l2);
00083
00091 int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr);
00092
00106 int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
00107 const u8 *buf, size_t len);
00108
00124 int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len);
00125
00126
00139 void l2_packet_notify_auth_start(struct l2_packet_data *l2);
00140
00141 #endif
00142