iw.h (1702B)
1 /* 2 wificurse - WiFi Jamming tool 3 Copyright (C) 2012 oblique 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef IW_H 20 #define IW_H 21 22 #include <stdint.h> 23 #include <sys/socket.h> 24 #include <linux/wireless.h> 25 26 27 struct radiotap_hdr { 28 uint8_t version; 29 uint8_t pad; 30 uint16_t len; 31 uint32_t present; 32 } __attribute__((__packed__)); 33 34 struct write_radiotap_data { 35 uint8_t rate; 36 uint8_t pad; 37 uint16_t tx_flags; 38 } __attribute__((__packed__)); 39 40 #define RADIOTAP_F_PRESENT_RATE (1<<2) 41 #define RADIOTAP_F_PRESENT_TX_FLAGS (1<<15) 42 #define RADIOTAP_F_TX_FLAGS_NOACK 0x0008 43 #define RADIOTAP_F_TX_FLAGS_NOSEQ 0x0010 44 45 struct iw_dev { 46 char ifname[IFNAMSIZ+1]; 47 int ifindex; 48 int fd_in; 49 int fd_out; 50 volatile int chan; 51 struct ifreq old_flags; 52 struct iwreq old_mode; 53 }; 54 55 56 void iw_init_dev(struct iw_dev *dev); 57 int iw_open(struct iw_dev *dev); 58 void iw_close(struct iw_dev *dev); 59 ssize_t iw_write(struct iw_dev *dev, void *buf, size_t count); 60 ssize_t iw_read(struct iw_dev *dev, void *buf, size_t count, uint8_t **pkt, size_t *pkt_sz); 61 int iw_set_channel(struct iw_dev *dev, int chan); 62 63 #endif