<div dir="ltr"><div><div><div><div>Hello!<br><br>> thanks a lot, I am afraid we need one more round.<br></div><br>No problem :)<br><br><span class="im">> -#define tmsi_from_string(str) strtoul(str, NULL, 10)<br>
> +#define tmsi_from_string(str) strtoul(str + 2, NULL, 16)<br>
><br>
</span>> this macro is used for parsing strings from the network. We should not modify it.<br><br></div>I cannot find where...<br><br>Searching 420 files for "tmsi_from_string" (regex)<br><br>/home/wmn/openbsc/openbsc/include/openbsc/gsm_subscriber.h:<br> 15 #define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001<br> 16 /* gprs_sgsn.h defines additional flags including and above bit 16 (0x10000) */<br> 17: #define tmsi_from_string(str) strtoul(str + 2, NULL, 16)<br> 18 <br> 19 #define GSM_SUBSCRIBER_NO_EXPIRATION 0x0<br><br>/home/wmn/openbsc/openbsc/src/libcommon/gsm_subscriber_base.c:<br> 122 {<br> 123 struct gsm_subscriber *subscr;<br> 124: uint8_t tmsi_val = tmsi_from_string(tmsi);<br> 125 <br> 126 llist_for_each_entry(subscr, subscr_bsc_active_subscribers(), entry) {<br><br>/home/wmn/openbsc/openbsc/src/libmsc/db.c:<br> 890 string = dbi_result_get_string(result, "tmsi");<br> 891 if (string)<br> 892: subscr->tmsi = tmsi_from_string(string);<br> 893 <br> 894 string = dbi_result_get_string(result, "name");<br><br>/home/wmn/openbsc/openbsc/src/libmsc/gsm_subscriber.c:<br> 215 {<br> 216 struct gsm_subscriber *subscr;<br> 217: uint32_t tmsi_val = tmsi_from_string(tmsi);<br> 218 <br> 219 /* we might have a record in memory already */<br><br>/home/wmn/openbsc/openbsc/tests/gsm0408/gsm0408_test.c:<br> 94 mi_len = gsm48_generate_mid_from_tmsi(mi, tmsi);<br> 95 gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len - 2);<br> 96: COMPARE((uint32_t)tmsi_from_string(mi_parsed), ==, tmsi);<br> 97 <br> 98 /* imsi code */<br><br>5 matches across 5 files<br><br><span class="im">> struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_subscriber_group *sgrp,<br>
> - uint32_t tmsi)<br>
> + const char *tmsi)<br>
><br>
</span>> why? the number of bytes needed fit in uint32_t so we should
remain with this internal storage. We should just make sure to always
print it as hex.<br><br></div>Ok, I'll revert this changes.<br><br><span class="im">> -#define SCHEMA_REVISION "4"<br>
> +#define SCHEMA_REVISION "5"<br>
><br>
</span>> good, but I think we should change the schema to use uint32_t/INTEGER for the TMSI instead of text.<br><br></div>I'll do it in db.c.<br><div><div><div> <br></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>С наилучшими пожеланиями,<br></div>Яницкий Вадим.<br></div></div></div>
<br><div class="gmail_quote">2016-03-27 22:44 GMT+06:00 Holger Freyther <span dir="ltr"><<a href="mailto:holger@freyther.de" target="_blank">holger@freyther.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On 27 Mar 2016, at 14:17, Vadim Yanitskiy <<a href="mailto:axilirator@gmail.com">axilirator@gmail.com</a>> wrote:<br>
<br>
Dear Vadim,<br>
<span class=""><br>
<br>
><br>
> In OpenBSC, we traditionally displayed a TMSI in its integer<br>
> representation, which is quite unusual in the telecom world. A TMSI is<br>
> normally printed as a series of 8 hex digits.<br>
><br>
> This patch aligns OpenBSC with the telecom industry standard.<br>
<br>
</span>thanks a lot, I am afraid we need one more round.<br>
<span class=""><br>
<br>
> -#define tmsi_from_string(str) strtoul(str, NULL, 10)<br>
> +#define tmsi_from_string(str) strtoul(str + 2, NULL, 16)<br>
<br>
</span>this macro is used for parsing strings from the network. We should not modify it.<br>
<span class=""><br>
<br>
<br>
> struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_subscriber_group *sgrp,<br>
> - uint32_t tmsi)<br>
> + const char *tmsi)<br>
<br>
<br>
</span>why? the number of bytes needed fit in uint32_t so we should remain with this internal storage. We should just make sure to always print it as hex.<br>
<span class=""><br>
<br>
> -#define SCHEMA_REVISION "4"<br>
> +#define SCHEMA_REVISION "5"<br>
<br>
</span>good, but I think we should change the schema to use uint32_t/INTEGER for the TMSI instead of text.<br>
<span class=""><br>
<br>
<br>
> + /* Update old TMSI */<br>
> + update = dbi_conn_queryf(conn,<br>
> + "UPDATE Subscriber "<br>
> + "SET tmsi = '0x%08x' "<br>
> + "WHERE id = %llu",<br>
<br>
</span>but to int :)<br>
<br>
<br>
kind regards<br>
<span class="HOEnZb"><font color="#888888"> holger</font></span></blockquote></div><br></div>