src/devices/wifi/wifi-information-element.h
author Dean Armstrong <deanarm@gmail.com>
Fri, 25 Jun 2010 11:50:06 +0100
changeset 6378 57485ed01268
child 6379 f1031f074dbd
permissions -rw-r--r--
Bug 881: Extract WifiInformationElement(Vector) core to wifi module This patch aims to bring the core of the current WifiInformationElement and WifiInformationElementVector classes into the wifi module, where they can then enjoy greater use (currently they are in the mesh module and contain mesh-specific aspects).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6378
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     2
/*
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2010 Dean Armstrong
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     4
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     8
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    13
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    17
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    18
 * Authors: Dean Armstrong <deanarm@gmail.com>
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    19
 */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    20
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    21
#ifndef WIFI_INFORMATION_ELEMENT_H
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    22
#define WIFI_INFORMATION_ELEMENT_H
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    23
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    24
#include "ns3/header.h"
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    25
#include "ns3/simple-ref-count.h"
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    26
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    27
/**
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    28
 * \ingroup wifi
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    29
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    30
 * \subsection wifi_ie Information Elements
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    31
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    32
 * The IEEE 802.11 standard includes the notion of Information
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    33
 * Elements, which are encodings of management information to be
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    34
 * communicated between STAs in the payload of various frames of type
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    35
 * Management. Information Elements (IEs) have a common format, each
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    36
 * starting with a single octet - the Element ID, which indicates the
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    37
 * specific type of IE (a type to represent the options here is
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    38
 * defined as WifiElementId). The next octet is a length field and
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    39
 * encodes the number of octets in the third and final field, which is
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    40
 * the IE Information field.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    41
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    42
 * The class ns3::WifiInformationElement provides a base for classes
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    43
 * which represent specific Information Elements. This class defines
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    44
 * pure virtual methods for serialisation
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    45
 * (ns3::WifiInformationElement::SerializeInformation) and
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    46
 * deserialisation
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    47
 * (ns3::WifiInformationElement::DeserializeInformation) of IEs, from
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    48
 * or to data members or other objects that simulation objects use to
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    49
 * maintain the relevant state.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    50
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    51
 * This class also provides an implementation of the equality
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    52
 * operator, which operates by comparing the serialised versions of
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    53
 * the two WifiInformationElement objects concerned.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    54
 */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    55
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    56
namespace ns3 {
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    57
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    58
/**
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    59
 * This type is used to represent an Information Element ID. An
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    60
 * enumeration would be tidier, but doesn't provide for the
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    61
 * inheritance that is currently preferable to cleanly support
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    62
 * pre-standard modules such as mesh. Maybe there is a nice way of
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    63
 * doing this with a class.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    64
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    65
 * Until such time as a better way of implementing this is dreamt up
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    66
 * and applied, developers will need to be careful to avoid
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    67
 * duplication of IE IDs in the #definitions below (and in files which
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    68
 * declare "subclasses" of WifiInformationElement). Sorry.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    69
 */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    70
typedef uint8_t WifiElementId;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    71
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    72
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    73
/**
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    74
 * Here we have definition of all Information Element IDs in IEEE
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    75
 * 802.11-2007. See the comments for WifiElementId - this could
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    76
 * probably be done in a considerably tidier manner.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    77
 */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    78
#define IE_SSID                                ((WifiElementId)0)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    79
#define IE_SUPPORTED_RATES                     ((WifiElementId)1)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    80
#define IE_FH_PARAMETER_SET                    ((WifiElementId)2)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    81
#define IE_DS_PARAMETER_SET                    ((WifiElementId)3)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    82
#define IE_CF_PARAMETER_SET                    ((WifiElementId)4)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    83
#define IE_TIM                                 ((WifiElementId)5)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    84
#define IE_IBSS_PARAMETER_SET                  ((WifiElementId)6)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    85
#define IE_COUNTRY                             ((WifiElementId)7)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    86
#define IE_HOPPING_PATTERN_PARAMETERS          ((WifiElementId)8)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    87
#define IE_HOPPING_PATTERN_TABLE               ((WifiElementId)9)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    88
#define IE_REQUEST                             ((WifiElementId)10)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    89
#define IE_BSS_LOAD                            ((WifiElementId)11)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    90
#define IE_EDCA_PARAMETER_SET                  ((WifiElementId)12)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    91
#define IE_TSPEC                               ((WifiElementId)13)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    92
#define IE_TCLAS                               ((WifiElementId)14)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    93
#define IE_SCHEDULE                            ((WifiElementId)15)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    94
#define IE_CHALLENGE_TEXT                      ((WifiElementId)16)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    95
// 17 to 31 are reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    96
#define IE_POWER_CONSTRAINT                    ((WifiElementId)32)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    97
#define IE_POWER_CAPABILITY                    ((WifiElementId)33)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    98
#define IE_TPC_REQUEST                         ((WifiElementId)34)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
    99
#define IE_TPC_REPORT                          ((WifiElementId)35)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   100
#define IE_SUPPORTED_CHANNELS                  ((WifiElementId)36)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   101
#define IE_CHANNEL_SWITCH_ANNOUNCEMENT         ((WifiElementId)37)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   102
#define IE_MEASUREMENT_REQUEST                 ((WifiElementId)38)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   103
#define IE_MEASUREMENT_REPORT                  ((WifiElementId)39)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   104
#define IE_QUIET                               ((WifiElementId)40)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   105
#define IE_IBSS_DFS                            ((WifiElementId)41)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   106
#define IE_ERP_INFORMATION                     ((WifiElementId)42)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   107
#define IE_TS_DELAY                            ((WifiElementId)43)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   108
#define IE_TCLAS_PROCESSING                    ((WifiElementId)44)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   109
// 45 is reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   110
#define IE_QOS_CAPABILITY                      ((WifiElementId)46)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   111
// 47 is reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   112
#define IE_RSN                                 ((WifiElementId)48)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   113
// 49 is reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   114
#define IE_EXTENDED_SUPPORTED_RATES            ((WifiElementId)50)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   115
// 51 to 126 are reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   116
#define IE_EXTENDED_CAPABILITIES               ((WifiElementId)127)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   117
// 128 to 220 are reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   118
#define IE_VENDOR_SPECIFIC                     ((WifiElementId)221)
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   119
// 222 to 255 are reserved in 802.11-2007
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   120
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   121
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   122
/**
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   123
 * \brief Information element, as defined in 802.11-2007 standard
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   124
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   125
 * Elements are defined to have a common general format consisting of
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   126
 * a 1 octet Element ID field, a 1 octet length field, and a
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   127
 * variable-length element-specific information field. Each element is
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   128
 * assigned a unique Element ID as defined in this standard. The
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   129
 * Length field specifies the number of octets in the Information
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   130
 * field.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   131
 *
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   132
 * This class is pure virtual and acts as base for classes which know
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   133
 * how to serialize specific IEs.
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   134
 */
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   135
class WifiInformationElement : public SimpleRefCount<WifiInformationElement>
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   136
{
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   137
public:
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   138
  virtual ~WifiInformationElement ();
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   139
  ///\name Each subclass must implement
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   140
  //\{
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   141
  virtual void Print (std::ostream &os) const = 0;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   142
  /// Own unique Element ID
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   143
  virtual WifiElementId ElementId () const = 0;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   144
  /// Length of serialized information
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   145
  virtual uint8_t GetInformationSize () const = 0;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   146
  /// Serialize information
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   147
  virtual void SerializeInformation (Buffer::Iterator start) const = 0;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   148
  /// Deserialize information
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   149
  virtual uint8_t DeserializeInformation (Buffer::Iterator start,
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   150
                                          uint8_t length) = 0;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   151
  //\}
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   152
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   153
  /// Compare information elements using Element ID
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   154
  virtual bool operator< (WifiInformationElement const & a) const;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   155
  /// Compare two IEs for equality by ID & Length, and then through
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   156
  /// memcmp of serialised version
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   157
  virtual bool operator== (WifiInformationElement const & a) const;
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   158
};
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   159
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   160
}
57485ed01268 Bug 881: Extract WifiInformationElement(Vector) core to wifi module
Dean Armstrong <deanarm@gmail.com>
parents:
diff changeset
   161
#endif /* WIFI_INFORMATION_ELEMENT_H */