From 834193484439acd6056a891e9b2df5992a370088 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 22 Mar 2011 16:36:13 +0100 Subject: include: reorganize headers file to include/osmocom/[gsm|core] This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso --- include/osmocore/Makefile.am | 14 - include/osmocore/backtrace.h | 6 - include/osmocore/bits.h | 45 -- include/osmocore/bitvec.h | 75 -- include/osmocore/comp128.h | 22 - include/osmocore/crc16.h | 34 - include/osmocore/gsm0480.h | 26 - include/osmocore/gsm0808.h | 46 -- include/osmocore/gsm48.h | 36 - include/osmocore/gsm48_ie.h | 117 --- include/osmocore/gsm_utils.h | 117 --- include/osmocore/gsmtap.h | 89 --- include/osmocore/gsmtap_util.h | 21 - include/osmocore/linuxlist.h | 360 ---------- include/osmocore/logging.h | 154 ---- include/osmocore/mncc.h | 71 -- include/osmocore/msgb.h | 197 ----- include/osmocore/msgfile.h | 49 -- include/osmocore/panic.h | 11 - include/osmocore/plugin.h | 6 - include/osmocore/process.h | 6 - include/osmocore/protocol/Makefile.am | 6 - include/osmocore/protocol/gsm_03_41.h | 51 -- include/osmocore/protocol/gsm_04_08.h | 1262 --------------------------------- include/osmocore/protocol/gsm_04_11.h | 188 ----- include/osmocore/protocol/gsm_04_12.h | 31 - include/osmocore/protocol/gsm_04_80.h | 126 ---- include/osmocore/protocol/gsm_08_08.h | 303 -------- include/osmocore/protocol/gsm_08_58.h | 546 -------------- include/osmocore/protocol/gsm_12_21.h | 713 ------------------- include/osmocore/rate_ctr.h | 81 --- include/osmocore/rsl.h | 41 -- include/osmocore/rxlev_stat.h | 22 - include/osmocore/select.h | 22 - include/osmocore/signal.h | 15 - include/osmocore/statistics.h | 31 - include/osmocore/talloc.h | 192 ----- include/osmocore/timer.h | 72 -- include/osmocore/tlv.h | 260 ------- include/osmocore/utils.h | 30 - include/osmocore/write_queue.h | 46 -- 41 files changed, 5540 deletions(-) delete mode 100644 include/osmocore/Makefile.am delete mode 100644 include/osmocore/backtrace.h delete mode 100644 include/osmocore/bits.h delete mode 100644 include/osmocore/bitvec.h delete mode 100644 include/osmocore/comp128.h delete mode 100644 include/osmocore/crc16.h delete mode 100644 include/osmocore/gsm0480.h delete mode 100644 include/osmocore/gsm0808.h delete mode 100644 include/osmocore/gsm48.h delete mode 100644 include/osmocore/gsm48_ie.h delete mode 100644 include/osmocore/gsm_utils.h delete mode 100644 include/osmocore/gsmtap.h delete mode 100644 include/osmocore/gsmtap_util.h delete mode 100644 include/osmocore/linuxlist.h delete mode 100644 include/osmocore/logging.h delete mode 100644 include/osmocore/mncc.h delete mode 100644 include/osmocore/msgb.h delete mode 100644 include/osmocore/msgfile.h delete mode 100644 include/osmocore/panic.h delete mode 100644 include/osmocore/plugin.h delete mode 100644 include/osmocore/process.h delete mode 100644 include/osmocore/protocol/Makefile.am delete mode 100644 include/osmocore/protocol/gsm_03_41.h delete mode 100644 include/osmocore/protocol/gsm_04_08.h delete mode 100644 include/osmocore/protocol/gsm_04_11.h delete mode 100644 include/osmocore/protocol/gsm_04_12.h delete mode 100644 include/osmocore/protocol/gsm_04_80.h delete mode 100644 include/osmocore/protocol/gsm_08_08.h delete mode 100644 include/osmocore/protocol/gsm_08_58.h delete mode 100644 include/osmocore/protocol/gsm_12_21.h delete mode 100644 include/osmocore/rate_ctr.h delete mode 100644 include/osmocore/rsl.h delete mode 100644 include/osmocore/rxlev_stat.h delete mode 100644 include/osmocore/select.h delete mode 100644 include/osmocore/signal.h delete mode 100644 include/osmocore/statistics.h delete mode 100644 include/osmocore/talloc.h delete mode 100644 include/osmocore/timer.h delete mode 100644 include/osmocore/tlv.h delete mode 100644 include/osmocore/utils.h delete mode 100644 include/osmocore/write_queue.h (limited to 'include/osmocore') diff --git a/include/osmocore/Makefile.am b/include/osmocore/Makefile.am deleted file mode 100644 index b65589a6..00000000 --- a/include/osmocore/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -osmocore_HEADERS = signal.h linuxlist.h timer.h select.h msgb.h bits.h \ - tlv.h bitvec.h comp128.h statistics.h gsm_utils.h utils.h \ - gsmtap.h write_queue.h rsl.h gsm48.h rxlev_stat.h mncc.h \ - gsm48_ie.h logging.h gsm0808.h rate_ctr.h gsmtap_util.h \ - plugin.h crc16.h panic.h process.h gsm0480.h msgfile.h \ - backtrace.h - -if ENABLE_TALLOC -osmocore_HEADERS += talloc.h -endif - -osmocoredir = $(includedir)/osmocore - -SUBDIRS = protocol diff --git a/include/osmocore/backtrace.h b/include/osmocore/backtrace.h deleted file mode 100644 index bbbb2c28..00000000 --- a/include/osmocore/backtrace.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _OSMO_BACKTRACE_H_ -#define _OSMO_BACKTRACE_H_ - -void generate_backtrace(); - -#endif diff --git a/include/osmocore/bits.h b/include/osmocore/bits.h deleted file mode 100644 index 8d4a0789..00000000 --- a/include/osmocore/bits.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _OSMO_BITS_H -#define _OSMO_BITS_H - -#include - -typedef uint8_t sbit_t; /* soft bit (-127...127) */ -typedef uint8_t ubit_t; /* unpacked bit (0 or 1) */ -typedef uint8_t pbit_t; /* packed bis (8 bits in a byte) */ - -/* - NOTE on the endianess of pbit_t: - Bits in a pbit_t are ordered MSB first, i.e. 0x80 is the first bit. - Bit i in a pbit_t array is array[i/8] & (1<<(7-i%8)) -*/ - -/* determine how many bytes we would need for 'num_bits' packed bits */ -static inline unsigned int osmo_pbit_bytesize(unsigned int num_bits) -{ - unsigned int pbit_bytesize = num_bits / 8; - - if (num_bits % 8) - pbit_bytesize++; - - return pbit_bytesize; -} - -/* convert unpacked bits to packed bits, return length in bytes */ -int osmo_ubit2pbit(pbit_t *out, const ubit_t *in, unsigned int num_bits); - -/* convert packed bits to unpacked bits, return length in bytes */ -int osmo_pbit2ubit(ubit_t *out, const pbit_t *in, unsigned int num_bits); - -/* convert unpacked bits to packed bits (extended options but slower), - * return length in bytes (max written ofs of output buffer + 1) */ -int osmo_ubit2pbit_ext(pbit_t *out, unsigned int out_ofs, - const ubit_t *in, unsigned int in_ofs, - unsigned int num_bits, int lsb_mode); - -/* convert packed bits to unpacked bits (extended options but slower), - * return length in bytes (max written ofs of output buffer + 1) */ -int osmo_pbit2ubit_ext(ubit_t *out, unsigned int out_ofs, - const pbit_t *in, unsigned int in_ofs, - unsigned int num_bits, int lsb_mode); - -#endif diff --git a/include/osmocore/bitvec.h b/include/osmocore/bitvec.h deleted file mode 100644 index 42977fb2..00000000 --- a/include/osmocore/bitvec.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _BITVEC_H -#define _BITVEC_H - -/* bit vector utility routines */ - -/* (C) 2009 by Harald Welte - * - * All Rights Reserved - * - * 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - - -/* In GSM mac blocks, every bit can be 0 or 1, or L or H. L/H are - * defined relative to the 0x2b padding pattern */ -enum bit_value { - ZERO = 0, - ONE = 1, - L = 2, - H = 3, -}; - -struct bitvec { - unsigned int cur_bit; /* curser to the next unused bit */ - unsigned int data_len; /* length of data array in bytes */ - uint8_t *data; /* pointer to data array */ -}; - -/* check if the bit is 0 or 1 for a given position inside a bitvec */ -enum bit_value bitvec_get_bit_pos(const struct bitvec *bv, unsigned int bitnr); - -/* check if the bit is L or H for a given position inside a bitvec */ -enum bit_value bitvec_get_bit_pos_high(const struct bitvec *bv, - unsigned int bitnr); - -/* get the Nth set bit inside the bit vector */ -unsigned int bitvec_get_nth_set_bit(const struct bitvec *bv, unsigned int n); - -/* Set a bit at given position */ -int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, - enum bit_value bit); - -/* Set the next bit in the vector */ -int bitvec_set_bit(struct bitvec *bv, enum bit_value bit); - -/* get the next bit (low/high) inside a bitvec */ -int bitvec_get_bit_high(struct bitvec *bv); - -/* Set multiple bits at the current position */ -int bitvec_set_bits(struct bitvec *bv, enum bit_value *bits, int count); - -/* Add an unsigned integer (of length count bits) to current position */ -int bitvec_set_uint(struct bitvec *bv, unsigned int in, int count); - -/* get multiple bits (based on numeric value) from current pos */ -int bitvec_get_uint(struct bitvec *bv, int num_bits); - - -/* Pad the bit vector up to a certain bit position */ -int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit); - -#endif /* _BITVEC_H */ diff --git a/include/osmocore/comp128.h b/include/osmocore/comp128.h deleted file mode 100644 index c37808f0..00000000 --- a/include/osmocore/comp128.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * COMP128 header - * - * See comp128.c for details - */ - -#ifndef __COMP128_H__ -#define __COMP128_H__ - -#include - -/* - * Performs the COMP128 algorithm (used as A3/A8) - * ki : uint8_t [16] - * srand : uint8_t [16] - * sres : uint8_t [4] - * kc : uint8_t [8] - */ -void comp128(uint8_t *ki, uint8_t *srand, uint8_t *sres, uint8_t *kc); - -#endif /* __COMP128_H__ */ - diff --git a/include/osmocore/crc16.h b/include/osmocore/crc16.h deleted file mode 100644 index 7a512490..00000000 --- a/include/osmocore/crc16.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This was copied from the linux kernel and adjusted for our types. - */ -/* - * crc16.h - CRC-16 routine - * - * Implements the standard CRC-16: - * Width 16 - * Poly 0x8005 (x^16 + x^15 + x^2 + 1) - * Init 0 - * - * Copyright (c) 2005 Ben Gardner - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. - */ - -#ifndef __CRC16_H -#define __CRC16_H - -#include - -#include - -extern uint16_t const crc16_table[256]; - -extern uint16_t crc16(uint16_t crc, const uint8_t *buffer, size_t len); - -static inline uint16_t crc16_byte(uint16_t crc, const uint8_t data) -{ - return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; -} - -#endif /* __CRC16_H */ diff --git a/include/osmocore/gsm0480.h b/include/osmocore/gsm0480.h deleted file mode 100644 index b504332e..00000000 --- a/include/osmocore/gsm0480.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef gsm0480_h -#define gsm0480_h - -#include "msgb.h" -#include "protocol/gsm_04_08.h" -#include "protocol/gsm_04_80.h" - -#define MAX_LEN_USSD_STRING 31 - -struct ussd_request { - char text[MAX_LEN_USSD_STRING + 1]; - uint8_t transaction_id; - uint8_t invoke_id; -}; - -int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len, - struct ussd_request *request); - -struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text); -struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text); -struct msgb *gsm0480_create_notifySS(const char *text); - -int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id); -int gsm0480_wrap_facility(struct msgb *msg); - -#endif diff --git a/include/osmocore/gsm0808.h b/include/osmocore/gsm0808.h deleted file mode 100644 index 1d853775..00000000 --- a/include/osmocore/gsm0808.h +++ /dev/null @@ -1,46 +0,0 @@ -/* (C) 2009,2010 by Holger Hans Peter Freyther - * (C) 2009,2010 by On-Waves - * All Rights Reserved - * - * 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#ifndef OSMOCORE_GSM0808_H -#define OSMOCORE_GSM0808_H - -#include "tlv.h" - -struct msgb; - -struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, uint16_t countrycode, int lac, uint16_t ci); -struct msgb *gsm0808_create_reset(void); -struct msgb *gsm0808_create_clear_command(uint8_t reason); -struct msgb *gsm0808_create_clear_complete(void); -struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t alg_id); -struct msgb *gsm0808_create_cipher_reject(uint8_t cause); -struct msgb *gsm0808_create_classmark_update(const uint8_t *classmark, uint8_t length); -struct msgb *gsm0808_create_sapi_reject(uint8_t link_id); -struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause, - uint8_t chosen_channel, uint8_t encr_alg_id, - uint8_t speech_mode); -struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t *rr_cause); -struct msgb *gsm0808_create_clear_rqst(uint8_t cause); - -struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id); -void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id); - -const struct tlv_definition *gsm0808_att_tlvdef(); - -#endif diff --git a/include/osmocore/gsm48.h b/include/osmocore/gsm48.h deleted file mode 100644 index ffe0399b..00000000 --- a/include/osmocore/gsm48.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _OSMOCORE_GSM48_H -#define _OSMOCORE_GSM48_H - -#include -#include -#include - -/* A parsed GPRS routing area */ -struct gprs_ra_id { - uint16_t mnc; - uint16_t mcc; - uint16_t lac; - uint8_t rac; -}; - -extern const struct tlv_definition gsm48_att_tlvdef; -extern const struct tlv_definition gsm48_rr_att_tlvdef; -extern const struct tlv_definition gsm48_mm_att_tlvdef; -const char *gsm48_cc_state_name(uint8_t state); -const char *gsm48_cc_msg_name(uint8_t msgtype); -const char *rr_cause_name(uint8_t cause); - -void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc, - uint16_t mnc, uint16_t lac); -int gsm48_generate_mid_from_tmsi(uint8_t *buf, uint32_t tmsi); -int gsm48_generate_mid_from_imsi(uint8_t *buf, const char *imsi); - -/* Convert Mobile Identity (10.5.1.4) to string */ -int gsm48_mi_to_string(char *string, const int str_len, - const uint8_t *mi, const int mi_len); - -/* Parse Routeing Area Identifier */ -void gsm48_parse_ra(struct gprs_ra_id *raid, const uint8_t *buf); -int gsm48_construct_ra(uint8_t *buf, const struct gprs_ra_id *raid); - -#endif diff --git a/include/osmocore/gsm48_ie.h b/include/osmocore/gsm48_ie.h deleted file mode 100644 index fa66159f..00000000 --- a/include/osmocore/gsm48_ie.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef _OSMOCORE_GSM48_IE_H -#define _OSMOCORE_GSM48_IE_H - -#include -#include -#include - -#include -#include -#include -#include - -/* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */ -int gsm48_decode_bcd_number(char *output, int output_len, - const uint8_t *bcd_lv, int h_len); - -/* convert a ASCII phone number to 'called/calling/connect party BCD number' */ -int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, - int h_len, const char *input); -/* decode 'bearer capability' */ -int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap, - const uint8_t *lv); -/* encode 'bearer capability' */ -int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only, - const struct gsm_mncc_bearer_cap *bcap); -/* decode 'call control cap' */ -int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv); -/* encode 'call control cap' */ -int gsm48_encode_cccap(struct msgb *msg, - const struct gsm_mncc_cccap *ccap); -/* decode 'called party BCD number' */ -int gsm48_decode_called(struct gsm_mncc_number *called, - const uint8_t *lv); -/* encode 'called party BCD number' */ -int gsm48_encode_called(struct msgb *msg, - const struct gsm_mncc_number *called); -/* decode callerid of various IEs */ -int gsm48_decode_callerid(struct gsm_mncc_number *callerid, - const uint8_t *lv); -/* encode callerid of various IEs */ -int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len, - const struct gsm_mncc_number *callerid); -/* decode 'cause' */ -int gsm48_decode_cause(struct gsm_mncc_cause *cause, - const uint8_t *lv); -/* encode 'cause' */ -int gsm48_encode_cause(struct msgb *msg, int lv_only, - const struct gsm_mncc_cause *cause); -/* decode 'calling number' */ -int gsm48_decode_calling(struct gsm_mncc_number *calling, - const uint8_t *lv); -/* encode 'calling number' */ -int gsm48_encode_calling(struct msgb *msg, - const struct gsm_mncc_number *calling); -/* decode 'connected number' */ -int gsm48_decode_connected(struct gsm_mncc_number *connected, - const uint8_t *lv); -/* encode 'connected number' */ -int gsm48_encode_connected(struct msgb *msg, - const struct gsm_mncc_number *connected); -/* decode 'redirecting number' */ -int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting, - const uint8_t *lv); -/* encode 'redirecting number' */ -int gsm48_encode_redirecting(struct msgb *msg, - const struct gsm_mncc_number *redirecting); -/* decode 'facility' */ -int gsm48_decode_facility(struct gsm_mncc_facility *facility, - const uint8_t *lv); -/* encode 'facility' */ -int gsm48_encode_facility(struct msgb *msg, int lv_only, - const struct gsm_mncc_facility *facility); -/* decode 'notify' */ -int gsm48_decode_notify(int *notify, const uint8_t *v); -/* encode 'notify' */ -int gsm48_encode_notify(struct msgb *msg, int notify); -/* decode 'signal' */ -int gsm48_decode_signal(int *signal, const uint8_t *v); -/* encode 'signal' */ -int gsm48_encode_signal(struct msgb *msg, int signal); -/* decode 'keypad' */ -int gsm48_decode_keypad(int *keypad, const uint8_t *lv); -/* encode 'keypad' */ -int gsm48_encode_keypad(struct msgb *msg, int keypad); -/* decode 'progress' */ -int gsm48_decode_progress(struct gsm_mncc_progress *progress, - const uint8_t *lv); -/* encode 'progress' */ -int gsm48_encode_progress(struct msgb *msg, int lv_only, - const struct gsm_mncc_progress *p); -/* decode 'user-user' */ -int gsm48_decode_useruser(struct gsm_mncc_useruser *uu, - const uint8_t *lv); -/* encode 'useruser' */ -int gsm48_encode_useruser(struct msgb *msg, int lv_only, - const struct gsm_mncc_useruser *uu); -/* decode 'ss version' */ -int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv, - const uint8_t *lv); -/* encode 'ss version' */ -int gsm48_encode_ssversion(struct msgb *msg, - const struct gsm_mncc_ssversion *ssv); -/* decode 'more data' does not require a function, because it has no value */ -/* encode 'more data' */ -int gsm48_encode_more(struct msgb *msg); - -/* structure of one frequency */ -struct gsm_sysinfo_freq { - /* if the frequency included in the sysinfo */ - uint8_t mask; -}; - -/* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */ -int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd, - uint8_t len, uint8_t mask, uint8_t frqt); - -#endif diff --git a/include/osmocore/gsm_utils.h b/include/osmocore/gsm_utils.h deleted file mode 100644 index 19adb70a..00000000 --- a/include/osmocore/gsm_utils.h +++ /dev/null @@ -1,117 +0,0 @@ -/* GSM utility functions, e.g. coding and decoding */ -/* - * (C) 2008 by Daniel Willmann - * (C) 2009 by Holger Hans Peter Freyther - * (C) 2009-2010 by Harald Welte - * - * All Rights Reserved - * - * 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef GSM_UTILS_H -#define GSM_UTILS_H - -#include - -#define ADD_MODULO(sum, delta, modulo) do { \ - if ((sum += delta) >= modulo) \ - sum -= modulo; \ - } while (0) - -#define GSM_MAX_FN (26*51*2048) - -struct gsm_time { - uint32_t fn; /* FN count */ - uint16_t t1; /* FN div (26*51) */ - uint8_t t2; /* FN modulo 26 */ - uint8_t t3; /* FN modulo 51 */ - uint8_t tc; -}; - -enum gsm_band { - GSM_BAND_850 = 1, - GSM_BAND_900 = 2, - GSM_BAND_1800 = 4, - GSM_BAND_1900 = 8, - GSM_BAND_450 = 0x10, - GSM_BAND_480 = 0x20, - GSM_BAND_750 = 0x40, - GSM_BAND_810 = 0x80, -}; - -const char *gsm_band_name(enum gsm_band band); -enum gsm_band gsm_band_parse(const char *mhz); - -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, uint8_t lvl); - -/* According to TS 08.05 Chapter 8.1.4 */ -int rxlev2dbm(uint8_t rxlev); -uint8_t dbm2rxlev(int dbm); - -/* According to GSM 04.08 Chapter 10.5.1.6 */ -static inline int ms_cm2_a5n_support(uint8_t *cm2, int n) { - switch (n) { - case 0: return 1; - case 1: return (cm2[0] & (1<<3)) ? 0 : 1; - case 2: return (cm2[2] & (1<<0)) ? 1 : 0; - case 3: return (cm2[2] & (1<<1)) ? 1 : 0; - default: - return 0; - } -} - -/* According to GSM 04.08 Chapter 10.5.2.29 */ -static inline int rach_max_trans_val2raw(int val) { return (val >> 1) & 3; } -static inline int rach_max_trans_raw2val(int raw) { - const int tbl[4] = { 1, 2, 4, 7 }; - return tbl[raw & 3]; -} - -#define ARFCN_PCS 0x8000 -#define ARFCN_UPLINK 0x4000 -#define ARFCN_FLAG_MASK 0xf000 /* Reserve the upper 5 bits for flags */ - -enum gsm_band gsm_arfcn2band(uint16_t arfcn); - -/* Convert an ARFCN to the frequency in MHz * 10 */ -uint16_t gsm_arfcn2freq10(uint16_t arfcn, int uplink); - -/* Convert from frame number to GSM time */ -void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn); - -/* Convert from GSM time to frame number */ -uint32_t gsm_gsmtime2fn(struct gsm_time *time); - -/* GSM TS 03.03 Chapter 2.6 */ -enum gprs_tlli_type { - TLLI_LOCAL, - TLLI_FOREIGN, - TLLI_RANDOM, - TLLI_AUXILIARY, - TLLI_RESERVED, -}; - -/* TS 03.03 Chapter 2.6 */ -int gprs_tlli_type(uint32_t tlli); - -uint32_t gprs_tmsi2tlli(uint32_t p_tmsi, enum gprs_tlli_type type); - -#endif diff --git a/include/osmocore/gsmtap.h b/include/osmocore/gsmtap.h deleted file mode 100644 index 236b25ac..00000000 --- a/include/osmocore/gsmtap.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _GSMTAP_H -#define _GSMTAP_H - -/* gsmtap header, pseudo-header in front of the actua GSM payload */ - -/* GSMTAP is a generic header format for GSM protocol captures, - * it uses the IANA-assigned UDP port number 4729 and carries - * payload in various formats of GSM interfaces such as Um MAC - * blocks or Um bursts. - * - * Example programs generating GSMTAP data are airprobe - * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/) - */ - -#include - -#define GSMTAP_VERSION 0x02 - -#define GSMTAP_TYPE_UM 0x01 -#define GSMTAP_TYPE_ABIS 0x02 -#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */ -#define GSMTAP_TYPE_SIM 0x04 -#define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */ -#define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */ - -/* sub-types for TYPE_UM_BURST */ -#define GSMTAP_BURST_UNKNOWN 0x00 -#define GSMTAP_BURST_FCCH 0x01 -#define GSMTAP_BURST_PARTIAL_SCH 0x02 -#define GSMTAP_BURST_SCH 0x03 -#define GSMTAP_BURST_CTS_SCH 0x04 -#define GSMTAP_BURST_COMPACT_SCH 0x05 -#define GSMTAP_BURST_NORMAL 0x06 -#define GSMTAP_BURST_DUMMY 0x07 -#define GSMTAP_BURST_ACCESS 0x08 -#define GSMTAP_BURST_NONE 0x09 - -/* sub-types for TYPE_UM */ -#define GSMTAP_CHANNEL_UNKNOWN 0x00 -#define GSMTAP_CHANNEL_BCCH 0x01 -#define GSMTAP_CHANNEL_CCCH 0x02 -#define GSMTAP_CHANNEL_RACH 0x03 -#define GSMTAP_CHANNEL_AGCH 0x04 -#define GSMTAP_CHANNEL_PCH 0x05 -#define GSMTAP_CHANNEL_SDCCH 0x06 -#define GSMTAP_CHANNEL_SDCCH4 0x07 -#define GSMTAP_CHANNEL_SDCCH8 0x08 -#define GSMTAP_CHANNEL_TCH_F 0x09 -#define GSMTAP_CHANNEL_TCH_H 0x0a -#define GSMTAP_CHANNEL_ACCH 0x80 - -/* sub-types for TYPE_TETRA_AIR */ -#define GSMTAP_TETRA_BSCH 0x01 -#define GSMTAP_TETRA_AACH 0x02 -#define GSMTAP_TETRA_SCH_HU 0x03 -#define GSMTAP_TETRA_SCH_HD 0x04 -#define GSMTAP_TETRA_SCH_F 0x05 -#define GSMTAP_TETRA_BNCH 0x06 -#define GSMTAP_TETRA_STCH 0x07 -#define GSMTAP_TETRA_TCH_F 0x08 - -/* flags for the ARFCN */ -#define GSMTAP_ARFCN_F_PCS 0x8000 -#define GSMTAP_ARFCN_F_UPLINK 0x4000 -#define GSMTAP_ARFCN_MASK 0x3fff - -/* IANA-assigned well-known UDP port for GSMTAP messages */ -#define GSMTAP_UDP_PORT 4729 - -struct gsmtap_hdr { - uint8_t version; /* version, set to 0x01 currently */ - uint8_t hdr_len; /* length in number of 32bit words */ - uint8_t type; /* see GSMTAP_TYPE_* */ - uint8_t timeslot; /* timeslot (0..7 on Um) */ - - uint16_t arfcn; /* ARFCN (frequency) */ - int8_t signal_dbm; /* signal level in dBm */ - int8_t snr_db; /* signal/noise ratio in dB */ - - uint32_t frame_number; /* GSM Frame Number (FN) */ - - uint8_t sub_type; /* Type of burst/channel, see above */ - uint8_t antenna_nr; /* Antenna Number */ - uint8_t sub_slot; /* sub-slot within timeslot */ - uint8_t res; /* reserved for future use (RFU) */ - -} __attribute__((packed)); - -#endif /* _GSMTAP_H */ diff --git a/include/osmocore/gsmtap_util.h b/include/osmocore/gsmtap_util.h deleted file mode 100644 index 96449443..00000000 --- a/include/osmocore/gsmtap_util.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _GSMTAP_UTIL_H -#define _GSMTAP_UTIL_H - -#include - -/* convert RSL channel number to GSMTAP channel type */ -uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id); - -/* receive a message from L1/L2 and put it in GSMTAP */ -struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, - uint8_t ss, uint32_t fn, int8_t signal_dbm, - uint8_t snr, const uint8_t *data, unsigned int len); - -/* receive a message from L1/L2 and put it in GSMTAP */ -int gsmtap_sendmsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, uint8_t ss, - uint32_t fn, int8_t signal_dbm, uint8_t snr, - const uint8_t *data, unsigned int len); - -int gsmtap_init(uint32_t dst_ip); - -#endif /* _GSMTAP_UTIL_H */ diff --git a/include/osmocore/linuxlist.h b/include/osmocore/linuxlist.h deleted file mode 100644 index fb99c5ec..00000000 --- a/include/osmocore/linuxlist.h +++ /dev/null @@ -1,360 +0,0 @@ -#ifndef _LINUX_LLIST_H -#define _LINUX_LLIST_H - -#include - -#ifndef inline -#define inline __inline__ -#endif - -static inline void prefetch(const void *x) {;} - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (typeof( ((type *)0)->member ) *)(ptr); \ - (type *)( (char *)__mptr - offsetof(type, member) );}) - - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized llist entries. - */ -#define LLIST_POISON1 ((void *) 0x00100100) -#define LLIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked llist implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole llists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct llist_head { - struct llist_head *next, *prev; -}; - -#define LLIST_HEAD_INIT(name) { &(name), &(name) } - -#define LLIST_HEAD(name) \ - struct llist_head name = LLIST_HEAD_INIT(name) - -#define INIT_LLIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal llist manipulation where we know - * the prev/next entries already! - */ -static inline void __llist_add(struct llist_head *_new, - struct llist_head *prev, - struct llist_head *next) -{ - next->prev = _new; - _new->next = next; - _new->prev = prev; - prev->next = _new; -} - -/** - * llist_add - add a new entry - * @new: new entry to be added - * @head: llist head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void llist_add(struct llist_head *_new, struct llist_head *head) -{ - __llist_add(_new, head, head->next); -} - -/** - * llist_add_tail - add a new entry - * @new: new entry to be added - * @head: llist head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void llist_add_tail(struct llist_head *_new, struct llist_head *head) -{ - __llist_add(_new, head->prev, head); -} - -/* - * Delete a llist entry by making the prev/next entries - * point to each other. - * - * This is only for internal llist manipulation where we know - * the prev/next entries already! - */ -static inline void __llist_del(struct llist_head * prev, struct llist_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * llist_del - deletes entry from llist. - * @entry: the element to delete from the llist. - * Note: llist_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void llist_del(struct llist_head *entry) -{ - __llist_del(entry->prev, entry->next); - entry->next = (struct llist_head *)LLIST_POISON1; - entry->prev = (struct llist_head *)LLIST_POISON2; -} - -/** - * llist_del_init - deletes entry from llist and reinitialize it. - * @entry: the element to delete from the llist. - */ -static inline void llist_del_init(struct llist_head *entry) -{ - __llist_del(entry->prev, entry->next); - INIT_LLIST_HEAD(entry); -} - -/** - * llist_move - delete from one llist and add as another's head - * @llist: the entry to move - * @head: the head that will precede our entry - */ -static inline void llist_move(struct llist_head *llist, struct llist_head *head) -{ - __llist_del(llist->prev, llist->next); - llist_add(llist, head); -} - -/** - * llist_move_tail - delete from one llist and add as another's tail - * @llist: the entry to move - * @head: the head that will follow our entry - */ -static inline void llist_move_tail(struct llist_head *llist, - struct llist_head *head) -{ - __llist_del(llist->prev, llist->next); - llist_add_tail(llist, head); -} - -/** - * llist_empty - tests whether a llist is empty - * @head: the llist to test. - */ -static inline int llist_empty(const struct llist_head *head) -{ - return head->next == head; -} - -static inline void __llist_splice(struct llist_head *llist, - struct llist_head *head) -{ - struct llist_head *first = llist->next; - struct llist_head *last = llist->prev; - struct llist_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * llist_splice - join two llists - * @llist: the new llist to add. - * @head: the place to add it in the first llist. - */ -static inline void llist_splice(struct llist_head *llist, struct llist_head *head) -{ - if (!llist_empty(llist)) - __llist_splice(llist, head); -} - -/** - * llist_splice_init - join two llists and reinitialise the emptied llist. - * @llist: the new llist to add. - * @head: the place to add it in the first llist. - * - * The llist at @llist is reinitialised - */ -static inline void llist_splice_init(struct llist_head *llist, - struct llist_head *head) -{ - if (!llist_empty(llist)) { - __llist_splice(llist, head); - INIT_LLIST_HEAD(llist); - } -} - -/** - * llist_entry - get the struct for this entry - * @ptr: the &struct llist_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the llist_struct within the struct. - */ -#define llist_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * llist_for_each - iterate over a llist - * @pos: the &struct llist_head to use as a loop counter. - * @head: the head for your llist. - */ -#define llist_for_each(pos, head) \ - for (pos = (head)->next, prefetch(pos->next); pos != (head); \ - pos = pos->next, prefetch(pos->next)) - -/** - * __llist_for_each - iterate over a llist - * @pos: the &struct llist_head to use as a loop counter. - * @head: the head for your llist. - * - * This variant differs from llist_for_each() in that it's the - * simplest possible llist iteration code, no prefetching is done. - * Use this for code that knows the llist to be very short (empty - * or 1 entry) most of the time. - */ -#define __llist_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * llist_for_each_prev - iterate over a llist backwards - * @pos: the &struct llist_head to use as a loop counter. - * @head: the head for your llist. - */ -#define llist_for_each_prev(pos, head) \ - for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ - pos = pos->prev, prefetch(pos->prev)) - -/** - * llist_for_each_safe - iterate over a llist safe against removal of llist entry - * @pos: the &struct llist_head to use as a loop counter. - * @n: another &struct llist_head to use as temporary storage - * @head: the head for your llist. - */ -#define llist_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * llist_for_each_entry - iterate over llist of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your llist. - * @member: the name of the llist_struct within the struct. - */ -#define llist_for_each_entry(pos, head, member) \ - for (pos = llist_entry((head)->next, typeof(*pos), member), \ - prefetch(pos->member.next); \ - &pos->member != (head); \ - pos = llist_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next)) - -/** - * llist_for_each_entry_reverse - iterate backwards over llist of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your llist. - * @member: the name of the llist_struct within the struct. - */ -#define llist_for_each_entry_reverse(pos, head, member) \ - for (pos = llist_entry((head)->prev, typeof(*pos), member), \ - prefetch(pos->member.prev); \ - &pos->member != (head); \ - pos = llist_entry(pos->member.prev, typeof(*pos), member), \ - prefetch(pos->member.prev)) - -/** - * llist_for_each_entry_continue - iterate over llist of given type - * continuing after existing point - * @pos: the type * to use as a loop counter. - * @head: the head for your llist. - * @member: the name of the llist_struct within the struct. - */ -#define llist_for_each_entry_continue(pos, head, member) \ - for (pos = llist_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next); \ - &pos->member != (head); \ - pos = llist_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next)) - -/** - * llist_for_each_entry_safe - iterate over llist of given type safe against removal of llist entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your llist. - * @member: the name of the llist_struct within the struct. - */ -#define llist_for_each_entry_safe(pos, n, head, member) \ - for (pos = llist_entry((head)->next, typeof(*pos), member), \ - n = llist_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = llist_entry(n->member.next, typeof(*n), member)) - -/** - * llist_for_each_rcu - iterate over an rcu-protected llist - * @pos: the &struct llist_head to use as a loop counter. - * @head: the head for your llist. - */ -#define llist_for_each_rcu(pos, head) \ - for (pos = (head)->next, prefetch(pos->next); pos != (head); \ - pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next)) - -#define __llist_for_each_rcu(pos, head) \ - for (pos = (head)->next; pos != (head); \ - pos = pos->next, ({ smp_read_barrier_depends(); 0;})) - -/** - * llist_for_each_safe_rcu - iterate over an rcu-protected llist safe - * against removal of llist entry - * @pos: the &struct llist_head to use as a loop counter. - * @n: another &struct llist_head to use as temporary storage - * @head: the head for your llist. - */ -#define llist_for_each_safe_rcu(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next) - -/** - * llist_for_each_entry_rcu - iterate over rcu llist of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your llist. - * @member: the name of the llist_struct within the struct. - */ -#define llist_for_each_entry_rcu(pos, head, member) \ - for (pos = llist_entry((head)->next, typeof(*pos), member), \ - prefetch(pos->member.next); \ - &pos->member != (head); \ - pos = llist_entry(pos->member.next, typeof(*pos), member), \ - ({ smp_read_barrier_depends(); 0;}), \ - prefetch(pos->member.next)) - - -/** - * llist_for_each_continue_rcu - iterate over an rcu-protected llist - * continuing after existing point. - * @pos: the &struct llist_head to use as a loop counter. - * @head: the head for your llist. - */ -#define llist_for_each_continue_rcu(pos, head) \ - for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \ - (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next)) - - -#endif diff --git a/include/osmocore/logging.h b/include/osmocore/logging.h deleted file mode 100644 index fd458440..00000000 --- a/include/osmocore/logging.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef _OSMOCORE_LOGGING_H -#define _OSMOCORE_LOGGING_H - -#include -#include -#include - -#define LOG_MAX_CATEGORY 32 -#define LOG_MAX_CTX 8 -#define LOG_MAX_FILTERS 8 - -#define DEBUG - -#ifdef DEBUG -#define DEBUGP(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 0, fmt, ## args) -#define DEBUGPC(ss, fmt, args...) logp(ss, __FILE__, __LINE__, 1, fmt, ## args) -#else -#define DEBUGP(xss, fmt, args...) -#define DEBUGPC(ss, fmt, args...) -#endif - - -void logp(unsigned int subsys, char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); - -/* new logging interface */ -#define LOGP(ss, level, fmt, args...) \ - logp2(ss, level, __FILE__, __LINE__, 0, fmt, ##args) -#define LOGPC(ss, level, fmt, args...) \ - logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args) - -/* different levels */ -#define LOGL_DEBUG 1 /* debugging information */ -#define LOGL_INFO 3 -#define LOGL_NOTICE 5 /* abnormal/unexpected condition */ -#define LOGL_ERROR 7 /* error condition, requires user action */ -#define LOGL_FATAL 8 /* fatal, program aborted */ - -#define LOG_FILTER_ALL 0x0001 - -struct log_category { - uint8_t loglevel; - uint8_t enabled; -}; - -struct log_info_cat { - const char *name; - const char *color; - const char *description; - uint8_t loglevel; - uint8_t enabled; -}; - -/* log context information, passed to filter */ -struct log_context { - void *ctx[LOG_MAX_CTX+1]; -}; - -struct log_target; - -typedef int log_filter(const struct log_context *ctx, - struct log_target *target); - -struct log_info { - /* filter callback function */ - log_filter *filter_fn; - - /* per-category information */ - const struct log_info_cat *cat; - unsigned int num_cat; -}; - -enum log_target_type { - LOG_TGT_TYPE_VTY, - LOG_TGT_TYPE_SYSLOG, - LOG_TGT_TYPE_FILE, - LOG_TGT_TYPE_STDERR, -}; - -struct log_target { - struct llist_head entry; - - int filter_map; - void *filter_data[LOG_MAX_FILTERS+1]; - - struct log_category categories[LOG_MAX_CATEGORY+1]; - uint8_t loglevel; - int use_color:1; - int print_timestamp:1; - - enum log_target_type type; - - union { - struct { - FILE *out; - const char *fname; - } tgt_file; - - struct { - int priority; - int facility; - } tgt_syslog; - - struct { - void *vty; - } tgt_vty; - }; - - void (*output) (struct log_target *target, unsigned int level, - const char *string); -}; - -/* use the above macros */ -void logp2(unsigned int subsys, unsigned int level, char *file, - int line, int cont, const char *format, ...) - __attribute__ ((format (printf, 6, 7))); -void log_init(const struct log_info *cat); - -/* context management */ -void log_reset_context(void); -int log_set_context(uint8_t ctx, void *value); - -/* filter on the targets */ -void log_set_all_filter(struct log_target *target, int); - -void log_set_use_color(struct log_target *target, int); -void log_set_print_timestamp(struct log_target *target, int); -void log_set_log_level(struct log_target *target, int log_level); -void log_parse_category_mask(struct log_target *target, const char* mask); -int log_parse_level(const char *lvl); -const char *log_level_str(unsigned int lvl); -int log_parse_category(const char *category); -void log_set_category_filter(struct log_target *target, int category, - int enable, int level); - -/* management of the targets */ -struct log_target *log_target_create(void); -void log_target_destroy(struct log_target *target); -struct log_target *log_target_create_stderr(void); -struct log_target *log_target_create_file(const char *fname); -struct log_target *log_target_create_syslog(const char *ident, int option, - int facility); -int log_target_file_reopen(struct log_target *tgt); - -void log_add_target(struct log_target *target); -void log_del_target(struct log_target *target); - -/* Generate command string for VTY use */ -const char *log_vty_command_string(const struct log_info *info); -const char *log_vty_command_description(const struct log_info *info); - -struct log_target *log_target_find(int type, const char *fname); -extern struct llist_head osmo_log_target_list; - -#endif /* _OSMOCORE_LOGGING_H */ diff --git a/include/osmocore/mncc.h b/include/osmocore/mncc.h deleted file mode 100644 index a094bb9b..00000000 --- a/include/osmocore/mncc.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _OSMOCORE_MNCC_H -#define _OSMOCORE_MNCC_H - -#define GSM_MAX_FACILITY 128 -#define GSM_MAX_SSVERSION 128 -#define GSM_MAX_USERUSER 128 - -/* Expanded fields from GSM TS 04.08, Table 10.5.102 */ -struct gsm_mncc_bearer_cap { - int transfer; /* Information Transfer Capability */ - int mode; /* Transfer Mode */ - int coding; /* Coding Standard */ - int radio; /* Radio Channel Requirement */ - int speech_ctm; /* CTM text telephony indication */ - int speech_ver[8]; /* Speech version indication */ -}; - -struct gsm_mncc_number { - int type; - int plan; - int present; - int screen; - char number[33]; -}; - -struct gsm_mncc_cause { - int location; - int coding; - int rec; - int rec_val; - int value; - int diag_len; - char diag[32]; -}; - -struct gsm_mncc_useruser { - int proto; - char info[GSM_MAX_USERUSER + 1]; /* + termination char */ -}; - -struct gsm_mncc_progress { - int coding; - int location; - int descr; -}; - -struct gsm_mncc_facility { - int len; - char info[GSM_MAX_FACILITY]; -}; - -struct gsm_mncc_ssversion { - int len; - char info[GSM_MAX_SSVERSION]; -}; - -struct gsm_mncc_cccap { - int dtmf; - int pcp; -}; - -enum { - GSM_MNCC_BCAP_SPEECH = 0, - GSM_MNCC_BCAP_UNR_DIG = 1, - GSM_MNCC_BCAP_AUDIO = 2, - GSM_MNCC_BCAP_FAX_G3 = 3, - GSM_MNCC_BCAP_OTHER_ITC = 5, - GSM_MNCC_BCAP_RESERVED = 7, -}; - -#endif diff --git a/include/osmocore/msgb.h b/include/osmocore/msgb.h deleted file mode 100644 index c4f44305..00000000 --- a/include/osmocore/msgb.h +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef _MSGB_H -#define _MSGB_H - -/* (C) 2008 by Harald Welte - * All Rights Reserved - * - * 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include -#include "linuxlist.h" -#include "utils.h" - -#define MSGB_DEBUG - -struct msgb { - struct llist_head list; - - /* Part of which TRX logical channel we were received / transmitted */ - /* FIXME: move them into the control buffer */ - struct gsm_bts_trx *trx; - struct gsm_lchan *lchan; - - /* the Layer1 header (if any) */ - unsigned char *l1h; - /* the A-bis layer 2 header: OML, RSL(RLL), NS */ - unsigned char *l2h; - /* the layer 3 header. For OML: FOM; RSL: 04.08; GPRS: BSSGP */ - unsigned char *l3h; - /* the layer 4 header */ - unsigned char *l4h; - - /* the 'control buffer', large enough to contain 5 pointers */ - unsigned long cb[5]; - - uint16_t data_len; - uint16_t len; - - unsigned char *head; - unsigned char *tail; - unsigned char *data; - unsigned char _data[0]; -}; - -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); -extern void msgb_reset(struct msgb *m); - -#ifdef MSGB_DEBUG -#include -#define MSGB_ABORT(msg, fmt, args ...) do { \ - osmo_panic("msgb(%p): " fmt, msg, ## args); \ - } while(0) -#else -#define MSGB_ABORT(msg, fmt, args ...) -#endif - -#define msgb_l1(m) ((void *)(m->l1h)) -#define msgb_l2(m) ((void *)(m->l2h)) -#define msgb_l3(m) ((void *)(m->l3h)) -#define msgb_sms(m) ((void *)(m->l4h)) - -static inline unsigned int msgb_l1len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l1(msgb); -} - -static inline unsigned int msgb_l2len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l2(msgb); -} - -static inline unsigned int msgb_l3len(const struct msgb *msgb) -{ - return msgb->tail - (uint8_t *)msgb_l3(msgb); -} - -static inline unsigned int msgb_headlen(const struct msgb *msgb) -{ - return msgb->len - msgb->data_len; -} - -static inline int msgb_tailroom(const struct msgb *msgb) -{ - return (msgb->head + msgb->data_len) - msgb->tail; -} - -static inline int msgb_headroom(const struct msgb *msgb) -{ - return (msgb->data - msgb->head); -} - -static inline unsigned char *msgb_put(struct msgb *msgb, unsigned int len) -{ - unsigned char *tmp = msgb->tail; - if (msgb_tailroom(msgb) < (int) len) - MSGB_ABORT(msgb, "Not enough tailroom msgb_push (%u < %u)\n", - msgb_tailroom(msgb), len); - msgb->tail += len; - msgb->len += len; - return tmp; -} -static inline void msgb_put_u8(struct msgb *msgb, uint8_t word) -{ - uint8_t *space = msgb_put(msgb, 1); - space[0] = word & 0xFF; -} -static inline void msgb_put_u16(struct msgb *msgb, uint16_t word) -{ - uint8_t *space = msgb_put(msgb, 2); - space[0] = word >> 8 & 0xFF; - space[1] = word & 0xFF; -} -static inline void msgb_put_u32(struct msgb *msgb, uint32_t word) -{ - uint8_t *space = msgb_put(msgb, 4); - space[0] = word >> 24 & 0xFF; - space[1] = word >> 16 & 0xFF; - space[2] = word >> 8 & 0xFF; - space[3] = word & 0xFF; -} -static inline unsigned char *msgb_get(struct msgb *msgb, unsigned int len) -{ - unsigned char *tmp = msgb->data; - msgb->data += len; - msgb->len -= len; - return tmp; -} -static inline uint8_t msgb_get_u8(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 1); - return space[0]; -} -static inline uint16_t msgb_get_u16(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 2); - return space[0] << 8 | space[1]; -} -static inline uint32_t msgb_get_u32(struct msgb *msgb) -{ - uint8_t *space = msgb_get(msgb, 4); - return space[0] << 24 | space[1] << 16 | space[2] << 8 | space[3]; -} -static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len) -{ - if (msgb_headroom(msgb) < (int) len) - MSGB_ABORT(msgb, "Not enough headroom msgb_push (%u < %u)\n", - msgb_headroom(msgb), len); - msgb->data -= len; - msgb->len += len; - return msgb->data; -} -static inline unsigned char *msgb_pull(struct msgb *msgb, unsigned int len) -{ - msgb->len -= len; - return msgb->data += len; -} - -/* increase the headroom of an empty msgb, reducing the tailroom */ -static inline void msgb_reserve(struct msgb *msg, int len) -{ - msg->data += len; - msg->tail += len; -} - -static inline struct msgb *msgb_alloc_headroom(int size, int headroom, - const char *name) -{ - static_assert(size > headroom, headroom_bigger); - - struct msgb *msg = msgb_alloc(size, name); - if (msg) - msgb_reserve(msg, headroom); - return msg; -} - -/* non inline functions to ease binding */ -uint8_t *msgb_data(const struct msgb *msg); -uint16_t msgb_length(const struct msgb *msg); - - -#endif /* _MSGB_H */ diff --git a/include/osmocore/msgfile.h b/include/osmocore/msgfile.h deleted file mode 100644 index 92caa9fc..00000000 --- a/include/osmocore/msgfile.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) 2010 by Holger Hans Peter Freyther - * (C) 2010 by On-Waves - * All Rights Reserved - * - * 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef MSG_FILE_H -#define MSG_FILE_H - -#include "linuxlist.h" - -/** - * One message in the list. - */ -struct msg_entry { - struct llist_head list; - - /* number for everyone to use */ - int nr; - - /* data from the file */ - char *mcc; - char *mnc; - char *option; - char *text; -}; - -struct msg_entries { - struct llist_head entry; -}; - -struct msg_entries *msg_entry_parse(void *ctx, const char *filename); - -#endif diff --git a/include/osmocore/panic.h b/include/osmocore/panic.h deleted file mode 100644 index c5a83778..00000000 --- a/include/osmocore/panic.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef OSMOCORE_PANIC_H -#define OSMOCORE_PANIC_H - -#include - -typedef void (*osmo_panic_handler_t)(const char *fmt, va_list args); - -void osmo_panic(const char *fmt, ...); -void osmo_set_panic_handler(osmo_panic_handler_t h); - -#endif diff --git a/include/osmocore/plugin.h b/include/osmocore/plugin.h deleted file mode 100644 index 98f9b56d..00000000 --- a/include/osmocore/plugin.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _OSMO_PLUGIN_H -#define _OSMO_PLUGIN_H - -int plugin_load_all(const char *directory); - -#endif diff --git a/include/osmocore/process.h b/include/osmocore/process.h deleted file mode 100644 index 2d663828..00000000 --- a/include/osmocore/process.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _OSMO_PROCESS_H -#define _OSMO_PROCESS_H - -int osmo_daemonize(void); - -#endif diff --git a/include/osmocore/protocol/Makefile.am b/include/osmocore/protocol/Makefile.am deleted file mode 100644 index 03a4849d..00000000 --- a/include/osmocore/protocol/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -osmocore_proto_HEADERS = gsm_03_41.h \ - gsm_04_08.h gsm_04_11.h gsm_04_12.h gsm_04_80.h \ - gsm_08_08.h gsm_08_58.h \ - gsm_12_21.h - -osmocore_protodir = $(includedir)/osmocore/protocol diff --git a/include/osmocore/protocol/gsm_03_41.h b/include/osmocore/protocol/gsm_03_41.h deleted file mode 100644 index 54365cbc..00000000 --- a/include/osmocore/protocol/gsm_03_41.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef PROTO_GSM_03_41_H -#define PROTO_GSM_03_41_H - -#include - -/* GSM TS 03.41 definitions also TS 23.041*/ - -/* Chapter 9.3.2 */ -struct gsm341_ms_message { - struct { - uint8_t code_hi:6; - uint8_t gs:2; - uint8_t update:4; - uint8_t code_lo:4; - } serial; - uint16_t msg_id; - struct { - uint8_t language:4; - uint8_t group:4; - } dcs; - struct { - uint8_t total:4; - uint8_t current:4; - } page; - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 9.4.1.3 */ -struct gsm341_etws_message { - struct { - uint8_t code_hi:4; - uint8_t popup:1; - uint8_t alert:1; - uint8_t gs:2; - uint8_t update:4; - uint8_t code_lo:4; - } serial; - uint16_t msg_id; - uint16_t warning_type; - uint8_t data[0]; -} __attribute__((packed)); - -#define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4)) - -/* Section 9.3.2.1 - Geographical Scope */ -#define GSM341_GS_CELL_WIDE_IMMED 0 -#define GSM341_GS_PLMN_WIDE 1 -#define GSM341_GS_LA_WIDE 2 -#define GSM341_GS_CELL_WIDE 3 - -#endif /* PROTO_GSM_03_41_H */ diff --git a/include/osmocore/protocol/gsm_04_08.h b/include/osmocore/protocol/gsm_04_08.h deleted file mode 100644 index 3ad7dfdc..00000000 --- a/include/osmocore/protocol/gsm_04_08.h +++ /dev/null @@ -1,1262 +0,0 @@ -#ifndef PROTO_GSM_04_08_H -#define PROTO_GSM_04_08_H - -#include - -/* GSM TS 04.08 definitions */ -struct gsm_lchan; - -/* Chapter 10.5.1.5 */ -struct gsm48_classmark1 { - uint8_t pwr_lev:3, - a5_1:1, - es_ind:1, - rev_lev:2, - spare:1; -} __attribute__ ((packed)); - -/* Chapter 10.5.1.6 */ -struct gsm48_classmark2 { - uint8_t pwr_lev:3, - a5_1:1, - es_ind:1, - rev_lev:2, - spare:1; - uint8_t fc:1, - vgcs:1, - vbs:1, - sm_cap:1, - ss_scr:2, - ps_cap:1, - spare2:1; - uint8_t a5_2:1, - a5_3:1, - cmsp:1, - solsa:1, - spare3:1, - lcsva_cap:1, - spare4:1, - cm3:1; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.1b.3 */ -struct gsm48_range_1024 { - uint8_t w1_hi:2, - f0:1, - form_id:5; - uint8_t w1_lo; - uint8_t w2_hi; - uint8_t w3_hi:7, - w2_lo:1; - uint8_t w4_hi:6, - w3_lo:2; - uint8_t w5_hi:6, - w4_lo:2; - uint8_t w6_hi:6, - w5_lo:2; - uint8_t w7_hi:6, - w6_lo:2; - uint8_t w8_hi:6, - w7_lo:2; - uint8_t w9:7, - w8_lo:1; - uint8_t w11_hi:1, - w10:7; - uint8_t w12_hi:2, - w11_lo:6; - uint8_t w13_hi:3, - w12_lo:5; - uint8_t w14_hi:4, - w13_lo:4; - uint8_t w15_hi:5, - w14_lo:3; - uint8_t w16:6, - w15_lo:2; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.1b.4 */ -struct gsm48_range_512 { - uint8_t orig_arfcn_hi:1, - form_id:7; - uint8_t orig_arfcn_mid; - uint8_t w1_hi:7, - orig_arfcn_lo:1; - uint8_t w2_hi:6, - w1_lo:2; - uint8_t w3_hi:6, - w2_lo:2; - uint8_t w4_hi:6, - w3_lo:2; - uint8_t w5:7, - w4_lo:1; - uint8_t w7_hi:1, - w6:7; - uint8_t w8_hi:2, - w7_lo:6; - uint8_t w9_hi:4, - w8_lo:4; - uint8_t w10:6, - w9_lo:2; - uint8_t w12_hi:2, - w11:6; - uint8_t w13_hi:4, - w12_lo:4; - uint8_t w14:6, - w13_lo:2; - uint8_t w16_hi:2, - w15:6; - uint8_t w17:5, - w16_lo:3; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.1b.5 */ -struct gsm48_range_256 { - uint8_t orig_arfcn_hi:1, - form_id:7; - uint8_t orig_arfcn_mid; - uint8_t w1_hi:7, - orig_arfcn_lo:1; - uint8_t w2:7, - w1_lo:1; - uint8_t w4_hi:1, - w3:7; - uint8_t w5_hi:3, - w4_lo:5; - uint8_t w6_hi:5, - w5_lo:3; - uint8_t w8_hi:1, - w7:6, - w6_lo:1; - uint8_t w9_hi:4, - w8_lo:4; - uint8_t w11_hi:2, - w10:5, - w9_lo:1; - uint8_t w12:5, - w11_lo:3; - uint8_t w14_hi:3, - w13:5; - uint8_t w16_hi:1, - w15:5, - w14_lo:2; - uint8_t w18_hi:1, - w17:4, - w16_lo:3; - uint8_t w20_hi:1, - w19:4, - w18_lo:3; - uint8_t spare:1, - w21:4, - w20_lo:3; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.1b.6 */ -struct gsm48_range_128 { - uint8_t orig_arfcn_hi:1, - form_id:7; - uint8_t orig_arfcn_mid; - uint8_t w1:7, - orig_arfcn_lo:1; - uint8_t w3_hi:2, - w2:6; - uint8_t w4_hi:4, - w3_lo:4; - uint8_t w6_hi:2, - w5:5, - w4_lo:1; - uint8_t w7:5, - w6_lo:3; - uint8_t w9:4, - w8:4; - uint8_t w11:4, - w10:4; - uint8_t w13:4, - w12:4; - uint8_t w15:4, - w14:4; - uint8_t w18_hi:2, - w17:3, - w16:3; - uint8_t w21_hi:1, - w20:3, - w19:3, - w18_lo:1; - uint8_t w23:3, - w22:3, - w21_lo:2; - uint8_t w26_hi:2, - w25:3, - w24:3; - uint8_t spare:1, - w28:3, - w27:3, - w26_lo:1; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.1b.7 */ -struct gsm48_var_bit { - uint8_t orig_arfcn_hi:1, - form_id:7; - uint8_t orig_arfcn_mid; - uint8_t rrfcn1_7:7, - orig_arfcn_lo:1; - uint8_t rrfcn8_111[13]; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.5 */ -struct gsm48_chan_desc { - uint8_t chan_nr; - union { - struct { - uint8_t maio_high:4, - h:1, - tsc:3; - uint8_t hsn:6, - maio_low:2; - } h1; - struct { - uint8_t arfcn_high:2, - spare:2, - h:1, - tsc:3; - uint8_t arfcn_low; - } h0; - }; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.20 */ -struct gsm48_meas_res { - uint8_t rxlev_full:6, - dtx_used:1, - ba_used:1; - uint8_t rxlev_sub:6, - meas_valid:1, - spare:1; - uint8_t no_nc_n_hi:1, - rxqual_sub:3, - rxqual_full:3, - spare2:1; - uint8_t rxlev_nc1:6, - no_nc_n_lo:2; - uint8_t bsic_nc1_hi:3, - bcch_f_nc1:5; - uint8_t rxlev_nc2_hi:5, - bsic_nc1_lo:3; - uint8_t bsic_nc2_hi:2, - bcch_f_nc2:5, - rxlev_nc2_lo:1; - uint8_t rxlev_nc3_hi:4, - bsic_nc2_lo:4; - uint8_t bsic_nc3_hi:1, - bcch_f_nc3:5, - rxlev_nc3_lo:2; - uint8_t rxlev_nc4_hi:3, - bsic_nc3_lo:5; - uint8_t bcch_f_nc4:5, - rxlev_nc4_lo:3; - uint8_t rxlev_nc5_hi:2, - bsic_nc4:6; - uint8_t bcch_f_nc5_hi:4, - rxlev_nc5_lo:4; - uint8_t rxlev_nc6_hi:1, - bsic_nc5:6, - bcch_f_nc5_lo:1; - uint8_t bcch_f_nc6_hi:3, - rxlev_nc6_lo:5; - uint8_t bsic_nc6:6, - bcch_f_nc6_lo:2; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.21aa */ -struct gsm48_multi_rate_conf { - uint8_t smod : 2, - spare: 1, - icmi : 1, - nscb : 1, - ver : 3; - uint8_t m4_75 : 1, - m5_15 : 1, - m5_90 : 1, - m6_70 : 1, - m7_40 : 1, - m7_95 : 1, - m10_2 : 1, - m12_2 : 1; -} __attribute__((packed)); - -/* Chapter 10.5.2.28(a) */ -struct gsm48_power_cmd { - uint8_t power_level:5, - spare:2, - atc:1; -} __attribute__((packed)); - -/* Chapter 10.5.2.29 */ -struct gsm48_rach_control { - uint8_t re :1, - cell_bar :1, - tx_integer :4, - max_trans :2; - uint8_t t2; - uint8_t t3; -} __attribute__ ((packed)); - - -/* Chapter 10.5.2.30 */ -struct gsm48_req_ref { - uint8_t ra; - uint8_t t3_high:3, - t1:5; - uint8_t t2:5, - t3_low:3; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.38 */ -struct gsm48_start_time { - uint8_t t3_high:3, - t1:5; - uint8_t t2:5, - t3_low:3; -} __attribute__ ((packed)); - -/* Chapter 10.5.2.39 */ -struct gsm48_sync_ind { - uint8_t si:2, - rot:1, - nci:1, - sync_ie:4; -} __attribute__((packed)); - -/* - * Chapter 9.1.5/9.1.6 - * - * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a - */ -struct gsm48_chan_mode_modify { - struct gsm48_chan_desc chan_desc; - uint8_t mode; -} __attribute__ ((packed)); - -enum gsm48_chan_mode { - GSM48_CMODE_SIGN = 0x00, - GSM48_CMODE_SPEECH_V1 = 0x01, - GSM48_CMODE_SPEECH_EFR = 0x21, - GSM48_CMODE_SPEECH_AMR = 0x41, - GSM48_CMODE_DATA_14k5 = 0x0f, - GSM48_CMODE_DATA_12k0 = 0x03, - GSM48_CMODE_DATA_6k0 = 0x0b, - GSM48_CMODE_DATA_3k6 = 0x23, -}; - -/* Chapter 9.1.2 */ -struct gsm48_ass_cmd { - /* Semantic is from 10.5.2.5a */ - struct gsm48_chan_desc chan_desc; - uint8_t power_command; - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 9.1.13 */ -struct gsm48_frq_redef { - /* Semantic is from 10.5.2.5a */ - struct gsm48_chan_desc chan_desc; - uint8_t mob_alloc_len; - uint8_t mob_alloc[0]; -} __attribute__((packed)); - -/* Chapter 10.5.2.2 */ -struct gsm48_cell_desc { - uint8_t bcc:3, - ncc:3, - arfcn_hi:2; - uint8_t arfcn_lo; -} __attribute__((packed)); - -/* Chapter 9.1.15 */ -struct gsm48_ho_cmd { - struct gsm48_cell_desc cell_desc; - struct gsm48_chan_desc chan_desc; - uint8_t ho_ref; - uint8_t power_command; - uint8_t data[0]; -} __attribute__((packed)); - -/* Chapter 9.1.18 */ -struct gsm48_imm_ass { - uint8_t l2_plen; - uint8_t proto_discr; - uint8_t msg_type; - uint8_t page_mode; - struct gsm48_chan_desc chan_desc; - struct gsm48_req_ref req_ref; - uint8_t timing_advance; - uint8_t mob_alloc_len; - uint8_t mob_alloc[0]; -} __attribute__ ((packed)); - -/* Chapter 9.1.25 */ -struct gsm48_pag_resp { - uint8_t spare:4, - key_seq:4; - uint32_t classmark2; - uint8_t mi_len; - uint8_t mi[0]; -} __attribute__ ((packed)); - -/* Chapter 10.5.1.3 */ -struct gsm48_loc_area_id { - uint8_t digits[3]; /* BCD! */ - uint16_t lac; -} __attribute__ ((packed)); - -/* Section 9.2.2 */ -struct gsm48_auth_req { - uint8_t key_seq:4, - spare:4; - uint8_t rand[16]; -} __attribute__ ((packed)); - -/* Section 9.2.3 */ -struct gsm48_auth_resp { - uint8_t sres[4]; -} __attribute__ ((packed)); - -/* Section 9.2.15 */ -struct gsm48_loc_upd_req { - uint8_t type:4, - key_seq:4; - struct gsm48_loc_area_id lai; - struct gsm48_classmark1 classmark1; - uint8_t mi_len; - uint8_t mi[0]; -} __attribute__ ((packed)); - -/* Section 10.1 */ -struct gsm48_hdr { - uint8_t proto_discr; - uint8_t msg_type; - uint8_t data[0]; -} __attribute__ ((packed)); - -/* Section 9.1.3x System information Type header */ -struct gsm48_system_information_type_header { - uint8_t l2_plen; - uint8_t rr_protocol_discriminator :4, - skip_indicator:4; - uint8_t system_information; -} __attribute__ ((packed)); - -/* Section 10.5.2.4 Cell Selection Parameters */ -struct gsm48_cell_sel_par { - uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */ - cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */ - uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */ - neci:1, - acs:1; -} __attribute__ ((packed)); - -/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */ -struct gsm48_control_channel_descr { - uint8_t ccch_conf :3, - bs_ag_blks_res :3, - att :1, - spare1 :1; - uint8_t bs_pa_mfrms : 3, - spare2 :5; - uint8_t t3212; -} __attribute__ ((packed)); - -struct gsm48_cell_options { - uint8_t radio_link_timeout:4, - dtx:2, - pwrc:1, - spare:1; -} __attr