summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-17 23:02:42 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-17 23:02:42 +0200
commita78b9c270bc2082d0a3fa88d6d44b6c777a86799 (patch)
tree5e18aff384a499feb00795245a82c4d6b830056c /openbsc
parent8a521136a4c0cfc94823edd7f8d6f6d5f9efdf96 (diff)
[GPRS] BSSGP: expose more internal structures / API
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gprs_bssgp.h29
-rw-r--r--openbsc/src/gprs/gprs_bssgp.c31
2 files changed, 33 insertions, 27 deletions
diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/openbsc/gprs_bssgp.h
index 8fdef811..f2b94c4d 100644
--- a/openbsc/include/openbsc/gprs_bssgp.h
+++ b/openbsc/include/openbsc/gprs_bssgp.h
@@ -149,6 +149,35 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg);
/* gprs_bssgp.c */
+#define BVC_S_BLOCKED 0x0001
+
+/* The per-BTS context that we keep on the SGSN side of the BSSGP link */
+struct bssgp_bvc_ctx {
+ struct llist_head list;
+
+ /* parsed RA ID and Cell ID of the remote BTS */
+ struct gprs_ra_id ra_id;
+ uint16_t cell_id;
+
+ /* NSEI and BVCI of underlying Gb link. Together they
+ * uniquely identify a link to a BTS (5.4.4) */
+ uint16_t bvci;
+ uint16_t nsei;
+
+ uint32_t state;
+
+ struct rate_ctr_group *ctrg;
+
+ /* we might want to add this as a shortcut later, avoiding the NSVC
+ * lookup for every packet, similar to a routing cache */
+ //struct gprs_nsvc *nsvc;
+};
+extern struct llist_head bssgp_bvc_ctxts;
+/* Find a BTS Context based on parsed RA ID and Cell ID */
+struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid);
+/* Find a BTS context based on BVCI+NSEI tuple */
+struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei);
+
#include <osmocore/tlv.h>
/* BSSGP-UL-UNITDATA.ind */
diff --git a/openbsc/src/gprs/gprs_bssgp.c b/openbsc/src/gprs/gprs_bssgp.c
index f6b02bad..b9c3c783 100644
--- a/openbsc/src/gprs/gprs_bssgp.c
+++ b/openbsc/src/gprs/gprs_bssgp.c
@@ -58,37 +58,14 @@ static const struct rate_ctr_group_desc bssgp_ctrg_desc = {
.ctr_desc = bssgp_ctr_description,
};
-#define BVC_S_BLOCKED 0x0001
-
-/* The per-BTS context that we keep on the SGSN side of the BSSGP link */
-struct bssgp_bvc_ctx {
- struct llist_head list;
-
- /* parsed RA ID and Cell ID of the remote BTS */
- struct gprs_ra_id ra_id;
- uint16_t cell_id;
-
- /* NSEI and BVCI of underlying Gb link. Together they
- * uniquely identify a link to a BTS (5.4.4) */
- uint16_t bvci;
- uint16_t nsei;
-
- uint32_t state;
-
- struct rate_ctr_group *ctrg;
-
- /* we might want to add this as a shortcut later, avoiding the NSVC
- * lookup for every packet, similar to a routing cache */
- //struct gprs_nsvc *nsvc;
-};
-static LLIST_HEAD(bts_ctxts);
+LLIST_HEAD(bssgp_bvc_ctxts);
/* Find a BTS Context based on parsed RA ID and Cell ID */
struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid)
{
struct bssgp_bvc_ctx *bctx;
- llist_for_each_entry(bctx, &bts_ctxts, list) {
+ llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {
if (!memcmp(&bctx->ra_id, raid, sizeof(bctx->ra_id)) &&
bctx->cell_id == cid)
return bctx;
@@ -101,7 +78,7 @@ struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei)
{
struct bssgp_bvc_ctx *bctx;
- llist_for_each_entry(bctx, &bts_ctxts, list) {
+ llist_for_each_entry(bctx, &bssgp_bvc_ctxts, list) {
if (bctx->nsei == nsei && bctx->bvci == bvci)
return bctx;
}
@@ -120,7 +97,7 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei)
/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
- llist_add(&ctx->list, &bts_ctxts);
+ llist_add(&ctx->list, &bssgp_bvc_ctxts);
return ctx;
}