change from u_int* to uint* (stdint.h)
This commit is contained in:
parent
13f52974e6
commit
a3d5514c21
|
@ -36,7 +36,7 @@ enum bit_value {
|
|||
struct bitvec {
|
||||
unsigned int cur_bit; /* curser to the next unused bit */
|
||||
unsigned int data_len; /* length of data array in bytes */
|
||||
u_int8_t *data; /* pointer to data array */
|
||||
uint8_t *data; /* pointer to data array */
|
||||
};
|
||||
|
||||
/* check if the bit is 0 or 1 for a given position inside a bitvec */
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
#ifndef __COMP128_H__
|
||||
#define __COMP128_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Performs the COMP128 algorithm (used as A3/A8)
|
||||
* ki : u_int8_t [16]
|
||||
* srand : u_int8_t [16]
|
||||
* sres : u_int8_t [4]
|
||||
* kc : u_int8_t [8]
|
||||
* ki : uint8_t [16]
|
||||
* srand : uint8_t [16]
|
||||
* sres : uint8_t [4]
|
||||
* kc : uint8_t [8]
|
||||
*/
|
||||
void comp128(u_int8_t *ki, u_int8_t *srand, u_int8_t *sres, u_int8_t *kc);
|
||||
void comp128(uint8_t *ki, uint8_t *srand, uint8_t *sres, uint8_t *kc);
|
||||
|
||||
#endif /* __COMP128_H__ */
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef GSM_UTILS_H
|
||||
#define GSM_UTILS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum gsm_band {
|
||||
GSM_BAND_850 = 1,
|
||||
|
@ -38,15 +38,15 @@ enum gsm_band {
|
|||
GSM_BAND_810 = 0x80,
|
||||
};
|
||||
|
||||
int gsm_7bit_decode(char *decoded, const u_int8_t *user_data, u_int8_t length);
|
||||
int gsm_7bit_encode(u_int8_t *result, const char *data);
|
||||
int gsm_7bit_decode(char *decoded, const uint8_t *user_data, uint8_t length);
|
||||
int gsm_7bit_encode(uint8_t *result, const char *data);
|
||||
|
||||
int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm);
|
||||
int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl);
|
||||
int ms_pwr_dbm(enum gsm_band band, uint8_t lvl);
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
int rxlev2dbm(u_int8_t rxlev);
|
||||
u_int8_t dbm2rxlev(int dbm);
|
||||
int rxlev2dbm(uint8_t rxlev);
|
||||
uint8_t dbm2rxlev(int dbm);
|
||||
|
||||
/* According to GSM 04.08 Chapter 10.5.2.29 */
|
||||
static inline int rach_max_trans_val2raw(int val) { return (val >> 1) & 3; }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include "linuxlist.h"
|
||||
|
||||
struct bts_link;
|
||||
|
@ -39,8 +39,8 @@ struct msgb {
|
|||
unsigned char *l3h;
|
||||
unsigned char *smsh;
|
||||
|
||||
u_int16_t data_len;
|
||||
u_int16_t len;
|
||||
uint16_t data_len;
|
||||
uint16_t len;
|
||||
|
||||
unsigned char *head;
|
||||
unsigned char *tail;
|
||||
|
@ -48,7 +48,7 @@ struct msgb {
|
|||
unsigned char _data[0];
|
||||
};
|
||||
|
||||
extern struct msgb *msgb_alloc(u_int16_t size, const char *name);
|
||||
extern struct msgb *msgb_alloc(uint16_t size, const char *name);
|
||||
extern void msgb_free(struct msgb *m);
|
||||
extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg);
|
||||
extern struct msgb *msgb_dequeue(struct llist_head *queue);
|
||||
|
@ -60,12 +60,12 @@ extern void msgb_reset(struct msgb *m);
|
|||
|
||||
static inline unsigned int msgb_l2len(const struct msgb *msgb)
|
||||
{
|
||||
return msgb->tail - (u_int8_t *)msgb_l2(msgb);
|
||||
return msgb->tail - (uint8_t *)msgb_l2(msgb);
|
||||
}
|
||||
|
||||
static inline unsigned int msgb_l3len(const struct msgb *msgb)
|
||||
{
|
||||
return msgb->tail - (u_int8_t *)msgb_l3(msgb);
|
||||
return msgb->tail - (uint8_t *)msgb_l3(msgb);
|
||||
}
|
||||
|
||||
static inline unsigned int msgb_headlen(const struct msgb *msgb)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _TLV_H
|
||||
#define _TLV_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <osmocore/msgb.h>
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
#define TVLV_MAX_ONEBYTE 0x7f
|
||||
|
||||
static inline u_int16_t TVLV_GROSS_LEN(u_int16_t len)
|
||||
static inline uint16_t TVLV_GROSS_LEN(uint16_t len)
|
||||
{
|
||||
if (len <= TVLV_MAX_ONEBYTE)
|
||||
return TLV_GROSS_LEN(len);
|
||||
|
@ -36,16 +36,16 @@ static inline u_int16_t TVLV_GROSS_LEN(u_int16_t len)
|
|||
|
||||
/* TLV generation */
|
||||
|
||||
static inline u_int8_t *lv_put(u_int8_t *buf, u_int8_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *lv_put(uint8_t *buf, uint8_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
*buf++ = len;
|
||||
memcpy(buf, val, len);
|
||||
return buf + len;
|
||||
}
|
||||
|
||||
static inline u_int8_t *tlv_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *tlv_put(uint8_t *buf, uint8_t tag, uint8_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
*buf++ = tag;
|
||||
*buf++ = len;
|
||||
|
@ -53,8 +53,8 @@ static inline u_int8_t *tlv_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
|
|||
return buf + len;
|
||||
}
|
||||
|
||||
static inline u_int8_t *tlv16_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
|
||||
const u_int16_t *val)
|
||||
static inline uint8_t *tlv16_put(uint8_t *buf, uint8_t tag, uint8_t len,
|
||||
const uint16_t *val)
|
||||
{
|
||||
*buf++ = tag;
|
||||
*buf++ = len;
|
||||
|
@ -62,8 +62,8 @@ static inline u_int8_t *tlv16_put(u_int8_t *buf, u_int8_t tag, u_int8_t len,
|
|||
return buf + len*2;
|
||||
}
|
||||
|
||||
static inline u_int8_t *tl16v_put(u_int8_t *buf, u_int8_t tag, u_int16_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *tl16v_put(uint8_t *buf, uint8_t tag, uint16_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
*buf++ = tag;
|
||||
*buf++ = len >> 8;
|
||||
|
@ -72,10 +72,10 @@ static inline u_int8_t *tl16v_put(u_int8_t *buf, u_int8_t tag, u_int16_t len,
|
|||
return buf + len*2;
|
||||
}
|
||||
|
||||
static inline u_int8_t *tvlv_put(u_int8_t *buf, u_int8_t tag, u_int16_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *tvlv_put(uint8_t *buf, uint8_t tag, uint16_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
u_int8_t *ret;
|
||||
uint8_t *ret;
|
||||
|
||||
if (len <= TVLV_MAX_ONEBYTE) {
|
||||
ret = tlv_put(buf, tag, len, val);
|
||||
|
@ -86,30 +86,30 @@ static inline u_int8_t *tvlv_put(u_int8_t *buf, u_int8_t tag, u_int16_t len,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tlv16_put(struct msgb *msg, u_int8_t tag, u_int8_t len, const u_int16_t *val)
|
||||
static inline uint8_t *msgb_tlv16_put(struct msgb *msg, uint8_t tag, uint8_t len, const uint16_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, TLV16_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, TLV16_GROSS_LEN(len));
|
||||
return tlv16_put(buf, tag, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tl16v_put(struct msgb *msg, u_int8_t tag, u_int16_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *msgb_tl16v_put(struct msgb *msg, uint8_t tag, uint16_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, TL16V_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, TL16V_GROSS_LEN(len));
|
||||
return tl16v_put(buf, tag, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tvlv_put(struct msgb *msg, u_int8_t tag, u_int16_t len,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *msgb_tvlv_put(struct msgb *msg, uint8_t tag, uint16_t len,
|
||||
const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, TVLV_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, TVLV_GROSS_LEN(len));
|
||||
return tvlv_put(buf, tag, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_l16tv_put(struct msgb *msg, u_int16_t len, u_int8_t tag,
|
||||
const u_int8_t *val)
|
||||
static inline uint8_t *msgb_l16tv_put(struct msgb *msg, uint16_t len, uint8_t tag,
|
||||
const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, L16TV_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, L16TV_GROSS_LEN(len));
|
||||
|
||||
*buf++ = len >> 8;
|
||||
*buf++ = len & 0xff;
|
||||
|
@ -118,14 +118,14 @@ static inline u_int8_t *msgb_l16tv_put(struct msgb *msg, u_int16_t len, u_int8_t
|
|||
return buf + len;
|
||||
}
|
||||
|
||||
static inline u_int8_t *v_put(u_int8_t *buf, u_int8_t val)
|
||||
static inline uint8_t *v_put(uint8_t *buf, uint8_t val)
|
||||
{
|
||||
*buf++ = val;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static inline u_int8_t *tv_put(u_int8_t *buf, u_int8_t tag,
|
||||
u_int8_t val)
|
||||
static inline uint8_t *tv_put(uint8_t *buf, uint8_t tag,
|
||||
uint8_t val)
|
||||
{
|
||||
*buf++ = tag;
|
||||
*buf++ = val;
|
||||
|
@ -133,8 +133,8 @@ static inline u_int8_t *tv_put(u_int8_t *buf, u_int8_t tag,
|
|||
}
|
||||
|
||||
/* 'val' is still in host byte order! */
|
||||
static inline u_int8_t *tv16_put(u_int8_t *buf, u_int8_t tag,
|
||||
u_int16_t val)
|
||||
static inline uint8_t *tv16_put(uint8_t *buf, uint8_t tag,
|
||||
uint16_t val)
|
||||
{
|
||||
*buf++ = tag;
|
||||
*buf++ = val >> 8;
|
||||
|
@ -142,59 +142,59 @@ static inline u_int8_t *tv16_put(u_int8_t *buf, u_int8_t tag,
|
|||
return buf;
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_lv_put(struct msgb *msg, u_int8_t len, const u_int8_t *val)
|
||||
static inline uint8_t *msgb_lv_put(struct msgb *msg, uint8_t len, const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, LV_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, LV_GROSS_LEN(len));
|
||||
return lv_put(buf, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tlv_put(struct msgb *msg, u_int8_t tag, u_int8_t len, const u_int8_t *val)
|
||||
static inline uint8_t *msgb_tlv_put(struct msgb *msg, uint8_t tag, uint8_t len, const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, TLV_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_put(msg, TLV_GROSS_LEN(len));
|
||||
return tlv_put(buf, tag, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tv_put(struct msgb *msg, u_int8_t tag, u_int8_t val)
|
||||
static inline uint8_t *msgb_tv_put(struct msgb *msg, uint8_t tag, uint8_t val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, 2);
|
||||
uint8_t *buf = msgb_put(msg, 2);
|
||||
return tv_put(buf, tag, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_v_put(struct msgb *msg, u_int8_t val)
|
||||
static inline uint8_t *msgb_v_put(struct msgb *msg, uint8_t val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, 1);
|
||||
uint8_t *buf = msgb_put(msg, 1);
|
||||
return v_put(buf, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tv16_put(struct msgb *msg, u_int8_t tag, u_int16_t val)
|
||||
static inline uint8_t *msgb_tv16_put(struct msgb *msg, uint8_t tag, uint16_t val)
|
||||
{
|
||||
u_int8_t *buf = msgb_put(msg, 3);
|
||||
uint8_t *buf = msgb_put(msg, 3);
|
||||
return tv16_put(buf, tag, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tlv_push(struct msgb *msg, u_int8_t tag, u_int8_t len, const u_int8_t *val)
|
||||
static inline uint8_t *msgb_tlv_push(struct msgb *msg, uint8_t tag, uint8_t len, const uint8_t *val)
|
||||
{
|
||||
u_int8_t *buf = msgb_push(msg, TLV_GROSS_LEN(len));
|
||||
uint8_t *buf = msgb_push(msg, TLV_GROSS_LEN(len));
|
||||
return tlv_put(buf, tag, len, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tv_push(struct msgb *msg, u_int8_t tag, u_int8_t val)
|
||||
static inline uint8_t *msgb_tv_push(struct msgb *msg, uint8_t tag, uint8_t val)
|
||||
{
|
||||
u_int8_t *buf = msgb_push(msg, 2);
|
||||
uint8_t *buf = msgb_push(msg, 2);
|
||||
return tv_put(buf, tag, val);
|
||||
}
|
||||
|
||||
static inline u_int8_t *msgb_tv16_push(struct msgb *msg, u_int8_t tag, u_int16_t val)
|
||||
static inline uint8_t *msgb_tv16_push(struct msgb *msg, uint8_t tag, uint16_t val)
|
||||
{
|
||||
u_int8_t *buf = msgb_push(msg, 3);
|
||||
uint8_t *buf = msgb_push(msg, 3);
|
||||
return tv16_put(buf, tag, val);
|
||||
}
|
||||
|
||||
/* TLV parsing */
|
||||
|
||||
struct tlv_p_entry {
|
||||
u_int16_t len;
|
||||
const u_int8_t *val;
|
||||
uint16_t len;
|
||||
const uint8_t *val;
|
||||
};
|
||||
|
||||
enum tlv_type {
|
||||
|
@ -209,7 +209,7 @@ enum tlv_type {
|
|||
|
||||
struct tlv_def {
|
||||
enum tlv_type type;
|
||||
u_int8_t fixed_len;
|
||||
uint8_t fixed_len;
|
||||
};
|
||||
|
||||
struct tlv_definition {
|
||||
|
@ -222,11 +222,11 @@ struct tlv_parsed {
|
|||
|
||||
extern struct tlv_definition tvlv_att_def;
|
||||
|
||||
int tlv_parse_one(u_int8_t *o_tag, u_int16_t *o_len, const u_int8_t **o_val,
|
||||
int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val,
|
||||
const struct tlv_definition *def,
|
||||
const u_int8_t *buf, int buf_len);
|
||||
const uint8_t *buf, int buf_len);
|
||||
int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def,
|
||||
const u_int8_t *buf, int buf_len, u_int8_t lv_tag, u_int8_t lv_tag2);
|
||||
const uint8_t *buf, int buf_len, uint8_t lv_tag, uint8_t lv_tag2);
|
||||
/* take a master (src) tlvdev and fill up all empty slots in 'dst' */
|
||||
void tlv_def_patch(struct tlv_definition *dst, const struct tlv_definition *src);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocore/bitvec.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@ static inline unsigned int bytenum_from_bitnum(unsigned int bitnum)
|
|||
}
|
||||
|
||||
/* convert ZERO/ONE/L/H to a bitmask at given pos in a byte */
|
||||
static u_int8_t bitval2mask(enum bit_value bit, u_int8_t bitnum)
|
||||
static uint8_t bitval2mask(enum bit_value bit, uint8_t bitnum)
|
||||
{
|
||||
int bitval;
|
||||
|
||||
|
@ -64,7 +64,7 @@ enum bit_value bitvec_get_bit_pos(struct bitvec *bv, unsigned int bitnr)
|
|||
{
|
||||
unsigned int bytenum = bytenum_from_bitnum(bitnr);
|
||||
unsigned int bitnum = 7 - (bitnr % 8);
|
||||
u_int8_t bitval;
|
||||
uint8_t bitval;
|
||||
|
||||
if (bytenum >= bv->data_len)
|
||||
return -EINVAL;
|
||||
|
@ -99,7 +99,7 @@ int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnr,
|
|||
{
|
||||
unsigned int bytenum = bytenum_from_bitnum(bitnr);
|
||||
unsigned int bitnum = 7 - (bitnr % 8);
|
||||
u_int8_t bitval;
|
||||
uint8_t bitval;
|
||||
|
||||
if (bytenum >= bv->data_len)
|
||||
return -EINVAL;
|
||||
|
|
|
@ -66,10 +66,10 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* The compression tables (just copied ...) */
|
||||
static const u_int8_t table_0[512] = {
|
||||
static const uint8_t table_0[512] = {
|
||||
102, 177, 186, 162, 2, 156, 112, 75, 55, 25, 8, 12, 251, 193, 246, 188,
|
||||
109, 213, 151, 53, 42, 79, 191, 115, 233, 242, 164, 223, 209, 148, 108, 161,
|
||||
252, 37, 244, 47, 64, 211, 6, 237, 185, 160, 139, 113, 76, 138, 59, 70,
|
||||
|
@ -138,11 +138,11 @@ static const u_int8_t table_0[512] = {
|
|||
10, 3, 4, 9, 6, 0, 3, 2, 5, 6, 8, 9, 11, 13, 15, 12,
|
||||
};
|
||||
|
||||
static const u_int8_t *_comp128_table[5] = { table_0, table_1, table_2, table_3, table_4 };
|
||||
static const uint8_t *_comp128_table[5] = { table_0, table_1, table_2, table_3, table_4 };
|
||||
|
||||
|
||||
static inline void
|
||||
_comp128_compression_round(u_int8_t *x, int n, const u_int8_t *tbl)
|
||||
_comp128_compression_round(uint8_t *x, int n, const uint8_t *tbl)
|
||||
{
|
||||
int i, j, m, a, b, y, z;
|
||||
m = 4 - n;
|
||||
|
@ -158,7 +158,7 @@ _comp128_compression_round(u_int8_t *x, int n, const u_int8_t *tbl)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_comp128_compression(u_int8_t *x)
|
||||
_comp128_compression(uint8_t *x)
|
||||
{
|
||||
int n;
|
||||
for (n=0; n<5; n++)
|
||||
|
@ -166,7 +166,7 @@ _comp128_compression(u_int8_t *x)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_comp128_bitsfrombytes(u_int8_t *x, u_int8_t *bits)
|
||||
_comp128_bitsfrombytes(uint8_t *x, uint8_t *bits)
|
||||
{
|
||||
int i;
|
||||
memset(bits, 0x00, 128);
|
||||
|
@ -176,7 +176,7 @@ _comp128_bitsfrombytes(u_int8_t *x, u_int8_t *bits)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_comp128_permutation(u_int8_t *x, u_int8_t *bits)
|
||||
_comp128_permutation(uint8_t *x, uint8_t *bits)
|
||||
{
|
||||
int i;
|
||||
memset(&x[16], 0x00, 16);
|
||||
|
@ -185,10 +185,10 @@ _comp128_permutation(u_int8_t *x, u_int8_t *bits)
|
|||
}
|
||||
|
||||
void
|
||||
comp128(u_int8_t *ki, u_int8_t *rand, u_int8_t *sres, u_int8_t *kc)
|
||||
comp128(uint8_t *ki, uint8_t *rand, uint8_t *sres, uint8_t *kc)
|
||||
{
|
||||
int i;
|
||||
u_int8_t x[32], bits[128];
|
||||
uint8_t x[32], bits[128];
|
||||
|
||||
/* x[16-31] = RAND */
|
||||
memcpy(&x[16], rand, 16);
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
#include <osmocore/gsm_utils.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* GSM 03.38 6.2.1 Charachter packing */
|
||||
int gsm_7bit_decode(char *text, const u_int8_t *user_data, u_int8_t length)
|
||||
int gsm_7bit_decode(char *text, const uint8_t *user_data, uint8_t length)
|
||||
{
|
||||
int i = 0;
|
||||
int l = 0;
|
||||
|
@ -51,7 +52,7 @@ int gsm_7bit_decode(char *text, const u_int8_t *user_data, u_int8_t length)
|
|||
|
||||
|
||||
/* GSM 03.38 6.2.1 Charachter packing */
|
||||
int gsm_7bit_encode(u_int8_t *result, const char *data)
|
||||
int gsm_7bit_encode(uint8_t *result, const char *data)
|
||||
{
|
||||
int i,j = 0;
|
||||
unsigned char ch1, ch2;
|
||||
|
@ -129,7 +130,7 @@ int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl)
|
||||
int ms_pwr_dbm(enum gsm_band band, uint8_t lvl)
|
||||
{
|
||||
lvl &= 0x1f;
|
||||
|
||||
|
@ -168,7 +169,7 @@ int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl)
|
|||
}
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
int rxlev2dbm(u_int8_t rxlev)
|
||||
int rxlev2dbm(uint8_t rxlev)
|
||||
{
|
||||
if (rxlev > 63)
|
||||
rxlev = 63;
|
||||
|
@ -177,7 +178,7 @@ int rxlev2dbm(u_int8_t rxlev)
|
|||
}
|
||||
|
||||
/* According to TS 08.05 Chapter 8.1.4 */
|
||||
u_int8_t dbm2rxlev(int dbm)
|
||||
uint8_t dbm2rxlev(int dbm)
|
||||
{
|
||||
int rxlev = dbm + 110;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
void *tall_msgb_ctx;
|
||||
|
||||
struct msgb *msgb_alloc(u_int16_t size, const char *name)
|
||||
struct msgb *msgb_alloc(uint16_t size, const char *name)
|
||||
{
|
||||
struct msgb *msg;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <osmocore/utils.h>
|
||||
#include <osmocore/tlv.h>
|
||||
|
||||
|
@ -25,11 +26,11 @@ int tlv_dump(struct tlv_parsed *dec)
|
|||
*
|
||||
* Also, returns the number of bytes consumed by the TLV entry
|
||||
*/
|
||||
int tlv_parse_one(u_int8_t *o_tag, u_int16_t *o_len, const u_int8_t **o_val,
|
||||
int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val,
|
||||
const struct tlv_definition *def,
|
||||
const u_int8_t *buf, int buf_len)
|
||||
const uint8_t *buf, int buf_len)
|
||||
{
|
||||
u_int8_t tag;
|
||||
uint8_t tag;
|
||||
int len;
|
||||
|
||||
tag = *buf;
|
||||
|
@ -100,11 +101,11 @@ int tlv_parse_one(u_int8_t *o_tag, u_int16_t *o_len, const u_int8_t **o_val,
|
|||
* lv_tag2: input: a second initial LV tag following lv_tag
|
||||
*/
|
||||
int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def,
|
||||
const u_int8_t *buf, int buf_len, u_int8_t lv_tag,
|
||||
u_int8_t lv_tag2)
|
||||
const uint8_t *buf, int buf_len, uint8_t lv_tag,
|
||||
uint8_t lv_tag2)
|
||||
{
|
||||
int ofs = 0, num_parsed = 0;
|
||||
u_int16_t len;
|
||||
uint16_t len;
|
||||
|
||||
memset(dec, 0, sizeof(*dec));
|
||||
|
||||
|
@ -133,8 +134,8 @@ int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def,
|
|||
|
||||
while (ofs < buf_len) {
|
||||
int rv;
|
||||
u_int8_t tag;
|
||||
const u_int8_t *val;
|
||||
uint8_t tag;
|
||||
const uint8_t *val;
|
||||
|
||||
rv = tlv_parse_one(&tag, &len, &val, def,
|
||||
&buf[ofs], buf_len-ofs);
|
||||
|
|
Loading…
Reference in New Issue