Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 1 | #ifndef _SGSN_H |
| 2 | #define _SGSN_H |
| 3 | |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 4 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 5 | #include <osmocom/core/msgb.h> |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 6 | |
Harald Welte | ea34a4e | 2012-06-16 14:59:56 +0800 | [diff] [blame^] | 7 | #include <osmocom/gprs/gprs_ns.h> |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 8 | #include <openbsc/gprs_sgsn.h> |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 9 | |
| 10 | struct sgsn_config { |
| 11 | /* parsed from config file */ |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 12 | |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 13 | char *gtp_statedir; |
| 14 | struct sockaddr_in gtp_listenaddr; |
| 15 | |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 16 | /* misc */ |
| 17 | struct gprs_ns_inst *nsi; |
| 18 | }; |
| 19 | |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 20 | struct sgsn_instance { |
| 21 | char *config_file; |
| 22 | struct sgsn_config cfg; |
| 23 | /* File descriptor wrappers for LibGTP */ |
Pablo Neira Ayuso | 4db9299 | 2011-05-06 12:11:23 +0200 | [diff] [blame] | 24 | struct osmo_fd gtp_fd0; |
| 25 | struct osmo_fd gtp_fd1c; |
| 26 | struct osmo_fd gtp_fd1u; |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 27 | /* Timer for libGTP */ |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 28 | struct osmo_timer_list gtp_timer; |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 29 | /* GSN instance for libgtp */ |
| 30 | struct gsn_t *gsn; |
| 31 | }; |
| 32 | |
Harald Welte | 8fc1a46 | 2010-05-17 00:53:10 +0200 | [diff] [blame] | 33 | extern struct sgsn_instance *sgsn; |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 34 | |
| 35 | /* sgsn_vty.c */ |
| 36 | |
| 37 | int sgsn_vty_init(void); |
| 38 | int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg); |
| 39 | |
| 40 | /* sgsn.c */ |
| 41 | |
| 42 | /* Main input function for Gb proxy */ |
| 43 | int sgsn_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci); |
| 44 | |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 45 | |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 46 | struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 47 | struct sgsn_mm_ctx *mmctx, |
| 48 | uint16_t nsapi, |
| 49 | struct tlv_parsed *tp); |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 50 | int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx); |
| 51 | |
Harald Welte | ebabdea | 2010-06-01 18:28:10 +0200 | [diff] [blame] | 52 | /* gprs_sndcp.c */ |
| 53 | |
| 54 | /* Entry point for the SNSM-ACTIVATE.indication */ |
| 55 | int sndcp_sm_activate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); |
Harald Welte | ce22f92 | 2010-06-03 21:21:21 +0200 | [diff] [blame] | 56 | /* Entry point for the SNSM-DEACTIVATE.indication */ |
| 57 | int sndcp_sm_deactivate_ind(struct gprs_llc_lle *lle, uint8_t nsapi); |
Harald Welte | ebabdea | 2010-06-01 18:28:10 +0200 | [diff] [blame] | 58 | /* Called by SNDCP when it has received/re-assembled a N-PDU */ |
Harald Welte | 8911cef | 2010-07-01 19:56:19 +0200 | [diff] [blame] | 59 | int sgsn_rx_sndcp_ud_ind(struct gprs_ra_id *ra_id, int32_t tlli, uint8_t nsapi, |
| 60 | struct msgb *msg, uint32_t npdu_len, uint8_t *npdu); |
Harald Welte | bb1c805 | 2010-06-03 06:38:38 +0200 | [diff] [blame] | 61 | int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, |
| 62 | void *mmcontext); |
Holger Hans Peter Freyther | 3dccda5 | 2011-10-14 23:42:13 +0200 | [diff] [blame] | 63 | int sndcp_llunitdata_ind(struct msgb *msg, struct gprs_llc_lle *lle, |
| 64 | uint8_t *hdr, uint16_t len); |
Harald Welte | ebabdea | 2010-06-01 18:28:10 +0200 | [diff] [blame] | 65 | |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 66 | #endif |