wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
l2_packet.h
Go to the documentation of this file.
1 
11 #ifndef L2_PACKET_H
12 #define L2_PACKET_H
13 
23 struct l2_packet_data;
24 
25 #ifdef _MSC_VER
26 #pragma pack(push, 1)
27 #endif /* _MSC_VER */
28 
29 struct l2_ethhdr {
30  u8 h_dest[ETH_ALEN];
31  u8 h_source[ETH_ALEN];
32  be16 h_proto;
33 } STRUCT_PACKED;
34 
35 #ifdef _MSC_VER
36 #pragma pack(pop)
37 #endif /* _MSC_VER */
38 
39 enum l2_packet_filter_type {
40  L2_PACKET_FILTER_DHCP,
41  L2_PACKET_FILTER_NDISC,
42 };
43 
62  const char *ifname, const u8 *own_addr, unsigned short protocol,
63  void (*rx_callback)(void *ctx, const u8 *src_addr,
64  const u8 *buf, size_t len),
65  void *rx_callback_ctx, int l2_hdr);
66 
75  const char *br_ifname, const char *ifname, const u8 *own_addr,
76  unsigned short protocol,
77  void (*rx_callback)(void *ctx, const u8 *src_addr,
78  const u8 *buf, size_t len),
79  void *rx_callback_ctx, int l2_hdr);
80 
85 void l2_packet_deinit(struct l2_packet_data *l2);
86 
93 int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr);
94 
107 int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
108  const u8 *buf, size_t len);
109 
124 int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len);
125 
126 
139 
150  enum l2_packet_filter_type type);
151 
152 #endif /* L2_PACKET_H */
struct l2_packet_data * l2_packet_init_bridge(const char *br_ifname, 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)
Like l2_packet_init() but with bridge workaround.
Definition: l2_packet_freebsd.c:255
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)
Initialize l2_packet interface.
Definition: l2_packet_freebsd.c:223
void l2_packet_notify_auth_start(struct l2_packet_data *l2)
Notify l2_packet about start of authentication.
Definition: l2_packet_freebsd.c:316
int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto, const u8 *buf, size_t len)
Send a packet.
Definition: l2_packet_freebsd.c:51
Definition: l2_packet_freebsd.c:32
int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len)
Get the current IP address from the interface.
Definition: l2_packet_freebsd.c:280
Definition: l2_packet.h:29
void l2_packet_deinit(struct l2_packet_data *l2)
Deinitialize l2_packet interface.
Definition: l2_packet_freebsd.c:267
int l2_packet_set_packet_filter(struct l2_packet_data *l2, enum l2_packet_filter_type type)
Set socket filter for l2_packet.
Definition: l2_packet_freebsd.c:321
int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr)
Get own layer 2 address.
Definition: l2_packet_freebsd.c:44