pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/32635 )


Change subject: gmm: Provide allocated PTMSI & TLLI to upper layers
......................................................................

gmm: Provide allocated PTMSI & TLLI to upper layers

Upper layers (SM or app) may need access to PTMSI or TLLI.

PTMSI:
- App may want to store it somewhere in order to reuse it next time
   it wants to GMM Attach.
TLLI:
- App will need the TLLI to identify the MS when sending/receiving
  primitives over SN SAP (app<->SNDCP).
- SM layer will need the TLLI to communicate over SNSM SAP (SM<->SNDCP),
  as well as relay the information to the app if the GMM Attach happens
  implicitly over SMREG-Act_Pdp_Ctx.req -> GMMSM-Establish-Req.

Change-Id: I552c43c55409773e2d13b72cba45a866165f203f
---
M include/osmocom/gprs/gmm/gmm_prim.h
M include/osmocom/gprs/gmm/gmm_private.h
M src/gmm/gmm.c
M src/gmm/gmm_ms_fsm.c
M src/gmm/gmm_prim.c
5 files changed, 35 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/35/32635/1

diff --git a/include/osmocom/gprs/gmm/gmm_prim.h 
b/include/osmocom/gprs/gmm/gmm_prim.h
index 7e50c58..42dc90a 100644
--- a/include/osmocom/gprs/gmm/gmm_prim.h
+++ b/include/osmocom/gprs/gmm/gmm_prim.h
@@ -117,6 +117,7 @@
                                struct {
                                        /* PLMNs MT-caps, attach-type. */
                                        uint32_t allocated_ptmsi;
+                                       uint32_t allocated_tlli;
                                } acc;
                                struct {
                                        uint8_t cause; /* See enum 
gsm48_gsm_cause */
@@ -219,6 +220,8 @@
                        union {
                                struct {
                                        /* PLMNs MT-caps, attach-type. */
+                                       uint32_t allocated_ptmsi;
+                                       uint32_t allocated_tlli;
                                } acc;
                                struct {
                                        uint8_t cause;
diff --git a/include/osmocom/gprs/gmm/gmm_private.h 
b/include/osmocom/gprs/gmm/gmm_private.h
index df97e1d..57658e9 100644
--- a/include/osmocom/gprs/gmm/gmm_private.h
+++ b/include/osmocom/gprs/gmm/gmm_private.h
@@ -118,7 +118,7 @@
 int gprs_gmm_tx_ciph_auth_resp(const struct gprs_gmm_entity *gmme, const 
uint8_t *sres);

 int gprs_gmm_submit_gmmreg_attach_cnf(struct gprs_gmm_entity *gmme, bool 
accepted, uint8_t cause);
-int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, uint32_t 
sess_id, bool accepted, uint8_t cause);
+int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, bool 
accepted, uint8_t cause);
 int gprs_gmm_submit_llgmm_assing_req(const struct gprs_gmm_entity *gmme);

 #define LOGGMME(gmme, level, fmt, args...) \
diff --git a/src/gmm/gmm.c b/src/gmm/gmm.c
index 0070dda..faba983 100644
--- a/src/gmm/gmm.c
+++ b/src/gmm/gmm.c
@@ -288,6 +288,7 @@
        gmm_prim_tx->gmmreg.attach_cnf.accepted = accepted;
        if (accepted) {
                gmm_prim_tx->gmmreg.attach_cnf.acc.allocated_ptmsi = 
gmme->ptmsi;
+               gmm_prim_tx->gmmreg.attach_cnf.acc.allocated_tlli = gmme->tlli;
        } else {
                gmm_prim_tx->gmmreg.attach_cnf.rej.cause = cause;
        }
@@ -323,12 +324,16 @@
        return rc;
 }

-int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, uint32_t 
sess_id, bool accepted, uint8_t cause)
+int gprs_gmm_submit_gmmsm_establish_cnf(struct gprs_gmm_entity *gmme, bool 
accepted, uint8_t cause)
 {
        struct osmo_gprs_gmm_prim *gmm_prim_tx;
        int rc;

-       gmm_prim_tx = gprs_gmm_prim_alloc_gmmsm_establish_cnf(sess_id, cause);
+       gmm_prim_tx = gprs_gmm_prim_alloc_gmmsm_establish_cnf(gmme->sess_id, 
cause);
+       if (accepted) {
+               gmm_prim_tx->gmmsm.establish_cnf.acc.allocated_ptmsi = 
gmme->ptmsi;
+               gmm_prim_tx->gmmsm.establish_cnf.acc.allocated_tlli = 
gmme->tlli;
+       }

        rc = gprs_gmm_prim_call_up_cb(gmm_prim_tx);
        return rc;
diff --git a/src/gmm/gmm_ms_fsm.c b/src/gmm/gmm_ms_fsm.c
index f553ad3..053f8fc 100644
--- a/src/gmm/gmm_ms_fsm.c
+++ b/src/gmm/gmm_ms_fsm.c
@@ -129,9 +129,7 @@

                if (att.implicit_att) {
                        /* Submit GMMSM-ESTABLISH-CNF as per TS 24.007 Annex 
C.3 */
-                       rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme,
-                                                                
ctx->gmme->sess_id,
-                                                                false, cause);
+                       rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme, 
false, cause);
                        if (rc < 0)
                                return;
                }
@@ -147,7 +145,7 @@
                }
                if (ctx->attach.implicit_att) {
                        /* Submit GMMSM-ESTABLISH-CNF as per TS 24.007 Annex 
C.3 */
-                       rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme, 
ctx->gmme->sess_id, true, 0);
+                       rc = gprs_gmm_submit_gmmsm_establish_cnf(ctx->gmme, 
true, 0);
                        if (rc < 0)
                                return;
                }
diff --git a/src/gmm/gmm_prim.c b/src/gmm/gmm_prim.c
index 573b568..ed8fed6 100644
--- a/src/gmm/gmm_prim.c
+++ b/src/gmm/gmm_prim.c
@@ -489,7 +489,7 @@
        gmme->sess_id = gmm_prim->gmmsm.sess_id;

        if (gmme->ms_fsm.fi->state == GPRS_GMM_MS_ST_REGISTERED) {
-               rc = gprs_gmm_submit_gmmsm_establish_cnf(gmme, 
gmm_prim->gmmsm.sess_id, true, 0);
+               rc = gprs_gmm_submit_gmmsm_establish_cnf(gmme, true, 0);
                return rc;
        }


--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32635
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I552c43c55409773e2d13b72cba45a866165f203f
Gerrit-Change-Number: 32635
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to