<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13107">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rspro_util: Add rspro_IpAddr2str() to get stringified version of IpAddr_t<br><br>Change-Id: Ic6cccb00d1d65bdab84178acb1e0525e11bc1315<br>---<br>M src/rspro_util.c<br>M src/rspro_util.h<br>2 files changed, 18 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/07/13107/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/rspro_util.c b/src/rspro_util.c</span><br><span>index efcc848..ed0678e 100644</span><br><span>--- a/src/rspro_util.c</span><br><span>+++ b/src/rspro_util.c</span><br><span>@@ -1,5 +1,8 @@</span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#include <netinet/in.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <arpa/inet.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include <asn_application.h></span><br><span> #include <der_encoder.h></span><br><span> </span><br><span>@@ -114,6 +117,20 @@</span><br><span>     string_fromOCTET_STRING_ARRAY(out->fw_version, in->fwVersion);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+const char *rspro_IpAddr2str(const IpAddress_t *in)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ static char buf[128];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       switch (in->present) {</span><br><span style="color: hsl(120, 100%, 40%);">+     case IpAddress_PR_ipv4:</span><br><span style="color: hsl(120, 100%, 40%);">+               return inet_ntop(AF_INET, in->choice.ipv4.buf, buf, sizeof(buf));</span><br><span style="color: hsl(120, 100%, 40%);">+  case IpAddress_PR_ipv6:</span><br><span style="color: hsl(120, 100%, 40%);">+               return inet_ntop(AF_INET6, in->choice.ipv6.buf, buf, sizeof(buf));</span><br><span style="color: hsl(120, 100%, 40%);">+ default:</span><br><span style="color: hsl(120, 100%, 40%);">+              return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void fill_ip4_port(IpPort_t *out, uint32_t ip, uint16_t port)</span><br><span> {</span><br><span>  uint32_t ip_n = htonl(ip);</span><br><span>diff --git a/src/rspro_util.h b/src/rspro_util.h</span><br><span>index 7a0c8ed..26b3883 100644</span><br><span>--- a/src/rspro_util.h</span><br><span>+++ b/src/rspro_util.h</span><br><span>@@ -38,3 +38,4 @@</span><br><span>                               const uint8_t *tpdu, unsigned int tpdu_len);</span><br><span> </span><br><span> void rspro_comp_id_retrieve(struct app_comp_id *out, const ComponentIdentity_t *in);</span><br><span style="color: hsl(120, 100%, 40%);">+const char *rspro_IpAddr2str(const IpAddress_t *in);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13107">change 13107</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13107"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-remsim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic6cccb00d1d65bdab84178acb1e0525e11bc1315 </div>
<div style="display:none"> Gerrit-Change-Number: 13107 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>