<p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/include/osmocom/gsm/bssmap_le.h">File include/osmocom/gsm/bssmap_le.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/include/osmocom/gsm/bssmap_le.h@43">Patch Set #1, Line 43:</a> <code style="font-family:monospace,monospace">     OSMO_BSSMAP_LE_MSGT_PERFORM_LOC_REQ = 0x2b,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">same comment as before in the BSSLAP patch.  Those should be 3GPP constants and hence not be in this header file, nor have an osmo prefix.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/src/gsm/bssmap_le.c">File src/gsm/bssmap_le.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/src/gsm/bssmap_le.c@47">Patch Set #1, Line 47:</a> <code style="font-family:monospace,monospace">      OSMO_BSSMAP_LE_IEI_GANSS_LOCATION_TYPE = 0x82,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">again those look like 3GPP related #defines that should go into a /protocol/ header file, not have OSMO prefix, ...</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/src/gsm/bssmap_le.c@317">Patch Set #1, Line 317:</a> <code style="font-family:monospace,monospace">#define PARSE_ERR(ERRMSG) \</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">this is highly untypical for our code.  I would prefer such functions to retnurn a machine-readable error (like a cause value, either spec-compliant or osmocom-specific) so that the caller can actually interpret the result rather than receiving just a human-readable string.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Transformation from cause/error code to human-readable string can then be done separately by value_string.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/src/gsm/bssmap_le.c@335">Patch Set #1, Line 335:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msgb_put_u8(msg, OSMO_BSSMAP_LE_IEI_APDU);<br>  l = msgb_put(msg, 2);<br> old_tail = msg->tail;<br>      msgb_put_u8(msg, OSMO_BSSMAP_LE_APDU_PROT_BSSLAP);<br>    int rc = osmo_bsslap_enc(msg, bsslap);<br>        if (rc <= 0)<br>               return -EINVAL;<br>       osmo_store16be(msg->tail - old_tail, l);<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">you can probably avoid the "let's first reserve two bytes and store a local pointer to whcih we later manually encode a 16bit length" if you change the order:</p><ul><li>first msgb_put the payload of the message</li><li>then msgb_push the header (including length) in front, at a time where you already know the length of the payload</li></ul></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/libosmocore/+/20334/1/src/gsm/bssmap_le.c@349">Patch Set #1, Line 349:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><br>        if (len < 1)<br>               return "APDU too short";<br><br>  proto = data[0];<br><br>    switch (proto) {<br>      case OSMO_BSSMAP_LE_APDU_PROT_BSSLAP:<br>         return osmo_bsslap_dec(bsslap, data + 1, len - 1);<br>    default:<br>              return "Unimplemented APDU type<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">likewise here. Please return error values (cause values, errno, custom error codes, ...) and not strings.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/20334">change 20334</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/+/20334"/><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: I271e59b794bafc0a7ae0eabbf58918f6d7df431d </div>
<div style="display:none"> Gerrit-Change-Number: 20334 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 01 Oct 2020 10:09:54 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>