libgb: remove dependency of BSSGP to include sgsn/gmm internal structs
This commit is contained in:
parent
0d5e8e0b56
commit
faa70ff2c6
|
@ -204,8 +204,21 @@ enum bssgp_ctr {
|
|||
int gprs_bssgp_rcvmsg(struct msgb *msg);
|
||||
|
||||
/* BSSGP-DL-UNITDATA.req */
|
||||
struct sgsn_mm_ctx;
|
||||
int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx);
|
||||
struct bssgp_lv {
|
||||
uint16_t len;
|
||||
uint8_t *v;
|
||||
};
|
||||
/* parameters for BSSGP downlink userdata transmission */
|
||||
struct bssgp_dl_ud_par {
|
||||
uint32_t *tlli;
|
||||
char *imsi;
|
||||
uint16_t drx_parms;
|
||||
/* FIXME: priority */
|
||||
struct bssgp_lv ms_ra_cap;
|
||||
uint8_t qos_profile[3];
|
||||
};
|
||||
int gprs_bssgp_tx_dl_ud(struct msgb *msg, uint16_t pdu_lifetime,
|
||||
struct bssgp_dl_ud_par *dup);
|
||||
|
||||
uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf);
|
||||
int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
|
||||
|
|
|
@ -36,6 +36,26 @@
|
|||
#include <openbsc/crc24.h>
|
||||
#include <openbsc/sgsn.h>
|
||||
|
||||
/* Entry function from upper level (LLC), asking us to transmit a BSSGP PDU
|
||||
* to a remote MS (identified by TLLI) at a BTS identified by its BVCI and NSEI */
|
||||
static int _bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx)
|
||||
{
|
||||
struct bssgp_dl_ud_par dup;
|
||||
const uint8_t qos_profile_default[3] = { 0x00, 0x00, 0x20 };
|
||||
|
||||
dup.tlli = NULL;
|
||||
dup.imsi = mmctx->imsi;
|
||||
dup.drx_parms = mmctx->drx_parms;
|
||||
dup.ms_ra_cap.len = mmctx->ms_radio_access_capa.len;
|
||||
dup.ms_ra_cap.v = mmctx->ms_radio_access_capa.buf;
|
||||
dup.pdu_lifetime = 1000; /* centi-seconds */
|
||||
memcpy(&dup.qos_profile, qos_profile_default,
|
||||
sizeof(qos_profile_default));
|
||||
|
||||
return gprs_bssgp_tx_dl_ud(msg, 1000, &dup);
|
||||
}
|
||||
|
||||
|
||||
/* Section 8.9.9 LLC layer parameter default values */
|
||||
static const struct gprs_llc_params llc_default_params[] = {
|
||||
[1] = {
|
||||
|
@ -308,7 +328,7 @@ int gprs_llc_tx_u(struct msgb *msg, uint8_t sapi, int command,
|
|||
/* Identifiers passed down: (BVCI, NSEI) */
|
||||
|
||||
/* Send BSSGP-DL-UNITDATA.req */
|
||||
return gprs_bssgp_tx_dl_ud(msg, NULL);
|
||||
return _bssgp_tx_dl_ud(msg, 1000, NULL);
|
||||
}
|
||||
|
||||
/* Send XID response to LLE */
|
||||
|
@ -420,7 +440,7 @@ int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command,
|
|||
/* Identifiers passed down: (BVCI, NSEI) */
|
||||
|
||||
/* Send BSSGP-DL-UNITDATA.req */
|
||||
return gprs_bssgp_tx_dl_ud(msg, mmctx);
|
||||
return _bssgp_tx_dl_ud(msg, mmctx);
|
||||
}
|
||||
|
||||
/* According to 6.4.1.6 / Figure 11 */
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include <osmocom/gprs/gprs_bssgp.h>
|
||||
#include <osmocom/gprs/gprs_ns.h>
|
||||
|
||||
#include <openbsc/gprs_gmm.h>
|
||||
|
||||
#include "common_vty.h"
|
||||
|
||||
void *bssgp_tall_ctx = NULL;
|
||||
|
@ -699,19 +697,17 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
|
|||
return rc;
|
||||
}
|
||||
|
||||
/* Entry function from upper level (LLC), asking us to transmit a BSSGP PDU
|
||||
* to a remote MS (identified by TLLI) at a BTS identified by its BVCI and NSEI */
|
||||
int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx)
|
||||
int gprs_bssgp_tx_dl_ud(struct msgb *msg, uint16_t pdu_lifetime,
|
||||
struct bssgp_dl_ud_par *dup)
|
||||
{
|
||||
struct bssgp_bvc_ctx *bctx;
|
||||
struct bssgp_ud_hdr *budh;
|
||||
uint8_t llc_pdu_tlv_hdr_len = 2;
|
||||
uint8_t *llc_pdu_tlv, *qos_profile;
|
||||
uint16_t pdu_lifetime = 1000; /* centi-seconds */
|
||||
uint8_t qos_profile_default[3] = { 0x00, 0x00, 0x20 };
|
||||
uint8_t *llc_pdu_tlv;
|
||||
uint16_t msg_len = msg->len;
|
||||
uint16_t bvci = msgb_bvci(msg);
|
||||
uint16_t nsei = msgb_nsei(msg);
|
||||
uint16_t _pdu_lifetime = htons(pdu_lifetime); /* centi-seconds */
|
||||
uint16_t drx_params;
|
||||
|
||||
/* Identifiers from UP: TLLI, BVCI, NSEI (all in msgb->cb) */
|
||||
|
@ -743,43 +739,42 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx)
|
|||
|
||||
/* FIXME: optional elements: Alignment, UTRAN CCO, LSA, PFI */
|
||||
|
||||
if (mmctx) {
|
||||
if (dup) {
|
||||
/* Old TLLI to help BSS map from old->new */
|
||||
#if 0
|
||||
if (mmctx->tlli_old)
|
||||
msgb_tvlv_push(msg, BSSGP_IE_TLLI, 4, htonl(*tlli_old));
|
||||
#endif
|
||||
if (dup->tlli) {
|
||||
uint32_t tlli = htonl(*dup->tlli);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_TLLI, 4, (uint8_t *) &tlli);
|
||||
}
|
||||
|
||||
/* IMSI */
|
||||
if (strlen(mmctx->imsi)) {
|
||||
if (strlen(dup->imsi)) {
|
||||
uint8_t mi[10];
|
||||
int imsi_len = gsm48_generate_mid_from_imsi(mi, mmctx->imsi);
|
||||
int imsi_len = gsm48_generate_mid_from_imsi(mi, dup->imsi);
|
||||
if (imsi_len > 2)
|
||||
msgb_tvlv_push(msg, BSSGP_IE_IMSI,
|
||||
imsi_len-2, mi+2);
|
||||
imsi_len-2, mi+2);
|
||||
}
|
||||
|
||||
/* DRX parameters */
|
||||
drx_params = htons(mmctx->drx_parms);
|
||||
drx_params = htons(dup->drx_parms);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_DRX_PARAMS, 2,
|
||||
(uint8_t *) &drx_params);
|
||||
|
||||
/* FIXME: Priority */
|
||||
|
||||
/* MS Radio Access Capability */
|
||||
if (mmctx->ms_radio_access_capa.len)
|
||||
if (dup->ms_ra_cap.len)
|
||||
msgb_tvlv_push(msg, BSSGP_IE_MS_RADIO_ACCESS_CAP,
|
||||
mmctx->ms_radio_access_capa.len,
|
||||
mmctx->ms_radio_access_capa.buf);
|
||||
dup->ms_ra_cap.len, dup->ms_ra_cap.v);
|
||||
|
||||
}
|
||||
|
||||
/* prepend the pdu lifetime */
|
||||
pdu_lifetime = htons(pdu_lifetime);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_PDU_LIFETIME, 2, (uint8_t *)&pdu_lifetime);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_PDU_LIFETIME, 2, (uint8_t *)&_pdu_lifetime);
|
||||
|
||||
/* prepend the QoS profile, TLLI and pdu type */
|
||||
budh = (struct bssgp_ud_hdr *) msgb_push(msg, sizeof(*budh));
|
||||
memcpy(budh->qos_profile, qos_profile_default, sizeof(qos_profile_default));
|
||||
memcpy(budh->qos_profile, dup->qos_profile, sizeof(budh->qos_profile));
|
||||
budh->tlli = htonl(msgb_tlli(msg));
|
||||
budh->pdu_type = BSSGP_PDUT_DL_UNITDATA;
|
||||
|
||||
|
|
Loading…
Reference in New Issue