frame-xchg.h (2486B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2020 Intel Corporation. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 */ 22 23 struct mmpdu_header; 24 25 typedef void (*frame_watch_cb_t)(const struct mmpdu_header *frame, 26 const void *body, size_t body_len, 27 int rssi, void *user_data); 28 typedef bool (*frame_xchg_resp_cb_t)(const struct mmpdu_header *frame, 29 const void *body, size_t body_len, 30 int rssi, void *user_data); 31 typedef void (*frame_xchg_cb_t)(int err, void *user_data); 32 typedef void (*frame_xchg_destroy_func_t)(void *user_data); 33 34 struct frame_xchg_prefix { 35 uint16_t frame_type; 36 const uint8_t *data; 37 size_t len; 38 }; 39 40 enum frame_xchg_group { 41 FRAME_GROUP_DEFAULT = 0, 42 FRAME_GROUP_P2P_LISTEN, 43 FRAME_GROUP_P2P_CONNECT, 44 FRAME_GROUP_DPP, 45 }; 46 47 bool frame_watch_add(uint64_t wdev_id, uint32_t group, uint16_t frame_type, 48 const uint8_t *prefix, size_t prefix_len, 49 bool multicast_rx, 50 frame_watch_cb_t handler, void *user_data, 51 frame_xchg_destroy_func_t destroy); 52 bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group); 53 bool frame_watch_wdev_remove(uint64_t wdev_id); 54 55 uint32_t frame_xchg_start(uint64_t wdev_id, struct iovec *frame, uint32_t freq, 56 unsigned int retry_interval, unsigned int resp_timeout, 57 unsigned int retries_on_ack, uint32_t group_id, 58 frame_xchg_cb_t cb, void *user_data, 59 frame_xchg_destroy_func_t destroy, ...); 60 uint32_t frame_xchg_startv(uint64_t wdev_id, struct iovec *frame, uint32_t freq, 61 unsigned int retry_interval, unsigned int resp_timeout, 62 unsigned int retries_on_ack, uint32_t group_id, 63 frame_xchg_cb_t cb, void *user_data, 64 frame_xchg_destroy_func_t destroy, va_list resp_args); 65 void frame_xchg_stop_wdev(uint64_t wdev_id); 66 void frame_xchg_cancel(uint32_t id);