blob: c4ad8f938ec79f5c41123e27a8c1de820b2cddd6 [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
3 * Copyright (c) 2017 Intel Corporation
4 * Copyright (c) 2019, Infosys Ltd.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef __S11_STRUCTS_H_
20#define __S11_STRUCTS_H_
21
22#include <stdlib.h>
23#include <arpa/inet.h>
24#include <unistd.h>
25
26#pragma pack(1)
27typedef struct gtpv2c_header {
28 struct gtpc{
29 unsigned char spare :3;
30 unsigned char teidFlg :1;
31 unsigned char piggyback :1;
32 unsigned char version :3;
33 unsigned char message_type;
34 unsigned short len;
35 }gtp;
36 union teid {
37 struct has_teid_t {
38 unsigned int teid;
39 unsigned int seq :24;
40 unsigned int spare :8;
41 } has_teid;
42 struct no_teid_t {
43 unsigned int seq :24;
44 unsigned int spare :8;
45 } no_teid;
46 } teid;
47} gtpv2c_header;
48
49typedef struct fteid {
50 struct fteid_header {
51 unsigned char iface_type :6;
52 unsigned char v6 :1;
53 unsigned char v4 :1;
54 unsigned int teid_gre;
55 } header;
56 union ftied_ip {
57 struct in_addr ipv4;
58 struct in6_addr ipv6;
59 struct ipv4v6_t {
60 struct in_addr ipv4;
61 struct in6_addr ipv6;
62 } ipv4v6;
63 } ip;
64} fteid_t;
65
66struct PAA {
67 uint8_t pdn_type;
68 union ip_type {
69 struct in_addr ipv4;
70 struct ipv6_t {
71 uint8_t prefix_length;
72 struct in6_addr ipv6;
73 } ipv6;
74 struct paa_ipv4v6_t {
75 uint8_t prefix_length;
76 struct in6_addr ipv6;
77 struct in_addr ipv4;
78 } paa_ipv4v6;
79 } ip_type;
80};
81
82struct gtp_cause {
83 unsigned char cause;
84 unsigned char data;
85};
86
87struct bearer_ctx {
88 unsigned char eps_bearer_id;
89 struct gtp_cause cause;
90 struct fteid s1u_sgw_teid;
91 struct fteid s5s8_pgw_u_teid;
92};
93
94struct ARP {
95 uint8_t prioLevel :4;
96 uint8_t preEmptionCapab :1;
97 uint8_t preEmptionVulnebility :1;
98 uint8_t spare :2;
99};
100
101
102struct s11_IE_header {
103 unsigned char ie_type;
104 unsigned short ie_len;
105 unsigned char cr_flag:4;
106 unsigned char instance:4;
107};
108
109union s11_IE_data {
110 struct gtp_cause cause;
111 struct fteid s11_sgw_fteid;
112 struct fteid s5s8_pgw_c_fteid;
113 struct PAA pdn_addr;
114 struct bearer_ctx bearer;
115};
116
117struct s11_IE {
118 struct s11_IE_header header;
119 union s11_IE_data data;
120};
121
122struct s11_proto_IE {
123 unsigned short message_type;
124 unsigned short no_of_ies;
125 struct s11_IE *s11_ies;
126};
127
128#pragma pack()
129
130#endif /* S11_STRUCTS_H */