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/13107 )
Change subject: rspro_util: Add rspro_IpAddr2str() to get stringified version of IpAddr_t
......................................................................
rspro_util: Add rspro_IpAddr2str() to get stringified version of IpAddr_t
Change-Id: Ic6cccb00d1d65bdab84178acb1e0525e11bc1315
---
M src/rspro_util.c
M src/rspro_util.h
2 files changed, 18 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/src/rspro_util.c b/src/rspro_util.c
index efcc848..ed0678e 100644
--- a/src/rspro_util.c
+++ b/src/rspro_util.c
@@ -1,5 +1,8 @@
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
#include <asn_application.h>
#include <der_encoder.h>
@@ -114,6 +117,20 @@
string_fromOCTET_STRING_ARRAY(out->fw_version, in->fwVersion);
}
+const char *rspro_IpAddr2str(const IpAddress_t *in)
+{
+ static char buf[128];
+
+ switch (in->present) {
+ case IpAddress_PR_ipv4:
+ return inet_ntop(AF_INET, in->choice.ipv4.buf, buf, sizeof(buf));
+ case IpAddress_PR_ipv6:
+ return inet_ntop(AF_INET6, in->choice.ipv6.buf, buf, sizeof(buf));
+ default:
+ return NULL;
+ }
+}
+
static void fill_ip4_port(IpPort_t *out, uint32_t ip, uint16_t port)
{
uint32_t ip_n = htonl(ip);
diff --git a/src/rspro_util.h b/src/rspro_util.h
index 7a0c8ed..26b3883 100644
--- a/src/rspro_util.h
+++ b/src/rspro_util.h
@@ -38,3 +38,4 @@
const uint8_t *tpdu, unsigned int tpdu_len);
void rspro_comp_id_retrieve(struct app_comp_id *out, const ComponentIdentity_t *in);
+const char *rspro_IpAddr2str(const IpAddress_t *in);
--
To view, visit https://gerrit.osmocom.org/13107
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic6cccb00d1d65bdab84178acb1e0525e11bc1315
Gerrit-Change-Number: 13107
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190307/70efa45a/attachment.htm>