123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- #ifndef L2_PACKET_H
- #define L2_PACKET_H
- struct l2_packet_data;
- #ifdef _MSC_VER
- #pragma pack(push, 1)
- #endif
- struct l2_ethhdr {
- u8 h_dest[ETH_ALEN];
- u8 h_source[ETH_ALEN];
- be16 h_proto;
- } STRUCT_PACKED;
- #ifdef _MSC_VER
- #pragma pack(pop)
- #endif
- enum l2_packet_filter_type {
- L2_PACKET_FILTER_DHCP,
- L2_PACKET_FILTER_NDISC,
- };
- 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);
- 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);
- void l2_packet_deinit(struct l2_packet_data *l2);
- int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr);
- int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
- const u8 *buf, size_t len);
- int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len);
- void l2_packet_notify_auth_start(struct l2_packet_data *l2);
- int l2_packet_set_packet_filter(struct l2_packet_data *l2,
- enum l2_packet_filter_type type);
- #endif
|