1*a399b765Szf162725 /* 2*a399b765Szf162725 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 3*a399b765Szf162725 * Use is subject to license terms. 4*a399b765Szf162725 */ 5*a399b765Szf162725 6*a399b765Szf162725 /* 7*a399b765Szf162725 * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> 8*a399b765Szf162725 * Sun elects to license this software under the BSD license. 9*a399b765Szf162725 * See README for more details. 10*a399b765Szf162725 */ 11*a399b765Szf162725 #ifndef __L2_PACKET_H 12*a399b765Szf162725 #define __L2_PACKET_H 13*a399b765Szf162725 14*a399b765Szf162725 #pragma ident "%Z%%M% %I% %E% SMI" 15*a399b765Szf162725 16*a399b765Szf162725 #ifdef __cplusplus 17*a399b765Szf162725 extern "C" { 18*a399b765Szf162725 #endif 19*a399b765Szf162725 20*a399b765Szf162725 #include <sys/types.h> 21*a399b765Szf162725 #include <net/if.h> 22*a399b765Szf162725 #include <libdlpi.h> 23*a399b765Szf162725 24*a399b765Szf162725 #define IEEE80211_MTU_MAX 2304 25*a399b765Szf162725 26*a399b765Szf162725 struct l2_packet_data { 27*a399b765Szf162725 dlpi_handle_t dh; /* dlpi handle for EAPOL frames */ 28*a399b765Szf162725 char ifname[DLPI_LINKNAME_MAX]; 29*a399b765Szf162725 uint8_t own_addr[IEEE80211_ADDR_LEN]; 30*a399b765Szf162725 void (*rx_callback)(void *, unsigned char *, 31*a399b765Szf162725 unsigned char *, size_t); 32*a399b765Szf162725 void *rx_callback_ctx; 33*a399b765Szf162725 }; 34*a399b765Szf162725 35*a399b765Szf162725 #pragma pack(1) 36*a399b765Szf162725 struct l2_ethhdr { 37*a399b765Szf162725 uint8_t h_dest[IEEE80211_ADDR_LEN]; 38*a399b765Szf162725 uint8_t h_source[IEEE80211_ADDR_LEN]; 39*a399b765Szf162725 uint16_t h_proto; 40*a399b765Szf162725 }; 41*a399b765Szf162725 #pragma pack() 42*a399b765Szf162725 43*a399b765Szf162725 struct l2_packet_data *l2_packet_init( 44*a399b765Szf162725 const char *, unsigned short, 45*a399b765Szf162725 void (*rx_callback)(void *, unsigned char *, 46*a399b765Szf162725 unsigned char *, size_t), 47*a399b765Szf162725 void *); 48*a399b765Szf162725 void l2_packet_deinit(struct l2_packet_data *); 49*a399b765Szf162725 50*a399b765Szf162725 int l2_packet_get_own_addr(struct l2_packet_data *, uint8_t *); 51*a399b765Szf162725 int l2_packet_send(struct l2_packet_data *, uint8_t *, size_t); 52*a399b765Szf162725 53*a399b765Szf162725 #ifdef __cplusplus 54*a399b765Szf162725 } 55*a399b765Szf162725 #endif 56*a399b765Szf162725 57*a399b765Szf162725 #endif /* __L2_PACKET_H */ 58