[gprs] Use stdint.h types (uintXX_t instead of u_intXX_t)
libosmocore already uses them, it's time (at least for new code) in openbsc to do the same.
This commit is contained in:
parent
e6afd60779
commit
eaa614cb9e
|
@ -1,6 +1,8 @@
|
|||
#ifndef _GPRS_BSSGP_H
|
||||
#define _GPRS_BSSGP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Section 11.3.26 / Table 11.27 */
|
||||
enum bssgp_pdu_type {
|
||||
/* PDUs between RL and BSSGP SAPs */
|
||||
|
@ -49,15 +51,15 @@ enum bssgp_pdu_type {
|
|||
|
||||
/* Section 10.2.1 and 10.2.2 */
|
||||
struct bssgp_ud_hdr {
|
||||
u_int8_t pdu_type;
|
||||
u_int32_t tlli;
|
||||
u_int8_t qos_profile[3];
|
||||
u_int8_t data[0]; /* TLV's */
|
||||
uint8_t pdu_type;
|
||||
uint32_t tlli;
|
||||
uint8_t qos_profile[3];
|
||||
uint8_t data[0]; /* TLV's */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bssgp_normal_hdr {
|
||||
u_int8_t pdu_type;
|
||||
u_int8_t data[0]; /* TLV's */
|
||||
uint8_t pdu_type;
|
||||
uint8_t data[0]; /* TLV's */
|
||||
};
|
||||
|
||||
enum bssgp_iei_type {
|
||||
|
@ -140,7 +142,7 @@ enum gprs_bssgp_cause {
|
|||
extern int gprs_bssgp_rcvmsg(struct msgb *msg);
|
||||
|
||||
/* Wrapper around TLV parser to parse BSSGP IEs */
|
||||
static inline int bssgp_tlv_parse(struct tlv_parsed *tp, u_int8_t *buf, int len)
|
||||
static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len)
|
||||
{
|
||||
return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _GPRS_LLC_H
|
||||
#define _GPRS_LLC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Section 4.7 LLC Layer Structure */
|
||||
enum gprs_llc_sapi {
|
||||
GPRS_SAPI_GMM = 1,
|
||||
|
@ -15,6 +17,6 @@ enum gprs_llc_sapi {
|
|||
|
||||
|
||||
int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv);
|
||||
int gprs_llc_tx_ui(struct msgb *msg, u_int8_t sapi, int command);
|
||||
int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
#ifndef _GPRS_NS_H
|
||||
#define _GPRS_NS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPRS Networks Service (NS) messages on the Gb interface
|
||||
* 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)
|
||||
* 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */
|
||||
|
||||
struct gprs_ns_hdr {
|
||||
u_int8_t pdu_type;
|
||||
u_int8_t data[0];
|
||||
uint8_t pdu_type;
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* TS 08.16, Section 10.3.7, Table 14 */
|
||||
|
@ -95,7 +97,7 @@ enum gprs_ns_evt {
|
|||
|
||||
struct gprs_nsvc;
|
||||
typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc,
|
||||
struct msgb *msg, u_int16_t bvci);
|
||||
struct msgb *msg, uint16_t bvci);
|
||||
|
||||
/* An instance of the NS protocol stack */
|
||||
struct gprs_ns_inst {
|
||||
|
@ -120,11 +122,11 @@ struct gprs_nsvc {
|
|||
struct llist_head list;
|
||||
struct gprs_ns_inst *nsi;
|
||||
|
||||
u_int16_t nsei; /* end-to-end significance */
|
||||
u_int16_t nsvci; /* uniquely identifies NS-VC at SGSN */
|
||||
uint16_t nsei; /* end-to-end significance */
|
||||
uint16_t nsvci; /* uniquely identifies NS-VC at SGSN */
|
||||
|
||||
u_int32_t state;
|
||||
u_int32_t remote_state;
|
||||
uint32_t state;
|
||||
uint32_t remote_state;
|
||||
|
||||
struct timer_list alive_timer;
|
||||
int timer_is_tns_alive;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _GPRS_SGSN_H
|
||||
#define _GPRS_SGSN_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */
|
||||
enum gprs_mm_state {
|
||||
GMM_DEREGISTERED, /* 4.1.3.3.1.1 */
|
||||
|
@ -25,43 +27,43 @@ struct sgsn_mm_ctx {
|
|||
|
||||
char imsi[GSM_IMSI_LENGTH];
|
||||
enum gprs_mm_state mm_state;
|
||||
u_int32_t p_tmsi;
|
||||
u_int32_t p_tmsi_sig;
|
||||
uint32_t p_tmsi;
|
||||
uint32_t p_tmsi_sig;
|
||||
char imei[GSM_IMEI_LENGTH];
|
||||
/* Opt: Software Version Numbber / TS 23.195 */
|
||||
char msisdn[GSM_EXTENSION_LENGTH];
|
||||
struct gprs_ra_id ra;
|
||||
u_int16_t cell_id;
|
||||
u_int32_t cell_id_age;
|
||||
u_int16_t sac; /* Iu: Service Area Code */
|
||||
u_int32_t sac_age;/* Iu: Service Area Code age */
|
||||
uint16_t cell_id;
|
||||
uint32_t cell_id_age;
|
||||
uint16_t sac; /* Iu: Service Area Code */
|
||||
uint32_t sac_age;/* Iu: Service Area Code age */
|
||||
/* VLR number */
|
||||
u_int32_t new_sgsn_addr;
|
||||
uint32_t new_sgsn_addr;
|
||||
/* Authentication Triplets */
|
||||
/* Kc */
|
||||
/* Iu: CK, IK, KSI */
|
||||
/* CKSN */
|
||||
enum gprs_ciph_algo ciph_algo;
|
||||
struct {
|
||||
u_int8_t buf[14]; /* 10.5.5.12a */
|
||||
u_int8_t len;
|
||||
uint8_t buf[14]; /* 10.5.5.12a */
|
||||
uint8_t len;
|
||||
} ms_radio_access_capa;
|
||||
struct {
|
||||
u_int8_t buf[4]; /* 10.5.5.12 */
|
||||
u_int8_t len;
|
||||
uint8_t buf[4]; /* 10.5.5.12 */
|
||||
uint8_t len;
|
||||
} ms_network_capa;
|
||||
u_int16_t drx_parms;
|
||||
uint16_t drx_parms;
|
||||
int mnrg; /* MS reported to HLR? */
|
||||
int ngaf; /* MS reported to MSC/VLR? */
|
||||
int ppf; /* paging for GPRS + non-GPRS? */
|
||||
/* SMS Parameters */
|
||||
int recovery;
|
||||
u_int8_t radio_prio_sms;
|
||||
uint8_t radio_prio_sms;
|
||||
|
||||
struct llist_head pdp_list;
|
||||
|
||||
/* Additional bits not present in the GSM TS */
|
||||
u_int32_t tlli;
|
||||
uint32_t tlli;
|
||||
struct timer_list timer;
|
||||
unsigned int T;
|
||||
};
|
||||
|
@ -80,33 +82,33 @@ struct sgsn_pdp_ctx {
|
|||
unsigned int id;
|
||||
enum pdp_ctx_state state;
|
||||
enum pdp_type type;
|
||||
u_int32_t addresss;
|
||||
uint32_t addresss;
|
||||
char *apn_subscribed;
|
||||
char *apn_used;
|
||||
u_int16_t nsapi;
|
||||
u_int8_t ti; /* transaction identifier */
|
||||
u_int32_t ggsn_in_use;
|
||||
uint16_t nsapi;
|
||||
uint8_t ti; /* transaction identifier */
|
||||
uint32_t ggsn_in_use;
|
||||
int vplmn_allowed;
|
||||
u_int32_t qos_profile_subscr;
|
||||
u_int32_t qos_profile_req;
|
||||
u_int32_t qos_profile_neg;
|
||||
u_int8_t radio_prio;
|
||||
u_int32_t tx_npdu_nr;
|
||||
u_int32_t rx_npdu_nr;
|
||||
u_int32_t tx_gtp_snd;
|
||||
u_int32_t rx_gtp_snu;
|
||||
u_int32_t charging_id;
|
||||
uint32_t qos_profile_subscr;
|
||||
uint32_t qos_profile_req;
|
||||
uint32_t qos_profile_neg;
|
||||
uint8_t radio_prio;
|
||||
uint32_t tx_npdu_nr;
|
||||
uint32_t rx_npdu_nr;
|
||||
uint32_t tx_gtp_snd;
|
||||
uint32_t rx_gtp_snu;
|
||||
uint32_t charging_id;
|
||||
int reordering_reqd;
|
||||
};
|
||||
|
||||
/* look-up a SGSN MM context based on TLLI + RAI */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(u_int32_t tlli,
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid);
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(u_int32_t tmsi);
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi);
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
|
||||
|
||||
/* Allocate a new SGSN MM context */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(u_int32_t tlli,
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid);
|
||||
|
||||
#endif /* _GPRS_SGSN_H */
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _GSM48_GPRS_H
|
||||
#define _GSM48_GPRS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
|
||||
#define GSM48_MT_GMM_ATTACH_REQ 0x01
|
||||
#define GSM48_MT_GMM_ATTACH_ACK 0x02
|
||||
|
@ -74,11 +76,11 @@ enum gsm48_gprs_ie_sm {
|
|||
|
||||
/* Chapter 9.4.15 / Table 9.4.15 */
|
||||
struct gsm48_ra_upd_ack {
|
||||
u_int8_t force_stby:4, /* 10.5.5.7 */
|
||||
uint8_t force_stby:4, /* 10.5.5.7 */
|
||||
upd_result:4; /* 10.5.5.17 */
|
||||
u_int8_t ra_upd_timer; /* 10.5.7.3 */
|
||||
uint8_t ra_upd_timer; /* 10.5.7.3 */
|
||||
struct gsm48_ra_id ra_id; /* 10.5.5.15 */
|
||||
u_int8_t data[0];
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Chapter 10.5.7.3 */
|
||||
|
@ -91,29 +93,29 @@ enum gsm48_gprs_tmr_unit {
|
|||
|
||||
/* Chapter 9.4.2 / Table 9.4.2 */
|
||||
struct gsm48_attach_ack {
|
||||
u_int8_t att_result:4, /* 10.5.5.7 */
|
||||
uint8_t att_result:4, /* 10.5.5.7 */
|
||||
force_stby:4; /* 10.5.5.1 */
|
||||
u_int8_t ra_upd_timer; /* 10.5.7.3 */
|
||||
u_int8_t radio_prio; /* 10.5.7.2 */
|
||||
uint8_t ra_upd_timer; /* 10.5.7.3 */
|
||||
uint8_t radio_prio; /* 10.5.7.2 */
|
||||
struct gsm48_ra_id ra_id; /* 10.5.5.15 */
|
||||
u_int8_t data[0];
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Chapter 9.5.1 / Table 9.5.1 */
|
||||
struct gsm48_act_pdp_ctx_req {
|
||||
u_int8_t req_nsapi;
|
||||
u_int8_t req_llc_sapi;
|
||||
u_int8_t req_qos_lv[4];
|
||||
u_int8_t data[0];
|
||||
uint8_t req_nsapi;
|
||||
uint8_t req_llc_sapi;
|
||||
uint8_t req_qos_lv[4];
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Chapter 9.5.2 / Table 9.5.2 */
|
||||
struct gsm48_act_pdp_ctx_ack {
|
||||
u_int8_t llc_sapi;
|
||||
u_int8_t qos_lv[4];
|
||||
u_int8_t radio_prio:4,
|
||||
uint8_t llc_sapi;
|
||||
uint8_t qos_lv[4];
|
||||
uint8_t radio_prio:4,
|
||||
spare:4;
|
||||
u_int8_t data[0];
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* Chapter 10.5.5.14 / Table 10.5.147 */
|
||||
|
@ -179,9 +181,9 @@ enum gsm48_pdp_state {
|
|||
PDP_S_MODIFY_PENDING,
|
||||
};
|
||||
|
||||
int gprs_tlli_type(u_int32_t tlli);
|
||||
int gprs_tlli_type(uint32_t tlli);
|
||||
|
||||
struct gsm_bts *gsm48_bts_by_ra_id(struct gsm_network *net,
|
||||
const u_int8_t *buf, unsigned int len);
|
||||
const uint8_t *buf, unsigned int len);
|
||||
|
||||
#endif /* _GSM48_GPRS_H */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
|
@ -147,26 +147,26 @@ static inline struct msgb *bssgp_msgb_alloc(void)
|
|||
}
|
||||
|
||||
/* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */
|
||||
static int bssgp_tx_simple_bvci(u_int8_t pdu_type, u_int16_t nsei,
|
||||
u_int16_t bvci, u_int16_t ns_bvci)
|
||||
static int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei,
|
||||
uint16_t bvci, uint16_t ns_bvci)
|
||||
{
|
||||
struct msgb *msg = bssgp_msgb_alloc();
|
||||
struct bssgp_normal_hdr *bgph =
|
||||
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
|
||||
u_int16_t _bvci;
|
||||
uint16_t _bvci;
|
||||
|
||||
msgb_nsei(msg) = nsei;
|
||||
msgb_bvci(msg) = ns_bvci;
|
||||
|
||||
bgph->pdu_type = pdu_type;
|
||||
_bvci = htons(bvci);
|
||||
msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (u_int8_t *) &_bvci);
|
||||
msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci);
|
||||
|
||||
return gprs_ns_sendmsg(bssgp_nsi, msg);
|
||||
}
|
||||
|
||||
/* Chapter 10.4.5: Flow Control BVC ACK */
|
||||
static int bssgp_tx_fc_bvc_ack(u_int16_t nsei, u_int8_t tag, u_int16_t ns_bvci)
|
||||
static int bssgp_tx_fc_bvc_ack(uint16_t nsei, uint8_t tag, uint16_t ns_bvci)
|
||||
{
|
||||
struct msgb *msg = bssgp_msgb_alloc();
|
||||
struct bssgp_normal_hdr *bgph =
|
||||
|
@ -182,7 +182,7 @@ static int bssgp_tx_fc_bvc_ack(u_int16_t nsei, u_int8_t tag, u_int16_t ns_bvci)
|
|||
}
|
||||
|
||||
/* Chapter 10.4.14: Status */
|
||||
int bssgp_tx_status(u_int8_t cause, u_int16_t *bvci, struct msgb *orig_msg)
|
||||
int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg)
|
||||
{
|
||||
struct msgb *msg = bssgp_msgb_alloc();
|
||||
struct bssgp_normal_hdr *bgph =
|
||||
|
@ -195,8 +195,8 @@ int bssgp_tx_status(u_int8_t cause, u_int16_t *bvci, struct msgb *orig_msg)
|
|||
bgph->pdu_type = BSSGP_PDUT_STATUS;
|
||||
msgb_tvlv_put(msg, BSSGP_IE_CAUSE, 1, &cause);
|
||||
if (bvci) {
|
||||
u_int16_t _bvci = htons(*bvci);
|
||||
msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (u_int8_t *) &_bvci);
|
||||
uint16_t _bvci = htons(*bvci);
|
||||
msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &_bvci);
|
||||
}
|
||||
if (orig_msg)
|
||||
msgb_tvlv_put(msg, BSSGP_IE_PDU_IN_ERROR,
|
||||
|
@ -223,7 +223,7 @@ static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
|
|||
uint16_t bvci;
|
||||
int rc;
|
||||
|
||||
bvci = ntohs(*(u_int16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI));
|
||||
bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI));
|
||||
DEBUGPC(DGPRS, "BVCI=%u, cause=%s\n", bvci,
|
||||
bssgp_cause_str(*TLVP_VAL(tp, BSSGP_IE_CAUSE)));
|
||||
|
||||
|
@ -413,7 +413,7 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
|
|||
if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI) ||
|
||||
!TLVP_PRESENT(&tp, BSSGP_IE_CAUSE))
|
||||
goto err_mand_ie;
|
||||
bvci = ntohs(*(u_int16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
|
||||
bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
|
||||
DEBUGPC(DGPRS, "BVCI=%u, cause=%s\n", bvci,
|
||||
bssgp_cause_str(*TLVP_VAL(&tp, BSSGP_IE_CAUSE)));
|
||||
/* We always acknowledge the BLOCKing */
|
||||
|
@ -425,7 +425,7 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
|
|||
DEBUGP(DGPRS, "BSSGP BVC UNBLOCK ");
|
||||
if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI))
|
||||
goto err_mand_ie;
|
||||
bvci = ntohs(*(u_int16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
|
||||
bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
|
||||
DEBUGPC(DGPRS, "BVCI=%u\n", bvci);
|
||||
/* We always acknowledge the unBLOCKing */
|
||||
rc = bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_UNBLOCK_ACK,
|
||||
|
@ -485,11 +485,11 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg)
|
|||
{
|
||||
struct bssgp_bts_ctx *bctx;
|
||||
struct bssgp_ud_hdr *budh;
|
||||
u_int8_t llc_pdu_tlv_hdr_len = 2;
|
||||
u_int8_t *llc_pdu_tlv, *qos_profile;
|
||||
u_int16_t pdu_lifetime = 1000; /* centi-seconds */
|
||||
u_int8_t qos_profile_default[3] = { 0x00, 0x00, 0x21 };
|
||||
u_int16_t msg_len = msg->len;
|
||||
uint8_t llc_pdu_tlv_hdr_len = 2;
|
||||
uint8_t *llc_pdu_tlv, *qos_profile;
|
||||
uint16_t pdu_lifetime = 1000; /* centi-seconds */
|
||||
uint8_t qos_profile_default[3] = { 0x00, 0x00, 0x21 };
|
||||
uint16_t msg_len = msg->len;
|
||||
uint16_t bvci = msgb_bvci(msg);
|
||||
uint16_t nsei = msgb_nsei(msg);
|
||||
|
||||
|
@ -522,7 +522,7 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg)
|
|||
|
||||
/* prepend the pdu lifetime */
|
||||
pdu_lifetime = htons(pdu_lifetime);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_PDU_LIFETIME, 2, (u_int8_t *)&pdu_lifetime);
|
||||
msgb_tvlv_push(msg, BSSGP_IE_PDU_LIFETIME, 2, (uint8_t *)&pdu_lifetime);
|
||||
|
||||
/* prepend the QoS profile, TLLI and pdu type */
|
||||
budh = (struct bssgp_ud_hdr *) msgb_push(msg, sizeof(*budh));
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
#include <osmocore/linuxlist.h>
|
||||
|
@ -52,12 +53,12 @@ struct gprs_llc_lle {
|
|||
|
||||
enum gprs_llc_ll_state state;
|
||||
|
||||
u_int32_t tlli;
|
||||
u_int32_t sapi;
|
||||
uint32_t tlli;
|
||||
uint32_t sapi;
|
||||
|
||||
u_int8_t v_sent;
|
||||
u_int8_t v_ack;
|
||||
u_int8_t v_recv;
|
||||
uint8_t v_sent;
|
||||
uint8_t v_ack;
|
||||
uint8_t v_recv;
|
||||
|
||||
unsigned int n200;
|
||||
unsigned int retrans_ctr;
|
||||
|
@ -113,15 +114,15 @@ enum gprs_llc_cmd {
|
|||
};
|
||||
|
||||
struct gprs_llc_hdr_parsed {
|
||||
u_int8_t sapi;
|
||||
u_int8_t is_cmd:1,
|
||||
uint8_t sapi;
|
||||
uint8_t is_cmd:1,
|
||||
ack_req:1,
|
||||
is_encrypted:1;
|
||||
u_int32_t seq_rx;
|
||||
u_int32_t seq_tx;
|
||||
u_int32_t fcs;
|
||||
u_int32_t fcs_calc;
|
||||
u_int8_t *data;
|
||||
uint32_t seq_rx;
|
||||
uint32_t seq_tx;
|
||||
uint32_t fcs;
|
||||
uint32_t fcs_calc;
|
||||
uint8_t *data;
|
||||
enum gprs_llc_cmd cmd;
|
||||
};
|
||||
|
||||
|
@ -130,9 +131,9 @@ struct gprs_llc_hdr_parsed {
|
|||
#define N202 4
|
||||
#define CRC24_LENGTH 3
|
||||
|
||||
static int gprs_llc_fcs(u_int8_t *data, unsigned int len)
|
||||
static int gprs_llc_fcs(uint8_t *data, unsigned int len)
|
||||
{
|
||||
u_int32_t fcs_calc;
|
||||
uint32_t fcs_calc;
|
||||
|
||||
fcs_calc = crc24_calc(INIT_CRC24, data, len);
|
||||
fcs_calc = ~fcs_calc;
|
||||
|
@ -192,13 +193,13 @@ static void t201_expired(void *data)
|
|||
}
|
||||
|
||||
/* Transmit a UI frame over the given SAPI */
|
||||
int gprs_llc_tx_ui(struct msgb *msg, u_int8_t sapi, int command)
|
||||
int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command)
|
||||
{
|
||||
struct gprs_llc_lle *lle;
|
||||
u_int8_t *fcs, *llch;
|
||||
u_int8_t addr, ctrl[2];
|
||||
u_int32_t fcs_calc;
|
||||
u_int16_t nu = 0;
|
||||
uint8_t *fcs, *llch;
|
||||
uint8_t addr, ctrl[2];
|
||||
uint32_t fcs_calc;
|
||||
uint16_t nu = 0;
|
||||
|
||||
/* Identifiers from UP: (TLLI, SAPI) + (BVCI, NSEI) */
|
||||
|
||||
|
@ -291,12 +292,12 @@ static int gprs_llc_hdr_rx(struct gprs_llc_hdr_parsed *gph,
|
|||
|
||||
/* parse a GPRS LLC header, also check for invalid frames */
|
||||
static int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
|
||||
const u_int8_t *llc_hdr, int len)
|
||||
const uint8_t *llc_hdr, int len)
|
||||
{
|
||||
u_int8_t *ctrl = llc_hdr+1;
|
||||
uint8_t *ctrl = llc_hdr+1;
|
||||
int is_sack = 0;
|
||||
unsigned int crc_length;
|
||||
u_int32_t fcs_calc;
|
||||
uint32_t fcs_calc;
|
||||
|
||||
if (len <= CRC24_LENGTH)
|
||||
return -EIO;
|
||||
|
@ -336,7 +337,7 @@ static int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp,
|
|||
|
||||
if ((ctrl[0] & 0x80) == 0) {
|
||||
/* I (Information transfer + Supervisory) format */
|
||||
u_int8_t k;
|
||||
uint8_t k;
|
||||
|
||||
ghp->data = ctrl + 3;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
@ -74,7 +74,7 @@ static const struct tlv_definition ns_att_tlvdef = {
|
|||
|
||||
/* Lookup struct gprs_nsvc based on NSVCI */
|
||||
static struct gprs_nsvc *nsvc_by_nsvci(struct gprs_ns_inst *nsi,
|
||||
u_int16_t nsvci)
|
||||
uint16_t nsvci)
|
||||
{
|
||||
struct gprs_nsvc *nsvc;
|
||||
llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) {
|
||||
|
@ -86,7 +86,7 @@ static struct gprs_nsvc *nsvc_by_nsvci(struct gprs_ns_inst *nsi,
|
|||
|
||||
/* Lookup struct gprs_nsvc based on NSVCI */
|
||||
static struct gprs_nsvc *nsvc_by_nsei(struct gprs_ns_inst *nsi,
|
||||
u_int16_t nsei)
|
||||
uint16_t nsei)
|
||||
{
|
||||
struct gprs_nsvc *nsvc;
|
||||
llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) {
|
||||
|
@ -109,7 +109,7 @@ static struct gprs_nsvc *nsvc_by_rem_addr(struct gprs_ns_inst *nsi,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, u_int16_t nsvci)
|
||||
static struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci)
|
||||
{
|
||||
struct gprs_nsvc *nsvc;
|
||||
|
||||
|
@ -163,7 +163,7 @@ static int gprs_ns_tx(struct gprs_nsvc *nsvc, struct msgb *msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int gprs_ns_tx_simple(struct gprs_nsvc *nsvc, u_int8_t pdu_type)
|
||||
static int gprs_ns_tx_simple(struct gprs_nsvc *nsvc, uint8_t pdu_type)
|
||||
{
|
||||
struct msgb *msg = msgb_alloc(NS_ALLOC_SIZE, "GPRS/NS");
|
||||
struct gprs_ns_hdr *nsh;
|
||||
|
@ -211,7 +211,7 @@ static int gprs_ns_tx_reset_ack(struct gprs_nsvc *nsvc)
|
|||
{
|
||||
struct msgb *msg = msgb_alloc(NS_ALLOC_SIZE, "GPRS/NS");
|
||||
struct gprs_ns_hdr *nsh;
|
||||
u_int16_t nsvci, nsei;
|
||||
uint16_t nsvci, nsei;
|
||||
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
@ -225,8 +225,8 @@ static int gprs_ns_tx_reset_ack(struct gprs_nsvc *nsvc)
|
|||
|
||||
DEBUGP(DGPRS, "nsvci=%u, nsei=%u\n", nsvc->nsvci, nsvc->nsei);
|
||||
|
||||
msgb_tvlv_put(msg, NS_IE_VCI, 2, (u_int8_t *)&nsvci);
|
||||
msgb_tvlv_put(msg, NS_IE_NSEI, 2, (u_int8_t *)&nsei);
|
||||
msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&nsvci);
|
||||
msgb_tvlv_put(msg, NS_IE_NSEI, 2, (uint8_t *)&nsei);
|
||||
|
||||
return gprs_ns_tx(nsvc, msg);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg)
|
|||
{
|
||||
struct gprs_nsvc *nsvc;
|
||||
struct gprs_ns_hdr *nsh;
|
||||
u_int16_t bvci = msgb_bvci(msg);
|
||||
uint16_t bvci = msgb_bvci(msg);
|
||||
|
||||
nsvc = nsvc_by_nsei(nsi, msgb_nsei(msg));
|
||||
if (!nsvc) {
|
||||
|
@ -262,7 +262,7 @@ int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg)
|
|||
static int gprs_ns_rx_unitdata(struct gprs_nsvc *nsvc, struct msgb *msg)
|
||||
{
|
||||
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *)msg->l2h;
|
||||
u_int16_t bvci;
|
||||
uint16_t bvci;
|
||||
|
||||
/* spare octet in data[0] */
|
||||
bvci = nsh->data[1] << 8 | nsh->data[2];
|
||||
|
@ -278,7 +278,7 @@ static int gprs_ns_rx_status(struct gprs_nsvc *nsvc, struct msgb *msg)
|
|||
{
|
||||
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
|
||||
struct tlv_parsed tp;
|
||||
u_int8_t cause;
|
||||
uint8_t cause;
|
||||
int rc;
|
||||
|
||||
DEBUGP(DGPRS, "NS STATUS ");
|
||||
|
@ -301,8 +301,8 @@ static int gprs_ns_rx_reset(struct gprs_nsvc *nsvc, struct msgb *msg)
|
|||
{
|
||||
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
|
||||
struct tlv_parsed tp;
|
||||
u_int8_t *cause;
|
||||
u_int16_t *nsvci, *nsei;
|
||||
uint8_t *cause;
|
||||
uint16_t *nsvci, *nsei;
|
||||
int rc;
|
||||
|
||||
DEBUGP(DGPRS, "NS RESET ");
|
||||
|
@ -317,9 +317,9 @@ static int gprs_ns_rx_reset(struct gprs_nsvc *nsvc, struct msgb *msg)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
cause = (u_int8_t *) TLVP_VAL(&tp, NS_IE_CAUSE);
|
||||
nsvci = (u_int16_t *) TLVP_VAL(&tp, NS_IE_VCI);
|
||||
nsei = (u_int16_t *) TLVP_VAL(&tp, NS_IE_NSEI);
|
||||
cause = (uint8_t *) TLVP_VAL(&tp, NS_IE_CAUSE);
|
||||
nsvci = (uint16_t *) TLVP_VAL(&tp, NS_IE_VCI);
|
||||
nsei = (uint16_t *) TLVP_VAL(&tp, NS_IE_NSEI);
|
||||
|
||||
nsvc->state = NSE_S_BLOCKED | NSE_S_ALIVE;
|
||||
nsvc->nsei = ntohs(*nsei);
|
||||
|
@ -517,7 +517,7 @@ static int nsip_fd_cb(struct bsc_fd *bfd, unsigned int what)
|
|||
|
||||
|
||||
/* FIXME: this is currently in input/ipaccess.c */
|
||||
extern int make_sock(struct bsc_fd *bfd, int proto, u_int16_t port,
|
||||
extern int make_sock(struct bsc_fd *bfd, int proto, uint16_t port,
|
||||
int (*cb)(struct bsc_fd *fd, unsigned int what));
|
||||
|
||||
/* Listen for incoming GPRS packets */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/linuxlist.h>
|
||||
#include <osmocore/talloc.h>
|
||||
|
@ -41,7 +41,7 @@ static int ra_id_equals(const struct gprs_ra_id *id1,
|
|||
}
|
||||
|
||||
/* look-up a SGSN MM context based on TLLI + RAI */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(u_int32_t tlli,
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid)
|
||||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
@ -54,7 +54,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(u_int32_t tlli,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(u_int32_t p_tmsi)
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t p_tmsi)
|
||||
{
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
||||
|
@ -78,7 +78,7 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi)
|
|||
}
|
||||
|
||||
/* Allocate a new SGSN MM context */
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(u_int32_t tlli,
|
||||
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
|
||||
const struct gprs_ra_id *raid)
|
||||
{
|
||||
struct sgsn_mm_ctx *ctx = talloc_zero(NULL, struct sgsn_mm_ctx);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
@ -97,7 +98,7 @@ struct value_string gsm_cause_names[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const char *att_name(u_int8_t type)
|
||||
static const char *att_name(uint8_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case GPRS_ATT_T_ATTACH:
|
||||
|
@ -111,7 +112,7 @@ static const char *att_name(u_int8_t type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char *upd_name(u_int8_t type)
|
||||
static const char *upd_name(uint8_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case GPRS_UPD_T_RA:
|
||||
|
@ -160,7 +161,7 @@ static int gsm48_tx_gmm_att_ack(struct msgb *old_msg)
|
|||
}
|
||||
|
||||
/* Chapter 9.4.5: Attach reject */
|
||||
static int gsm48_tx_gmm_att_rej(struct msgb *old_msg, u_int8_t gmm_cause)
|
||||
static int gsm48_tx_gmm_att_rej(struct msgb *old_msg, uint8_t gmm_cause)
|
||||
{
|
||||
struct msgb *msg = gsm48_msgb_alloc();
|
||||
struct gsm48_hdr *gh;
|
||||
|
@ -179,7 +180,7 @@ static int gsm48_tx_gmm_att_rej(struct msgb *old_msg, u_int8_t gmm_cause)
|
|||
}
|
||||
|
||||
/* Transmit Chapter 9.4.12 Identity Request */
|
||||
static int gsm48_tx_gmm_id_req(struct msgb *old_msg, u_int8_t id_type)
|
||||
static int gsm48_tx_gmm_id_req(struct msgb *old_msg, uint8_t id_type)
|
||||
{
|
||||
struct msgb *msg = gsm48_msgb_alloc();
|
||||
struct gsm48_hdr *gh;
|
||||
|
@ -218,7 +219,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx, struct msgb *msg)
|
|||
static int gsm48_rx_gmm_id_resp(struct msgb *msg)
|
||||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
u_int8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK;
|
||||
uint8_t mi_type = gh->data[1] & GSM_MI_TYPE_MASK;
|
||||
char mi_string[GSM48_MI_SIZE];
|
||||
struct gprs_ra_id ra_id;
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
@ -275,10 +276,10 @@ static void schedule_reject(struct sgsn_mm_ctx *ctx)
|
|||
static int gsm48_rx_gmm_att_req(struct msgb *msg)
|
||||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
u_int8_t *cur = gh->data, *msnc, *mi, *old_ra_info;
|
||||
u_int8_t msnc_len, att_type, mi_len, mi_type;
|
||||
u_int16_t drx_par;
|
||||
u_int32_t tmsi;
|
||||
uint8_t *cur = gh->data, *msnc, *mi, *old_ra_info;
|
||||
uint8_t msnc_len, att_type, mi_len, mi_type;
|
||||
uint16_t drx_par;
|
||||
uint32_t tmsi;
|
||||
char mi_string[GSM48_MI_SIZE];
|
||||
struct gprs_ra_id ra_id;
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
|
@ -398,7 +399,7 @@ static int gsm48_tx_gmm_ra_upd_ack(struct msgb *old_msg)
|
|||
}
|
||||
|
||||
/* Chapter 9.4.17: Routing area update reject */
|
||||
static int gsm48_tx_gmm_ra_upd_rej(struct msgb *old_msg, u_int8_t cause)
|
||||
static int gsm48_tx_gmm_ra_upd_rej(struct msgb *old_msg, uint8_t cause)
|
||||
{
|
||||
struct msgb *msg = gsm48_msgb_alloc();
|
||||
struct gsm48_hdr *gh;
|
||||
|
@ -423,9 +424,9 @@ static int gsm48_rx_gmm_ra_upd_req(struct msgb *msg)
|
|||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
struct sgsn_mm_ctx *mmctx;
|
||||
u_int8_t *cur = gh->data;
|
||||
uint8_t *cur = gh->data;
|
||||
struct gprs_ra_id old_ra_id;
|
||||
u_int8_t upd_type;
|
||||
uint8_t upd_type;
|
||||
|
||||
/* Update Type 10.5.5.18 */
|
||||
upd_type = *cur++ & 0x0f;
|
||||
|
@ -524,7 +525,7 @@ static int gsm48_tx_gsm_act_pdp_acc(struct msgb *old_msg, struct gsm48_act_pdp_c
|
|||
struct msgb *msg = gsm48_msgb_alloc();
|
||||
struct gsm48_act_pdp_ctx_ack *act_ack;
|
||||
struct gsm48_hdr *gh;
|
||||
u_int8_t transaction_id = ((old_gh->proto_discr >> 4) ^ 0x8); /* flip */
|
||||
uint8_t transaction_id = ((old_gh->proto_discr >> 4) ^ 0x8); /* flip */
|
||||
|
||||
DEBUGP(DMM, "<- ACTIVATE PDP CONTEXT ACK\n");
|
||||
|
||||
|
@ -549,7 +550,7 @@ static int gsm48_tx_gsm_deact_pdp_acc(struct msgb *old_msg)
|
|||
struct gsm48_hdr *old_gh = (struct gsm48_hdr *) msgb_gmmh(old_msg);
|
||||
struct msgb *msg = gsm48_msgb_alloc();
|
||||
struct gsm48_hdr *gh;
|
||||
u_int8_t transaction_id = ((old_gh->proto_discr >> 4) ^ 0x8); /* flip */
|
||||
uint8_t transaction_id = ((old_gh->proto_discr >> 4) ^ 0x8); /* flip */
|
||||
|
||||
DEBUGP(DMM, "<- DEACTIVATE PDP CONTEXT ACK\n");
|
||||
|
||||
|
@ -568,7 +569,7 @@ static int gsm48_rx_gsm_act_pdp_req(struct msgb *msg)
|
|||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
struct gsm48_act_pdp_ctx_req *act_req = (struct gsm48_act_pdp_ctx_req *) gh->data;
|
||||
u_int8_t *pdp_addr_lv = act_req->data;
|
||||
uint8_t *pdp_addr_lv = act_req->data;
|
||||
|
||||
DEBUGP(DMM, "ACTIVATE PDP CONTEXT REQ\n");
|
||||
|
||||
|
@ -633,7 +634,7 @@ static int gsm0408_rcv_gsm(struct msgb *msg)
|
|||
int gsm0408_gprs_rcvmsg(struct msgb *msg)
|
||||
{
|
||||
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
|
||||
u_int8_t pdisc = gh->proto_discr & 0x0f;
|
||||
uint8_t pdisc = gh->proto_discr & 0x0f;
|
||||
int rc = -EINVAL;
|
||||
|
||||
switch (pdisc) {
|
||||
|
@ -654,7 +655,7 @@ int gsm0408_gprs_rcvmsg(struct msgb *msg)
|
|||
|
||||
/* Determine the 'struct gsm_bts' from a RA ID */
|
||||
struct gsm_bts *gsm48_bts_by_ra_id(struct gsm_network *net,
|
||||
const u_int8_t *buf, unsigned int len)
|
||||
const uint8_t *buf, unsigned int len)
|
||||
{
|
||||
struct gprs_ra_id raid;
|
||||
struct gsm_bts *bts;
|
||||
|
|
Loading…
Reference in New Issue