l2_packet.h
Go to the documentation of this file.
00001 /*
00002  * WPA Supplicant - Layer2 packet interface definition
00003  * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  *
00014  * This file defines an interface for layer 2 (link layer) packet sending and
00015  * receiving. l2_packet_linux.c is one implementation for such a layer 2
00016  * implementation using Linux packet sockets and l2_packet_pcap.c another one
00017  * using libpcap and libdnet. When porting %wpa_supplicant to other operating
00018  * systems, a new l2_packet implementation may need to be added.
00019  */
00020 
00021 #ifndef L2_PACKET_H
00022 #define L2_PACKET_H
00023 
00032 struct l2_packet_data;
00033 
00034 #ifdef _MSC_VER
00035 #pragma pack(push, 1)
00036 #endif /* _MSC_VER */
00037 
00038 struct l2_ethhdr {
00039         u8 h_dest[ETH_ALEN];
00040         u8 h_source[ETH_ALEN];
00041         be16 h_proto;
00042 } STRUCT_PACKED;
00043 
00044 #ifdef _MSC_VER
00045 #pragma pack(pop)
00046 #endif /* _MSC_VER */
00047 
00065 struct l2_packet_data * l2_packet_init(
00066         const char *ifname, const u8 *own_addr, unsigned short protocol,
00067         void (*rx_callback)(void *ctx, const u8 *src_addr,
00068                             const u8 *buf, size_t len),
00069         void *rx_callback_ctx, int l2_hdr);
00070 
00075 void l2_packet_deinit(struct l2_packet_data *l2);
00076 
00083 int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr);
00084 
00097 int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
00098                    const u8 *buf, size_t len);
00099 
00114 int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len);
00115 
00116 
00128 void l2_packet_notify_auth_start(struct l2_packet_data *l2);
00129 
00130 #endif /* L2_PACKET_H */


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:20