Change in libosmocore[master]: oap_client: Rename symbols with osmo_ prefix

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 30 10:57:43 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10237 )

Change subject: oap_client: Rename symbols with osmo_ prefix
......................................................................

oap_client: Rename symbols with osmo_ prefix

As we're moving this to a common/shared library now, we need to use
the osmo_ namespace prefix for symbol names, struct/type names and
constants.

Change-Id: Ie36729996abd30b84d1c30a09f62ebc6a9794950
---
M include/osmocom/gsm/oap_client.h
M src/gsm/libosmogsm.map
M src/gsm/oap_client.c
3 files changed, 41 insertions(+), 41 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/gsm/oap_client.h b/include/osmocom/gsm/oap_client.h
index 80c86d5..763f982 100644
--- a/include/osmocom/gsm/oap_client.h
+++ b/include/osmocom/gsm/oap_client.h
@@ -30,7 +30,7 @@
 /* This is the config part for vty. It is essentially copied in
  * oap_client_state, where values are copied over once the config is
  * considered valid. */
-struct oap_client_config {
+struct osmo_oap_client_config {
 	uint16_t client_id;
 	int secret_k_present;
 	uint8_t secret_k[16];
@@ -42,14 +42,14 @@
  * duplicated from oap_client_config, so that a separate validation of the
  * config data is possible, and so that only a struct oap_client_state* is
  * passed around. */
-struct oap_client_state {
+struct osmo_oap_client_state {
 	enum {
-		OAP_UNINITIALIZED = 0,	/* just allocated. */
-		OAP_DISABLED,		/* disabled by config. */
-		OAP_INITIALIZED,	/* enabled, config is valid. */
-		OAP_REQUESTED_CHALLENGE,
-		OAP_SENT_CHALLENGE_RESULT,
-		OAP_REGISTERED
+		OSMO_OAP_UNINITIALIZED = 0,	/* just allocated. */
+		OSMO_OAP_DISABLED,		/* disabled by config. */
+		OSMO_OAP_INITIALIZED,		/* enabled, config is valid. */
+		OSMO_OAP_REQUESTED_CHALLENGE,
+		OSMO_OAP_SENT_CHALLENGE_RESULT,
+		OSMO_OAP_REGISTERED
 	} state;
 	uint16_t client_id;
 	uint8_t secret_k[16];
@@ -58,25 +58,25 @@
 };
 
 /* From config, initialize state. Return 0 on success. */
-int oap_client_init(struct oap_client_config *config,
-		    struct oap_client_state *state);
+int osmo_oap_client_init(struct osmo_oap_client_config *config,
+			 struct osmo_oap_client_state *state);
 
 /* Construct an OAP registration message and return in *msg_tx. Use
  * state->client_id and update state->state.
  * Return 0 on success, or a negative value on error.
  * If an error is returned, *msg_tx is guaranteed to be NULL. */
-int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx);
+int osmo_oap_client_register(struct osmo_oap_client_state *state, struct msgb **msg_tx);
 
 /* Decode and act on a received OAP message msg_rx. Update state->state.  If a
  * non-NULL pointer is returned in *msg_tx, that msgb should be sent to the OAP
  * server (and freed) by the caller. The received msg_rx is not freed.
  * Return 0 on success, or a negative value on error.
  * If an error is returned, *msg_tx is guaranteed to be NULL. */
-int oap_client_handle(struct oap_client_state *state,
-		      const struct msgb *msg_rx, struct msgb **msg_tx);
+int osmo_oap_client_handle(struct osmo_oap_client_state *state,
+			   const struct msgb *msg_rx, struct msgb **msg_tx);
 
 /* Allocate a msgb and in it, return the encoded oap_client_msg. Return
  * NULL on error. (Like oap_client_encode(), but also allocates a msgb.)
  * About the name: the idea is do_something(oap_client_encoded(my_struct))
  */
-struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_client_msg);
+struct msgb *osmo_oap_client_encoded(const struct osmo_oap_message *oap_client_msg);
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 6eb60cc..bc9ed52 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -493,10 +493,10 @@
 osmo_mncc_names;
 _osmo_mncc_log;
 
-oap_client_encoded;
-oap_client_handle;
-oap_client_init;
-oap_client_register;
+osmo_oap_client_encoded;
+osmo_oap_client_handle;
+osmo_oap_client_init;
+osmo_oap_client_register;
 
 local: *;
 };
diff --git a/src/gsm/oap_client.c b/src/gsm/oap_client.c
index 2227a3c..ea40634 100644
--- a/src/gsm/oap_client.c
+++ b/src/gsm/oap_client.c
@@ -30,10 +30,10 @@
 
 #include <osmocom/gsm/oap_client.h>
 
-int oap_client_init(struct oap_client_config *config,
-		    struct oap_client_state *state)
+int osmo_oap_client_init(struct osmo_oap_client_config *config,
+			 struct osmo_oap_client_state *state)
 {
-	OSMO_ASSERT(state->state == OAP_UNINITIALIZED);
+	OSMO_ASSERT(state->state == OSMO_OAP_UNINITIALIZED);
 
 	if (!config)
 		goto disable;
@@ -54,11 +54,11 @@
 	state->client_id = config->client_id;
 	memcpy(state->secret_k, config->secret_k, sizeof(state->secret_k));
 	memcpy(state->secret_opc, config->secret_opc, sizeof(state->secret_opc));
-	state->state = OAP_INITIALIZED;
+	state->state = OSMO_OAP_INITIALIZED;
 	return 0;
 
 disable:
-	state->state = OAP_DISABLED;
+	state->state = OSMO_OAP_DISABLED;
 	return 0;
 }
 
