osmo_gsup_messge.[ch] documentation update (doxygen)
This commit is contained in:
parent
7ca035deca
commit
eff215a8bb
|
@ -1,11 +1,9 @@
|
||||||
/* Osmocom Subscriber Update Protocol message encoder/decoder */
|
/* Osmocom Subscriber Update Protocol message encoder/decoder */
|
||||||
|
|
||||||
/* (C) 2014 by Sysmocom s.f.m.c. GmbH
|
/* (C) 2014 by Sysmocom s.f.m.c. GmbH, Author: Jacob Erlbeck
|
||||||
* (C) 2016 by Harald Welte <laforge@gnumonks.org>
|
* (C) 2016 by Harald Welte <laforge@gnumonks.org>
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*
|
*
|
||||||
* Author: Jacob Erlbeck
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
@ -28,12 +26,16 @@
|
||||||
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
|
||||||
#include <osmocom/crypt/auth.h>
|
#include <osmocom/crypt/auth.h>
|
||||||
|
|
||||||
|
/*! Maximum nubmer of PDP inside \ref osmo_gsup_message */
|
||||||
#define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */
|
#define OSMO_GSUP_MAX_NUM_PDP_INFO 10 /* GSM 09.02 limits this to 50 */
|
||||||
|
/*! Maximum number of auth info inside \ref osmo_gsup_message */
|
||||||
#define OSMO_GSUP_MAX_NUM_AUTH_INFO 5
|
#define OSMO_GSUP_MAX_NUM_AUTH_INFO 5
|
||||||
|
/*! Maximum number of octets encoding MSISDN in BCD format */
|
||||||
#define OSMO_GSUP_MAX_MSISDN_LEN 9
|
#define OSMO_GSUP_MAX_MSISDN_LEN 9
|
||||||
|
|
||||||
#define OSMO_GSUP_PDP_TYPE_SIZE 2
|
#define OSMO_GSUP_PDP_TYPE_SIZE 2
|
||||||
|
|
||||||
|
/*! Information Element Identifiers for GSUP IEs */
|
||||||
enum osmo_gsup_iei {
|
enum osmo_gsup_iei {
|
||||||
OSMO_GSUP_IMSI_IE = 0x01,
|
OSMO_GSUP_IMSI_IE = 0x01,
|
||||||
OSMO_GSUP_CAUSE_IE = 0x02,
|
OSMO_GSUP_CAUSE_IE = 0x02,
|
||||||
|
@ -59,6 +61,7 @@ enum osmo_gsup_iei {
|
||||||
OSMO_GSUP_RES_IE = 0x27,
|
OSMO_GSUP_RES_IE = 0x27,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! GSUP message type */
|
||||||
enum osmo_gsup_message_type {
|
enum osmo_gsup_message_type {
|
||||||
OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100,
|
OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST = 0b00000100,
|
||||||
OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101,
|
OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR = 0b00000101,
|
||||||
|
@ -94,16 +97,25 @@ enum osmo_gsup_cancel_type {
|
||||||
OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
|
OSMO_GSUP_CANCEL_TYPE_WITHDRAW = 2, /* on wire: 1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! parsed/decoded PDP context information */
|
||||||
struct osmo_gsup_pdp_info {
|
struct osmo_gsup_pdp_info {
|
||||||
unsigned int context_id;
|
unsigned int context_id;
|
||||||
int have_info;
|
int have_info;
|
||||||
|
/*! Type of PDP context */
|
||||||
uint16_t pdp_type;
|
uint16_t pdp_type;
|
||||||
|
/*! APN information, still in encoded form. Can be NULL if no
|
||||||
|
* APN information included */
|
||||||
const uint8_t *apn_enc;
|
const uint8_t *apn_enc;
|
||||||
|
/*! length (in octets) of apn_enc */
|
||||||
size_t apn_enc_len;
|
size_t apn_enc_len;
|
||||||
|
/*! QoS information, still in encoded form. Can be NULL if no
|
||||||
|
* QoS information included */
|
||||||
const uint8_t *qos_enc;
|
const uint8_t *qos_enc;
|
||||||
|
/*! length (in octets) of qos_enc */
|
||||||
size_t qos_enc_len;
|
size_t qos_enc_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*! parsed/decoded GSUP protocol message */
|
||||||
struct osmo_gsup_message {
|
struct osmo_gsup_message {
|
||||||
enum osmo_gsup_message_type message_type;
|
enum osmo_gsup_message_type message_type;
|
||||||
char imsi[GSM23003_IMSI_MAX_DIGITS+2];
|
char imsi[GSM23003_IMSI_MAX_DIGITS+2];
|
||||||
|
|
|
@ -174,6 +174,12 @@ parse_error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Decode (parse) a GSUP message
|
||||||
|
* \param[in] const_data input data to be parsed
|
||||||
|
* \param[in] data_len length of input (\a const_data)
|
||||||
|
* \param[out] gsup_msg callee-allocated output data structure
|
||||||
|
* \returns 0 on success; negative otherwise
|
||||||
|
*/
|
||||||
int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
|
int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
|
||||||
struct osmo_gsup_message *gsup_msg)
|
struct osmo_gsup_message *gsup_msg)
|
||||||
{
|
{
|
||||||
|
@ -392,6 +398,10 @@ static void encode_auth_info(struct msgb *msg, enum osmo_gsup_iei iei,
|
||||||
*len_field = msgb_length(msg) - old_len;
|
*len_field = msgb_length(msg) - old_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Encode a GSUP message
|
||||||
|
* \param[out] msg message buffer to which encoded message is written
|
||||||
|
* \param[in] gsup_msg \ref osmo_gsup_message data to be encoded
|
||||||
|
*/
|
||||||
void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
|
void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
|
||||||
{
|
{
|
||||||
uint8_t u8;
|
uint8_t u8;
|
||||||
|
|
Loading…
Reference in New Issue