aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-07-14 01:52:51 +0200
committerHarald Welte <laforge@gnumonks.org>2012-09-06 21:22:28 +0200
commitd43e407f813d819b0217f7c91bb4ebad007b2928 (patch)
tree051d6e58b82802e7b769be1fa363a40bf8f81dfc
parent4ac78384c2e3a15c43ba9e49bf8db01f26a96915 (diff)
ganc: use vTvLV_GAN TLV encoder/decoderlaforge/ganc-2012
This is required to correctly parse and generate messages with IEs of length > 0x7F, like long SMS messages. A recent copy of libosmocore is required for the core TLV parser support (2fe6847 or later).
-rw-r--r--openbsc/src/osmo-ganc/ganc_server.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/openbsc/src/osmo-ganc/ganc_server.c b/openbsc/src/osmo-ganc/ganc_server.c
index 9bb786e30..0fda63ab5 100644
--- a/openbsc/src/osmo-ganc/ganc_server.c
+++ b/openbsc/src/osmo-ganc/ganc_server.c
@@ -37,8 +37,6 @@
#include "conn.h"
#include "ganc_data.h"
-static struct tlv_definition tlv_att_def;
-
static void push_rc_csr_hdr(struct msgb *msg, uint8_t pdisc, uint8_t msgt)
{
struct gan_rc_csr_hdr *gh =
@@ -246,8 +244,7 @@ static int tx_csr_dl_direct_xfer(struct gan_peer *peer, struct msgb *msg)
printf("<- GA-CSR DL DIRECT TRANSFER\n");
/* tag and length of L3 info */
- assert(msgb_l3len(msg) <= 255);
- msgb_tv_push(msg, GA_IE_L3_MSG, msgb_l3len(msg));
+ msgb_vtvl_gan_push(msg, GA_IE_L3_MSG, msgb_l3len(msg));
push_rc_csr_hdr(msg, GA_PDISC_CSR, GA_MT_CSR_DL_DIRECT_XFER);
@@ -526,7 +523,7 @@ static int rx_unc_msg(struct gan_peer *peer, struct msgb *msg)
printf("-> (%u) %s\n", gh->pdisc, get_value_string(gan_msgt_vals, gh->msg_type));
if (len > 2) {
- rc = tlv_parse(&tp, &tlv_att_def, gh->data, len - 2, 0, 0);
+ rc = tlv_parse(&tp, &vtvlv_gan_att_def, gh->data, len - 2, 0, 0);
if (rc < 0)
fprintf(stderr, "error %d during tlv_parse\n", rc);
} else
@@ -625,10 +622,6 @@ static void unc_accept_cb(struct osmo_conn *conn)
int ganc_server_start(const char *host, uint16_t port)
{
struct osmo_link *link;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(tlv_att_def.def); i++)
- tlv_att_def.def[i].type = TLV_TYPE_TLV;
link = osmo_link_create(NULL, host, port, unc_read_cb, 10);
if (!link)