@@ -71,7 +71,7 @@
  * response message and update the state.
  * Return 0 on success; -1 if OAP is disabled; -2 if rx_random and rx_autn fail
  * the authentication check; -3 for any other errors. */
-static int oap_evaluate_challenge(const struct oap_client_state *state,
+static int oap_evaluate_challenge(const struct osmo_oap_client_state *state,
 				  const uint8_t *rx_random,
 				  const uint8_t *rx_autn,
 				  uint8_t *tx_xres)
@@ -89,8 +89,8 @@
 			   == sizeof(state->secret_opc), _secret_opc_size_match);
 
 	switch (state->state) {
-	case OAP_UNINITIALIZED:
-	case OAP_DISABLED:
+	case OSMO_OAP_UNINITIALIZED:
+	case OSMO_OAP_DISABLED:
 		return -1;
 	default:
 		break;
@@ -124,7 +124,7 @@
 	return 0;
 }
 
-struct msgb *oap_client_encoded(const struct osmo_oap_message *oap_msg)
+struct msgb *osmo_oap_client_encoded(const struct osmo_oap_message *oap_msg)
 {
 	struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__);
 	OSMO_ASSERT(msg);
@@ -145,16 +145,16 @@
 
 	oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST;
 	oap_msg.client_id = client_id;
-	return oap_client_encoded(&oap_msg);
+	return osmo_oap_client_encoded(&oap_msg);
 }
 
-int oap_client_register(struct oap_client_state *state, struct msgb **msg_tx)
+int osmo_oap_client_register(struct osmo_oap_client_state *state, struct msgb **msg_tx)
 {
 	*msg_tx = oap_msg_register(state->client_id);
 	if (!(*msg_tx))
 		return -1;
 
-	state->state = OAP_REQUESTED_CHALLENGE;
+	state->state = OSMO_OAP_REQUESTED_CHALLENGE;
 	return 0;
 }
 
@@ -168,10 +168,10 @@
 	oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT;
 	memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres));
 	oap_reply.xres_present = 1;
-	return oap_client_encoded(&oap_reply);
+	return osmo_oap_client_encoded(&oap_reply);
 }
 
-static int handle_challenge(struct oap_client_state *state,
+static int handle_challenge(struct osmo_oap_client_state *state,
 			    struct osmo_oap_message *oap_rx,
 			    struct msgb **msg_tx)
 {
@@ -199,17 +199,17 @@
 		goto failure;
 	}
 
-	state->state = OAP_SENT_CHALLENGE_RESULT;
+	state->state = OSMO_OAP_SENT_CHALLENGE_RESULT;
 	return 0;
 
 failure:
 	OSMO_ASSERT(rc < 0);
-	state->state = OAP_INITIALIZED;
+	state->state = OSMO_OAP_INITIALIZED;
 	return rc;
 }
 
-int oap_client_handle(struct oap_client_state *state,
-		      const struct msgb *msg_rx, struct msgb **msg_tx)
+int osmo_oap_client_handle(struct osmo_oap_client_state *state,
+			   const struct msgb *msg_rx, struct msgb **msg_tx)
 {
 	uint8_t *data = msgb_l2(msg_rx);
 	size_t data_len = msgb_l2len(msg_rx);
@@ -229,12 +229,12 @@
 	}
 
 	switch (state->state) {
-	case OAP_UNINITIALIZED:
+	case OSMO_OAP_UNINITIALIZED:
 		LOGP(DLOAP, LOGL_ERROR,
 		     "Received OAP message %d, but the OAP client is"
 		     " not initialized\n", oap_msg.message_type);
 		return -ENOTCONN;
-	case OAP_DISABLED:
+	case OSMO_OAP_DISABLED:
 		LOGP(DLOAP, LOGL_ERROR,
 		     "Received OAP message %d, but the OAP client is"
 		     " disabled\n", oap_msg.message_type);
@@ -249,16 +249,16 @@
 
 	case OAP_MSGT_REGISTER_RESULT:
 		/* successfully registered */
-		state->state = OAP_REGISTERED;
+		state->state = OSMO_OAP_REGISTERED;
 		break;
 
 	case OAP_MSGT_REGISTER_ERROR:
 		LOGP(DLOAP, LOGL_ERROR,
 		     "OAP registration failed\n");
-		state->state = OAP_INITIALIZED;
+		state->state = OSMO_OAP_INITIALIZED;
 		if (state->registration_failures < 3) {
 			state->registration_failures++;
-			return oap_client_register(state, msg_tx);
+			return osmo_oap_client_register(state, msg_tx);
 		}
 		return -11;
 

-- 
To view, visit https://gerrit.osmocom.org/10237
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie36729996abd30b84d1c30a09f62ebc6a9794950
Gerrit-Change-Number: 10237
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180730/f1633b43/attachment.htm>


More information about the gerrit-log mailing list