neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/31434 )


Change subject: fixup for: add osmo_scu_prim_name_c() / _buf()
......................................................................

fixup for: add osmo_scu_prim_name_c() / _buf()

I would like to tweak the names for the recently added functions, so
that they are more clear -- quickly before we release it or anyone uses
these.

Related: I4c1998fd7fee7282d107846dae2cff4b5ceb3a7b
Change-Id: If381f537ab91af1feef7f0e51921217f27e18e6a
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_sap.c
2 files changed, 29 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/34/31434/1

diff --git a/include/osmocom/sigtran/sccp_sap.h 
b/include/osmocom/sigtran/sccp_sap.h
index 3930111..3cda135 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -273,6 +273,14 @@

 #define msgb_scu_prim(msg) ((struct osmo_scu_prim *)(msg)->l1h)

+extern const struct value_string osmo_scu_prim_type_names[];
+static inline const char *osmo_scu_prim_type_name(enum osmo_scu_prim_type val)
+{
+       return get_value_string(osmo_scu_prim_type_names, val);
+}
+
+int osmo_scu_prim_hdr_name_buf(char *buf, size_t buflen, const struct 
osmo_prim_hdr *oph);
+char *osmo_scu_prim_hdr_name_c(void *ctx, const struct osmo_prim_hdr *oph);
 char *osmo_scu_prim_name(const struct osmo_prim_hdr *oph);
 int osmo_scu_prim_name_buf(char *buf, size_t buflen, const struct 
osmo_prim_hdr *oph);
 char *osmo_scu_prim_name_c(void *ctx, const struct osmo_prim_hdr *oph);
diff --git a/src/sccp_sap.c b/src/sccp_sap.c
index c0a42c6..51237ad 100644
--- a/src/sccp_sap.c
+++ b/src/sccp_sap.c
@@ -25,7 +25,7 @@

 #include <osmocom/sigtran/sccp_sap.h>

-const struct value_string osmo_scu_prim_names[] = {
+const struct value_string osmo_scu_prim_type_names[] = {
        { OSMO_SCU_PRIM_N_CONNECT,              "N-CONNECT" },
        { OSMO_SCU_PRIM_N_DATA,                 "N-DATA" },
        { OSMO_SCU_PRIM_N_EXPEDITED_DATA,       "N-EXPEDITED-DATA" },
@@ -45,11 +45,11 @@
 
 char *osmo_scu_prim_name(const struct osmo_prim_hdr *oph)
 {
-       osmo_scu_prim_name_buf(prim_name_buf, sizeof(prim_name_buf), oph);
+       osmo_scu_prim_hdr_name_buf(prim_name_buf, sizeof(prim_name_buf), oph);
        return prim_name_buf;
 }

-int osmo_scu_prim_name_buf(char *buf, size_t buflen, const struct 
osmo_prim_hdr *oph)
+int osmo_scu_prim_hdr_name_buf(char *buf, size_t buflen, const struct 
osmo_prim_hdr *oph)
 {
        struct osmo_strbuf sb = { .buf = buf, .len = buflen };

@@ -59,14 +59,14 @@
        }

        OSMO_STRBUF_PRINTF(sb, "%s.%s",
-                          get_value_string(osmo_scu_prim_names, 
oph->primitive),
-                          get_value_string(osmo_prim_op_names, 
oph->operation));
+                          osmo_scu_prim_type_name(oph->primitive),
+                          osmo_prim_operation_name(oph->operation));
        return sb.chars_needed;
 }

-char *osmo_scu_prim_name_c(void *ctx, const struct osmo_prim_hdr *oph)
+char *osmo_scu_prim_hdr_name_c(void *ctx, const struct osmo_prim_hdr *oph)
 {
-       OSMO_NAME_C_IMPL(ctx, 32, "ERROR", osmo_scu_prim_name_buf, oph)
+       OSMO_NAME_C_IMPL(ctx, 32, "ERROR", osmo_scu_prim_hdr_name_buf, oph)
 }

 #include <osmocom/sigtran/sigtran_sap.h>

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/31434
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: If381f537ab91af1feef7f0e51921217f27e18e6a
Gerrit-Change-Number: 31434
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to