summaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-08 21:30:34 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-13 14:54:01 +0000
commit49012f14dd5480573943e5d8cd5e9908f3eabb16 (patch)
tree4e00395a69f244daa66c334d28f9be61e01ebcb1 /openbsc/tests
parent736474ce451a92cdc17db5f290f55f8cf22a13a2 (diff)
oap: rename public API from oap_ to oap_client_
Mainly to differentiate the OAP messaging API (osmo_oap_ in libosmocore) from the OAP client. This is in preparation for moving the oap client to libcommon, which is in turn preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should have. We also have OAP messages code in libosmocore, so clarify by naming this osmo_oap_client, and by also renaming the oap_test to oap_client_test. This reshuffling will allow an easy move of OAP to libosmocore if we should want to do that. A number of patches will follow up on this. Related: OS#1592 Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/oap/oap_test.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c
index 68542fd4d..a6f54f67e 100644
--- a/openbsc/tests/oap/oap_test.c
+++ b/openbsc/tests/oap/oap_test.c
@@ -31,11 +31,11 @@ static void test_oap_api(void)
{
printf("Testing OAP API\n - Config parsing\n");
- struct oap_config _config;
- struct oap_config *config = &_config;
+ struct oap_client_config _config;
+ struct oap_client_config *config = &_config;
- struct oap_state _state;
- struct oap_state *state = &_state;
+ struct oap_client_state _state;
+ struct oap_client_state *state = &_state;
memset(config, 0, sizeof(*config));
memset(state, 0, sizeof(*state));
@@ -50,7 +50,7 @@ static void test_oap_api(void)
config->client_id = 0;
config->secret_k_present = 0;
config->secret_opc_present = 0;
- OSMO_ASSERT( oap_init(config, state) == 0 );
+ OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_DISABLED);
/* reset state */
@@ -60,7 +60,7 @@ static void test_oap_api(void)
config->client_id = 0;
config->secret_k_present = 1;
config->secret_opc_present = 1;
- OSMO_ASSERT( oap_init(config, state) == 0 );
+ OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_DISABLED);
memset(state, 0, sizeof(*state));
@@ -69,7 +69,7 @@ static void test_oap_api(void)
config->client_id = 12345;
config->secret_k_present = 0;
config->secret_opc_present = 1;
- OSMO_ASSERT( oap_init(config, state) == 0 );
+ OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_DISABLED);
memset(state, 0, sizeof(*state));
@@ -78,7 +78,7 @@ static void test_oap_api(void)
config->client_id = 12345;
config->secret_k_present = 1;
config->secret_opc_present = 0;
- OSMO_ASSERT( oap_init(config, state) == 0 );
+ OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_DISABLED);
memset(state, 0, sizeof(*state));
@@ -89,7 +89,7 @@ static void test_oap_api(void)
config->secret_k_present = 1;
config->secret_opc_present = 1;
/*config->secret_* buffers are still set from the top */
- OSMO_ASSERT( oap_init(config, state) == 0 );
+ OSMO_ASSERT( oap_client_init(config, state) == 0 );
OSMO_ASSERT(state->state == OAP_INITIALIZED);
printf(" - AUTN failures\n");
@@ -105,8 +105,8 @@ static void test_oap_api(void)
oap_rx.message_type = OAP_MSGT_CHALLENGE_REQUEST;
oap_rx.rand_present = 0;
oap_rx.autn_present = 0;
- msg_rx = oap_encoded(&oap_rx);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2);
+ msg_rx = oap_client_encoded(&oap_rx);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2);
msgb_free(msg_rx);
OSMO_ASSERT(!msg_tx);
@@ -114,8 +114,8 @@ static void test_oap_api(void)
osmo_hexparse("0102030405060708090a0b0c0d0e0f10",
oap_rx.rand, 16);
oap_rx.rand_present = 1;
- msg_rx = oap_encoded(&oap_rx);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2);
+ msg_rx = oap_client_encoded(&oap_rx);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2);
msgb_free(msg_rx);
OSMO_ASSERT(!msg_tx);
@@ -124,8 +124,8 @@ static void test_oap_api(void)
osmo_hexparse("cec4e3848a33000086781158ca40f136",
oap_rx.autn, 16);
oap_rx.autn_present = 1;
- msg_rx = oap_encoded(&oap_rx);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2);
+ msg_rx = oap_client_encoded(&oap_rx);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2);
msgb_free(msg_rx);
OSMO_ASSERT(!msg_tx);
@@ -136,25 +136,25 @@ static void test_oap_api(void)
oap_rx.autn, 16);
oap_rx.rand_present = 1;
oap_rx.autn_present = 1;
- msg_rx = oap_encoded(&oap_rx);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -2);
+ msg_rx = oap_client_encoded(&oap_rx);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -2);
msgb_free(msg_rx);
OSMO_ASSERT(!msg_tx);
/* all data correct */
osmo_hexparse("cec4e3848a33000086781158ca40f136",
oap_rx.autn, 16);
- msg_rx = oap_encoded(&oap_rx);
+ msg_rx = oap_client_encoded(&oap_rx);
/* but refuse to evaluate in uninitialized state */
OSMO_ASSERT(state->state == OAP_INITIALIZED);
state->state = OAP_UNINITIALIZED;
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1);
OSMO_ASSERT(!msg_tx);
state->state = OAP_DISABLED;
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -1);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -1);
OSMO_ASSERT(!msg_tx);
state->state = OAP_INITIALIZED;
@@ -162,7 +162,7 @@ static void test_oap_api(void)
/* now everything is correct */
printf(" - AUTN success\n");
/* a successful return value here indicates correct autn */
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0);
msgb_free(msg_rx);
/* Expect the challenge response in msg_tx */
@@ -176,18 +176,18 @@ static void test_oap_api(void)
msgb_free(msg_tx);
msg_tx = 0;
- struct oap_state saved_state = _state;
+ struct oap_client_state saved_state = _state;
printf(" - Registration failure\n");
memset(&oap_rx, 0, sizeof(oap_rx));
oap_rx.message_type = OAP_MSGT_REGISTER_ERROR;
oap_rx.cause = GMM_CAUSE_PROTO_ERR_UNSPEC;
- msg_rx = oap_encoded(&oap_rx);
+ msg_rx = oap_client_encoded(&oap_rx);
/* Receive registration error for the first time. */
OSMO_ASSERT(state->registration_failures == 0);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0);
OSMO_ASSERT(state->registration_failures == 1);
OSMO_ASSERT(msg_tx);
OSMO_ASSERT(osmo_oap_decode(&oap_tx, msg_tx->data, msg_tx->len) == 0);
@@ -198,7 +198,7 @@ static void test_oap_api(void)
/* Receive registration error for the Nth time. */
state->registration_failures = 999;
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == -11);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == -11);
OSMO_ASSERT(!msg_tx);
OSMO_ASSERT(state->state == OAP_INITIALIZED);
msgb_free(msg_tx);
@@ -211,8 +211,8 @@ static void test_oap_api(void)
_state = saved_state;
memset(&oap_rx, 0, sizeof(oap_rx));
oap_rx.message_type = OAP_MSGT_REGISTER_RESULT;
- msg_rx = oap_encoded(&oap_rx);
- OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0);
+ msg_rx = oap_client_encoded(&oap_rx);
+ OSMO_ASSERT(oap_client_handle(state, msg_rx, &msg_tx) == 0);
OSMO_ASSERT(!msg_tx);
OSMO_ASSERT(state->state == OAP_REGISTERED);
msgb_free(msg_rx);