diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-01-04 18:43:34 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-02-22 10:52:08 +0100 |
commit | e7bcdc3bdac76503fa75a64fd1d592ef77ebc294 (patch) | |
tree | f611a43d93968b271103cf9d3f764ef01c78421e | |
parent | 9158089fa8564bbca8dca4c902b6ae55c65cda98 (diff) |
sgsn: Make ra_id_equals available as gprs_ra_id_equals
The function is moved to gprs_utils.c, renamed, and made non-static
to be usable in other modules, too.
Sponsored-by: On-Waves ehf
-rw-r--r-- | openbsc/include/openbsc/gprs_utils.h | 2 | ||||
-rw-r--r-- | openbsc/src/gprs/gprs_sgsn.c | 11 | ||||
-rw-r--r-- | openbsc/src/gprs/gprs_utils.c | 7 |
3 files changed, 11 insertions, 9 deletions
diff --git a/openbsc/include/openbsc/gprs_utils.h b/openbsc/include/openbsc/gprs_utils.h index 6880e0587..474eb45da 100644 --- a/openbsc/include/openbsc/gprs_utils.h +++ b/openbsc/include/openbsc/gprs_utils.h @@ -25,6 +25,7 @@ #include <sys/types.h> struct msgb; +struct gprs_ra_id; struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name); int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area, @@ -52,3 +53,4 @@ int gprs_match_tlv(uint8_t **data, size_t *data_len, int gprs_shift_lv(uint8_t **data, size_t *data_len, uint8_t **value, size_t *value_len); +int gprs_ra_id_equals(const struct gprs_ra_id *id1, const struct gprs_ra_id *id2); diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index c4dc9d7ec..8f8bdc68e 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -90,13 +90,6 @@ static const struct rate_ctr_group_desc pdpctx_ctrg_desc = { .class_id = OSMO_STATS_CLASS_SUBSCRIBER, }; -static int ra_id_equals(const struct gprs_ra_id *id1, - const struct gprs_ra_id *id2) -{ - return (id1->mcc == id2->mcc && id1->mnc == id2->mnc && - id1->lac == id2->lac && id1->rac == id2->rac); -} - /* See 03.02 Chapter 2.6 */ static inline uint32_t tlli_foreign(uint32_t tlli) { @@ -112,7 +105,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) { if (tlli == ctx->tlli && - ra_id_equals(raid, &ctx->ra)) + gprs_ra_id_equals(raid, &ctx->ra)) return ctx; } @@ -130,7 +123,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, case TLLI_FOREIGN: llist_for_each_entry(ctx, &sgsn_mm_ctxts, list) { if (tlli == tlli_foreign(ctx->tlli) && - ra_id_equals(raid, &ctx->ra)) + gprs_ra_id_equals(raid, &ctx->ra)) return ctx; } break; diff --git a/openbsc/src/gprs/gprs_utils.c b/openbsc/src/gprs/gprs_utils.c index ad479db81..895a03384 100644 --- a/openbsc/src/gprs/gprs_utils.c +++ b/openbsc/src/gprs/gprs_utils.c @@ -26,6 +26,7 @@ #include <osmocom/gprs/gprs_ns.h> #include <osmocom/gsm/protocol/gsm_04_08.h> +#include <osmocom/gsm/gsm48.h> #include <string.h> @@ -399,3 +400,9 @@ fail: return -1; } +int gprs_ra_id_equals(const struct gprs_ra_id *id1, + const struct gprs_ra_id *id2) +{ + return (id1->mcc == id2->mcc && id1->mnc == id2->mnc && + id1->lac == id2->lac && id1->rac == id2->rac); +} |