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