path: root/include
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2019-08-29 17:21:00 +0200
committerpespin <pespin@sysmocom.de>2019-09-02 09:42:21 +0000
commit6dfb5fef4072c177fc58149d48cec74b7a501f47 (patch)
treeb9c7f45cb75d437ac4e59a86eca1674d86639037 /include
parent259e303436e035a5d137c17978f2f8de4bd58328 (diff)
Move lots of Iu/ranap specific code into its own file
RANAP related functionalities were splitted among several files (gprs_gmm.c, gprs_sgsn.c and sgsn_libgtp.c). Let's move it into its own file to shrink complexity/size of existing files. It also allows to keep a lot of conditionally enabled code (BUILD_IU) and its dependencies (osmo-iuh) together. Change-Id: I549042aaff045a378de77d657cc396ee08f22f33
Diffstat (limited to 'include')
4 files changed, 33 insertions, 5 deletions
diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am
index cbf7c51b..b4cd5db0 100644
--- a/include/osmocom/sgsn/Makefile.am
+++ b/include/osmocom/sgsn/Makefile.am
@@ -8,6 +8,7 @@ noinst_HEADERS = \
gprs_gmm_attach.h \
gprs_llc.h \
gprs_llc_xid.h \
+ gprs_ranap.h \
gprs_sgsn.h \
gprs_sndcp_comp.h \
gprs_sndcp_dcomp.h \
diff --git a/include/osmocom/sgsn/gprs_gmm.h b/include/osmocom/sgsn/gprs_gmm.h
index ffcebd35..047bd774 100644
--- a/include/osmocom/sgsn/gprs_gmm.h
+++ b/include/osmocom/sgsn/gprs_gmm.h
@@ -17,8 +17,10 @@ int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm,
int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
bool drop_cipherable);
-int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id,
- uint16_t *sai);
+int gsm0408_rcv_gsm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
+ struct gprs_llc_llme *llme);
+int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
+ struct gprs_llc_llme *llme, bool drop_cipherable);
int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx);
int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg,
struct gprs_llc_llme *llme);
@@ -33,8 +35,6 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli,
time_t gprs_max_time_to_idle(void);
-int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp);
int gsm48_tx_gmm_id_req(struct sgsn_mm_ctx *mm, uint8_t id_type);
int gsm48_tx_gmm_att_rej(struct sgsn_mm_ctx *mm,
uint8_t gmm_cause);
@@ -42,9 +42,12 @@ int gsm48_tx_gmm_att_ack(struct sgsn_mm_ctx *mm);
int gprs_gmm_attach_req_ies(struct msgb *a, struct msgb *b);
+int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx);
/* TODO: move extract_subscr_* when gsm48_gmm_authorize() got removed */
void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx);
void extract_subscr_hlr(struct sgsn_mm_ctx *ctx);
void pdp_ctx_detach_mm_ctx(struct sgsn_pdp_ctx *pdp);
+void mmctx_set_pmm_state(struct sgsn_mm_ctx *ctx, enum gprs_pmm_state state);
#endif /* _GPRS_GMM_H */
diff --git a/include/osmocom/sgsn/gprs_ranap.h b/include/osmocom/sgsn/gprs_ranap.h
new file mode 100644
index 00000000..b300130a
--- /dev/null
+++ b/include/osmocom/sgsn/gprs_ranap.h
@@ -0,0 +1,23 @@
+#pragma once
+#include <osmocom/core/msgb.h>
+#include <osmocom/sgsn/gprs_sgsn.h>
+#ifdef BUILD_IU
+#include <osmocom/ranap/ranap_ies_defs.h>
+#include <osmocom/ranap/ranap_msg_factory.h>
+#include <osmocom/ranap/iu_client.h>
+void activate_pdp_rabs(struct sgsn_mm_ctx *ctx);
+int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type type, void *data);
+int iu_rab_act_ps(uint8_t rab_id, struct sgsn_pdp_ctx *pdp);
+int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id, uint16_t *sai);
+struct ranap_ue_conn_ctx;
+/* On RANAP, Returns pointer to he associated ranap_ue_conn_ctx in msg, filled
+ * in by osmo-iuh's iu_recv_cb().
+ * On Gb, returns NULL */
+#define MSG_IU_UE_CTX(msg) ((struct ranap_ue_conn_ctx *)(msg)->dst)
+#define MSG_IU_UE_CTX_SET(msg, val) (msg)->dst = (val)
diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h
index 78803c77..e1c5c4af 100644
--- a/include/osmocom/sgsn/sgsn.h
+++ b/include/osmocom/sgsn/sgsn.h
@@ -161,7 +161,7 @@ char *sgsn_gtp_ntoa(struct ul16_t *ul);
/* Main input function for Gb proxy */
int sgsn_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci);
+/* sgsn_libgtp.c */
struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
struct sgsn_mm_ctx *mmctx,
uint16_t nsapi,
@@ -169,6 +169,7 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
int sgsn_delete_pdp_ctx(struct sgsn_pdp_ctx *pctx);
void sgsn_pdp_upd_gtp_u(struct sgsn_pdp_ctx *pdp, void *addr, size_t alen);
void sgsn_ggsn_echo_req(struct sgsn_ggsn_ctx *ggc);
+int send_act_pdp_cont_acc(struct sgsn_pdp_ctx *pctx);
/* gprs_sndcp.c */