libosmogsm
0.11.0-dirty
Osmocom GSM library
|
00001 00010 /* 00011 * (C) 2015-2016 by sysmocom - s.f.m.c. GmbH 00012 * Author: Neels Hofmeyr 00013 * All Rights Reserved 00014 * 00015 * SPDX-License-Identifier: GPL-2.0+ 00016 * 00017 * This program is free software; you can redistribute it and/or modify 00018 * it under the terms of the GNU General Public License as published by 00019 * the Free Software Foundation; either version 2 of the License, or 00020 * (at your option) any later version. 00021 * 00022 * This program is distributed in the hope that it will be useful, 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 * GNU General Public License for more details. 00026 * 00027 * You should have received a copy of the GNU General Public License 00028 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00029 * 00030 */ 00031 00032 #pragma once 00033 00034 #include <stdint.h> 00035 #include <osmocom/core/msgb.h> 00036 #include <osmocom/gsm/protocol/gsm_04_08_gprs.h> 00037 00040 enum osmo_oap_iei { 00041 OAP_CAUSE_IE = 0x02, 00042 OAP_RAND_IE = 0x20, 00043 OAP_AUTN_IE = 0x23, 00044 OAP_XRES_IE = 0x24, 00045 OAP_AUTS_IE = 0x25, 00046 OAP_CLIENT_ID_IE = 0x30, 00047 }; 00048 00050 enum osmo_oap_message_type { 00051 OAP_MSGT_REGISTER_REQUEST = 0b00000100, 00052 OAP_MSGT_REGISTER_ERROR = 0b00000101, 00053 OAP_MSGT_REGISTER_RESULT = 0b00000110, 00054 00055 OAP_MSGT_CHALLENGE_REQUEST = 0b00001000, 00056 OAP_MSGT_CHALLENGE_ERROR = 0b00001001, 00057 OAP_MSGT_CHALLENGE_RESULT = 0b00001010, 00058 00059 OAP_MSGT_SYNC_REQUEST = 0b00001100, 00060 OAP_MSGT_SYNC_ERROR = 0b00001101, 00061 OAP_MSGT_SYNC_RESULT = 0b00001110, 00062 }; 00063 00065 struct osmo_oap_message { 00066 enum osmo_oap_message_type message_type; 00067 enum gsm48_gmm_cause cause; 00068 uint16_t client_id; 00069 int rand_present; 00070 uint8_t rand[16]; 00071 int autn_present; 00072 uint8_t autn[16]; 00073 int xres_present; 00074 uint8_t xres[8]; 00075 int auts_present; 00076 uint8_t auts[14]; 00077 }; 00078 00079 int osmo_oap_decode(struct osmo_oap_message *oap_msg, const uint8_t *data, 00080 size_t data_len); 00081 void osmo_oap_encode(struct msgb *msg, const struct osmo_oap_message *oap_msg); 00082