OAP: use osmo_oap_ prefix for OAP, rather than plain oap_
this is in preparation of moving related code to libosmocore.
This commit is contained in:
parent
31760a1f60
commit
564c06525b
|
@ -25,7 +25,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
struct msgb;
|
||||
struct oap_message;
|
||||
struct osmo_oap_message;
|
||||
|
||||
/* This is the config part for vty. It is essentially copied in oap_state,
|
||||
* where values are copied over once the config is considered valid. */
|
||||
|
@ -74,5 +74,5 @@ int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb *
|
|||
/* Allocate a msgb and in it, return the encoded oap_msg. Return NULL on
|
||||
* error. (Like oap_encode(), but also allocates a msgb.)
|
||||
* About the name: the idea is do_something(oap_encoded(my_struct)) */
|
||||
struct msgb *oap_encoded(const struct oap_message *oap_msg);
|
||||
struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ enum oap_iei {
|
|||
OAP_CLIENT_ID_IE = 0x30,
|
||||
};
|
||||
|
||||
enum oap_message_type {
|
||||
enum osmo_oap_message_type {
|
||||
OAP_MSGT_REGISTER_REQUEST = 0b00000100,
|
||||
OAP_MSGT_REGISTER_ERROR = 0b00000101,
|
||||
OAP_MSGT_REGISTER_RESULT = 0b00000110,
|
||||
|
@ -50,8 +50,8 @@ enum oap_message_type {
|
|||
OAP_MSGT_SYNC_RESULT = 0b00001110,
|
||||
};
|
||||
|
||||
struct oap_message {
|
||||
enum oap_message_type message_type;
|
||||
struct osmo_oap_message {
|
||||
enum osmo_oap_message_type message_type;
|
||||
enum gsm48_gmm_cause cause;
|
||||
uint16_t client_id;
|
||||
int rand_present;
|
||||
|
@ -64,7 +64,7 @@ struct oap_message {
|
|||
uint8_t auts[16];
|
||||
};
|
||||
|
||||
int oap_decode(const uint8_t *data, size_t data_len,
|
||||
struct oap_message *oap_msg);
|
||||
void oap_encode(struct msgb *msg, const struct oap_message *oap_msg);
|
||||
int osmo_oap_decode(const uint8_t *data, size_t data_len,
|
||||
struct osmo_oap_message *oap_msg);
|
||||
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg);
|
||||
|
||||
|
|
|
@ -119,11 +119,11 @@ static int oap_evaluate_challenge(const struct oap_state *state,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct msgb *oap_encoded(const struct oap_message *oap_msg)
|
||||
struct msgb *oap_encoded(const struct osmo_oap_message *oap_msg)
|
||||
{
|
||||
struct msgb *msg = msgb_alloc_headroom(1000, 64, __func__);
|
||||
OSMO_ASSERT(msg);
|
||||
oap_encode(msg, oap_msg);
|
||||
osmo_oap_encode(msg, oap_msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ static struct msgb* oap_msg_register(uint16_t client_id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct oap_message oap_msg = {0};
|
||||
struct osmo_oap_message oap_msg = {0};
|
||||
oap_msg.message_type = OAP_MSGT_REGISTER_REQUEST;
|
||||
oap_msg.client_id = client_id;
|
||||
return oap_encoded(&oap_msg);
|
||||
|
@ -157,7 +157,7 @@ int oap_register(struct oap_state *state, struct msgb **msg_tx)
|
|||
* On error, return NULL. */
|
||||
static struct msgb* oap_msg_challenge_response(uint8_t *xres)
|
||||
{
|
||||
struct oap_message oap_reply = {0};
|
||||
struct osmo_oap_message oap_reply = {0};
|
||||
|
||||
oap_reply.message_type = OAP_MSGT_CHALLENGE_RESULT;
|
||||
memcpy(oap_reply.xres, xres, sizeof(oap_reply.xres));
|
||||
|
@ -166,7 +166,7 @@ static struct msgb* oap_msg_challenge_response(uint8_t *xres)
|
|||
}
|
||||
|
||||
static int handle_challenge(struct oap_state *state,
|
||||
struct oap_message *oap_rx,
|
||||
struct osmo_oap_message *oap_rx,
|
||||
struct msgb **msg_tx)
|
||||
{
|
||||
int rc;
|
||||
|
@ -209,11 +209,11 @@ int oap_handle(struct oap_state *state, const struct msgb *msg_rx, struct msgb *
|
|||
size_t data_len = msgb_l2len(msg_rx);
|
||||
int rc = 0;
|
||||
|
||||
struct oap_message oap_msg = {0};
|
||||
struct osmo_oap_message oap_msg = {0};
|
||||
|
||||
OSMO_ASSERT(data);
|
||||
|
||||
rc = oap_decode(data, data_len, &oap_msg);
|
||||
rc = osmo_oap_decode(data, data_len, &oap_msg);
|
||||
if (rc < 0) {
|
||||
LOGP(DGPRS, LOGL_ERROR,
|
||||
"Decoding OAP message failed with error '%s' (%d)\n",
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
|
||||
int oap_decode(const uint8_t *const_data, size_t data_len,
|
||||
struct oap_message *oap_msg)
|
||||
int osmo_oap_decode(const uint8_t *const_data, size_t data_len,
|
||||
struct osmo_oap_message *oap_msg)
|
||||
{
|
||||
int rc;
|
||||
uint8_t tag;
|
||||
|
@ -144,7 +144,7 @@ int oap_decode(const uint8_t *const_data, size_t data_len,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void oap_encode(struct msgb *msg, const struct oap_message *oap_msg)
|
||||
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg)
|
||||
{
|
||||
uint8_t u8;
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ static void test_oap_api(void)
|
|||
|
||||
printf(" - AUTN failures\n");
|
||||
|
||||
struct oap_message oap_rx;
|
||||
struct oap_message oap_tx;
|
||||
struct osmo_oap_message oap_rx;
|
||||
struct osmo_oap_message oap_tx;
|
||||
struct msgb *msg_rx;
|
||||
struct msgb *msg_tx;
|
||||
|
||||
|
@ -168,7 +168,7 @@ static void test_oap_api(void)
|
|||
|
||||
/* Expect the challenge response in msg_tx */
|
||||
OSMO_ASSERT(msg_tx);
|
||||
OSMO_ASSERT(oap_decode(msg_tx->data, msg_tx->len, &oap_tx) == 0);
|
||||
OSMO_ASSERT(osmo_oap_decode(msg_tx->data, msg_tx->len, &oap_tx) == 0);
|
||||
OSMO_ASSERT(oap_tx.message_type == OAP_MSGT_CHALLENGE_RESULT);
|
||||
OSMO_ASSERT(strcmp("e2d05b598c61d9ba",
|
||||
osmo_hexdump_nospc(oap_tx.xres, sizeof(oap_tx.xres)))
|
||||
|
@ -191,7 +191,7 @@ static void test_oap_api(void)
|
|||
OSMO_ASSERT(oap_handle(state, msg_rx, &msg_tx) == 0);
|
||||
OSMO_ASSERT(state->registration_failures == 1);
|
||||
OSMO_ASSERT(msg_tx);
|
||||
OSMO_ASSERT(oap_decode(msg_tx->data, msg_tx->len, &oap_tx) == 0);
|
||||
OSMO_ASSERT(osmo_oap_decode(msg_tx->data, msg_tx->len, &oap_tx) == 0);
|
||||
OSMO_ASSERT(oap_tx.message_type == OAP_MSGT_REGISTER_REQUEST);
|
||||
OSMO_ASSERT(state->state == OAP_REQUESTED_CHALLENGE);
|
||||
msgb_free(msg_tx);
|
||||
|
|
Loading…
Reference in New Issue