pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/40954?usp=email )


Change subject: Move gsm0408_gprs_rcvmsg_iu to gprs_gmm.{c,h}
......................................................................

Move gsm0408_gprs_rcvmsg_iu to gprs_gmm.{c,h}

It belongs to that layer, same as existing gsm0408_gprs_rcvmsg_gb()
counterpart.

Change-Id: I09c19689fd7016b76ebeee821b551427965b7cf1
---
M include/osmocom/sgsn/gprs_gmm.h
M include/osmocom/sgsn/gprs_ranap.h
M src/sgsn/gprs_gmm.c
M src/sgsn/gprs_ranap.c
4 files changed, 46 insertions(+), 42 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/54/40954/1

diff --git a/include/osmocom/sgsn/gprs_gmm.h b/include/osmocom/sgsn/gprs_gmm.h
index 900ad6a..3b36ccd 100644
--- a/include/osmocom/sgsn/gprs_gmm.h
+++ b/include/osmocom/sgsn/gprs_gmm.h
@@ -2,6 +2,7 @@
 #define _GPRS_GMM_H

 #include <stdbool.h>
+#include <stdint.h>
 
 #include <osmocom/core/msgb.h>
 #include <osmocom/gsm/gsm48.h>
@@ -35,6 +36,10 @@

 int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme,
                           bool drop_cipherable);
+#ifdef BUILD_IU
+int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id, 
uint16_t *sai);
+#endif /* ifdef BUILD_IU */
+
 /* Has to be called whenever any PDU (signaling, data, ...) has been received 
*/
 void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg);

diff --git a/include/osmocom/sgsn/gprs_ranap.h 
b/include/osmocom/sgsn/gprs_ranap.h
index 6dcb63a..b75bba2 100644
--- a/include/osmocom/sgsn/gprs_ranap.h
+++ b/include/osmocom/sgsn/gprs_ranap.h
@@ -21,8 +21,6 @@
 void sgsn_ranap_iu_release_free(struct sgsn_mm_ctx *ctx,
                                const struct RANAP_Cause *cause);

-int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id, 
uint16_t *sai);
-
 #else /* ifndef BUILD_IU */
 inline static void sgsn_ranap_iu_free(void *ctx) {};
 inline static void sgsn_ranap_iu_release_free(void *ctx, void *cause) {};
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 4c32fd8..d2627a3 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -2379,3 +2379,44 @@

        return rc;
 }
+
+#ifdef BUILD_IU
+/* Main entry point for incoming 04.08 GPRS messages from Iu */
+int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id,
+                          uint16_t *sai)
+{
+       struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
+       uint8_t pdisc = gsm48_hdr_pdisc(gh);
+       struct sgsn_mm_ctx *mmctx;
+       int rc = -EINVAL;
+
+       mmctx = sgsn_mm_ctx_by_ue_ctx(MSG_IU_UE_CTX(msg));
+       if (mmctx) {
+               rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, 
GMM_CTR_PKTS_SIG_IN));
+               if (ra_id)
+                       memcpy(&mmctx->ra, ra_id, sizeof(mmctx->ra));
+       }
+
+       /* MMCTX can be NULL */
+
+       switch (pdisc) {
+       case GSM48_PDISC_MM_GPRS:
+               rc = gsm0408_rcv_gmm(mmctx, msg, NULL, false);
+#pragma message "set drop_cipherable arg for gsm0408_rcv_gmm() from IuPS?"
+               break;
+       case GSM48_PDISC_SM_GPRS:
+               rc = gsm0408_rcv_gsm(mmctx, msg, NULL);
+               break;
+       default:
+               LOGMMCTXP(LOGL_NOTICE, mmctx,
+                       "Unknown GSM 04.08 discriminator 0x%02x: %s\n",
+                       pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg)));
+               /* FIXME: return status message */
+               break;
+       }
+
+       /* MMCTX can be invalid */
+
+       return rc;
+}
+#endif /* ifdef BUILD_IU */
diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c
index 08fc625..a7f8c5a 100644
--- a/src/sgsn/gprs_ranap.c
+++ b/src/sgsn/gprs_ranap.c
@@ -281,43 +281,3 @@
        msg->l2h = msg->data;
        return ranap_iu_rab_act(uectx, msg);
 }
-
-
-/* Main entry point for incoming 04.08 GPRS messages from Iu */
-int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id,
-                          uint16_t *sai)
-{
-       struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
-       uint8_t pdisc = gsm48_hdr_pdisc(gh);
-       struct sgsn_mm_ctx *mmctx;
-       int rc = -EINVAL;
-
-       mmctx = sgsn_mm_ctx_by_ue_ctx(MSG_IU_UE_CTX(msg));
-       if (mmctx) {
-               rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, 
GMM_CTR_PKTS_SIG_IN));
-               if (ra_id)
-                       memcpy(&mmctx->ra, ra_id, sizeof(mmctx->ra));
-       }
-
-       /* MMCTX can be NULL */
-
-       switch (pdisc) {
-       case GSM48_PDISC_MM_GPRS:
-               rc = gsm0408_rcv_gmm(mmctx, msg, NULL, false);
-#pragma message "set drop_cipherable arg for gsm0408_rcv_gmm() from IuPS?"
-               break;
-       case GSM48_PDISC_SM_GPRS:
-               rc = gsm0408_rcv_gsm(mmctx, msg, NULL);
-               break;
-       default:
-               LOGMMCTXP(LOGL_NOTICE, mmctx,
-                       "Unknown GSM 04.08 discriminator 0x%02x: %s\n",
-                       pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg)));
-               /* FIXME: return status message */
-               break;
-       }
-
-       /* MMCTX can be invalid */
-
-       return rc;
-}

--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/40954?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I09c19689fd7016b76ebeee821b551427965b7cf1
Gerrit-Change-Number: 40954
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>

Reply via email to