Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 1 | #ifndef _SGSN_H |
| 2 | #define _SGSN_H |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame^] | 6 | #include <osmocom/core/msgb.h> |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 7 | |
| 8 | #include <openbsc/gprs_ns.h> |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 9 | #include <openbsc/gprs_sgsn.h> |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 10 | |
| 11 | struct sgsn_config { |
| 12 | /* parsed from config file */ |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 13 | |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 14 | char *gtp_statedir; |
| 15 | struct sockaddr_in gtp_listenaddr; |
| 16 | |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 17 | /* misc */ |
| 18 | struct gprs_ns_inst *nsi; |
| 19 | }; |
| 20 | |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 21 | struct 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 Welte | 8fc1a46 | 2010-05-17 00:53:10 +0200 | [diff] [blame] | 34 | extern struct sgsn_instance *sgsn; |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 35 | |
| 36 | /* sgsn_vty.c */ |
| 37 | |
| 38 | int sgsn_vty_init(void); |
| 39 | int sgsn_parse_config(const char *config_file, struct sgsn_config *cfg); |
| 40 | |
| 41 | /* sgsn.c */ |
| 42 | |
| 43 | /* Main input function for Gb proxy */ |
| 44 | int sgsn_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci); |
| 45 | |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 46 | |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 47 | 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] | 48 | struct sgsn_mm_ctx *mmctx, |
| 49 | uint16_t nsapi, |
| 50 | struct tlv_parsed *tp); |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 51 | int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx); |
| 52 | |
Harald Welte | ebabdea | 2010-06-01 18:28:10 +0200 | [diff] [blame] | 53 | /* gprs_sndcp.c */ |
| 54 | |
| 55 | /* Entry point for the SNSM-ACTIVATE.indication */ |
| 56 | 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] | 57 | /* Entry point for the SNSM-DEACTIVATE.indication */ |
| 58 | 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] | 59 | /* Called by SNDCP when it has received/re-assembled a N-PDU */ |
Harald Welte | 8911cef | 2010-07-01 19:56:19 +0200 | [diff] [blame] | 60 | int 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 Welte | bb1c805 | 2010-06-03 06:38:38 +0200 | [diff] [blame] | 62 | int sndcp_unitdata_req(struct msgb *msg, struct gprs_llc_lle *lle, uint8_t nsapi, |
| 63 | void *mmcontext); |
Harald Welte | ebabdea | 2010-06-01 18:28:10 +0200 | [diff] [blame] | 64 | |
Harald Welte | 288be16 | 2010-05-01 16:48:27 +0200 | [diff] [blame] | 65 | #endif |