summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libgb
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-11-24 21:32:07 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-24 21:33:16 +0100
commit8cbc4a406d8fc11c663b0baf58497671fa165c84 (patch)
treefadeb8ee5cfde297f9535b56044f5432e5078d3c /openbsc/src/libgb
parent914660d6f65e7a5f90cdebc31b173ba8bc0f0483 (diff)
GPRS: add new bssgp_create_cell_id(), opposite of bssgp_parse_cell_id()
Diffstat (limited to 'openbsc/src/libgb')
-rw-r--r--openbsc/src/libgb/gprs_bssgp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c
index 072dff6ef..f26ff163c 100644
--- a/openbsc/src/libgb/gprs_bssgp.c
+++ b/openbsc/src/libgb/gprs_bssgp.c
@@ -232,6 +232,18 @@ uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf)
return ntohs(*(uint16_t *) (buf+6));
}
+int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
+ uint16_t cid)
+{
+ uint16_t *out_cid = (uint16_t *) (buf + 6);
+ /* 6 octets RAC */
+ gsm48_construct_ra(buf, raid);
+ /* 2 octets CID */
+ *out_cid = htons(cid);
+
+ return 8;
+}
+
/* Chapter 8.4 BVC-Reset Procedure */
static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
uint16_t ns_bvci)