blob: 7417f08317eb1bbd4e814dba8560b107500d830b [file] [log] [blame]
jjako52c24142002-12-16 13:33:51 +00001/*
2 * OpenGGSN - Gateway GPRS Support Node
jjako0fe0df02004-09-17 11:30:40 +00003 * Copyright (C) 2002, 2003, 2004 Mondru AB.
jjako52c24142002-12-16 13:33:51 +00004 *
5 * The contents of this file may be used under the terms of the GNU
6 * General Public License Version 2, provided that the above copyright
7 * notice and this permission notice is included in all copies or
8 * substantial portions of the software.
9 *
jjako52c24142002-12-16 13:33:51 +000010 */
11
12#ifndef _GTP_H
13#define _GTP_H
14
Harald Weltebed35df2011-11-02 13:06:18 +010015#define GTP_DEBUG 0 /* Print debug information */
jjako2e840a32003-01-28 16:05:18 +000016
jjako1db1c812003-07-06 20:53:57 +000017#define GTP_MODE_GGSN 1
18#define GTP_MODE_SGSN 2
19
jjako52c24142002-12-16 13:33:51 +000020#define GTP0_PORT 3386
21#define GTP1C_PORT 2123
22#define GTP1U_PORT 2152
23#define PACKET_MAX 8196
24
Harald Weltebed35df2011-11-02 13:06:18 +010025#define GTP_MAX 0xffff /* TODO: Choose right number */
jjako52c24142002-12-16 13:33:51 +000026#define GTP0_HEADER_SIZE 20
27#define GTP1_HEADER_SIZE_SHORT 8
28#define GTP1_HEADER_SIZE_LONG 12
29
30#define SYSLOG_PRINTSIZE 255
31#define ERRMSG_SIZE 255
32
33#define RESTART_FILE "gsn_restart"
34#define NAMESIZE 1024
35
jjako2c381332003-10-21 19:09:53 +000036/* GTP version 1 extension header type definitions. */
Harald Weltebed35df2011-11-02 13:06:18 +010037#define GTP_EXT_PDCP_PDU 0xC0 /* PDCP PDU Number */
jjako2c381332003-10-21 19:09:53 +000038
jjako52c24142002-12-16 13:33:51 +000039/* GTP version 1 message type definitions. Also covers version 0 except *
40 * for anonymous PDP context which was superceded in version 1 */
41
42/* 0 For future use. */
Harald Weltebed35df2011-11-02 13:06:18 +010043#define GTP_ECHO_REQ 1 /* Echo Request */
44#define GTP_ECHO_RSP 2 /* Echo Response */
45#define GTP_NOT_SUPPORTED 3 /* Version Not Supported */
46#define GTP_ALIVE_REQ 4 /* Node Alive Request */
47#define GTP_ALIVE_RSP 5 /* Node Alive Response */
48#define GTP_REDIR_REQ 6 /* Redirection Request */
49#define GTP_REDIR_RSP 7 /* Redirection Response */
jjako52c24142002-12-16 13:33:51 +000050/* 8-15 For future use. */
Harald Weltebed35df2011-11-02 13:06:18 +010051#define GTP_CREATE_PDP_REQ 16 /* Create PDP Context Request */
52#define GTP_CREATE_PDP_RSP 17 /* Create PDP Context Response */
53#define GTP_UPDATE_PDP_REQ 18 /* Update PDP Context Request */
54#define GTP_UPDATE_PDP_RSP 19 /* Update PDP Context Response */
55#define GTP_DELETE_PDP_REQ 20 /* Delete PDP Context Request */
56#define GTP_DELETE_PDP_RSP 21 /* Delete PDP Context Response */
57 /* 22-25 For future use. *//* In version GTP 1 anonomous PDP context */
58#define GTP_ERROR 26 /* Error Indication */
59#define GTP_PDU_NOT_REQ 27 /* PDU Notification Request */
60#define GTP_PDU_NOT_RSP 28 /* PDU Notification Response */
61#define GTP_PDU_NOT_REJ_REQ 29 /* PDU Notification Reject Request */
62#define GTP_PDU_NOT_REJ_RSP 30 /* PDU Notification Reject Response */
63#define GTP_SUPP_EXT_HEADER 31 /* Supported Extension Headers Notification */
64#define GTP_SND_ROUTE_REQ 32 /* Send Routeing Information for GPRS Request */
65#define GTP_SND_ROUTE_RSP 33 /* Send Routeing Information for GPRS Response */
66#define GTP_FAILURE_REQ 34 /* Failure Report Request */
67#define GTP_FAILURE_RSP 35 /* Failure Report Response */
68#define GTP_MS_PRESENT_REQ 36 /* Note MS GPRS Present Request */
69#define GTP_MS_PRESENT_RSP 37 /* Note MS GPRS Present Response */
70/* 38-47 For future use. */
71#define GTP_IDEN_REQ 48 /* Identification Request */
72#define GTP_IDEN_RSP 49 /* Identification Response */
73#define GTP_SGSN_CONTEXT_REQ 50 /* SGSN Context Request */
74#define GTP_SGSN_CONTEXT_RSP 51 /* SGSN Context Response */
75#define GTP_SGSN_CONTEXT_ACK 52 /* SGSN Context Acknowledge */
76#define GTP_FWD_RELOC_REQ 53 /* Forward Relocation Request */
77#define GTP_FWD_RELOC_RSP 54 /* Forward Relocation Response */
78#define GTP_FWD_RELOC_COMPL 55 /* Forward Relocation Complete */
79#define GTP_RELOC_CANCEL_REQ 56 /* Relocation Cancel Request */
80#define GTP_RELOC_CANCEL_RSP 57 /* Relocation Cancel Response */
81#define GTP_FWD_SRNS 58 /* Forward SRNS Context */
82#define GTP_FWD_RELOC_ACK 59 /* Forward Relocation Complete Acknowledge */
83#define GTP_FWD_SRNS_ACK 60 /* Forward SRNS Context Acknowledge */
jjako52c24142002-12-16 13:33:51 +000084/* 61-239 For future use. */
Harald Weltebed35df2011-11-02 13:06:18 +010085#define GTP_DATA_TRAN_REQ 240 /* Data Record Transfer Request */
86#define GTP_DATA_TRAN_RSP 241 /* Data Record Transfer Response */
jjako52c24142002-12-16 13:33:51 +000087/* 242-254 For future use. */
Harald Weltebed35df2011-11-02 13:06:18 +010088#define GTP_GPDU 255 /* G-PDU */
jjako08d331d2003-10-13 20:33:30 +000089
90/* GTP information element cause codes from 29.060 v3.9.0 7.7 */
91/* */
Harald Weltebed35df2011-11-02 13:06:18 +010092#define GTPCAUSE_REQ_IMSI 0 /* Request IMSI */
93#define GTPCAUSE_REQ_IMEI 1 /* Request IMEI */
94#define GTPCAUSE_REQ_IMSI_IMEI 2 /* Request IMSI and IMEI */
95#define GTPCAUSE_NO_ID_NEEDED 3 /* No identity needed */
96#define GTPCAUSE_MS_REFUSES_X 4 /* MS refuses */
97#define GTPCAUSE_MS_NOT_RESP_X 5 /* MS is not GPRS responding */
98#define GTPCAUSE_006 6 /* For future use 6-48 */
99#define GTPCAUSE_049 49 /* Cause values reserved for GPRS charging protocol use (See GTP' in GSM 12.15) 49-63 */
100#define GTPCAUSE_064 64 /* For future use 64-127 */
101#define GTPCAUSE_ACC_REQ 128 /* Request accepted */
102#define GTPCAUSE_129 129 /* For future use 129-176 */
103#define GTPCAUSE_177 177 /* Cause values reserved for GPRS charging protocol use (See GTP' In GSM 12.15) 177-191 */
104#define GTPCAUSE_NON_EXIST 192 /* Non-existent */
105#define GTPCAUSE_INVALID_MESSAGE 193 /* Invalid message format */
106#define GTPCAUSE_IMSI_NOT_KNOWN 194 /* IMSI not known */
107#define GTPCAUSE_MS_DETACHED 195 /* MS is GPRS detached */
108#define GTPCAUSE_MS_NOT_RESP 196 /* MS is not GPRS responding */
109#define GTPCAUSE_MS_REFUSES 197 /* MS refuses */
110#define GTPCAUSE_198 198 /* For future use */
111#define GTPCAUSE_NO_RESOURCES 199 /* No resources available */
112#define GTPCAUSE_NOT_SUPPORTED 200 /* Service not supported */
113#define GTPCAUSE_MAN_IE_INCORRECT 201 /* Mandatory IE incorrect */
114#define GTPCAUSE_MAN_IE_MISSING 202 /* Mandatory IE missing */
115#define GTPCAUSE_OPT_IE_INCORRECT 203 /* Optional IE incorrect */
116#define GTPCAUSE_SYS_FAIL 204 /* System failure */
117#define GTPCAUSE_ROAMING_REST 205 /* Roaming Restriction */
118#define GTPCAUSE_PTIMSI_MISMATCH 206 /* P-TMSI signature mismatch */
119#define GTPCAUSE_CONN_SUSP 207 /* GPRS connection suspended */
120#define GTPCAUSE_AUTH_FAIL 208 /* Authentication failure */
121#define GTPCAUSE_USER_AUTH_FAIL 209 /* User authentication failed */
122#define GTPCAUSE_CONTEXT_NOT_FOUND 210 /* Context not found */
123#define GTPCAUSE_ADDR_OCCUPIED 211 /* All dynamic PDP addresses are occupied */
124#define GTPCAUSE_NO_MEMORY 212 /* No memory is available */
125#define GTPCAUSE_RELOC_FAIL 213 /* Relocation failure */
126#define GTPCAUSE_UNKNOWN_MAN_EXTHEADER 214 /* Unknown mandatory extension header */
127#define GTPCAUSE_SEM_ERR_TFT 215 /* Semantic error in the TFT operation */
128#define GTPCAUSE_SYN_ERR_TFT 216 /* Syntactic error in the TFT operation */
129#define GTPCAUSE_SEM_ERR_FILTER 217 /* Semantic errors in packet filter(s) */
130#define GTPCAUSE_SYN_ERR_FILTER 218 /* Syntactic errors in packet filter(s) */
131#define GTPCAUSE_MISSING_APN 219 /* Missing or unknown APN */
132#define GTPCAUSE_UNKNOWN_PDP 220 /* Unknown PDP address or PDP type */
133#define GTPCAUSE_221 221 /* For Future Use 221-240 */
134#define GTPCAUSE_241 241 /* Cause Values Reserved For Gprs Charging Protocol Use (See Gtp' In Gsm 12.15) 241-255 */
jjako08d331d2003-10-13 20:33:30 +0000135
jjako52c24142002-12-16 13:33:51 +0000136/* GTP 0 header.
137 * Explanation to some of the fields:
138 * SNDCP NPDU Number flag = 0 except for inter SGSN handover situations
139 * SNDCP N-PDU LCC Number 0 = 0xff except for inter SGSN handover situations
140 * Sequence number. Used for reliable delivery of signalling messages, and
141 * to discard "illegal" data messages.
142 * Flow label. Is used to point a particular PDP context. Is used in data
143 * messages as well as signalling messages related to a particular context.
144 * Tunnel ID is IMSI+NSAPI. Unique identifier of PDP context. Is somewhat
145 * redundant because the header also includes flow. */
146
Harald Weltebed35df2011-11-02 13:06:18 +0100147struct gtp0_header { /* Descriptions from 3GPP 09.60 */
148 uint8_t flags; /* 01 bitfield, with typical values */
149 /* 000..... Version: 1 (0) */
150 /* ...1111. Spare (7) */
151 /* .......0 SNDCP N-PDU Number flag (0) */
152 uint8_t type; /* 02 Message type. T-PDU = 0xff */
153 uint16_t length; /* 03 Length (of G-PDU excluding header) */
154 uint16_t seq; /* 05 Sequence Number */
155 uint16_t flow; /* 07 Flow Label ( = 0 for signalling) */
156 uint8_t number; /* 09 SNDCP N-PDU LCC Number ( 0 = 0xff) */
157 uint8_t spare1; /* 10 Spare */
158 uint8_t spare2; /* 11 Spare */
159 uint8_t spare3; /* 12 Spare */
160 uint64_t tid; /* 13 Tunnel ID */
161}; /* 20 */
jjako52c24142002-12-16 13:33:51 +0000162
Harald Weltebed35df2011-11-02 13:06:18 +0100163struct gtp1_header_short { /* Descriptions from 3GPP 29060 */
164 uint8_t flags; /* 01 bitfield, with typical values */
165 /* 001..... Version: 1 */
166 /* ...1.... Protocol Type: GTP=1, GTP'=0 */
167 /* ....0... Spare = 0 */
168 /* .....0.. Extension header flag: 0 */
169 /* ......0. Sequence number flag: 0 */
170 /* .......0 PN: N-PDU Number flag */
171 uint8_t type; /* 02 Message type. T-PDU = 0xff */
172 uint16_t length; /* 03 Length (of IP packet or signalling) */
173 uint32_t tei; /* 05 - 08 Tunnel Endpoint ID */
jjako52c24142002-12-16 13:33:51 +0000174};
175
Harald Weltebed35df2011-11-02 13:06:18 +0100176struct gtp1_header_long { /* Descriptions from 3GPP 29060 */
177 uint8_t flags; /* 01 bitfield, with typical values */
178 /* 001..... Version: 1 */
179 /* ...1.... Protocol Type: GTP=1, GTP'=0 */
180 /* ....0... Spare = 0 */
181 /* .....0.. Extension header flag: 0 */
182 /* ......1. Sequence number flag: 1 */
183 /* .......0 PN: N-PDU Number flag */
184 uint8_t type; /* 02 Message type. T-PDU = 0xff */
185 uint16_t length; /* 03 Length (of IP packet or signalling) */
186 uint32_t tei; /* 05 Tunnel Endpoint ID */
187 uint16_t seq; /* 10 Sequence Number */
188 uint8_t npdu; /* 11 N-PDU Number */
189 uint8_t next; /* 12 Next extension header type. Empty = 0 */
jjako52c24142002-12-16 13:33:51 +0000190};
191
192struct gtp0_packet {
Harald Weltebed35df2011-11-02 13:06:18 +0100193 struct gtp0_header h;
194 uint8_t p[GTP_MAX];
195} __attribute__ ((packed));
jjako52c24142002-12-16 13:33:51 +0000196
197struct gtp1_packet_short {
Harald Weltebed35df2011-11-02 13:06:18 +0100198 struct gtp1_header_short h;
199 uint8_t p[GTP_MAX];
200} __attribute__ ((packed));
jjako52c24142002-12-16 13:33:51 +0000201
202struct gtp1_packet_long {
Harald Weltebed35df2011-11-02 13:06:18 +0100203 struct gtp1_header_long h;
204 uint8_t p[GTP_MAX];
205} __attribute__ ((packed));
jjako52c24142002-12-16 13:33:51 +0000206
207union gtp_packet {
Harald Weltebed35df2011-11-02 13:06:18 +0100208 uint8_t flags;
209 struct gtp0_packet gtp0;
210 struct gtp1_packet_short gtp1s;
211 struct gtp1_packet_long gtp1l;
212} __attribute__ ((packed));
jjako52c24142002-12-16 13:33:51 +0000213
214/* ***********************************************************
215 * Information storage for each gsn instance
216 *
217 * Normally each instance of the application corresponds to
218 * one instance of a gsn.
219 *
220 * In order to avoid global variables in the application, and
221 * also in order to allow several instances of a gsn in the same
222 * application this struct is provided in order to store all
223 * relevant information related to the gsn.
224 *
225 * Note that this does not include information storage for '
226 * each pdp context. This is stored in another struct.
227 *************************************************************/
228
229struct gsn_t {
Harald Weltebed35df2011-11-02 13:06:18 +0100230 /* Parameters related to the network interface */
jjako52c24142002-12-16 13:33:51 +0000231
Harald Weltebed35df2011-11-02 13:06:18 +0100232 int fd0; /* GTP0 file descriptor */
233 int fd1c; /* GTP1 control plane file descriptor */
234 int fd1u; /* GTP0 user plane file descriptor */
235 int mode; /* Mode of operation: GGSN or SGSN */
236 struct in_addr gsnc; /* IP address of this gsn for signalling */
237 struct in_addr gsnu; /* IP address of this gsn for user traffic */
jjako52c24142002-12-16 13:33:51 +0000238
Harald Weltebed35df2011-11-02 13:06:18 +0100239 /* Parameters related to signalling messages */
240 uint16_t seq_next; /* Next sequence number to use */
241 int seq_first; /* First packet in queue (oldest timeout) */
242 int seq_last; /* Last packet in queue (youngest timeout) */
jjako52c24142002-12-16 13:33:51 +0000243
Harald Weltebed35df2011-11-02 13:06:18 +0100244 unsigned char restart_counter; /* Increment on restart. Stored on disk */
245 char *statedir; /* Disk location for permanent storage */
jjako52c24142002-12-16 13:33:51 +0000246
Harald Weltebed35df2011-11-02 13:06:18 +0100247 struct queue_t *queue_req; /* Request queue */
248 struct queue_t *queue_resp; /* Response queue */
jjako52c24142002-12-16 13:33:51 +0000249
Harald Weltebed35df2011-11-02 13:06:18 +0100250 /* Call back functions */
251 int (*cb_delete_context) (struct pdp_t *);
252 int (*cb_create_context_ind) (struct pdp_t *);
253 int (*cb_unsup_ind) (struct sockaddr_in * peer);
254 int (*cb_extheader_ind) (struct sockaddr_in * peer);
255 int (*cb_conf) (int type, int cause, struct pdp_t * pdp, void *cbp);
256 int (*cb_data_ind) (struct pdp_t * pdp, void *pack, unsigned len);
257 int (*cb_recovery) (struct sockaddr_in * peer, uint8_t recovery);
jjako52c24142002-12-16 13:33:51 +0000258
Harald Weltebed35df2011-11-02 13:06:18 +0100259 /* Counters */
jjako52c24142002-12-16 13:33:51 +0000260
Harald Weltebed35df2011-11-02 13:06:18 +0100261 uint64_t err_socket; /* Number of socket errors */
262 uint64_t err_readfrom; /* Number of readfrom errors */
263 uint64_t err_sendto; /* Number of sendto errors */
264 uint64_t err_memcpy; /* Number of memcpy */
265 uint64_t err_queuefull; /* Number of times queue was full */
266 uint64_t err_seq; /* Number of seq out of range */
267 uint64_t err_address; /* GSN address conversion failed */
268 uint64_t err_unknownpdp; /* GSN address conversion failed */
269 uint64_t err_unknowntid; /* Application supplied unknown imsi+nsapi */
270 uint64_t err_cause; /* Unexpected cause value received */
271 uint64_t err_outofpdp; /* Out of storage for PDP contexts */
272
273 uint64_t empty; /* Number of empty packets */
274 uint64_t unsup; /* Number of unsupported version 29.60 11.1.1 */
275 uint64_t tooshort; /* Number of too short headers 29.60 11.1.2 */
276 uint64_t unknown; /* Number of unknown messages 29.60 11.1.3 */
277 uint64_t unexpect; /* Number of unexpected messages 29.60 11.1.4 */
278 uint64_t dublicate; /* Number of dublicate or unsolicited replies */
279 uint64_t missing; /* Number of missing information field messages */
280 uint64_t incorrect; /* Number of incorrect information field messages */
281 uint64_t invalid; /* Number of invalid message format messages */
jjako52c24142002-12-16 13:33:51 +0000282};
283
jjako52c24142002-12-16 13:33:51 +0000284/* External API functions */
285
Harald Weltebed35df2011-11-02 13:06:18 +0100286extern const char *gtp_version();
jjako1db1c812003-07-06 20:53:57 +0000287extern int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen,
288 int mode);
289
jjako52c24142002-12-16 13:33:51 +0000290extern int gtp_free(struct gsn_t *gsn);
291
292extern int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp,
293 uint64_t imsi, uint8_t nsapi);
294extern int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp);
295
Harald Weltebed35df2011-11-02 13:06:18 +0100296extern int gtp_create_context_req(struct gsn_t *gsn, struct pdp_t *pdp,
jjako193e8b12003-11-10 12:31:41 +0000297 void *cbp);
jjako52c24142002-12-16 13:33:51 +0000298
jjako08d331d2003-10-13 20:33:30 +0000299extern int gtp_set_cb_create_context_ind(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100300 int (*cb_create_context_ind) (struct
301 pdp_t *
302 pdp));
jjako1db1c812003-07-06 20:53:57 +0000303
Harald Weltebed35df2011-11-02 13:06:18 +0100304extern int gtp_create_context_resp(struct gsn_t *gsn, struct pdp_t *pdp,
jjako08d331d2003-10-13 20:33:30 +0000305 int cause);
306
Harald Weltebed35df2011-11-02 13:06:18 +0100307extern int gtp_update_context(struct gsn_t *gsn, struct pdp_t *pdp,
308 void *cbp, struct in_addr *inetaddr);
jjako08d331d2003-10-13 20:33:30 +0000309
Harald Weltebed35df2011-11-02 13:06:18 +0100310extern int gtp_delete_context_req(struct gsn_t *gsn, struct pdp_t *pdp,
jjako2c381332003-10-21 19:09:53 +0000311 void *cbp, int teardown);
jjako08d331d2003-10-13 20:33:30 +0000312
313extern int gtp_data_req(struct gsn_t *gsn, struct pdp_t *pdp,
314 void *pack, unsigned len);
315
316extern int gtp_set_cb_data_ind(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100317 int (*cb_data_ind) (struct pdp_t * pdp,
318 void *pack, unsigned len));
jjako52c24142002-12-16 13:33:51 +0000319
320extern int gtp_fd(struct gsn_t *gsn);
jjako08d331d2003-10-13 20:33:30 +0000321extern int gtp_decaps0(struct gsn_t *gsn);
322extern int gtp_decaps1c(struct gsn_t *gsn);
323extern int gtp_decaps1u(struct gsn_t *gsn);
jjako52c24142002-12-16 13:33:51 +0000324extern int gtp_retrans(struct gsn_t *gsn);
325extern int gtp_retranstimeout(struct gsn_t *gsn, struct timeval *timeout);
326
Harald Weltebed35df2011-11-02 13:06:18 +0100327extern int gtp_set_cb_delete_context(struct gsn_t *gsn,
328 int (*cb_delete_context) (struct pdp_t *
329 pdp));
jjako08d331d2003-10-13 20:33:30 +0000330/*extern int gtp_set_cb_create_context(struct gsn_t *gsn,
331 int (*cb_create_context) (struct pdp_t* pdp)); */
332
333extern int gtp_set_cb_unsup_ind(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100334 int (*cb) (struct sockaddr_in * peer));
jjako08d331d2003-10-13 20:33:30 +0000335
jjako2c381332003-10-21 19:09:53 +0000336extern int gtp_set_cb_extheader_ind(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100337 int (*cb) (struct sockaddr_in * peer));
jjako08d331d2003-10-13 20:33:30 +0000338
jjako52c24142002-12-16 13:33:51 +0000339extern int gtp_set_cb_conf(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100340 int (*cb) (int type, int cause, struct pdp_t * pdp,
341 void *cbp));
jjako52c24142002-12-16 13:33:51 +0000342
Harald Welte629e9862010-12-24 20:58:09 +0100343int gtp_set_cb_recovery(struct gsn_t *gsn,
Harald Weltebed35df2011-11-02 13:06:18 +0100344 int (*cb) (struct sockaddr_in * peer,
345 uint8_t recovery));
jjako52c24142002-12-16 13:33:51 +0000346
347/* Internal functions (not part of the API */
348
jjako08d331d2003-10-13 20:33:30 +0000349extern int gtp_echo_req(struct gsn_t *gsn, int version, void *cbp,
350 struct in_addr *inetaddrs);
Harald Weltebed35df2011-11-02 13:06:18 +0100351extern int gtp_echo_resp(struct gsn_t *gsn, int version,
jjako08d331d2003-10-13 20:33:30 +0000352 struct sockaddr_in *peer, int fd,
jjako52c24142002-12-16 13:33:51 +0000353 void *pack, unsigned len);
Harald Weltebed35df2011-11-02 13:06:18 +0100354extern int gtp_echo_ind(struct gsn_t *gsn, int version,
355 struct sockaddr_in *peer, int fd,
jjako52c24142002-12-16 13:33:51 +0000356 void *pack, unsigned len);
Harald Weltebed35df2011-11-02 13:06:18 +0100357extern int gtp_echo_conf(struct gsn_t *gsn, int version,
358 struct sockaddr_in *peer, void *pack, unsigned len);
jjako52c24142002-12-16 13:33:51 +0000359
Harald Weltebed35df2011-11-02 13:06:18 +0100360extern int gtp_unsup_req(struct gsn_t *gsn, int version,
jjako08d331d2003-10-13 20:33:30 +0000361 struct sockaddr_in *peer,
362 int fd, void *pack, unsigned len);
363extern int gtp_unsup_ind(struct gsn_t *gsn, struct sockaddr_in *peer,
364 void *pack, unsigned len);
jjako52c24142002-12-16 13:33:51 +0000365
Harald Weltebed35df2011-11-02 13:06:18 +0100366extern int gtp_create_pdp_resp(struct gsn_t *gsn, int version,
jjako52c24142002-12-16 13:33:51 +0000367 struct pdp_t *pdp, uint8_t cause);
368
369extern int gtp_create_pdp_ind(struct gsn_t *gsn, int version,
jjako08d331d2003-10-13 20:33:30 +0000370 struct sockaddr_in *peer, int fd,
jjako52c24142002-12-16 13:33:51 +0000371 void *pack, unsigned len);
372
373extern int gtp_create_pdp_conf(struct gsn_t *gsn, int version,
374 struct sockaddr_in *peer,
375 void *pack, unsigned len);
376
jjako08d331d2003-10-13 20:33:30 +0000377extern int gtp_update_pdp_req(struct gsn_t *gsn, int version, void *cbp,
Harald Weltebed35df2011-11-02 13:06:18 +0100378 struct in_addr *inetaddr, struct pdp_t *pdp);
jjako52c24142002-12-16 13:33:51 +0000379
jjako08d331d2003-10-13 20:33:30 +0000380extern int gtp_delete_pdp_req(struct gsn_t *gsn, int version, void *cbp,
jjako52c24142002-12-16 13:33:51 +0000381 struct pdp_t *pdp);
382
383extern int gtp_delete_pdp_resp(struct gsn_t *gsn, int version,
jjako08d331d2003-10-13 20:33:30 +0000384 struct sockaddr_in *peer, int fd,
Harald Weltebed35df2011-11-02 13:06:18 +0100385 void *pack, unsigned len,
jjako2c381332003-10-21 19:09:53 +0000386 struct pdp_t *pdp, struct pdp_t *linked_pdp,
387 uint8_t cause, int teardown);
jjako52c24142002-12-16 13:33:51 +0000388
389extern int gtp_delete_pdp_ind(struct gsn_t *gsn, int version,
jjako08d331d2003-10-13 20:33:30 +0000390 struct sockaddr_in *peer, int fd,
jjako52c24142002-12-16 13:33:51 +0000391 void *pack, unsigned len);
392
393extern int gtp_delete_pdp_conf(struct gsn_t *gsn, int version,
394 struct sockaddr_in *peer,
395 void *pack, unsigned len);
396
jjako52c24142002-12-16 13:33:51 +0000397extern int ipv42eua(struct ul66_t *eua, struct in_addr *src);
398extern int eua2ipv4(struct in_addr *dst, struct ul66_t *eua);
399extern int gsna2in_addr(struct in_addr *dst, struct ul16_t *gsna);
400extern int in_addr2gsna(struct ul16_t *gsna, struct in_addr *src);
401
Harald Weltebed35df2011-11-02 13:06:18 +0100402#endif /* !_GTP_H */