oap.h
Go to the documentation of this file.
/*
* (C) 2015-2016 by sysmocom - s.f.m.c. GmbH
* Author: Neels Hofmeyr
* All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <stdint.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
enum osmo_oap_iei {
OAP_CAUSE_IE = 0x02,
OAP_RAND_IE = 0x20,
OAP_AUTN_IE = 0x23,
OAP_XRES_IE = 0x24,
OAP_AUTS_IE = 0x25,
OAP_CLIENT_ID_IE = 0x30,
};
enum osmo_oap_message_type {
OAP_MSGT_REGISTER_REQUEST = 0b00000100,
OAP_MSGT_REGISTER_ERROR = 0b00000101,
OAP_MSGT_REGISTER_RESULT = 0b00000110,
OAP_MSGT_CHALLENGE_REQUEST = 0b00001000,
OAP_MSGT_CHALLENGE_ERROR = 0b00001001,
OAP_MSGT_CHALLENGE_RESULT = 0b00001010,
OAP_MSGT_SYNC_REQUEST = 0b00001100,
OAP_MSGT_SYNC_ERROR = 0b00001101,
OAP_MSGT_SYNC_RESULT = 0b00001110,
};
struct osmo_oap_message {
enum osmo_oap_message_type message_type;
enum gsm48_gmm_cause cause;
uint16_t client_id;
int rand_present;
uint8_t rand[16];
int autn_present;
uint8_t autn[16];
int xres_present;
uint8_t xres[8];
int auts_present;
uint8_t auts[14];
};
int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data,
size_t data_len);
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg);
data
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:34
OAP_MSGT_CHALLENGE_ERROR
@ OAP_MSGT_CHALLENGE_ERROR
Definition: oap.h:56
osmo_oap_message_type
osmo_oap_message_type
OAP message types.
Definition: oap.h:50
OAP_MSGT_CHALLENGE_REQUEST
@ OAP_MSGT_CHALLENGE_REQUEST
Definition: oap.h:55
OAP_MSGT_SYNC_RESULT
@ OAP_MSGT_SYNC_RESULT
Definition: oap.h:61
osmo_oap_message::xres
uint8_t xres[8]
Definition: oap.h:74
OAP_MSGT_SYNC_REQUEST
@ OAP_MSGT_SYNC_REQUEST
Definition: oap.h:59
OAP_RAND_IE
@ OAP_RAND_IE
Definition: oap.h:42
OAP_CAUSE_IE
@ OAP_CAUSE_IE
Definition: oap.h:41
OAP_AUTS_IE
@ OAP_AUTS_IE
Definition: oap.h:45
OAP_AUTN_IE
@ OAP_AUTN_IE
Definition: oap.h:43
gsm48_gmm_cause
gsm48_gmm_cause
Definition: gsm_04_08_gprs.h:197
osmo_oap_message::auts
uint8_t auts[14]
Definition: oap.h:76
osmo_oap_encode
void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg)
Compose OAP message data.
Definition: oap.c:160
OAP_MSGT_CHALLENGE_RESULT
@ OAP_MSGT_CHALLENGE_RESULT
Definition: oap.h:57
OAP_MSGT_REGISTER_REQUEST
@ OAP_MSGT_REGISTER_REQUEST
Definition: oap.h:51
osmo_oap_decode
int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, size_t data_len)
Decode OAP message data.
Definition: oap.c:43
osmo_oap_iei
osmo_oap_iei
Information Element Identifiers for OAP IEs.
Definition: oap.h:40
OAP_XRES_IE
@ OAP_XRES_IE
Definition: oap.h:44
osmo_oap_message::autn_present
int autn_present
Definition: oap.h:71
OAP_MSGT_SYNC_ERROR
@ OAP_MSGT_SYNC_ERROR
Definition: oap.h:60
osmo_oap_message::xres_present
int xres_present
Definition: oap.h:73
OAP_CLIENT_ID_IE
@ OAP_CLIENT_ID_IE
Definition: oap.h:46
OAP_MSGT_REGISTER_ERROR
@ OAP_MSGT_REGISTER_ERROR
Definition: oap.h:52
osmo_oap_message::rand
uint8_t rand[16]
Definition: oap.h:70
osmo_oap_message::autn
uint8_t autn[16]
Definition: oap.h:72
gsm_04_08_gprs.h
osmo_oap_message
Parsed/decoded OAP protocol message.
Definition: oap.h:65
OAP_MSGT_REGISTER_RESULT
@ OAP_MSGT_REGISTER_RESULT
Definition: oap.h:53
osmo_oap_message::message_type
enum osmo_oap_message_type message_type
Definition: oap.h:66
osmo_oap_message::client_id
uint16_t client_id
Definition: oap.h:68
osmo_oap_message::rand_present
int rand_present
Definition: oap.h:69
osmo_oap_message::auts_present
int auts_present
Definition: oap.h:75
osmo_oap_message::cause
enum gsm48_gmm_cause cause
Definition: oap.h:67