Commit Graph

1111 Commits

Author SHA1 Message Date
Harald Welte f4d45ab021 gsm 08.08: use ANSI function definition with (void) 2011-07-16 12:13:00 +02:00
Harald Welte 79599ba0eb tlv: Make tlv parser arrays 256 entries wide to prevent overflow on 0xff
If we encounter a tag with 0xFF, we overflow our existing tlv_parse
array definitions.

Warning: this breaks ABI
2011-07-16 12:08:28 +02:00
Harald Welte 95b2b47b26 get rid of non-ANSI function declarations missing (void)
Detected by Smatch
2011-07-16 12:03:46 +02:00
Harald Welte 87dbca148f don't use signed bit-fields
detected by Smatch
2011-07-16 12:03:46 +02:00
Harald Welte 7e82020259 timer: use (void) for functions that take no arguments
This has been detected by http://smatch.sourceforge.net/
2011-07-16 12:03:46 +02:00
Harald Welte 9b837e6fda gsm 08.08: add value_strings and gsm0808_msg_name() function 2011-07-11 17:45:31 +02:00
Harald Welte 9e1f0604b5 add msgb_set_talloc_ctx() to set the talloc context for msgb allocations 2011-06-29 18:46:10 +02:00
Harald Welte 1f0b8c26f7 add LAPDm code from osmocom-bb into libosmocore 2011-06-27 10:51:37 +02:00
Harald Welte b43bc048eb logging: introduce library-internal logging categories
We do this by using a trick: library-internal log categories use
negative subsystem numbers, which are converted into positive
array indexes at the time of logging.

