l2_packet.h
Go to the documentation of this file.00001
00022 #ifndef L2_PACKET_H
00023 #define L2_PACKET_H
00024
00034 struct l2_packet_data;
00035
00036 #ifdef _MSC_VER
00037 #pragma pack(push, 1)
00038 #endif
00039
00040 struct l2_ethhdr {
00041 u8 h_dest[ETH_ALEN];
00042 u8 h_source[ETH_ALEN];
00043 be16 h_proto;
00044 } STRUCT_PACKED;
00045
00046 #ifdef _MSC_VER
00047 #pragma pack(pop)
00048 #endif
00049
00068 struct l2_packet_data * l2_packet_init(
00069 const char *ifname, const u8 *own_addr, unsigned short protocol,
00070 void (*rx_callback)(void *ctx, const u8 *src_addr,
00071 const u8 *buf, size_t len),
00072 void *rx_callback_ctx, int l2_hdr);
00073
00079 void l2_packet_deinit(struct l2_packet_data *l2);
00080
00088 int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr);
00089
00103 int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
00104 const u8 *buf, size_t len);
00105
00121 int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len);
00122
00123
00136 void l2_packet_notify_auth_start(struct l2_packet_data *l2);
00137
00138 #endif
00139