Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 1 | #ifndef _GPRS_SGSN_H |
| 2 | #define _GPRS_SGSN_H |
| 3 | |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 4 | #include <stdint.h> |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 5 | #include <netinet/in.h> |
| 6 | |
Holger Hans Peter Freyther | 26d0fe3 | 2012-01-06 17:29:06 +0100 | [diff] [blame] | 7 | #include <osmocom/core/timer.h> |
| 8 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 9 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 10 | |
Harald Welte | 496aee4 | 2010-06-30 19:59:55 +0200 | [diff] [blame] | 11 | #include <osmocom/crypt/gprs_cipher.h> |
| 12 | |
Harald Welte | 2720e73 | 2010-05-17 00:44:57 +0200 | [diff] [blame] | 13 | #define GSM_IMSI_LENGTH 17 |
| 14 | #define GSM_IMEI_LENGTH 17 |
| 15 | #define GSM_EXTENSION_LENGTH 15 |
| 16 | |
Harald Welte | 807a5d8 | 2010-06-01 11:53:01 +0200 | [diff] [blame] | 17 | struct gprs_llc_lle; |
Holger Hans Peter Freyther | a273030 | 2014-03-23 18:08:26 +0100 | [diff] [blame] | 18 | struct ctrl_handle; |
Harald Welte | 807a5d8 | 2010-06-01 11:53:01 +0200 | [diff] [blame] | 19 | |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 20 | /* TS 04.08 4.1.3.3 GMM mobility management states on the network side */ |
| 21 | enum gprs_mm_state { |
| 22 | GMM_DEREGISTERED, /* 4.1.3.3.1.1 */ |
| 23 | GMM_COMMON_PROC_INIT, /* 4.1.3.3.1.2 */ |
| 24 | GMM_REGISTERED_NORMAL, /* 4.1.3.3.2.1 */ |
| 25 | GMM_REGISTERED_SUSPENDED, /* 4.1.3.3.2.2 */ |
| 26 | GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */ |
| 27 | }; |
| 28 | |
Harald Welte | c2e8cc4 | 2010-05-31 20:23:38 +0200 | [diff] [blame] | 29 | enum gprs_mm_ctr { |
Harald Welte | 8acd88f | 2010-05-18 10:57:45 +0200 | [diff] [blame] | 30 | GMM_CTR_PKTS_SIG_IN, |
| 31 | GMM_CTR_PKTS_SIG_OUT, |
| 32 | GMM_CTR_PKTS_UDATA_IN, |
| 33 | GMM_CTR_PKTS_UDATA_OUT, |
| 34 | GMM_CTR_BYTES_UDATA_IN, |
| 35 | GMM_CTR_BYTES_UDATA_OUT, |
| 36 | GMM_CTR_PDP_CTX_ACT, |
| 37 | GMM_CTR_SUSPEND, |
| 38 | GMM_CTR_PAGING_PS, |
| 39 | GMM_CTR_PAGING_CS, |
| 40 | GMM_CTR_RA_UPDATE, |
| 41 | }; |
| 42 | |
Harald Welte | efbdee9 | 2010-06-10 00:20:12 +0200 | [diff] [blame] | 43 | enum gprs_pdp_ctx { |
| 44 | PDP_CTR_PKTS_UDATA_IN, |
| 45 | PDP_CTR_PKTS_UDATA_OUT, |
| 46 | PDP_CTR_BYTES_UDATA_IN, |
| 47 | PDP_CTR_BYTES_UDATA_OUT, |
| 48 | }; |
| 49 | |
Harald Welte | c2e8cc4 | 2010-05-31 20:23:38 +0200 | [diff] [blame] | 50 | enum gprs_t3350_mode { |
Jacob Erlbeck | 93eae8e | 2014-10-28 12:23:29 +0100 | [diff] [blame] | 51 | GMM_T3350_MODE_NONE, |
Harald Welte | c2e8cc4 | 2010-05-31 20:23:38 +0200 | [diff] [blame] | 52 | GMM_T3350_MODE_ATT, |
| 53 | GMM_T3350_MODE_RAU, |
| 54 | GMM_T3350_MODE_PTMSI_REALL, |
| 55 | }; |
| 56 | |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 57 | /* Authorization/ACL handling */ |
| 58 | enum sgsn_auth_state { |
| 59 | SGSN_AUTH_UNKNOWN, |
| 60 | SGSN_AUTH_ACCEPTED, |
| 61 | SGSN_AUTH_REJECTED |
| 62 | }; |
| 63 | |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 64 | #define MS_RADIO_ACCESS_CAPA |
| 65 | |
| 66 | /* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */ |
Harald Welte | f533e13 | 2010-05-01 16:45:46 +0200 | [diff] [blame] | 67 | /* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 68 | struct sgsn_mm_ctx { |
| 69 | struct llist_head list; |
| 70 | |
| 71 | char imsi[GSM_IMSI_LENGTH]; |
| 72 | enum gprs_mm_state mm_state; |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 73 | uint32_t p_tmsi; |
Harald Welte | c2e8cc4 | 2010-05-31 20:23:38 +0200 | [diff] [blame] | 74 | uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */ |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 75 | uint32_t p_tmsi_sig; |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 76 | char imei[GSM_IMEI_LENGTH]; |
Harald Welte | f533e13 | 2010-05-01 16:45:46 +0200 | [diff] [blame] | 77 | /* Opt: Software Version Numbber / TS 23.195 */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 78 | char msisdn[GSM_EXTENSION_LENGTH]; |
| 79 | struct gprs_ra_id ra; |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 80 | uint16_t cell_id; |
| 81 | uint32_t cell_id_age; |
| 82 | uint16_t sac; /* Iu: Service Area Code */ |
| 83 | uint32_t sac_age;/* Iu: Service Area Code age */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 84 | /* VLR number */ |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 85 | uint32_t new_sgsn_addr; |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 86 | /* Authentication Triplets */ |
| 87 | /* Kc */ |
Harald Welte | f533e13 | 2010-05-01 16:45:46 +0200 | [diff] [blame] | 88 | /* Iu: CK, IK, KSI */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 89 | /* CKSN */ |
| 90 | enum gprs_ciph_algo ciph_algo; |
| 91 | struct { |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 92 | uint8_t len; |
Alexander Chemeris | 84402c0 | 2013-07-03 10:12:23 +0400 | [diff] [blame] | 93 | uint8_t buf[50]; /* GSM 04.08 10.5.5.12a, extended in TS 24.008 */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 94 | } ms_radio_access_capa; |
| 95 | struct { |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 96 | uint8_t len; |
Alexander Chemeris | 84402c0 | 2013-07-03 10:12:23 +0400 | [diff] [blame] | 97 | uint8_t buf[8]; /* GSM 04.08 10.5.5.12, extended in TS 24.008 */ |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 98 | } ms_network_capa; |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 99 | uint16_t drx_parms; |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 100 | int mnrg; /* MS reported to HLR? */ |
| 101 | int ngaf; /* MS reported to MSC/VLR? */ |
| 102 | int ppf; /* paging for GPRS + non-GPRS? */ |
| 103 | /* SMS Parameters */ |
| 104 | int recovery; |
Harald Welte | ba850c5 | 2010-05-02 14:40:32 +0200 | [diff] [blame] | 105 | uint8_t radio_prio_sms; |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 106 | |
| 107 | struct llist_head pdp_list; |
| 108 | |
| 109 | /* Additional bits not present in the GSM TS */ |
Harald Welte | 807a5d8 | 2010-06-01 11:53:01 +0200 | [diff] [blame] | 110 | struct gprs_llc_llme *llme; |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 111 | uint32_t tlli; |
Harald Welte | 807a5d8 | 2010-06-01 11:53:01 +0200 | [diff] [blame] | 112 | uint32_t tlli_new; |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 113 | uint16_t nsei; |
| 114 | uint16_t bvci; |
Harald Welte | 8acd88f | 2010-05-18 10:57:45 +0200 | [diff] [blame] | 115 | struct rate_ctr_group *ctrg; |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 116 | struct osmo_timer_list timer; |
Harald Welte | c2e8cc4 | 2010-05-31 20:23:38 +0200 | [diff] [blame] | 117 | unsigned int T; /* Txxxx number */ |
| 118 | unsigned int num_T_exp; /* number of consecutive T expirations */ |
| 119 | |
| 120 | enum gprs_t3350_mode t3350_mode; |
| 121 | uint8_t t3370_id_type; |
Jacob Erlbeck | 93eae8e | 2014-10-28 12:23:29 +0100 | [diff] [blame] | 122 | uint8_t pending_req; /* the request's message type */ |
| 123 | /* TODO: There isn't much semantic difference between t3350_mode |
| 124 | * (refers to the timer) and pending_req (refers to the procedure), |
| 125 | * where mm->T == 3350 => mm->t3350_mode == f(mm->pending_req). Check |
| 126 | * whether one of them can be dropped. */ |
Jacob Erlbeck | 0c06f98 | 2014-10-29 22:12:20 +0100 | [diff] [blame] | 127 | |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 128 | enum sgsn_auth_state auth_state; |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 129 | }; |
| 130 | |
Daniel Willmann | b15ceec | 2014-09-03 15:57:49 +0200 | [diff] [blame] | 131 | #define LOGMMCTXP(level, mm, fmt, args...) \ |
Jacob Erlbeck | 5a38f64 | 2014-10-21 13:09:55 +0200 | [diff] [blame] | 132 | LOGP(DMM, level, "MM(%s/%08x) " fmt, (mm) ? (mm)->imsi : "---", \ |
| 133 | (mm) ? (mm)->p_tmsi : GSM_RESERVED_TMSI, ## args) |
Daniel Willmann | b15ceec | 2014-09-03 15:57:49 +0200 | [diff] [blame] | 134 | |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 135 | /* look-up a SGSN MM context based on TLLI + RAI */ |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 136 | struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 137 | const struct gprs_ra_id *raid); |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 138 | struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi); |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 139 | struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi); |
| 140 | |
| 141 | /* Allocate a new SGSN MM context */ |
Harald Welte | eaa614c | 2010-05-02 11:26:34 +0200 | [diff] [blame] | 142 | struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli, |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 143 | const struct gprs_ra_id *raid); |
Harald Welte | c728eea | 2010-12-24 23:07:18 +0100 | [diff] [blame] | 144 | void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm); |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 145 | |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 146 | |
| 147 | enum pdp_ctx_state { |
| 148 | PDP_STATE_NONE, |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 149 | PDP_STATE_CR_REQ, |
| 150 | PDP_STATE_CR_CONF, |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 151 | |
| 152 | /* 04.08 / Figure 6.2 / 6.1.2.2 */ |
| 153 | PDP_STATE_INACT_PEND, |
| 154 | PDP_STATE_INACTIVE = PDP_STATE_NONE, |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | enum pdp_type { |
| 158 | PDP_TYPE_NONE, |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 159 | PDP_TYPE_ETSI_PPP, |
| 160 | PDP_TYPE_IANA_IPv4, |
| 161 | PDP_TYPE_IANA_IPv6, |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 162 | }; |
| 163 | |
| 164 | struct sgsn_pdp_ctx { |
| 165 | struct llist_head list; /* list_head for mmctx->pdp_list */ |
| 166 | struct llist_head g_list; /* list_head for global list */ |
| 167 | struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */ |
| 168 | struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */ |
Harald Welte | efbdee9 | 2010-06-10 00:20:12 +0200 | [diff] [blame] | 169 | struct rate_ctr_group *ctrg; |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 170 | |
| 171 | //unsigned int id; |
| 172 | struct pdp_t *lib; /* pointer to libgtp PDP ctx */ |
| 173 | enum pdp_ctx_state state; |
| 174 | enum pdp_type type; |
| 175 | uint32_t address; |
| 176 | char *apn_subscribed; |
| 177 | //char *apn_used; |
Harald Welte | 6abf94e | 2010-05-18 10:35:06 +0200 | [diff] [blame] | 178 | uint16_t nsapi; /* SNDCP */ |
| 179 | uint16_t sapi; /* LLC */ |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 180 | uint8_t ti; /* transaction identifier */ |
| 181 | int vplmn_allowed; |
| 182 | uint32_t qos_profile_subscr; |
| 183 | //uint32_t qos_profile_req; |
| 184 | //uint32_t qos_profile_neg; |
| 185 | uint8_t radio_prio; |
| 186 | uint32_t tx_npdu_nr; |
| 187 | uint32_t rx_npdu_nr; |
| 188 | uint32_t tx_gtp_snd; |
| 189 | uint32_t rx_gtp_snu; |
| 190 | //uint32_t charging_id; |
| 191 | int reordering_reqd; |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 192 | |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 193 | struct osmo_timer_list timer; |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 194 | unsigned int T; /* Txxxx number */ |
| 195 | unsigned int num_T_exp; /* number of consecutive T expirations */ |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 196 | }; |
| 197 | |
Daniel Willmann | b15ceec | 2014-09-03 15:57:49 +0200 | [diff] [blame] | 198 | #define LOGPDPCTXP(level, pdp, fmt, args...) \ |
Jacob Erlbeck | 99985b5 | 2014-10-13 10:32:00 +0200 | [diff] [blame] | 199 | LOGP(DGPRS, level, "PDP(%s/%u) " \ |
| 200 | fmt, (pdp)->mm ? (pdp)->mm->imsi : "---", (pdp)->ti, ## args) |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 201 | |
Harald Welte | 96df606 | 2010-06-03 06:37:26 +0200 | [diff] [blame] | 202 | /* look up PDP context by MM context and NSAPI */ |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 203 | struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm, |
| 204 | uint8_t nsapi); |
Harald Welte | 96df606 | 2010-06-03 06:37:26 +0200 | [diff] [blame] | 205 | /* look up PDP context by MM context and transaction ID */ |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 206 | struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm, |
| 207 | uint8_t tid); |
Harald Welte | 96df606 | 2010-06-03 06:37:26 +0200 | [diff] [blame] | 208 | |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 209 | struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, |
| 210 | uint8_t nsapi); |
Jacob Erlbeck | 99985b5 | 2014-10-13 10:32:00 +0200 | [diff] [blame] | 211 | void sgsn_pdp_ctx_terminate(struct sgsn_pdp_ctx *pdp); |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 212 | void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp); |
| 213 | |
| 214 | |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 215 | struct sgsn_ggsn_ctx { |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 216 | struct llist_head list; |
| 217 | uint32_t id; |
| 218 | unsigned int gtp_version; |
| 219 | struct in_addr remote_addr; |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 220 | int remote_restart_ctr; |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 221 | struct gsn_t *gsn; |
| 222 | }; |
Harald Welte | cd4dd4d | 2010-05-18 17:20:49 +0200 | [diff] [blame] | 223 | struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id); |
| 224 | struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id); |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 225 | struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr); |
Harald Welte | cd4dd4d | 2010-05-18 17:20:49 +0200 | [diff] [blame] | 226 | struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id); |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 227 | |
| 228 | struct apn_ctx { |
| 229 | struct llist_head list; |
Harald Welte | 77289c2 | 2010-05-18 14:32:29 +0200 | [diff] [blame] | 230 | struct sgsn_ggsn_ctx *ggsn; |
Harald Welte | d193cb3 | 2010-05-17 22:58:03 +0200 | [diff] [blame] | 231 | char *name; |
| 232 | char *description; |
| 233 | }; |
| 234 | |
| 235 | extern struct llist_head sgsn_mm_ctxts; |
| 236 | extern struct llist_head sgsn_ggsn_ctxts; |
| 237 | extern struct llist_head sgsn_apn_ctxts; |
| 238 | extern struct llist_head sgsn_pdp_ctxts; |
| 239 | |
Harald Welte | 6463c07 | 2010-05-18 17:04:55 +0200 | [diff] [blame] | 240 | uint32_t sgsn_alloc_ptmsi(void); |
| 241 | |
Harald Welte | a9b473a | 2010-12-24 21:13:26 +0100 | [diff] [blame] | 242 | /* High-level function to be called in case a GGSN has disappeared or |
| 243 | * ottherwise lost state (recovery procedure) */ |
| 244 | int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); |
| 245 | |
Holger Hans Peter Freyther | a273030 | 2014-03-23 18:08:26 +0100 | [diff] [blame] | 246 | char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len); |
| 247 | |
Jacob Erlbeck | 78ecaf0 | 2014-09-05 14:32:36 +0200 | [diff] [blame] | 248 | /* Force re-attachment based on msgb meta data */ |
| 249 | int sgsn_force_reattach_oldmsg(struct msgb *oldmsg); |
| 250 | |
Holger Hans Peter Freyther | a273030 | 2014-03-23 18:08:26 +0100 | [diff] [blame] | 251 | /* |
| 252 | * ctrl interface related work |
| 253 | */ |
| 254 | struct gsm_network; |
| 255 | struct ctrl_handle *sgsn_controlif_setup(struct gsm_network *, uint16_t port); |
| 256 | int sgsn_ctrl_cmds_install(void); |
| 257 | |
Holger Hans Peter Freyther | 1768a57 | 2014-04-04 12:40:34 +0200 | [diff] [blame] | 258 | /* |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 259 | * Authorization/ACL handling |
Holger Hans Peter Freyther | 1768a57 | 2014-04-04 12:40:34 +0200 | [diff] [blame] | 260 | */ |
Jacob Erlbeck | 3b5d407 | 2014-10-24 15:11:03 +0200 | [diff] [blame] | 261 | struct imsi_acl_entry { |
| 262 | struct llist_head list; |
| 263 | char imsi[16+1]; |
| 264 | }; |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 265 | |
| 266 | struct sgsn_subscriber_data { |
| 267 | enum sgsn_auth_state auth_state; |
| 268 | }; |
| 269 | |
Jacob Erlbeck | 3b5d407 | 2014-10-24 15:11:03 +0200 | [diff] [blame] | 270 | struct sgsn_config; |
| 271 | struct sgsn_instance; |
Jacob Erlbeck | f951a01 | 2014-11-07 14:17:44 +0100 | [diff] [blame] | 272 | extern const struct value_string *sgsn_auth_state_names; |
Jacob Erlbeck | 3b5d407 | 2014-10-24 15:11:03 +0200 | [diff] [blame] | 273 | |
Jacob Erlbeck | a0b6efb | 2014-11-13 10:48:39 +0100 | [diff] [blame^] | 274 | void sgsn_auth_init(void); |
Jacob Erlbeck | 3b5d407 | 2014-10-24 15:11:03 +0200 | [diff] [blame] | 275 | struct imsi_acl_entry *sgsn_acl_lookup(const char *imsi, struct sgsn_config *cfg); |
| 276 | int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg); |
| 277 | int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg); |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 278 | /* Request authorization */ |
Jacob Erlbeck | a0b6efb | 2014-11-13 10:48:39 +0100 | [diff] [blame^] | 279 | int sgsn_auth_request(struct sgsn_mm_ctx *mm); |
| 280 | enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mm); |
| 281 | void sgsn_auth_update(struct sgsn_mm_ctx *mm); |
Jacob Erlbeck | 423f8bf | 2014-10-24 18:09:54 +0200 | [diff] [blame] | 282 | |
| 283 | /* Called on subscriber data updates */ |
Jacob Erlbeck | f951a01 | 2014-11-07 14:17:44 +0100 | [diff] [blame] | 284 | void sgsn_update_subscriber_data(struct sgsn_mm_ctx *mmctx); |
Holger Hans Peter Freyther | 1768a57 | 2014-04-04 12:40:34 +0200 | [diff] [blame] | 285 | |
Holger Hans Peter Freyther | 90e9a44 | 2014-04-04 12:51:28 +0200 | [diff] [blame] | 286 | int gprs_sndcp_vty_init(void); |
| 287 | struct sgsn_instance; |
| 288 | int sgsn_gtp_init(struct sgsn_instance *sgi); |
| 289 | |
Harald Welte | 9b455bf | 2010-03-14 15:45:01 +0800 | [diff] [blame] | 290 | #endif /* _GPRS_SGSN_H */ |