library-internal log categories need to be knwo at compile-time,
while application-specified categories now are of unlimited number,
as they are dynamically allocated.
2011-06-27 10:40:25 +02:00
Harald Welte ea19c97816 import gsm0502_calc_paging_group() from openbsc 2011-06-26 14:47:16 +02:00
Harald Welte 94df39e905 add some utility functions for paging related calculation (TS 05.02) 2011-06-26 14:40:12 +02:00
Harald Welte 2aee7b14ca add gsm48_number_of_paging_subchannels() function
(from openbsc's rsl_number_of_paging_subchannels)
2011-06-26 14:20:04 +02:00
Harald Welte e9b744e581 add MAX() macro as OSMO_MAX 2011-06-26 14:19:54 +02:00
Harald Welte 32e1f239b3 merge process.[ch] with application.[ch] 2011-06-26 14:14:05 +02:00
Andreas Eversberg 2a68c7c8cd gsm/utils: Adding conversion of "mobile power class" to dBm
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-26 11:41:48 +02:00
Harald Welte 620f7ab350 sysinfo: add EXTENDED MEASUREMENT ORDER / MEASUREMENT INFO to SI types
those two are used in the RSL SACCH FILLING messages and delivered
like SI5 / SI6.
2011-06-25 21:39:18 +02:00
Harald Welte 3d73227b61 RSL: Fix typo 2011-06-25 21:39:01 +02:00
Harald Welte cf7e5dad45 add value_string definitions for RSL message types 2011-06-23 20:44:03 +02:00
Harald Welte 5e924a31a0 introduce GSM primitive definitions
The idea here is to use the osmocom core primitive code ot abstract out
primitives for inter-layer comunication in GSM.
2011-06-23 15:04:47 +02:00
Harald Welte 9b21e88367 add new 'prim.h' header file for primitives 2011-06-23 14:14:20 +02:00
Pablo Neira Ayuso 0849c9af2a socket: add OSMO_SOCK_F_[CONNECT|BIND|NON_BLOCK] flags
This extends the socket infrastructure in libosmocore to allow
to create non-blocking sockets.

Basically, it replaces the connect0_bind1 parameter by one
flags parameter.
2011-06-13 19:15:59 +02:00
Harald Welte ee50081daa add missing #include file to sysinfo.h
(otherwise 'struct value_string' would not be defined)
2011-06-05 19:53:56 +02:00
Harald Welte fc90646d48 abis_nm.h: Add include to gsm_utils.h 2011-06-05 11:22:59 +02:00
Holger Hans Peter Freyther 271c43b0ae abis_nm: Forward declare the used enums
This file is using enums in that might or might not be
known to the compiler. Forward declare them.
2011-05-31 00:42:38 +02:00
Harald Welte cd623ebb56 bitvec: add missing stdint.h 2011-05-29 15:37:38 +02:00
Harald Welte 11c7193ad8 Import abis_nm_{chcomb4pchan,pchan4chcomb}() from openbsc 2011-05-24 17:22:55 +02:00
Harald Welte b5503136fa Import sytem information related definitions + code from openbsc 2011-05-24 15:01:53 +02:00
Holger Hans Peter Freyther 3036612d59 abis_nm: Mark the structs as extern to avoid compiler warning
warning: array ‘abis_nm_obj_class_names’ assumed to have one element
2011-05-23 21:41:34 +02:00
Harald Welte ea4b12aa5d abis_nm: remove abis_nm_obj_class_name / abis_nm_adm_state_name
and export the underlying raw value_string arrays instead:
abis_nm_obj_class_names / abis_nm_adm_state_names.

This permits the caller to use get_string_value() as well as
get_value_string().
2011-05-23 20:41:31 +02:00
Harald Welte 61dc63e354 rename abis_nm_adm_name() to abis_nm_adm_state_name() 2011-05-23 20:30:17 +02:00
Harald Welte f7a1bcce0c abis_nm: import definitions and common code on A-bis OML from OpenBSC 2011-05-22 22:45:16 +02:00
Harald Welte 4185fa5d9b libosmogsm: add ipaccess related header file 2011-05-22 21:57:15 +02:00
Harald Welte 68b1574257 socket: use listen() and SO_REUSEADDR, new osmo_sock_init_ofd() function
osmo_sock_init_ofd() is a wrapper around osmo_sock_init() which will
take care of initializing and registering a 'struct osmo_fd' for the
newly-created socket.
2011-05-22 21:47:29 +02:00
Harald Welte e476442cf0 GSMTAP/socket code: Check for sys/socket.h and conditionally compile 2011-05-22 12:25:57 +02:00
Harald Welte 33cb71ac91 gsmtap: rework GSMTAP API to be more future-proof
* use write_queue where applicable
* provide functions that work on raw FD and those with osmo_fd
* add support for multiple gsmtap instances (no global variables)
2011-05-22 11:43:23 +02:00
Holger Hans Peter Freyther ba01fa44fe app: Introduce some routines to help with application startup
The plan is to collect structs and routines for application
setup and remove many copies of the boilerplate code we have
right now. This starts with routines to ignore certain signals
and the stderr init code.

Increment the age of the library because a new interface was added.
2011-05-12 15:43:47 +02:00
Pablo Neira Ayuso 1b4a42c3b1 msgfile: use namespace prefix osmo_* and use more descriptive names
Summary of changes:

s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
s/msg_entry_parse/osmo_config_list_parse/g

minor glitch included in this patch while I was at it:

-#include "linuxlist.h"
+#include <osmocom/core/linuxlist.h>
2011-05-07 13:14:41 +02:00
Pablo Neira Ayuso 2c34867fc3 plugin: use namespace prefix osmo_*
Summary of changes:

s/plugin_load_all/osmo_plugin_load_all/g
2011-05-07 13:00:52 +02:00
Pablo Neira Ayuso 619b8b3292 backtrace: use namespace prefix osmo_*
Summary of changes:

s/backtrace/osmo_backtrace/g
2011-05-07 13:00:52 +02:00
Pablo Neira Ayuso ddcd2afc82 crc: use namespace prefix osmo_*
Summary of changes:

s/crc16_table/osmo_crc16_table/g
s/crc16/osmo_crc16/g
s/crc16_byte/osmo_crc16_byte/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso 87f7b25e56 utils: use namespace prefix osmo_*
Summary of changes:

s/bcd2char/osmo_bcd2char/g
s/char2bcd/osmo_char2bcd/g
s/hexparse/osmo_hexparse/g
s/hexdump/osmo_hexdump/g
s/hexdump_nospc/osmo_hexdump_nospc/g
s/ubit_dump/osmo_ubit_dump/g
s/static_assert/osmo_static_assert/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso 220abab3fa statistics: use namespace prefix osmo_counter*
Summary of changes:

s/struct counter/struct osmo_counter/g
s/counter_inc/osmo_counter_inc/g
s/counter_get/osmo_counter_get/g
s/counter_reset/osmo_counter_reset/g
s/counter_alloc/osmo_counter_alloc/g
s/counter_free/osmo_counter_free/g
s/counters_for_each/osmo_counters_for_each/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso 9111d930a5 write-queue: use namespace prefix osmo_wqueue*
Summary of changes:

s/struct write_queue/struct osmo_wqueue/g
s/write_queue_init/osmo_wqueue_init/g
s/void write_queue_clear/osmo_wqueue_clear/g
s/write_queue_enqueue/osmo_wqueue_enqueue/g
s/write_queue_bfd_cb/osmo_wqueue_bfd_cb/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso a10dd35566 signal: use namespace prefix osmo_signal*
Summary of changes:

s/signal_cbfn/osmo_signal_cbfn/g
s/register_signal_handler/osmo_signal_register_handler/g
s/unregister_signal_handler/osmo_signal_unregister_handler/g
s/dispatch_signal/osmo_signal_dispatch/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso f7f89d0cfe select: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso 0b21c1c885 timer: use namespace prefix osmo_timer*
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-07 13:00:51 +02:00
Harald Welte d58ba465f1 GSMTAP: add function to create a 'sink' for gsmtap packets
This can be helpful where we send GSMTAP messages to the loopback
device (localhost, 127.0.0.1) from where the kernel would then
send ICMP reject packets as nobody is listening on that port.
2011-05-04 11:09:21 +02:00
Sylvain Munaut 19dc5c9cca core/conv: Add some generic code for convolutional coding/decoding
Far from perfect but suits our need thus far.

The viterbi with softbit input is quite cpu-intensive. Since
most received bursts are often mostly error free, you could
use a less cpu intensive algorithm (Fano ?) and with hard bit
input. Then only switch to viterbi soft bit input if the channel
is bad enough to justify it.

Soft output is not implemented as its usefulness for the block
coding is limited.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-04-26 14:40:49 +02:00
Sylvain Munaut f1d3344781 gsm/a5: Add a A5 1&2 implementation
It's always useful to have around

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-04-26 14:40:49 +02:00
Pablo Neira Ayuso 240f01cfa7 include: fix missing extern in osmo_panic* declarations
This patch adds the missing extern to osmo_panic* declarations.
2011-04-26 14:36:52 +02:00
Holger Hans Peter Freyther a9f526a1ab stats: Fix the compiler warnings
Do not remove the const, include strings.h for strcmp
2011-04-18 16:46:35 +02:00
Daniel Willmann 334c8e1780 Add a function to search for a counter by name 2011-04-09 20:52:18 +02:00
Daniel Willmann 2d42ddeba3 Add functions to search for rate counters by name
* rate_ctr_get_group_by_name_idx, rate_ctr_get_by_name
2011-04-09 20:52:12 +02:00
Pablo Neira Ayuso 3abad6a6f9 utils: move OSMO_SNPRINT_RET() macro definition to osmocom/core/utils.h
This is used by the logging to vty conversion functions by now, but it
may be of help for other functions that plan to use snprintf().
2011-03-28 20:00:45 +02:00
Pablo Neira Ayuso 70004fcc6d vty: move vty_out_rate_ctr_group prototype to osmocom/vty/misc.h
Before this patch, it was in osmocom/core/rate_ctr.h
2011-03-28 20:00:45 +02:00
Pablo Neira Ayuso dc35dbee95 write_queue: use full path of includes in osmocom/core/write_queue.h 2011-03-28 20:00:45 +02:00
Pablo Neira Ayuso 36bdf2cb73 bitvec: add bitvec_find_first_bit_pos() from gsm/rxlev_stat.c
This patch adds bitvec_find_bit_pos() to bitvec.c where it really
belongs to. Before this patch used to be part of gsm/rxlev_stat.c
2011-03-28 20:00:45 +02:00
Sylvain Munaut d6643d5fcf core/bits: Make sbit_t a signed type (so that the math works)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-03-27 11:35:40 +02:00
Pablo Neira Ayuso 8341934844 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 <pablo@gnumonks.org>
2011-03-23 18:09:28 +01:00
Pablo Neira Ayuso fba495e5f6 This patch moves the GSM-specific functions to the new library
libosmogsm which is provided by libosmocore.

I have also moved generate_backtrace() to backtrace.c instead
of gsm_utils.c, otherwise the timer and msgfile tests depend on
libosmogsm.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:08:08 +01:00
Pablo Neira Ayuso 04139f14b6 vty: integration with logging framework
The logging categories are registered by the applications, like
osmo-nitb, during startup. Thus, the VTY have to provide the logging
commands according to the logging categories that the application
has registered.

Before this patch, the VTY contained the logging categories
hardcoded. Thus, any change in the logging categories by the
application would not be shown by the VTY.

So far, this was not a problem because all applications used the
same logging categories. However, according to what Harald told
me, this may be a problem in the future.

This patch resolve the lack of integration between the logging
framework and the VTY by generating the VTY logging commands
from the logging categories registered.

Since this patch changes one function of the libosmocore API,
it follows another patch for the openbsc application to get in
sync with the new function layout.

I have reworked and renamed the functions:

 * log_vty_category_string()
 * log_vty_level_string()

to provide the new ones that generate the exact output that VTY
requires.

This patch does not release the memory allocated by
talloc_zero_size() to store the VTY strings for the commands
and the description. I found no exit function that can clean
up resources that were allocated.
2011-03-19 18:33:48 -03:00
Harald Welte 63196de6d8 TLV: Add tv_fixed_put() and msgb_tv_fixed_put()
This is for a Tag-Value type with fixed-length value (len > 1)
2011-03-05 14:32:50 +01:00
Harald Welte a62648b0b0 LOGGING: remove duplicated code between vty-logging and cfg-logging 2011-02-18 21:03:27 +01:00
Harald Welte 2822296ddb LOGGING: configure logging from the vty
We can now configure logging to (multiple) files, stderr and syslog
from the vty command line in a persistent way (config file)
2011-02-18 20:37:04 +01:00
Harald Welte 46cfd77f75 LOGGING: Add syslog log target 2011-02-17 15:56:56 +01:00
Harald Welte 76e72abe32 LOGGING: Pass the log level down to the log target output function
This will be required for mapping osmocore log levels to syslog priorities.
2011-02-17 15:52:39 +01:00
Harald Welte b05552b14c [utils] introduce ubit_dump to dump buffers of unpacked bits 2011-02-08 16:56:23 +01:00
Harald Welte 3d0ac5e446 [utils] add 'bitdump' function for bitfields 2011-02-08 16:55:03 +01:00
Holger Hans Peter Freyther e750908367 gsmtap: The TETRA_AACH was defined twice, remove one, renumber
The GSMTAP_TETRA_AACH was defined twice. On the tetra list we
decided to remove the second entry and renumber the list as no
one is using this yet.
2011-01-28 10:13:41 +01:00
Christian Vogel c7f84e91b7 ubit2pbit flushes at the wrong moment, added one note to bits.h
(e.g. input2[] test sequence from testra/crc_test
 decodes incorrectly to packed bits: 90 b0 3e 80 03 87 53 bd 6f 08,
 this patch fixes it)
2011-01-22 22:48:37 +01:00
Sylvain Munaut aeb1077051 bits: Add extended options version of pbit2ubit and ubit2pbit
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-01-21 12:22:30 +01:00
Harald Welte 2230c133a6 [BITS] introduce new packed/unpacked bit conversion routines 2011-01-19 10:10:16 +01:00
Harald Welte c035ec63f5 [gsmtap] extend GSMTAP for TETRA 2011-01-19 09:40:59 +01:00
Harald Welte dba8478222 gsmtap.h: Add some more comments 2011-01-18 21:38:12 +01:00
Holger Hans Peter Freyther 5853f084a0 msgb: Make sure at compile time that headroom is smaller than size
All current code is using constants to allocate the msgb with
headroom. Use a static_assert to make sure that the headroom
is smaller than the size. This makes API misusage unlikely to
happen.
2011-01-16 20:29:48 +01:00
Holger Hans Peter Freyther 52c07ca6c5 misc: Move the static_assert from logging to the utils
This is just an ordinary macro, no specific reason to
have it in logging.h. This was compile tested with code
from our osmo family.
2011-01-16 20:29:48 +01:00
Alex Badea d126ab988b gsm 03.41: fix GSM341_MSG_CODE macro argument
One usage of the "ms" argument is typoed as "msg".  Fix it to prevent
subtle future failures.  Also paranthesize the macro argument for good
measure.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
2011-01-15 23:41:00 +01:00
Holger Hans Peter Freyther 9c559147c7 smscb: Add definition of a warning message 2010-12-29 22:51:45 +01:00
Holger Hans Peter Freyther a1e8bf71fe smscb: Mention 23.041 and fix the size of the update number 2010-12-29 22:51:45 +01:00
Holger Hans Peter Freyther e05c7dfa8e smscb: Add some simple decoding routines for SMSCB. 2010-12-29 22:51:45 +01:00
Alex Badea ab1246e0b5 protocol: introduce gsm_03_41.h
This currently contains definitions for the BTS->MS SMSCB message.

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
2010-11-28 15:08:32 +01:00
Alex Badea 8493018f24 gsm_08_58: add struct and constants for RSL_IE_CB_CMD_TYPE
Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
2010-11-28 15:06:13 +01:00
Alex Badea 3ba0a2bea0 gsm_04_12: fix 04.13 typos
There are two occurrences of "413" in the 04.12 header file.
These are probably typos; correct them to "412".

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
2010-11-28 15:05:01 +01:00
Harald Welte fe851ffc57 gsmtap.h: Add GSMTAP_TYPE_SIM 2010-11-18 23:54:20 +01:00
Sylvain Munaut 7f6615a37d Move the generate backtrace call from MSGB_ABORT to osmo_panic handler
This has two benefits:
 - All people calling osmo_panic() will have the backtrace
 - It makes the thing build in 'target' mode in osmocom-bb

And one downside:
 - The osmo_panic handler is now in the backtrace
(I can live with that :)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-11-13 22:47:47 +01:00
Sylvain Munaut c91d17b3d5 panic: Fix type warning - osmo_panic_handler_t is already a pointer ...
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-11-13 18:00:25 +01:00
Sylvain Munaut 2a471ee25d gsm_utils: Define 4 upper bits as "flags" and mask them out in utility functions
This way those function don't care about the flags they don't know about

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-11-13 17:51:37 +01:00
Harald Welte dab0287b3f msgb: fix printing of msgb pointer during MSGB_ABORT() 2010-11-09 13:42:26 +01:00
Harald Welte 46a45a6c4f msgb: don't compare unsigned int with int (fix lcr build) 2010-11-09 13:41:48 +01:00
Harald Welte be6cb17228 msgb_abort(): better formatting 2010-11-05 07:52:22 +01:00
Harald Welte 088e68aff4 generate backtrace in msgb_abort()
This helps us to debug where we encounter insufficient headroom...
2010-11-05 07:52:22 +01:00
Harald Welte 929d8870d2 Change msgb_abort() function in MSGB_ABORT argument with variable arguments
This enables callers to provide format string and arguments to it

Also, put conditionals into the macro, and remove them from the caller
site.
2010-11-05 07:52:22 +01:00
Holger Hans Peter Freyther af270a41e3 gsm0808: Move the clear request from bsc_msc_ip to here
This method should use the msgb_tlv_put routines instead
of the stuff it is doing. This will be cleaned up.
2010-11-04 12:42:50 +01:00
Holger Hans Peter Freyther c25c668106 gsm0808: Add a method to create a new DTAP message with a msgb 2010-11-04 12:27:48 +01:00
Holger Hans Peter Freyther a3f05d8609 gsm0808: Add a method to create a clear command message.
Use the msgb_tv_put functions for putting the data into
the message. Do not support the extended error reports.
2010-10-27 11:53:23 +02:00
Sylvain Munaut a1094c801f codec: Fix bit order table definition for GSM HR
There is two tables: one for unvoiced frames and one for voiced frames.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-24 21:13:40 +02:00
Sylvain Munaut b99b9309b2 codec: Add the missing bits for include to install and pkgconfig to work
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-24 18:23:10 +02:00
Holger Hans Peter Freyther acffb60c1a msgb: Add non-inlined helper functions to ease with language bindings
It is easier from languages that dlopen libosmocore to have a function
to access this data than to poke at the bytes of the struct directly. Add
copyright for this method and the reset method I did earlier this year.
2010-10-18 18:22:31 +02:00
Holger Hans Peter Freyther c64970ede5 gsm0480: Add method create own number response 2010-10-18 17:04:49 +02:00
Sylvain Munaut 1a4ea5b436 codec: Add bit ordering tables from specs for HR,FR,EFR & AMR
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-15 09:45:04 +02:00
Holger Hans Peter Freyther daa653fc22 ussd: Add a test case, switch parsing to use a gsm48_hdr and len
The current USSD code is not doing any size checks, add a test
case to find out how easily we access the data out of bounds.
Begin to use the length in some places.
2010-10-11 09:25:14 +02:00
Holger Hans Peter Freyther 00cb5700e6 gsm0480: Move the USSD parsing code to libosmocore
- Change u_int8 to uint8
- Change DEBUGP to LOGP
- Change fprintf(stderr, to LOGP(0, LOGL_DEBUG
- We should define log areas used inside libosmocore
2010-10-09 01:49:11 +08:00
Holger Hans Peter Freyther c87f266522 msgfile: Add a file parser for a simple file format
This file format will be used to store per country code,
per network code messages. This will be used for various
things ranging from access control, to messages...
2010-10-08 19:23:18 +08:00
Holger Hans Peter Freyther 55aea5099c gsm0480: Add USSD format functions to libosmocore
These routines come from OpenBSC, the msgb_wrap_* functions
belong to Mike Haben, the rest is mine. The msgb allocation
is compatible to the GSM48 allocation in OpenBSC.
2010-09-30 19:00:58 +08:00
Sylvain Munaut 77b6f6c536 protocol/gsm_04_08: Fix cr field position in gsm48_cip_mode_cmd
Thanks to Dieter for pointing this out.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-17 13:56:31 +02:00
Holger Hans Peter Freyther 08aaded3b8 vty: Add functions to access index and node
It is easier to call these two functions from bindings than
wrapping the vty structure and figuring out the alignment of
the enum on all different ABIs.
2010-09-14 02:24:03 +08:00
Andreas Eversberg fa832012d0 Add handover and frequency redefiniton message headers
This simply add some TS 04.08 related structures for frequency
redefinition and handover.
2010-09-01 23:37:07 +02:00
Holger Hans Peter Freyther 4aaccd76f2 vty: Make the talloc ctx extern void* to avoid duplicate symbols 2010-08-31 17:09:44 +08:00
Holger Hans Peter Freyther 8f09f01380 vty: Add a new callback to let code decide if it is a config node or not 2010-08-26 15:00:52 +08:00
Harald Welte 5ea4498c28 add header file for osmo_daemonize() 2010-08-25 19:25:37 +02:00
Harald Welte 72d0c536e9 logging: add missing include file changes for last commit (logfile) 2010-08-25 19:24:00 +02:00
Harald Welte 0083cd381c logging: rename tgt_stdout to tgt_file 2010-08-25 18:10:19 +02:00
Harald Welte 1523d7039d Import gsm48_decode_freq_list() from osmocom-bb/layer23
This will enable us to use this function from OpenBSC / ipaccess-config
2010-08-04 11:46:44 +02:00
Holger Hans Peter Freyther 18e6298e88 vty: Forward delcare the logging command. 2010-08-04 06:34:06 +08:00
Harald Welte dee47cd14d add new hexdump_nospc() function 2010-07-30 11:47:50 +02:00
Harald Welte 40481e8954 move hexdump() from logging.c to utils.c 2010-07-30 11:40:32 +02:00
Harald Welte 3eba991b3d Import 'hexparse' function from OpenBSC 2010-07-30 10:37:29 +02:00
Sylvain Munaut 7459d6cfd1 core/msgb: Use the new osmo_panic call to handle errors
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-25 18:09:28 +02:00
Sylvain Munaut ac3e61a7a6 core: Add some generic panic handling
This also includes an option for a minimal 'infinite loop' type
panic that could be required for embedded target that don't have
abort() or fprintf()

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-25 18:08:54 +02:00
Sylvain Munaut 27af075e1e osmocore: Add utility function rsl_chan_nr_str to RSL
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-25 12:27:44 +02:00
Holger Hans Peter Freyther 5e84a86937 msgb: Avoid warnings that the string might contain %s or such.. 2010-07-23 19:22:23 +08:00
Holger Hans Peter Freyther b60a4b3b97 gsm0808: Why should there be a lchan in the parameter... 2010-07-23 18:35:59 +08:00
Holger Hans Peter Freyther 06f795c56f gsm0808: Import unaligned mem access fix from on-waves/bsc-master 2010-07-23 18:20:02 +08:00
Holger Hans Peter Freyther dd02a47234 gsm_utils: Move the gsm_7bit_alphabet into the impl and make it static 2010-07-23 16:36:05 +08:00
Harald Welte 652a72385c msgb: Check for available headroom/tailroom and abort() if we violate it 2010-07-22 21:56:10 +02:00
Holger Hans Peter Freyther 0d60aa2ad7 gsm_04_12.h: Add beginning of structs for SMS CB
I am trying to understand the RSL and GSM 04.12
spec to implement CBS for OpenBSC...
2010-07-21 05:02:33 +08:00
Nico Golde 28de05336b * rewrite GSM 7bit default encoding/decoding based on a lookup table as the previous code produced wrong encodings for certain characters. 2010-07-20 02:48:17 +08:00
Ingo Albrecht 383134b5ac Added crc16 from linux kernel. 2010-07-15 22:43:52 +02:00
Harald Welte 6eb7d6c887 [RSL] split rsl_rll_push_l3() L3 LV pushign and rsl_rll_push_hdr()
This allows us to generate RSLms messages that have some non-standard
IEs between the RSL/RLL common header and the L3 INFO IE.
2010-07-13 13:48:13 +02:00
Andreas Eversberg 014cb8725c Added new IE definitions to gsm_04_08.h of libosmocore.
Also added RR and MM TLV tables to gsm48.c

[import from accidential commit to osmocom-bb.git]
2010-07-12 09:11:00 +02:00
Andreas Eversberg cd2a74bd43 Added single octet TV (type + value) to libosmocore.
In case of a single octet, the upper nibble is the type, the lower nibble
carries the value.

[import from accidentially committed changes to osmocom-bb.git]
diff --git a/src/shared/libosmocore/include/osmocore/tlv.h b/src/shared/libosmocore/include/osmocore/tlv.h
index c733dbc..4cfce87 100644
--- a/src/shared/libosmocore/include/osmocore/tlv.h
+++ b/src/shared/libosmocore/include/osmocore/tlv.h
@@ -212,6 +212,7 @@ enum tlv_type {
 	TLV_TYPE_TLV,
 	TLV_TYPE_TL16V,
 	TLV_TYPE_TvLV,
+	TLV_TYPE_SINGLE_TV
 };

 struct tlv_def {
diff --git a/src/shared/libosmocore/src/tlv_parser.c b/src/shared/libosmocore/src/tlv_parser.c
index 407e57a..bbef7a9 100644
--- a/src/shared/libosmocore/src/tlv_parser.c
+++ b/src/shared/libosmocore/src/tlv_parser.c
@@ -36,6 +36,14 @@ int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val,
 	tag = *buf;
 	*o_tag = tag;

+	/* single octet TV IE */
+	if (def->def[tag & 0xf0].type == TLV_TYPE_SINGLE_TV) {
+		*o_tag = tag & 0xf0;
+		*o_val = buf;
+		*o_len = 1;
+		return 1;
+	}
+
 	/* FIXME: use tables for knwon IEI */
 	switch (def->def[tag].type) {
 	case TLV_TYPE_T:
2010-07-12 08:55:14 +02:00
Harald Welte e335b91ccd GPRS: Add 'input' generator functions for GPRS cipher algorithm 2010-06-30 19:50:14 +02:00
Harald Welte b9ce51c5fd Add support for plugins (and specifically GPRS encryption plugins) 2010-06-30 19:43:11 +02:00
Harald Welte e34a940542 [gsmtap] add new gsmtap_makemsg() function
This generates a gsmtap message without actually enqueueing to a
bsc_select style queue.
2010-06-29 22:31:21 +02:00
Harald Welte e779c364ac Add gsmtap utility functions to libosmocore
This is imported from OsmocomBB/Layer23
2010-06-29 21:57:25 +02:00
Andreas Eversberg 816e24cb42 [RSL] Added special RSL message types for mobile side
- suspension DL
    - resume DL
    - re-establish DL
2010-06-25 02:50:56 +02:00
Andreas Eversberg 93364fc8e0 [gsm48] fix typo in struct gsm48_req_ref 2010-06-25 02:50:06 +02:00
Harald Welte 639f74bdf4 [GSM 04.08] add more RR IEIs 2010-06-15 09:32:14 +02:00
Sylvain Munaut d005eabe16 gsm48: Add authentication response message
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-10 13:30:50 +02:00
Sylvain Munaut 4f585491b9 gsm_utils: Add a fn to test A5(x) support given a classmark2
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-09 13:40:36 +02:00
Holger Hans Peter Freyther dd19527cd2 vty: Mark app info strings as const char*. 2010-06-08 16:12:58 +08:00
Harald Welte 7b4913662a Merge remote branch 'origin/master' 2010-06-01 21:21:20 +02:00
Harald Welte c226317c9c add new new gprs_tmsi2tlli() function 2010-06-01 10:47:07 +02:00
Harald Welte 4c053013c9 [VTY] Remove all application specific VTY node definitions from enum 2010-05-31 16:01:59 +02:00
Harald Welte 544037700c add configure option '--disable-vty' to prevent building libosmovty 2010-05-29 11:49:51 +02:00
Harald Welte 237f6241f2 [VTY] Introduce "struct vty_app_info" for vty_init() function 2010-05-25 23:38:19 +02:00
Harald Welte ab1b819930 make sure we actually install the vty headers 2010-05-25 22:28:40 +02:00
Harald Welte 3fb0b6f26e Create libosmovty as library from OpenBSC VTY functions 2010-05-25 22:28:39 +02:00
Holger Hans Peter Freyther 75bd69bc91 rate_ctr: Make the struct rate_ctr_group_desc members const 2010-05-23 21:14:32 +08:00
Andreas.Eversberg 0ebd688746 Added some "get"-functions to bitvec of libosmocore.
- Getting Low or High value from current postion
- Getting unsigned interger from current postion
2010-05-19 18:14:01 +02:00
Holger Hans Peter Freyther 9a3dec0c01 gsm0808: Add API to wrap a GSM48 msg with a BSSMAP/DTAP msg. 2010-05-16 08:15:40 +08:00
Holger Hans Peter Freyther 5dcef3c8b1 gsm48: Add paging response header 2010-05-15 22:35:25 +08:00
Harald Welte cf734784b0 [rate_ctr] Rename group_prefix_fmt to group_name_prefix 2010-05-13 12:53:35 +02:00
Harald Welte dd178b2dc9 rate_counters: Remove group-name-sprintf-with-idx string 2010-05-13 12:50:44 +02:00
Harald Welte 087fcff9a5 rate_ctr: Store the numeric index as part of 'rate_ctr_group' 2010-05-13 12:16:17 +02:00
Harald Welte 7b45d60887 Add new 'rate counter' implementation to libosmocore
A 'rate counter' is a counter that counts events but also keeps
track of the rate of events (per second, minute, hour and day).

'rate counters' are generally abstracted in 'rate counter groups',
which are instances of a 'rate counter group description'.  This
way we can have e.g. a description describing what kind of counters
a BTS (or TRX) has - and we can then create one instance of that
group for every BTS or TRX that exists.
2010-05-13 11:35:30 +02:00
Harald Welte 7638af95fd logging: add log_vty_{level,category}_string() 2010-05-11 16:39:22 +02:00
Harald Welte 9ac2225ff4 logging: introuduce log_level_str() to obtain the name of a log level 2010-05-11 11:19:40 +02:00
Harald Welte 35a939463e Import gsm48_construct_ra() from openbsc 2010-05-01 14:25:22 +02:00
Harald Welte debf955074 gsm48.h: Prevent accidental re-inclusion of same header file 2010-05-01 12:06:48 +02:00
Harald Welte a1c4f765ec import gsm48_parse_ra() and gprs_tlli_type() from openbsc 2010-05-01 12:00:21 +02:00
Holger Hans Peter Freyther 5ba4dc171b Add missing file. 2010-05-01 15:14:05 +08:00
Harald Welte 074c9f904c msgb: introduce msgb->cb (the control buffer) 2010-04-30 14:29:11 +02:00
Harald Welte bb77c9d6cc msgb: remove smsh, llch, tlli and gmmh
This is a lot of GSM/GPRS specific stuff in struct msgb which we want
to avoid.  The 'control buffer' will replace them.
2010-04-30 14:26:12 +02:00
Harald Welte 3120ac3f78 remove the unneeded bts_link pointer from msgb 2010-04-30 14:19:48 +02:00
Sylvain Munaut a074ec4b89 gsm 08.08: Fix some u_int8_t -> uint8_t
This breaks the ARM build in osmocom-bb. Besides uint??_t seems to
be the preferred type in osmocore. (coming from stdint.h vs sys/types.h)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-04-28 10:05:29 +02:00
Sylvain Munaut 221030fc85 gsm_utils: Just add some constant and timekeeping utils
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-04-27 21:48:40 +02:00
Holger Hans Peter Freyther ba6172a7fd gsm0808: Port asiggnment_complete msg creation to libosmocore. 2010-04-17 06:21:49 +02:00
Holger Hans Peter Freyther 81716d5fa8 gsm0808: Port cipher_complete to be part of libosmocore. 2010-04-17 06:16:35 +02:00
Holger Hans Peter Freyther 280cd5153f Add GSM0808 utilities to Osmocore.
The code is coming from the on-waves/bsc-master branch.
2010-04-15 10:10:39 +02:00
Holger Hans Peter Freyther 2c86c2a726 gsm_08_08.h: Remove OpenBSC include file from the header. 2010-04-15 10:01:39 +02:00
Holger Hans Peter Freyther ebaed74e17 Add GSM08.08 protocol header.
This header is copied from bssap.h of the on-waves/bsc-master
branch and only contains the protocol specific information.
2010-04-15 03:14:51 +02:00
Harald Welte 163d0ea85b remove references to u_int*_t and use uint*_t instead 2010-04-09 07:57:40 +02:00
Andreas Eversberg 1ef041ff1e gsm48: introduce MM_CONNECTION_PEND state 2010-04-09 07:52:12 +02:00
Holger Hans Peter Freyther 4052c811a9 write_queue: Add callback for exceptions as well. 2010-04-08 10:58:20 +02:00
Harald Welte 9bb553ee40 import gsm48_mi_to_string() from OpenBSC 2010-03-28 18:14:50 +08:00
Harald Welte 3ae2758fba rename 'debug' interface to 'logging' interface
It's not really about debugging, but about generic logging...
2010-03-26 21:26:01 +08:00
Harald Welte faadfe2b93 debug: remove unneeded 'number' member of 'struct debug_info_cat'
As the debug subsystem number is used as index into the debug_info_cat
array, there is no need to store the number explicitly inside the
structure again.
2010-03-26 21:26:01 +08:00
Harald Welte 4a2bb9e38b Import 'debug' support from OpenBSC into libosmocore 2010-03-26 21:26:01 +08:00
Holger Hans Peter Freyther 99a263ff20 write_queue: Add a method to clear the queue. 2010-03-26 09:22:38 +01:00
Harald Welte 52b4abdcb3 replace rsl_rlm_cause_strs with rsl_rlm_cause_name() 2010-03-25 12:11:38 +08:00
Harald Welte 9eb6d88d64 replace gsm48_cc_msg_names[] with gsm48_cc_msg_name()
and implement the backend using value_string
2010-03-25 12:00:54 +08:00
Holger Hans Peter Freyther 045cc22bae osmocore: Add a direct l4h to the union of l4h pointers
This is needed for the BSSAP code of the On Waves/BSC master branch
2010-03-22 03:11:10 +01:00
Harald Welte cbc8062ef8 fix compiler warnings (itsme <itsme@xs4all.nl>)
* added several 'const' for strings.
 * added 'extern' to declarations of rsl_rlm_cause_strs
2010-03-22 08:28:44 +08:00
Holger Hans Peter Freyther 6214b92f81 gsm48.h: Make the array extern to a silence a linker warning
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/../../../../i686-pc-linux-gnu/bin/ld:
Warning: size of symbol `rsl_rlm_cause_strs' changed from 8 in ./openbsc/src/libbsc.a(abis_rsl.o)
to 120 in /usr/local/lib/libosmocore.so

spotted and sent to the list by Andreas
2010-03-11 14:42:41 +01:00
Holger Hans Peter Freyther a49951fed7 write_queue: Make the bfd cb public so it can be used in a different context
* I'm doing a nonblocking connect and for this I need to select
  on writable and the first thing I need to do is to check the
  SOL_SOCKET SO_ERROR state. I realize this by setting a different
  cb on the embedded bfd during setup and then go back to the real
  implementation.
2010-03-08 14:32:39 +01:00
Harald Welte 1e9086684f import GSM04.08 encode/decode functions and mncc.h from openbsc 2010-03-07 23:39:54 +01:00
Harald Welte cbb29f7c94 add --disable-talloc option to build without talloc support 2010-03-07 20:24:30 +01:00
Ingo Albrecht 48e17f8951 msgb: Buffer formatting and scanning functions. 2010-03-07 18:03:41 +01:00
Harald Welte 622b718195 import some gsm band/arfcn/time related utilities from OsmocomBB 2010-03-07 17:50:21 +01:00
Harald Welte 63d3e396e7 introduce RxLev statistics module, an efficient way for power scan data 2010-03-06 11:34:27 +01:00
Harald Welte 380ae25052 some more ip.access specific ABIS_NM defines 2010-03-06 11:29:07 +01:00
Harald Welte d9abf01436 mark some occasions of bitvec as 'const' as appropriate 2010-03-06 11:28:49 +01:00
Harald Welte 4e1287938e add GSTMAP ARCFCN flag bits 2010-03-04 15:15:37 +01:00
Harald Welte 8c8caaa1ac update GSMTAP to version 0x02 2010-03-04 15:02:54 +01:00
Harald Welte ecf9dd0d96 add new rsl_dec_chan_nr() function 2010-03-04 14:27:48 +01:00
Harald Welte 61e2bfc5f4 import gsm48 utility functions from OpenBSC
* gsm48_generate_lai() gsm48_generate_mid_from_tmsi() gsm48_generate_mid_from_imsi()
* gsm48_cc_msg_names[]
2010-03-04 10:53:03 +01:00
Harald Welte a73e2f9acb import bcd2char() and char2bcd() from OpenBSC 2010-03-04 10:50:32 +01:00
Harald Welte aebe08c71f import gsm_band_name() and gsm_band_parse() from OpenBSC 2010-03-04 10:39:17 +01:00
Harald Welte eb8bf3915c add 'transparent' argument to rsl_rll_push_l3() and rsl_rll_push_l3()
this is required to make those functions useful for OpenBSC, nut just
OsmocomBB
2010-03-04 10:32:09 +01:00
Harald Welte 4fb20757c6 import some GSM 04.08 utility code from OpenBSC 2010-03-02 23:17:33 +01:00
Harald Welte f08eabf234 add two new RSL utility functions 2010-03-02 21:59:20 +01:00
Harald Welte fdd0a70093 add msgb_l1() and msgb_l1len() inline functions 2010-03-01 22:30:51 +01:00
Harald Welte d284cd9f43 Import value_string utilities and some RSL stuff from OpenBSC 2010-03-01 21:58:31 +01:00
Harald Welte 00096acb8f msgb: add msgb->l1h member 2010-03-01 12:55:47 +01:00
Holger Hans Peter Freyther 8df932a7fd [write_queue] Add a generic write queue class
The write queue can be a dropin replacement for the bsc_fd. It
is featuring two callbacks. One for ready read and one for ready
write. Whenever there is a message in the queue the write_queue
will set the BSC_FD_WRITE flag and then call the write callback.

It will make sure to delete the msgb after the write function
has been called. This class is intended to be be used in the
osmocom, layer2, bsc_msc_ip, bsc_hack and other applications.
2010-02-26 20:30:32 +01:00
Harald Welte ac778fb85d fix msgb_talroom() calculation 2010-02-24 22:54:11 +01:00
Harald Welte 3415d41a8c add msgb and tlv support bits required for openbsc gprs branch 2010-02-21 19:03:41 +01:00
Harald Welte 3cae0398ea add missing automake / autoconf files 2010-02-20 21:09:24 +01:00
Harald Welte 47a0885d78 add missing Makefile.am in include/osmocore/protocol directory 2010-02-20 20:37:26 +01:00
Harald Welte ec8b4501c7 intial checkin of the libosmocore project 2010-02-20 20:34:29 +01:00