blob: e3b2467e6d268f3ba1c0dde17eec5ffdf128c674 [file] [log] [blame]
Harald Welte288be162010-05-01 16:48:27 +02001#ifndef _SGSN_H
2#define _SGSN_H
3
4#include <sys/types.h>
5
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +01006#include <osmocom/core/msgb.h>
Harald Welte288be162010-05-01 16:48:27 +02007
8#include <openbsc/gprs_ns.h>
Harald Welte6abf94e2010-05-18 10:35:06 +02009#include <openbsc/gprs_sgsn.h>
Harald Welte288be162010-05-01 16:48:27 +020010
11struct sgsn_config {
12 /* parsed from config file */
Harald Welte288be162010-05-01 16:48:27 +020013
Harald Welte2720e732010-05-17 00:44:57 +020014 char *gtp_statedir;
15 struct sockaddr_in gtp_listenaddr;
16
Harald Welte288be162010-05-01 16:48:27 +020017 /* misc */
18 struct gprs_ns_inst *nsi;
19};
20
Harald Welte2720e732010-05-17 00:44:57 +020021struct sgsn_instance {
22 char *config_file;
23 struct sgsn_config cfg;
24 /* File descriptor wrappers for LibGTP */
25 struct bsc_fd gtp_fd0;
26 struct bsc_fd gtp_fd1c;
27 struct bsc_fd gtp_fd1u;
28 /* Timer for libGTP */
29 struct timer_list gtp_timer;
30 /* GSN instance for libgtp */
31 struct gsn_t *gsn;
32};
33
Harald Welte8fc1a462010-05-17 00:53:10 +020034extern struct sgsn_instance *sgsn;
Harald Welte288be162010-05-01 16:48:27 +020035
36/* sgsn_vty.c */
37
38int sgsn_vty_init(void);
39int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg);
40
41/* sgsn.c */
42
43/* Main input function for Gb proxy */
44int sgsn_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci);
45
Harald Welte6abf94e2010-05-18 10:35:06 +020046
Harald Welte77289c22010-05-18 14:32:29 +020047struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
Harald Welte6abf94e2010-05-18 10:35:06 +020048 struct sgsn_mm_ctx *mmctx,
49 uint16_t nsapi,
50 struct tlv_parsed *tp);
Harald Welte77289c22010-05-18 14:32:29 +020051int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx);
52
Harald Welteebabdea2010-06-01 18:28:10 +020053/* gprs_sndcp.c */
54
55/* Entry point for the SNSM-ACTIVATE.indication */
56int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi);
Harald Weltece22f922010-06-03 21:21:21 +020057/* Entry point for the SNSM-DEACTIVATE.indication */
58int sndcp_sm_deactivate_ind(struct gprs_llc_lle *lle, uint8_t nsapi);
Harald Welteebabdea2010-06-01 18:28:10 +020059/* Called by SNDCP when it has received/re-assembled a N-PDU */
Harald Welte8911cef2010-07-01 19:56:19 +020060int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi,
61 struct msgb *msg, uint32_t npdu_len, uint8_t *npdu);
Harald Weltebb1c8052010-06-03 06:38:38 +020062int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi,
63 void *mmcontext);
Harald Welteebabdea2010-06-01 18:28:10 +020064
Harald Welte288be162010-05-01 16:48:27 +020065#endif