Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Pablo Neira | 459aa66 | 2016-05-09 00:55:48 +0200 | [diff] [blame] | 2 | #ifndef _GTP_H_ |
Colin Ian King | 9b8ac4f | 2016-07-24 19:24:09 +0100 | [diff] [blame] | 3 | #define _GTP_H_ |
Pablo Neira | 459aa66 | 2016-05-09 00:55:48 +0200 | [diff] [blame] | 4 | |
| 5 | /* General GTP protocol related definitions. */ |
| 6 | |
| 7 | #define GTP0_PORT 3386 |
| 8 | #define GTP1U_PORT 2152 |
| 9 | |
Wojciech Drewek | 9af41cc | 2022-03-04 17:40:43 +0100 | [diff] [blame^] | 10 | /* GTP messages types */ |
| 11 | #define GTP_ECHO_REQ 1 /* Echo Request */ |
| 12 | #define GTP_ECHO_RSP 2 /* Echo Response */ |
Pablo Neira | 459aa66 | 2016-05-09 00:55:48 +0200 | [diff] [blame] | 13 | #define GTP_TPDU 255 |
| 14 | |
Wojciech Drewek | 9af41cc | 2022-03-04 17:40:43 +0100 | [diff] [blame^] | 15 | #define GTPIE_RECOVERY 14 |
| 16 | |
Pablo Neira | 459aa66 | 2016-05-09 00:55:48 +0200 | [diff] [blame] | 17 | struct 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 | |
| 28 | struct 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 Drewek | 9af41cc | 2022-03-04 17:40:43 +0100 | [diff] [blame^] | 35 | struct 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 */ |
| 46 | struct gtp_ie { |
| 47 | __u8 tag; |
| 48 | __u8 val; |
| 49 | } __packed; |
| 50 | |
| 51 | struct gtp0_packet { |
| 52 | struct gtp0_header gtp0_h; |
| 53 | struct gtp_ie ie; |
| 54 | } __packed; |
| 55 | |
| 56 | struct gtp1u_packet { |
| 57 | struct gtp1_header_long gtp1u_h; |
| 58 | struct gtp_ie ie; |
| 59 | } __packed; |
| 60 | |
Pablo Neira | 459aa66 | 2016-05-09 00:55:48 +0200 | [diff] [blame] | 61 | #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 |