aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_l1_if.cpp
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-07-06 08:58:22 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2012-07-06 08:58:22 +0200
commitbf5a0f6e2c9d0ae564b171b210f0f97bcbdddbf3 (patch)
tree519edcb8df656328b3fe28cc73ebd32002ab04e5 /src/pcu_l1_if.cpp
parent81e895b6193530ea4b180c2118b9f40bb33de5b7 (diff)
Move BSSGP/NS instances creation and desctruction to gprs_bssgp_pcu.cpp
Diffstat (limited to 'src/pcu_l1_if.cpp')
-rw-r--r--src/pcu_l1_if.cpp38
1 files changed, 37 insertions, 1 deletions
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 <errno.h>
#include <string.h>
#include <gprs_rlcmac.h>
+#include <gprs_bssgp_pcu.h>
#include <pcu_l1_if.h>
#include <gprs_debug.h>
#include <bitvector.h>
#include <gsmL1prim.h>
#include <sys/socket.h>
-#include <linux/in.h>
+#include <arpa/inet.h>
extern "C" {
#include <osmocom/core/talloc.h>
#include <osmocom/core/write_queue.h>
@@ -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);
+}