diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-05-12 02:04:53 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-11-05 05:13:57 +0000 |
commit | 219ed20cb5cbda05d5480d7486b228b994e50b9d (patch) | |
tree | 34629be7f718d39c3a11614d4cd2222469009b11 /src/host/virt_phy | |
parent | d350e9f30c3b5f77363124308dfdfbc0ef3bd35c (diff) |
l1ctl_proto.h: use flexible array member for traffic messages
Unlike the DATA messages, traffic frames may have different length.
Instead of having fixed payload (i.e. TCH frame) length, let's
introduce a flexible array member. This would allow one to
calculate the frame length using the MSGB API.
Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
Diffstat (limited to 'src/host/virt_phy')
-rw-r--r-- | src/host/virt_phy/src/virt_prim_traffic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/host/virt_phy/src/virt_prim_traffic.c b/src/host/virt_phy/src/virt_prim_traffic.c index 4e58de60..5f6b273b 100644 --- a/src/host/virt_phy/src/virt_prim_traffic.c +++ b/src/host/virt_phy/src/virt_prim_traffic.c @@ -84,6 +84,7 @@ void l1ctl_tx_traffic_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arf struct msgb *l1ctl_msg = NULL; struct l1ctl_traffic_ind * l1ti; struct l1ctl_info_dl * l1dl; + uint8_t *frame, frame_len; uint8_t rsl_chan_type, subchan, timeslot; l1ctl_msg = l1ctl_msgb_alloc(L1CTL_TRAFFIC_IND); l1dl = (struct l1ctl_info_dl *) msgb_put(l1ctl_msg, sizeof(*l1dl)); @@ -102,7 +103,10 @@ void l1ctl_tx_traffic_ind(struct l1_model_ms *ms, struct msgb *msg, uint16_t arf /* TODO: traffic decoding and decryption */ - memcpy(l1ti->data, msgb_data(msg), msgb_length(msg)); + frame_len = msgb_length(msg); + frame = (uint8_t *) msgb_put(l1ctl_msg, frame_len); + memcpy(frame, msgb_data(msg), frame_len); + DEBUGPMS(DL1P, ms, "Tx L1CTL_TRAFFIC_IND (chan_nr=0x%02x, link_id=0x%02x)\n", chan_nr, link_id); l1ctl_sap_tx_to_l23_inst(ms, l1ctl_msg); } |