Change in libosmocore[master]: oap_client: rename oa_* to osmo_oap_*

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 23 11:45:15 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/10111


Change subject: oap_client: rename oa_* to osmo_oap_*
......................................................................

oap_client: rename oa_* to osmo_oap_*

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: Ifa777de6293bac5d4817c11dc2420fa6631c8b41
---
M include/osmocom/gsupclient/gsup_client.h
M include/osmocom/gsupclient/oap_client.h
M src/gsupclient/gsup_client.c
M src/gsupclient/oap_client.c
4 files changed, 44 insertions(+), 44 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/11/10111/1

diff --git a/include/osmocom/gsupclient/gsup_client.h b/include/osmocom/gsupclient/gsup_client.h
index e8be11f..6af50dc 100644
--- a/include/osmocom/gsupclient/gsup_client.h
+++ b/include/osmocom/gsupclient/gsup_client.h
@@ -44,7 +44,7 @@
 	osmo_gsup_client_read_cb_t read_cb;
 	void *data;
 
-	struct oap_client_state oap_state;
+	struct osmo_oap_client_state oap_state;
 
 	struct osmo_timer_list ping_timer;
 	struct osmo_timer_list connect_timer;
@@ -57,7 +57,7 @@
 						 const char *ip_addr,
 						 unsigned int tcp_port,
 						 osmo_gsup_client_read_cb_t read_cb,
-						 struct oap_client_config *oapc_config);
+						 struct osmo_oap_client_config *oapc_config);
 
 void osmo_gsup_client_destroy(struct osmo_gsup_client *gsupc);
 int osmo_gsup_client_send(struct osmo_gsup_client *gsupc, struct msgb *msg);
diff --git a/include/osmocom/gsupclient/oap_client.h b/include/osmocom/gsupclient/oap_client.h
index 80c86d5..763f982 100644
--- a/include/osmocom/gsupclient/oap_client.h
+++ b/include/osmocom/gsupclient/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/gsupclient/gsup_client.c b/src/gsupclient/gsup_client.c
index b4b138b..7cf58ea 100644
--- a/src/gsupclient/gsup_client.c
+++ b/src/gsupclient/gsup_client.c
@@ -112,7 +112,7 @@
 {
 	struct msgb *msg_tx;
 	int rc;
-	rc = oap_client_register(&gsupc->oap_state, &msg_tx);
+	rc = osmo_oap_client_register(&gsupc->oap_state, &msg_tx);
 
 	if ((rc < 0) || (!msg_tx)) {
 		LOGP(DLGSUP, LOGL_ERROR, "GSUP OAP set up, but cannot register.\n");
@@ -134,7 +134,7 @@
 	if (up) {
 		start_test_procedure(gsupc);
 
-		if (gsupc->oap_state.state == OAP_INITIALIZED)
+		if (gsupc->oap_state.state == OSMO_OAP_INITIALIZED)
 			gsup_client_oap_register(gsupc);
 
 		osmo_timer_del(&gsupc->connect_timer);
@@ -152,7 +152,7 @@
 	struct msgb *msg_tx;
 
 	/* If the oap_state is disabled, this will reject the messages. */
-	rc = oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx);
+	rc = osmo_oap_client_handle(&gsupc->oap_state, msg_rx, &msg_tx);
 	msgb_free(msg_rx);
 	if (rc < 0)
 		return rc;
@@ -266,7 +266,7 @@
 						 const char *ip_addr,
 						 unsigned int tcp_port,
 						 osmo_gsup_client_read_cb_t read_cb,
-						 struct oap_client_config *oapc_config)
+						 struct osmo_oap_client_config *oapc_config)
 {
 	struct osmo_gsup_client *gsupc;
 	int rc;
@@ -281,7 +281,7 @@
 	OSMO_ASSERT(gsupc->unit_name);
 
 	/* a NULL oapc_config will mark oap_state disabled. */
-	rc = oap_client_init(oapc_config, &gsupc->oap_state);
+	rc = osmo_oap_client_init(oapc_config, &gsupc->oap_state);
 	if (rc != 0)
 		goto failed;
 
diff --git a/src/gsupclient/oap_client.c b/src/gsupclient/oap_client.c
index 9a0b60f..26b0fe0 100644
--- a/src/gsupclient/oap_client.c
+++ b/src/gsupclient/oap_client.c
@@ -30,10 +30,10 @@
 
 #include <osmocom/gsupclient/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/10111
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa777de6293bac5d4817c11dc2420fa6631c8b41
Gerrit-Change-Number: 10111
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180723/bb93a754/attachment.htm>


More information about the gerrit-log mailing list