blob: 71dd1fa7faadcd499109684d32d372585c01bc3f [file] [log] [blame]
Harald Welte75827d62010-05-18 11:07:34 +02001#ifndef _GPRS_GMM_H
2#define _GPRS_GMM_H
3
Max82040102016-07-06 11:59:18 +02004#include <stdbool.h>
5
Pau Espin Pedrol58101ea2023-01-09 12:29:27 +01006#include <osmocom/core/msgb.h>
7#include <osmocom/gsm/gsm48.h>
8#include <osmocom/crypt/auth.h>
9
10struct sgsn_mm_ctx;
11struct gprs_llc_llme;
12
Alexander Couzensd4788cd2018-05-02 22:32:19 +020013int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm,
14 const struct osmo_auth_vector *vec,
15 uint8_t key_seq, bool force_standby);
Harald Welte77289c22010-05-18 14:32:29 +020016
Max82040102016-07-06 11:59:18 +020017int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
18 bool drop_cipherable);
Pau Espin Pedrol6dfb5fe2019-08-29 17:21:00 +020019int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
20 struct gprs_llc_llme *llme, bool drop_cipherable);
Pau Espin Pedrol35f0e662019-09-02 18:27:27 +020021int gsm48_gmm_sendmsg(struct msgb *msg, int command,
22 struct sgsn_mm_ctx *mm, bool encryptable);
Jacob Erlbeckabdf02b2014-10-31 12:20:49 +010023int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx);
Maxb997f842016-07-06 15:57:01 +020024int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg,
25 struct gprs_llc_llme *llme);
Jacob Erlbeck423f8bf2014-10-24 18:09:54 +020026void gsm0408_gprs_access_granted(struct sgsn_mm_ctx *mmctx);
Jacob Erlbeckaf3d5c52015-01-05 17:51:17 +010027void gsm0408_gprs_access_denied(struct sgsn_mm_ctx *mmctx, int gmm_cause);
28void gsm0408_gprs_access_cancelled(struct sgsn_mm_ctx *mmctx, int gmm_cause);
Jacob Erlbeck4adb1362014-12-02 09:47:26 +010029void gsm0408_gprs_authenticate(struct sgsn_mm_ctx *mmctx);
Harald Welte75827d62010-05-18 11:07:34 +020030
Harald Welte5bfe4992010-06-09 11:22:47 +020031int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli);
32int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
33 uint8_t suspend_ref);
34
Pau Espin Pedrol05d5f282022-12-23 17:09:08 +010035int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
36 bool drop_cipherable);
37/* Has to be called whenever any PDU (signaling, data, ...) has been received */
38void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg);
39
Jacob Erlbeck81ffb742015-01-23 11:33:51 +010040time_t gprs_max_time_to_idle(void);
41
Alexander Couzensd4788cd2018-05-02 22:32:19 +020042int gsm48_tx_gmm_id_req(struct sgsn_mm_ctx *mm, uint8_t id_type);
43int gsm48_tx_gmm_att_rej(struct sgsn_mm_ctx *mm,
44 uint8_t gmm_cause);
45int gsm48_tx_gmm_att_ack(struct sgsn_mm_ctx *mm);
46
Alexander Couzensf7198d72018-05-22 18:29:14 +020047int gprs_gmm_attach_req_ies(struct msgb *a, struct msgb *b);
48
Pau Espin Pedrol6dfb5fe2019-08-29 17:21:00 +020049int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx);
Alexander Couzens8007be42018-05-14 06:48:24 +020050/* TODO: move extract_subscr_* when gsm48_gmm_authorize() got removed */
51void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx);
52void extract_subscr_hlr(struct sgsn_mm_ctx *ctx);
Pau Espin Pedrol8c7d2592018-07-09 20:44:17 +020053
Pau Espin Pedrol8333ef12019-08-29 19:26:12 +020054void msgid2mmctx(struct sgsn_mm_ctx *mm, const struct msgb *msg);
Pau Espin Pedrol35f0e662019-09-02 18:27:27 +020055void mmctx2msgid(struct msgb *msg, const struct sgsn_mm_ctx *mm);
Harald Welte75827d62010-05-18 11:07:34 +020056#endif /* _GPRS_GMM_H */