#include "includes.h"
#include <winsock2.h>
#include <ntddndis.h>
#include "common.h"
#include "eloop.h"
#include "l2_packet.h"
Go to the source code of this file.
Classes | |
struct | l2_packet_data |
struct | l2_packet_ndisuio_global |
Defines | |
#define | _NDISUIO_CTL_CODE(_Function, _Method, _Access) CTL_CODE(FSCTL_NDISUIO_BASE, _Function, _Method, _Access) |
#define | FSCTL_NDISUIO_BASE FILE_DEVICE_NETWORK |
#define | IOCTL_NDISUIO_SET_ETHER_TYPE |
Functions | |
HANDLE | driver_ndis_get_ndisuio_handle (void) |
static int | l2_ndisuio_set_ether_type (unsigned short protocol) |
static int | l2_ndisuio_start_read (struct l2_packet_data *l2, int recursive) |
static void | l2_packet_callback (struct l2_packet_data *l2) |
void | l2_packet_deinit (struct l2_packet_data *l2) |
int | l2_packet_get_ip_addr (struct l2_packet_data *l2, char *buf, size_t len) |
int | l2_packet_get_own_addr (struct l2_packet_data *l2, u8 *addr) |
struct l2_packet_data * | l2_packet_init (const char *ifname, const u8 *own_addr, unsigned short protocol, void(*rx_callback)(void *ctx, const u8 *src_addr, const u8 *buf, size_t len), void *rx_callback_ctx, int l2_hdr) |
void | l2_packet_notify_auth_start (struct l2_packet_data *l2) |
static void | l2_packet_rx_event (void *eloop_data, void *user_data) |
int | l2_packet_send (struct l2_packet_data *l2, const u8 *dst_addr, u16 proto, const u8 *buf, size_t len) |
Variables | |
static struct l2_packet_ndisuio_global * | l2_ndisuio_global = NULL |
#define _NDISUIO_CTL_CODE | ( | _Function, | |
_Method, | |||
_Access | |||
) | CTL_CODE(FSCTL_NDISUIO_BASE, _Function, _Method, _Access) |
Definition at line 40 of file l2_packet_ndis.c.
#define FSCTL_NDISUIO_BASE FILE_DEVICE_NETWORK |
Definition at line 39 of file l2_packet_ndis.c.
#define IOCTL_NDISUIO_SET_ETHER_TYPE |
_NDISUIO_CTL_CODE(0x202, METHOD_BUFFERED, \ FILE_READ_ACCESS | FILE_WRITE_ACCESS)
Definition at line 42 of file l2_packet_ndis.c.
HANDLE driver_ndis_get_ndisuio_handle | ( | void | ) |
static int l2_ndisuio_set_ether_type | ( | unsigned short | protocol | ) | [static] |
Definition at line 330 of file l2_packet_ndis.c.
static int l2_ndisuio_start_read | ( | struct l2_packet_data * | l2, |
int | recursive | ||
) | [static] |
Definition at line 250 of file l2_packet_ndis.c.
static void l2_packet_callback | ( | struct l2_packet_data * | l2 | ) | [static] |
Definition at line 279 of file l2_packet_ndis.c.
void l2_packet_deinit | ( | struct l2_packet_data * | l2 | ) |
l2_packet_deinit - Deinitialize l2_packet interface : Pointer to internal l2_packet data from l2_packet_init()
Definition at line 453 of file l2_packet_ndis.c.
int l2_packet_get_ip_addr | ( | struct l2_packet_data * | l2, |
char * | buf, | ||
size_t | len | ||
) |
l2_packet_get_ip_addr - Get the current IP address from the interface : Pointer to internal l2_packet data from l2_packet_init() : Buffer for the IP address in text format : Maximum buffer length Returns: 0 on success, -1 on failure
This function can be used to get the current IP address from the interface bound to the l2_packet. This is mainly for status information and the IP address will be stored as an ASCII string. This function is not essential for wpa_supplicant operation, so full implementation is not required. l2_packet implementation will need to define the function, but it can return -1 if the IP address information is not available.
Definition at line 508 of file l2_packet_ndis.c.
int l2_packet_get_own_addr | ( | struct l2_packet_data * | l2, |
u8 * | addr | ||
) |
l2_packet_get_own_addr - Get own layer 2 address : Pointer to internal l2_packet data from l2_packet_init() : Buffer for the own address (6 bytes) Returns: 0 on success, -1 on failure
Definition at line 90 of file l2_packet_ndis.c.
struct l2_packet_data* l2_packet_init | ( | const char * | ifname, |
const u8 * | own_addr, | ||
unsigned short | protocol, | ||
void(*)(void *ctx, const u8 *src_addr, const u8 *buf, size_t len) | rx_callback, | ||
void * | rx_callback_ctx, | ||
int | l2_hdr | ||
) | [read] |
Definition at line 348 of file l2_packet_ndis.c.
void l2_packet_notify_auth_start | ( | struct l2_packet_data * | l2 | ) |
l2_packet_notify_auth_start - Notify l2_packet about start of authentication : Pointer to internal l2_packet data from l2_packet_init()
This function is called when authentication is expected to start, e.g., when association has been completed, in order to prepare l2_packet implementation for EAPOL frames. This function is used mainly if the l2_packet code needs to do polling in which case it can increasing polling frequency. This can also be an empty function if the l2_packet implementation does not benefit from knowing about the starting authentication.
Definition at line 514 of file l2_packet_ndis.c.
static void l2_packet_rx_event | ( | void * | eloop_data, |
void * | user_data | ||
) | [static] |
Definition at line 304 of file l2_packet_ndis.c.
int l2_packet_send | ( | struct l2_packet_data * | l2, |
const u8 * | dst_addr, | ||
u16 | proto, | ||
const u8 * | buf, | ||
size_t | len | ||
) |
l2_packet_send - Send a packet : Pointer to internal l2_packet data from l2_packet_init() : Destination address for the packet (only used if l2_hdr == 0) : Protocol/ethertype for the packet in host byte order (only used if l2_hdr == 0) : Packet contents to be sent; including layer 2 header if l2_hdr was set to 1 in l2_packet_init() call. Otherwise, only the payload of the packet is included. : Length of the buffer (including l2 header only if l2_hdr == 1) Returns: >=0 on success, <0 on failure
Definition at line 97 of file l2_packet_ndis.c.
struct l2_packet_ndisuio_global* l2_ndisuio_global = NULL [static] |
Definition at line 71 of file l2_packet_ndis.c.