pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/28820 )
Change subject: Move cbc_cell_id2str() and make it public ......................................................................
Move cbc_cell_id2str() and make it public
It will be used later on to log whenever new cell ids are added to a message_peer.
Change-Id: I74ccbbc810a2fa76fb2999a7588b3f67d4d21e03 --- M include/osmocom/cbc/cbc_data.h M src/cbc_data.c M src/cbc_vty.c 3 files changed, 35 insertions(+), 33 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, approved
diff --git a/include/osmocom/cbc/cbc_data.h b/include/osmocom/cbc/cbc_data.h index d3a8319..890da67 100644 --- a/include/osmocom/cbc/cbc_data.h +++ b/include/osmocom/cbc/cbc_data.h @@ -39,6 +39,8 @@ } num_compl; };
+const char *cbc_cell_id2str(const struct cbc_cell_id *cid); + /********************************************************************************* * CBC itself *********************************************************************************/ diff --git a/src/cbc_data.c b/src/cbc_data.c index 2e350e9..68dc024 100644 --- a/src/cbc_data.c +++ b/src/cbc_data.c @@ -35,6 +35,39 @@ #include <osmocom/cbc/rest_it_op.h> #include <osmocom/cbc/debug.h>
+const char *cbc_cell_id2str(const struct cbc_cell_id *cid) +{ + static char buf[256]; + + switch (cid->id_discr) { + case CBC_CELL_ID_NONE: + snprintf(buf, sizeof(buf), "NONE"); + break; + case CBC_CELL_ID_BSS: + snprintf(buf, sizeof(buf), "BSS"); + break; + case CBC_CELL_ID_CGI: + snprintf(buf, sizeof(buf), "CGI %s", osmo_cgi_name(&cid->u.cgi)); + break; + case CBC_CELL_ID_LAC_CI: + snprintf(buf, sizeof(buf), "LAC %u CI %u", cid->u.lac_and_ci.lac, cid->u.lac_and_ci.ci); + break; + case CBC_CELL_ID_LAI: + snprintf(buf, sizeof(buf), "LAI %s", osmo_lai_name(&cid->u.lai)); + break; + case CBC_CELL_ID_LAC: + snprintf(buf, sizeof(buf), "LAC %u", cid->u.lac); + break; + case CBC_CELL_ID_CI: + snprintf(buf, sizeof(buf), "CI %u", cid->u.ci); + break; + default: + snprintf(buf, sizeof(buf), "<invalid>"); + break; + } + return buf; +} + struct cbc *cbc_alloc(void *ctx) { struct cbc *cbc; diff --git a/src/cbc_vty.c b/src/cbc_vty.c index 1f19878..631ef96 100644 --- a/src/cbc_vty.c +++ b/src/cbc_vty.c @@ -174,39 +174,6 @@ return CMD_SUCCESS; }
-static const char *cbc_cell_id2str(const struct cbc_cell_id *cid) -{ - static char buf[256]; - - switch (cid->id_discr) { - case CBC_CELL_ID_NONE: - snprintf(buf, sizeof(buf), "NONE"); - break; - case CBC_CELL_ID_BSS: - snprintf(buf, sizeof(buf), "BSS"); - break; - case CBC_CELL_ID_CGI: - snprintf(buf, sizeof(buf), "CGI %s", osmo_cgi_name(&cid->u.cgi)); - break; - case CBC_CELL_ID_LAC_CI: - snprintf(buf, sizeof(buf), "LAC %u CI %u", cid->u.lac_and_ci.lac, cid->u.lac_and_ci.ci); - break; - case CBC_CELL_ID_LAI: - snprintf(buf, sizeof(buf), "LAI %s", osmo_lai_name(&cid->u.lai)); - break; - case CBC_CELL_ID_LAC: - snprintf(buf, sizeof(buf), "LAC %u", cid->u.lac); - break; - case CBC_CELL_ID_CI: - snprintf(buf, sizeof(buf), "CI %u", cid->u.ci); - break; - default: - snprintf(buf, sizeof(buf), "<invalid>"); - break; - } - return buf; -} - static void dump_one_msg_peer(struct vty *vty, const struct cbc_message_peer *msg_peer, const char *pfx) { struct cbc_cell_id *cid;
2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.