[PATCH 4/8] oap: implement initial OAP API.

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/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Wed Oct 7 17:16:58 UTC 2015


> On 01 Oct 2015, at 15:23, Neels Hofmeyr <nhofmeyr at sysmocom.de> wrote:
> 
> +		OAP_UNINITIALIZED = 0,	// just allocated.

No C99 comments

> 
> +static int oap_evaluate_challenge(const struct oap_state *state,
> +				  const uint8_t *rx_random,
> +				  const uint8_t *rx_autn,
> +				  uint8_t *tx_xres)
> +{
> 
> +	OSMO_ASSERT(sizeof(auth.u.umts.k) == sizeof(state->secret_k));
> +	OSMO_ASSERT(sizeof(auth.u.umts.opc) == sizeof(state->secret_opc));

static assert?


> +
> +	memcpy(auth.u.umts.k, state->secret_k, sizeof(auth.u.umts.k));
> +	memcpy(auth.u.umts.opc, state->secret_opc, sizeof(auth.u.umts.opc));
> +	memset(auth.u.umts.amf, 0, 2);

sizeof?


> +	auth.u.umts.sqn = 42; /* TODO */

In three years we wonder what the todo is. I think it is a good habbit to add
a short summary what we want to do.


> 
> +struct msgb *oap_encoded(const struct oap_message *oap_msg)

encode? Sure it is encoded after the function is done but it triggers the
encoding?




> +{
> +int oap_register(struct oap_state *state, struct msgb **msg_tx)

return the struct msgb*? If it is NULL you already know it didnt't work
and the -1/0 carry as much value right now?

> 
> +	case OAP_MSGT_REGISTER_RESULT:
> +		// successfully registered!

no C99 comments (sorry to have away the method again)



I have not looked at the state machine, we can do it together. 


holger



More information about the OpenBSC mailing list