📄 mac-802_11.h
字号:
/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- * * EDCF/HCF module extension for ns-2.1b9a * Referred to P802_11E-D4_0.doc * By Antonio Annese - antonio1979[at]libero.it * * G.Boggia, P.Camarda, A.Grieco, S.Mascolo * Dipartimento di Elettrotecnica ed Elettronica, Politecnico di Bari * Via Orabona,4 - 70125 BARI, Italy * July, 2003 * * * Copyright (c) 2003 Politecnico di Bari, Italy. * All rights reserved. * * * ParaQ module extension for ns-2.1b9 * by Fabio A. Favia [faz(at)lugbari.org] * July, 2004 * * Copyright (c) 2004 Politecnico di Bari, Italy. * All rights reserved. * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code and binary code must contain * the above copyright notice, this list of conditions and the following * disclaimer. * * 2. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed at Politecnico di Bari, Italy * * 3. The name of the University may not be used to endorse or promote * products derived from this software without specific prior written * permission. * POLITECNICO DI BARI, ITALY, MAKES NO REPRESENTATIONS * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software * is provided "as is" without express or implied warranty of any kind. * * * Copyright (c) 1997 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Computer Systems * Engineering Group at Lawrence Berkeley Laboratory. * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Header: /nfs/jade/vint/CVSROOT/ns-2/mac/mac-802_11.h,v 1.20 2002/03/14 01:12:53 haldar Exp $ * * Ported from CMU/Monarch's code, nov'98 -Padma. * wireless-mac-802_11.h */#ifndef ns_mac_80211_h#define ns_mac_80211_h#include "mac-timers.h"#include "marshall.h"//@@ FaZ//#include "mac.h"//@ FaZ#include "qos-priqueue.h"#define GET_ETHER_TYPE(x) GET2BYTE((x))#define SET_ETHER_TYPE(x,y) {u_int16_t t = (y); STORE2BYTE(x,&t);}/* ====================================================================== Frame Formats ====================================================================== */#define MAC_ProtocolVersion 0x00#define MAC_Type_Management 0x00#define MAC_Type_Control 0x01#define MAC_Type_Data 0x02#define MAC_Type_Reserved 0x03#define MAC_Subtype_RTS 0x0B#define MAC_Subtype_CTS 0x0C#define MAC_Subtype_ACK 0x0D#define MAC_Subtype_Data 0x00#define MAC_Subtype_Beacon 0x08//@@ FaZ 6/7/04#define MAC_Subtype_SchElem 0x0E // THIS IS NOT STANDARD, ONLY FOR SIMULATION !!!!//@ FaZ 6/7/04#define MAC_Subtype_QoS_CFPoll 0x0E#define MAC_Subtype_QoS_Null 0x0Fstruct frame_control { u_char fc_subtype : 4; u_char fc_type : 2; u_char fc_protocol_version : 2; u_char fc_order : 1; u_char fc_wep : 1; u_char fc_more_data : 1; u_char fc_pwr_mgt : 1; u_char fc_retry : 1; u_char fc_more_frag : 1; u_char fc_from_ds : 1; u_char fc_to_ds : 1;};struct rts_frame { struct frame_control rf_fc; u_int16_t rf_duration; u_char rf_ra[ETHER_ADDR_LEN]; u_char rf_ta[ETHER_ADDR_LEN]; u_char rf_fcs[ETHER_FCS_LEN];};struct cts_frame { struct frame_control cf_fc; u_int16_t cf_duration; u_char cf_ra[ETHER_ADDR_LEN]; u_char cf_fcs[ETHER_FCS_LEN];};struct ack_frame { struct frame_control af_fc; u_int16_t af_duration; u_char af_ra[ETHER_ADDR_LEN]; u_char af_fcs[ETHER_FCS_LEN];};// XXX This header does not have its header access function because it shares// the same header space with hdr_mac.struct hdr_mac802_11 { struct frame_control dh_fc; u_int16_t dh_duration; u_char dh_da[ETHER_ADDR_LEN]; u_char dh_sa[ETHER_ADDR_LEN]; u_char dh_bssid[ETHER_ADDR_LEN]; u_int16_t dh_scontrol; u_char dh_qos_control_tc; // It carries the TC u_char dh_qos_control_ds; // It carries TXOP duration in units of 32 us or Queue size in units of 256 octets u_char dh_body[0]; // XXX Non-ANSI};struct beacon_frame { struct frame_control bf_fc; // we have to set bf_fc.type=00,bf_fc.subtype=1000 *F@Z* u_int16_t bf_duration; u_char bf_da[ETHER_ADDR_LEN]; // unsigned char is lenght 8 bit just like bf_da[] element u_char bf_sa[ETHER_ADDR_LEN]; u_char bf_bssid[ETHER_ADDR_LEN]; u_int16_t bf_scontrol; u_char bf_body[0]; // XXX Non-ANSI#define BEACON_BODY_LEN (8+2+2+10+2+3+8+2+12) // Broadcast SSID; 8 supported rates; no FH/IBSS param // sets; 7 partial virtual bitmap elements in TIM /*F@Z Comment * 8 octets -> Timestamp * 2 octets -> Beacon Interval (it's not declared here but in bf_beacon_interval) * 2 octets -> Capability Infos * variable fields * 2 + 0 oct -> SSID Broadcast * 2 + 8 oct -> 8 Supported Rates * 2 + 0 oct -> no FH * 2 + 1 oct -> DS * 2 + 6 oct -> CF * 2 + 0 oct -> no IBSS * 5 + 7 oct -> TIM * end F@Z Comment */ u_int16_t bf_beacon_interval; // is part of beacon frame body /* posso mettere qui la definizione per il TIM oppure creare una struttura ad hoc, * devo mettere anche Capability (vd. pag 67 IEEE-802.11)? * u_char bf_eid; // Element ID (1 octet) * u_char bf_lenght; // Lenght (1 octet) * u_char bf_dtimc; // DTIM Count (1 octet) * u_char bf_dtimp; // DTIM Period (1 octet) * u_char bf_bmc; // Bitmap Control (1 octet) * ora la Virtual Bitmap posso farla in due modi * u_char bf_vbm[56]; // Virtual Bitmap (7 octet) in array dove ogni elemento
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -