This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13562 )
Change subject: smpp: Make libsmpp34 use talloc for its allocations
......................................................................
smpp: Make libsmpp34 use talloc for its allocations
We are just introducing smpp34_set_memory_functions() in libsmpp34
to allow applications like OsmoMSC to provide their own heap allocator
callback functions. Let's used this to integrate with talloc and
hence allow talloc tracking/debugging for libsmpp34 internal
allocations.
Depends: libsmpp34 Change-Id I3656117115e89638c093bfbcbc4369ce302f7a94
Change-Id: Ie2725ffab6a225813e65768735f01678e2022128
Related: OS#3913
---
M src/libmsc/smpp_openbsc.c
1 file changed, 27 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index e6eb010..bbfc500 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -28,6 +28,7 @@
#include <smpp34.h>
#include <smpp34_structs.h>
#include <smpp34_params.h>
+#include <smpp34_heap.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
@@ -52,6 +53,31 @@
#define VSUB_USE_SMPP "SMPP"
#define VSUB_USE_SMPP_CMD "SMPP-cmd"
+/* talloc integration for libsmpp34 */
+
+static struct smsc *g_smsc;
+
+static void *smpp34_talloc_malloc(size_t sz)
+{
+ return talloc_size(g_smsc, sz);
+}
+
+static void *smpp34_talloc_realloc(void *ptr, size_t sz)
+{
+ return talloc_realloc_size(g_smsc, ptr, sz);
+}
+
+static void smpp34_talloc_free(void *ptr)
+{
+ talloc_free(ptr);
+}
+
+static const struct smpp34_memory_functions smpp34_talloc = {
+ .malloc_fun = smpp34_talloc_malloc,
+ .realloc_fun = smpp34_talloc_realloc,
+ .free_fun = smpp34_talloc_free,
+};
+
/*! \brief find vlr_subscr for a given SMPP NPI/TON/Address */
static struct vlr_subscr *subscr_by_dst(struct gsm_network *net,
uint8_t npi, uint8_t ton,
@@ -790,6 +816,7 @@
LOGP(DSMPP, LOGL_FATAL, "Cannot allocate smsc struct\n");
return -1;
}
+ smpp34_set_memory_functions(&smpp34_talloc);
return smpp_vty_init();
}
--
To view, visit https://gerrit.osmocom.org/13562
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie2725ffab6a225813e65768735f01678e2022128
Gerrit-Change-Number: 13562
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190508/ae28ff78/attachment.htm>