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
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;