From cb1db8b6d5277a52ed553925d301bfdc514bb77c Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Tue, 3 Feb 2015 13:47:53 +0100 Subject: sgsn: Add functions to handle APN contexts This commit adds the exported functions apn_ctx_find_alloc, apn_ctx_free, apn_ctx_by_name, and apn_ctx_match to manage and retrieve APN to GGSN mappings. The following VTY commands are added to 'config-sgsn': - apn APN ggsn <0-255> - apn APN imsi-prefix PREFIX ggsn <0-255> which maps an APN gateway string to an SGSN id. The SGSN must be configured in advance. When matching an APN string, entries with a leading '*' are used for suffix matching, otherwise an exact match is done. When a prefix is given, it is matched against the IMSI. If several entries match, a longer matching IMSI prefix has precedence. If there are several matching entries with the same PREFIX, the entry with longest matching APN is returned. Ticket: OW#1334 Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/gprs_sgsn.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 516b6cda9..b0d7c32b4 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -239,9 +239,15 @@ struct apn_ctx { struct llist_head list; struct sgsn_ggsn_ctx *ggsn; char *name; + char *imsi_prefix; char *description; }; +struct apn_ctx *sgsn_apn_ctx_find_alloc(const char *name, const char *imsi_prefix); +void sgsn_apn_ctx_free(struct apn_ctx *actx); +struct apn_ctx *sgsn_apn_ctx_by_name(const char *name, const char *imsi_prefix); +struct apn_ctx *sgsn_apn_ctx_match(const char *name, const char *imsi_prefix); + extern struct llist_head sgsn_mm_ctxts; extern struct llist_head sgsn_ggsn_ctxts; extern struct llist_head sgsn_apn_ctxts; -- cgit v1.2.3