For DL HARQ retx, support knowing result or not.
[obnox/wireshark/wip.git] / epan / dissectors / packet-mac-lte.h
1 /* packet-mac-lte.h
2  *
3  * Martin Mathieson
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  *
24  * This header file may also be distributed under
25  * the terms of the BSD Licence as follows:
26  * 
27  * Copyright (C) 2009 Martin Mathieson. All rights reserved.
28  * 
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  * 1. Redistributions of source code must retain the above copyright
33  *    notice, this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright
35  *    notice, this list of conditions and the following disclaimer in the
36  *    documentation and/or other materials provided with the distribution.
37  * 
38  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
39  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
42  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48  * SUCH DAMAGE
49  */
50
51 /* radioType */
52 #define FDD_RADIO 1
53 #define TDD_RADIO 2
54
55 /* Direction */
56 #define DIRECTION_UPLINK   0
57 #define DIRECTION_DOWNLINK 1
58
59 /* rntiType */
60 #define NO_RNTI  0
61 #define P_RNTI   1
62 #define RA_RNTI  2
63 #define C_RNTI   3
64 #define SI_RNTI  4
65 #define SPS_RNTI 5
66
67
68 typedef enum mac_lte_oob_event {
69     ltemac_send_preamble,
70     ltemac_send_sr,
71     ltemac_sr_failure
72 } mac_lte_oob_event;
73
74 typedef enum mac_lte_dl_retx {
75     dl_retx_no,
76     dl_retx_yes,
77     dl_retx_unknown
78 } mac_lte_dl_retx;
79
80 /* Context info attached to each LTE MAC frame */
81 typedef struct mac_lte_info
82 {
83     /* Needed for decode */
84     guint8          radioType;
85     guint8          direction;
86     guint8          rntiType;
87
88     /* Extra info to display */
89     guint16         rnti;
90     guint16         ueid;
91     guint16         subframeNumber;
92     guint8          isPredefinedData;
93     guint16         length;
94     guint8          reTxCount;   /* UL */
95     guint8          crcStatusValid;
96
97     mac_lte_dl_retx dl_retx;
98
99     /* More Physical layer info (direction-specific) */
100     union {
101         struct mac_lte_ul_phy_info
102         {
103             guint8 present;
104             guint8 modulation_type;
105             guint8 tbs_index;
106             guint8 resource_block_length;
107             guint8 resource_block_start;
108         } ul_info;
109         struct mac_lte_dl_phy_info
110         {
111             guint8 present;
112             guint8 dci_format;
113             guint8 resource_allocation_type;
114             guint8 aggregation_level;
115             guint8 mcs_index;
116             guint8 redundancy_version_index;
117             guint8 resource_block_length; 
118             guint8 crc_status;
119         } dl_info;
120     } detailed_phy_info;
121     
122     /* Relating to out-of-band events */
123     mac_lte_oob_event  oob_event;
124     guint8             rapid;
125     guint8             rach_attempt_number;
126 } mac_lte_info;
127
128
129 typedef struct mac_lte_tap_info {
130     /* Info from context */
131     guint16  rnti;
132     guint16  ueid;
133     guint8   rntiType;
134     guint8   isPredefinedData;
135     guint8   crcStatusValid;
136     guint8   crcStatus;
137     guint8   direction;
138
139     guint8   isPHYRetx;
140
141     /* Number of bytes (which part is used depends upon context settings) */
142     guint32  single_number_of_bytes;
143     guint32  bytes_for_lcid[11];
144     guint32  sdus_for_lcid[11];
145     guint8   number_of_rars;
146
147     /* Number of padding bytes includes padding subheaders and trailing padding */
148     guint16  padding_bytes;
149     guint16  raw_length;
150 } mac_lte_tap_info;
151
152
153 /* Accessor function to check if a frame was considered to be ReTx */
154 int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
155
156 /*****************************************************************/
157 /* UDP framing format                                            */
158 /* -----------------------                                       */
159 /* Several people have asked about dissecting MAC by framing     */
160 /* PDUs over IP.  A suggested format over UDP has been created   */
161 /* and implemented by this dissector, using the definitions      */
162 /* below. A link to an example program showing you how to encode */
163 /* these headers and send LTE MAC PDUs on a UDP socket is        */
164 /* provided at http://wiki.wireshark.org/MAC-LTE                 */
165 /*                                                               */
166 /* A heuristic dissecter (enabled by a preference) will          */
167 /* recognise a signature at the beginning of these frames   .    */
168 /* Until someone is using this format, suggestions for changes   */
169 /* are welcome.                                                  */
170 /*****************************************************************/
171
172
173 /* Signature.  Rather than try to define a port for this, or make the
174    port number a preference, frames will start with this string (with no
175    terminating NULL */
176 #define MAC_LTE_START_STRING "mac-lte"
177
178 /* Fixed fields.  This is followed by the following 3 mandatory fields:
179    - radioType (1 byte)
180    - direction (1 byte) 
181    - rntiType (1 byte)
182    (where the allowed values are defined above */
183
184 /* Optional fields. Attaching this info to frames will allow you
185    to show you display/filter/plot/add-custom-columns on these fields, so should
186    be added if available.
187    The format is to have the tag, followed by the value (there is no length field,
188    its implicit from the tag) */
189
190 #define MAC_LTE_RNTI_TAG            0x02
191 /* 2 bytes, network order */
192
193 #define MAC_LTE_UEID_TAG            0x03
194 /* 2 bytes, network order */
195
196 #define MAC_LTE_SUBFRAME_TAG        0x04
197 /* 2 bytes, network order */
198
199 #define MAC_LTE_PREDFINED_DATA_TAG  0x05
200 /* 1 byte */
201
202 #define MAC_LTE_RETX_TAG            0x06
203 /* 1 byte */
204
205 #define MAC_LTE_CRC_STATUS_TAG      0x07
206 /* 1 byte */
207
208
209 /* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
210    continues until the end of the frame) */
211 #define MAC_LTE_PAYLOAD_TAG 0x01
212