diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-17 22:58:03 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-17 22:58:03 +0200 |
commit | d193cb327a145b5d69953f12c5638eb46997f791 (patch) | |
tree | 644a58f5a7adcfa89e611c7fa1fbee09be9096cc /openbsc/src/gprs/sgsn_libgtp.c | |
parent | 8fc1a46f2868d71ba271aa34d1758a6c6bb8bd92 (diff) |
[GPRS] More work on a real SGSN
Diffstat (limited to 'openbsc/src/gprs/sgsn_libgtp.c')
-rw-r--r-- | openbsc/src/gprs/sgsn_libgtp.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index e99cb6cc8..f6331b9f0 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -49,12 +49,6 @@ #include <gtp.h> #include <pdp.h> -struct ggsn_ctx { - unsigned int gtp_version; - struct in_addr remote_addr; - struct gsn_t *gsn; -}; - const struct value_string gtp_cause_strs[] = { { GTPCAUSE_REQ_IMSI, "Request IMSI" }, { GTPCAUSE_REQ_IMEI, "Request IMEI" }, @@ -96,18 +90,30 @@ const struct value_string gtp_cause_strs[] = { /* generate a PDP context based on the IE's from the 04.08 message, * and send the GTP create pdp context request to the GGSN */ -int sgsn_create_pdp_ctx(struct ggsn_ctx *ggsn, struct sgsn_mm_ctx *mmctx, - uint16_t nsapi, struct tlv_parsed *tp) +struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct ggsn_ctx *ggsn, + struct sgsn_mm_ctx *mmctx, + uint16_t nsapi, + struct tlv_parsed *tp) { + struct sgsn_pdp_ctx *pctx; struct pdp_t *pdp; uint64_t imsi_ui64; int rc; + pctx = sgsn_pdp_ctx_alloc(mmctx, nsapi); + if (!pctx) { + LOGP(DGPRS, LOGL_ERROR, "Couldn't allocate PDP Ctx\n"); + return NULL; + } + rc = pdp_newpdp(&pdp, imsi_ui64, nsapi, NULL); if (rc) { - LOGP(DGPRS, LOGL_ERROR, "Out of PDP Contexts\n"); - return -ENOMEM; + LOGP(DGPRS, LOGL_ERROR, "Out of libgtp PDP Contexts\n"); + return NULL; } + pctx->lib = pdp; + pctx->ggsn = ggsn; + //pdp->peer = /* sockaddr_in of GGSN (receive) */ //pdp->ipif = /* not used by library */ pdp->version = ggsn->gtp_version; @@ -166,14 +172,16 @@ int sgsn_create_pdp_ctx(struct ggsn_ctx *ggsn, struct sgsn_mm_ctx *mmctx, /* FIXME: change pdp state to 'requested' */ - /* FIXME: pass along a pointer to the MM CTX */ - return gtp_create_context_req(ggsn->gsn, pdp, mmctx); + rc = gtp_create_context_req(ggsn->gsn, pdp, pctx); + /* FIXME */ + + return pctx; } /* The GGSN has confirmed the creation of a PDP Context */ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) { - struct sgsn_mm_ctx *mmctx = cbp; + struct sgsn_pdp_ctx *pctx = cbp; DEBUGP(DGPRS, "Received CREATE PDP CTX CONF, cause=%d(%s)\n", cause, get_value_string(gtp_cause_strs, cause)); @@ -197,7 +205,6 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) return EOF; } - /* FIXME: Determine MM ctx for the PDP ctx */ /* FIXME: Send PDP CTX ACT ACK/REJ to MS */ return 0; } |