From bf5a0f6e2c9d0ae564b171b210f0f97bcbdddbf3 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 6 Jul 2012 08:58:22 +0200 Subject: Move BSSGP/NS instances creation and desctruction to gprs_bssgp_pcu.cpp --- src/pcu_l1_if.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/pcu_l1_if.cpp') diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 0652a1c6..ee126366 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -20,12 +20,13 @@ #include #include #include +#include #include #include #include #include #include -#include +#include extern "C" { #include #include @@ -279,12 +280,40 @@ static int udp_write_cb(struct osmo_fd *ofd, struct msgb *msg) return 0; } +// TODO: We should move this parameters to config file. +#define SGSN_IP 127.0.0.1 +#define SGSN_PORT 23000 +#define NSEI 3 +#define NSVCI 4 + +#define BVCI 7 + +#define MAX_LEN_PDU 60 +#define IE_LLC_PDU 14 +#define BLOCK_DATA_LEN 20 +#define BLOCK_LEN 23 + +#define CELL_ID 0 +#define MNC 2 +#define MCC 262 +#define PCU_LAC 1 +#define PCU_RAC 0 + int pcu_l1if_open() { //struct l1fwd_hdl *l1fh; struct femtol1_hdl *fl1h; int rc; + struct sockaddr_in dest; + dest.sin_family = AF_INET; + dest.sin_port = htons(SGSN_PORT); + inet_aton(SGSN_IP, &dest.sin_addr); + + rc = gprs_bssgp_create(ntohl(dest.sin_addr.s_addr), SGSN_PORT, NSEI, NSVCI, BVCI, MCC, MNC, PCU_LAC, PCU_RAC, CELL_ID); + if (rc < 0) + return rc; + /* allocate new femtol1_handle */ fl1h = talloc_zero(NULL, struct femtol1_hdl); INIT_LLIST_HEAD(&fl1h->wlc_list); @@ -318,3 +347,10 @@ int pcu_l1if_open() return 0; } +void pcu_l1if_close(void) +{ + gprs_bssgp_destroy(); + + /* FIXME: cleanup l1if */ + talloc_free(fl1h); +} -- cgit v1.2.3