/* * Copyright (C) 2013 Bastian Bloessl * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef INCLUDED_IEEE802_11_OFDM_UTILS_H #define INCLUDED_IEEE802_11_OFDM_UTILS_H #include /** * Define structure for the MAC header of a data frame. * Values as stored as MSB, but standard mandates LSB * representation. Bit utils functions can help changing * endiannes */ struct MAC_DATAFRAME_HEADER { char frame_control[2]; //protocol version, type, subtype, to_ds, from_ds, ... char duration[2]; //duration field char address1[6]; //address 1 indicating BSSID: 6 bytes MAC address char address2[6]; //address 2 indicating receiver char address3[6]; //address 3 indicating sender char sequence[2]; //sequence number plus fragment number }; enum ENCODING { BPSK_1_2 = 0, BPSK_3_4 = 1, QPSK_1_2 = 2, QPSK_3_4 = 3, QAM16_1_2 = 4, QAM16_3_4 = 5, QAM64_2_3 = 6, QAM64_3_4 = 7, }; /** * OFDM parameters */ class ofdm_param { public: ofdm_param(ENCODING e); // data rate ENCODING encoding; // rate field of the SIGNAL header char rate_field; // number of coded bits per sub carrier int n_bpsc; // number of coded bits per OFDM symbol int n_cbps; // number of data bits per OFDM symbol int n_dbps; void print_out(); }; /** * packet specific parameters */ class tx_param { public: tx_param(ofdm_param &ofdm, int psdu_length); // PSDU size in bytes int psdu_size; // number of OFDM symbols (17-11) int n_sym; // number of data bits in the DATA field, including service and padding (17-12) int n_data; // number of padding bits in the DATA field (17-13) int n_pad; int n_encoded_bits; void print_out(); }; #endif /* INCLUDED_IEEE802_11_OFDM_UTILS_H */