diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-11-24 21:32:07 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-11-24 21:33:16 +0100 |
commit | 2861007a404cf6d8e85b299d4b2507485c461a4a (patch) | |
tree | 61cb0cedb66425dffbca9f4215e8c59c50c57168 /openbsc/src | |
parent | a9f23c8291a0d9a61152a6f9646d72ed3d40fff3 (diff) |
GPRS: add new bssgp_create_cell_id(), opposite of bssgp_parse_cell_id()
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/libgb/gprs_bssgp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c index 072dff6e..f26ff163 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) |