1#! /usr/bin/env python
2
3# This file is part of Scapy
4# Scapy is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# any later version.
8#
9# Scapy is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Scapy. If not, see <http://www.gnu.org/licenses/>.
16
17# scapy.contrib.description = AVS WLAN Monitor Header
18# scapy.contrib.status = loads
19
20from scapy.packet import *
21from scapy.fields import *
22from scapy.layers.dot11 import *
23
24AVSWLANPhyType =  { 0 : "Unknown",
25                    1 : "FHSS 802.11 '97",
26                    2 : "DSSS 802.11 '97",
27                    3 : "IR Baseband",
28                    4 : "DSSS 802.11b",
29                    5 : "PBCC 802.11b",
30                    6 : "OFDM 802.11g",
31                    7 : "PBCC 802.11g",
32                    8 : "OFDM 802.11a" }
33
34AVSWLANEncodingType =  { 0 : "Unknown",
35                         1 : "CCK",
36                         2 : "PBCC",
37                         3 : "OFDM"}
38
39AVSWLANSSIType = { 0 : "None",
40                   1 : "Normalized RSSI",
41                   2 : "dBm",
42                   3 : "Raw RSSI"}
43
44AVSWLANPreambleType = { 0 : "Unknown",
45                        1 : "Short",
46                        2 : "Long" }
47
48
49class AVSWLANHeader(Packet):
50        """ iwpriv eth1 set_prismhdr 1 """
51        name = "AVS WLAN Monitor Header"
52        fields_desc = [   IntField("version",1),
53                          IntField("len",64),
54                         LongField("mactime",0),
55                         LongField("hosttime",0),
56                      IntEnumField("phytype",0, AVSWLANPhyType),
57                          IntField("channel",0),
58                          IntField("datarate",0),
59                          IntField("antenna",0),
60                          IntField("priority",0),
61                      IntEnumField("ssi_type",0, AVSWLANSSIType),
62                    SignedIntField("ssi_signal",0),
63                    SignedIntField("ssi_noise",0),
64                      IntEnumField("preamble",0, AVSWLANPreambleType),
65                      IntEnumField("encoding",0, AVSWLANEncodingType),
66                        ]
67
68bind_layers(AVSWLANHeader, Dot11)
69