iu_common wip

This commit is contained in:
Neels Hofmeyr
2016-01-08 02:41:23 +01:00
parent 45b13244f0
commit 5d145b5477
6 changed files with 30 additions and 6 deletions

View File

@@ -18,7 +18,8 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
gprs_gb_parse.h smpp.h meas_feed.h gprs_gsup_messages.h \
gprs_gsup_client.h bsc_msg_filter.h \
oap.h oap_messages.h \
gtphub.h
gtphub.h \
iu.h
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
openbscdir = $(includedir)/openbsc

View File

@@ -11,6 +11,8 @@ int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp);
int gsm48_tx_gsm_deact_pdp_acc(struct sgsn_pdp_ctx *pdp);
int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme);
int gsm0408_gprs_rcvmsg_iu(struct msgb *msg, struct gprs_ra_id *ra_id,
uint16_t *sai);
int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx);
int gsm0408_gprs_force_reattach_oldmsg(struct msgb *msg);
void gsm0408_gprs_access_granted(struct sgsn_mm_ctx *mmctx);

View File

@@ -0,0 +1,9 @@
#pragma once
struct msgb;
struct gprs_ra_id;
typedef int (* iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id,
uint16_t *sai);
int iu_tx(struct msgb *msg, uint8_t sapi);

View File

@@ -55,6 +55,7 @@
#include <openbsc/gprs_utils.h>
#include <openbsc/sgsn.h>
#include <openbsc/signal.h>
#include <openbsc/iu.h>
#include <pdp.h>
@@ -138,7 +139,7 @@ static int gsm48_gmm_sendmsg(struct msgb *msg, int command,
rate_ctr_inc(&mm->ctrg->ctr[GMM_CTR_PKTS_SIG_OUT]);
if (msg->dst)
return gprs_iu_tx(msg, GPRS_SAPI_GMM, mm);
return iu_tx(msg, GPRS_SAPI_GMM);
/* caller needs to provide TLLI, BVCI and NSEI */
return gprs_llc_tx_ui(msg, GPRS_SAPI_GMM, command, mm);

View File

@@ -18,14 +18,21 @@
#include <osmocom/sigtran/sccp_sap.h>
#include <openbsc/gprs_sgsn.h>
#include <openbsc/iu.h>
#include <openbsc/debug.h>
#include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_common.h>
#include <osmocom/ranap/ranap_common_cn.h>
#include <osmocom/ranap/ranap_msg_factory.h>
#include <asn1c/asn1helpers.h>
int asn1_xer_print = 1;
void *talloc_asn1_ctx;
iu_recv_cb_t global_iu_recv_cb = NULL;
struct ue_conn_ctx {
struct llist_head list;
struct osmo_sua_link *link;
@@ -125,6 +132,7 @@ int gprs_transp_upd_key(struct sgsn_mm_ctx *mm)
return 0;
}
static int ranap_handle_co_initial_ue(void *ctx, RANAP_InitialUE_MessageIEs_t *ies)
{
struct gprs_ra_id ra_id;
@@ -138,7 +146,8 @@ static int ranap_handle_co_initial_ue(void *ctx, RANAP_InitialUE_MessageIEs_t *i
/* Feed into the MM layer */
msg->dst = ctx;
gsm0408_gprs_rcvmsg_iu(msg, ra_id, sai);
global_iu_recv_cb(msg, &ra_id, sai);
// gsm0408_gprs_rcvmsg_iu(msg, ra_id, sai);
return 0;
}
@@ -182,7 +191,7 @@ static int ranap_handle_co_err_ind(void *ctx, RANAP_ErrorIndicationIEs_t *ies)
return 0;
}
int gprs_iu_tx(struct msgb *msg, uint8_t sapi, struct mm_context *mm)
int iu_tx(struct msgb *msg, uint8_t sapi)
{
struct ue_conn_ctx *uectx = msg->dst;
struct osmo_scu_prim *prim;
@@ -405,13 +414,15 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *link)
return 0;
}
int sgsn_iu_init(void *ctx)
int sgsn_iu_init(void *ctx, iu_recv_cb_t iu_recv_cb)
{
struct osmo_sua_user *user;
int rc;
talloc_asn1_ctx = talloc_named_const(ctx, 1, "asn1");
global_iu_recv_cb = iu_recv_cb;
osmo_sua_set_log_area(DSUA);
user = osmo_sua_user_create(ctx, sccp_sap_up, ctx);

View File

@@ -418,7 +418,7 @@ int main(int argc, char **argv)
}
asn_debug = 0;
sgsn_iu_init(tall_bsc_ctx);
sgsn_iu_init(tall_bsc_ctx, gsm0408_gprs_rcvmsg_iu);
if (daemonize) {
rc = osmo_daemonize();