blob: 0e12c37f29583bb3efabb96d881a2415f8e182f9 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Pablo Neira459aa662016-05-09 00:55:48 +02002#ifndef _GTP_H_
Colin Ian King9b8ac4f2016-07-24 19:24:09 +01003#define _GTP_H_
Pablo Neira459aa662016-05-09 00:55:48 +02004
5/* General GTP protocol related definitions. */
6
7#define GTP0_PORT 3386
8#define GTP1U_PORT 2152
9
Wojciech Drewek9af41cc2022-03-04 17:40:43 +010010/* GTP messages types */
11#define GTP_ECHO_REQ 1 /* Echo Request */
12#define GTP_ECHO_RSP 2 /* Echo Response */
Pablo Neira459aa662016-05-09 00:55:48 +020013#define GTP_TPDU 255
14
Wojciech Drewek9af41cc2022-03-04 17:40:43 +010015#define GTPIE_RECOVERY 14
16
Pablo Neira459aa662016-05-09 00:55:48 +020017struct gtp0_header { /* According to GSM TS 09.60. */
18 __u8 flags;
19 __u8 type;
20 __be16 length;
21 __be16 seq;
22 __be16 flow;
23 __u8 number;
24 __u8 spare[3];
25 __be64 tid;
26} __attribute__ ((packed));
27
28struct gtp1_header { /* According to 3GPP TS 29.060. */
29 __u8 flags;
30 __u8 type;
31 __be16 length;
32 __be32 tid;
33} __attribute__ ((packed));
34
Wojciech Drewek9af41cc2022-03-04 17:40:43 +010035struct gtp1_header_long { /* According to 3GPP TS 29.060. */
36 __u8 flags;
37 __u8 type;
38 __be16 length;
39 __be32 tid;
40 __be16 seq;
41 __u8 npdu;
42 __u8 next;
43} __packed;
44
45/* GTP Information Element */
46struct gtp_ie {
47 __u8 tag;
48 __u8 val;
49} __packed;
50
51struct gtp0_packet {
52 struct gtp0_header gtp0_h;
53 struct gtp_ie ie;
54} __packed;
55
56struct gtp1u_packet {
57 struct gtp1_header_long gtp1u_h;
58 struct gtp_ie ie;
59} __packed;
60
Pablo Neira459aa662016-05-09 00:55:48 +020061#define GTP1_F_NPDU 0x01
62#define GTP1_F_SEQ 0x02
63#define GTP1_F_EXTHDR 0x04
64#define GTP1_F_MASK 0x07
65
66#endif