<p>lynxis lazus has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/19141">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">socket.h: introduce osmo_sockaddr to hold v4 and v6 endpoints<br><br>When dealing with IPv4 and IPv6 address, the struct sockaddr<br>allows to hold IPv4 and IPv6.<br>However even when struct sockaddr is being used, a cast to the<br>IPv4 or IPv6 family must happen. To work around this additional code,<br>use a union for the most common types.<br><br>Change-Id: If80172373735193401af872b18e1ff00c93880e7<br>---<br>M include/osmocom/core/socket.h<br>1 file changed, 9 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/19141/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h</span><br><span>index 129612c..bc60dfc 100644</span><br><span>--- a/include/osmocom/core/socket.h</span><br><span>+++ b/include/osmocom/core/socket.h</span><br><span>@@ -22,6 +22,15 @@</span><br><span> struct sockaddr;</span><br><span> struct osmo_fd;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct osmo_sockaddr {</span><br><span style="color: hsl(120, 100%, 40%);">+     union {</span><br><span style="color: hsl(120, 100%, 40%);">+               struct sockaddr sa;</span><br><span style="color: hsl(120, 100%, 40%);">+           struct sockaddr_storage sas;</span><br><span style="color: hsl(120, 100%, 40%);">+          struct sockaddr_in sin;</span><br><span style="color: hsl(120, 100%, 40%);">+               struct sockaddr_in6 sin6;</span><br><span style="color: hsl(120, 100%, 40%);">+     } u;</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* flags for osmo_sock_init. */</span><br><span> /*! connect the socket to a remote peer */</span><br><span> #define OSMO_SOCK_F_CONNECT      (1 << 0)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/19141">change 19141</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/c/libosmocore/+/19141"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If80172373735193401af872b18e1ff00c93880e7 </div>
<div style="display:none"> Gerrit-Change-Number: 19141 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>