aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-08-17 22:05:06 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-17 22:05:06 +0200
commit57555aa60c8ac528a1635e0c7a56ba232e860cb7 (patch)
treea8c7858a3251905d05205334348de2d41def4590
parentd5c5c0b790e6d16572389a7877060356a8dbc9cf (diff)
rspro_util: Add ASN_ALLOC_COPY macro and add clientSlot to ConnectClientReq
-rw-r--r--src/rspro_util.c13
-rw-r--r--src/rspro_util.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/rspro_util.c b/src/rspro_util.c
index 4da9270..9f51257 100644
--- a/src/rspro_util.c
+++ b/src/rspro_util.c
@@ -8,6 +8,16 @@
#include "rspro_util.h"
+#define ASN_ALLOC_COPY(out, in) \
+do { \
+ if (in) { \
+ out = CALLOC(1, sizeof(*in)); \
+ OSMO_ASSERT(out); \
+ memcpy(out, in, sizeof(*in)); \
+ } \
+} while (0)
+
+
struct msgb *rspro_msgb_alloc(void)
{
return msgb_alloc_headroom(1024, 8, "RSPRO");
@@ -95,13 +105,14 @@ RsproPDU_t *rspro_gen_ConnectBankReq(const struct app_comp_id *a_cid,
return pdu;
}
-RsproPDU_t *rspro_gen_ConnectClientReq(const struct app_comp_id *a_cid)
+RsproPDU_t *rspro_gen_ConnectClientReq(const struct app_comp_id *a_cid, const ClientSlot_t *client)
{
RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
if (!pdu)
return NULL;
pdu->msg.present = RsproPDUchoice_PR_connectClientReq;
fill_comp_id(&pdu->msg.choice.connectClientReq.identity, a_cid);
+ ASN_ALLOC_COPY(pdu->msg.choice.connectClientReq.clientSlot, client);
return pdu;
}
diff --git a/src/rspro_util.h b/src/rspro_util.h
index 87b2b97..8590a1b 100644
--- a/src/rspro_util.h
+++ b/src/rspro_util.h
@@ -22,7 +22,7 @@ struct msgb *rspro_enc_msg(RsproPDU_t *pdu);
RsproPDU_t *rspro_dec_msg(struct msgb *msg);
RsproPDU_t *rspro_gen_ConnectBankReq(const struct app_comp_id *a_cid,
uint16_t bank_id, uint16_t num_slots);
-RsproPDU_t *rspro_gen_ConnectClientReq(const struct app_comp_id *a_cid);
+RsproPDU_t *rspro_gen_ConnectClientReq(const struct app_comp_id *a_cid, const ClientSlot_t *client);
RsproPDU_t *rspro_gen_CreateMappingReq(const ClientSlot_t *client, const BankSlot_t *bank);
RsproPDU_t *rspro_gen_ConfigClientReq(const ClientSlot_t *client, uint32_t ip, uint16_t port);
RsproPDU_t *rspro_gen_SetAtrReq(uint16_t client_id, uint16_t slot_nr, const uint8_t *atr,