Commit Graph

447 Commits

Author SHA1 Message Date
Harald Welte a72e47b8a0 auth_milenage/osmo-auc-gen: compute OPC in case only OP is known 2012-03-21 09:04:14 +01:00
Holger Hans Peter Freyther 58d3153249 misc: Fix warning when compiling telnet_interface.c
In file included from telnet_interface.c:30:0:
osmocom/core/socket.h:25:4: warning: 'struct osmo_fd' declared inside parameter list [enabled by default]
telnet_interface.c: In function 'telnet_init_dynif':
telnet_interface.c:84:4: warning: passing argument 1 of 'osmo_sock_init_ofd' from incompatible pointer type [enabled by default]
osmocom/core/socket.h:24:5: note: expected 'struct osmo_fd *' but argument is of type 'struct osmo_fd *'
2012-03-16 09:18:12 +01:00
Sylvain Munaut a9efc12ccd vty/telnet: Add function to allow binding telnet interface to custom IP/Interface
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-03-01 22:33:20 +01:00
Harald Welte 3e04ed6083 gsmtap: Add GSMTAP_GPRS_CS() / GSMTAP_GPRS_MCS()
As requested by Mike Morrin <Mike.Morrin@ipaccess.com>, we introduce
GSMTAP sub-types for all the different GPRS and EGPRS coding schemes.

This is neccessary due to the fact that the RLC PDU doesn't contain any
explicit indication of the coding scheme used on the radio layer.
2012-02-08 18:13:34 +01:00
Andreas Eversberg 4b332d7d0e libosmocore/gsm: Fixed total size of gsm48_req_ref
"__attribute ((packed))" must be defined for unions, in order to make
sure that the compiler packs unions.
2012-02-07 20:02:17 +01:00
Harald Welte 07b625dd2c GSM 08.08: change gsm0808_create_classmark_update() prototype
The caller explicitly specifies CM2 and CM3, rather than one blob
containing both.
2012-01-26 22:42:16 +01:00
Harald Welte 7d974addc6 gsmtap: make sure we agree with wireshark on GSMTAP channel types 2012-01-26 13:12:03 +01:00
Harald Welte 2c02043f49 TLV/msgb: Return first byte of newly-pushed data from msgb_*_push()
The msgb_*_push() functions erroneously returned the firsrt byte after
newly-pushed information, which makes no sense at all.
2012-01-22 23:10:40 +01:00
Harald Welte 3068d5747a msgb_trim(): actually trim to an absolute length, as the comment states
The previous commit introduced a new msgb_trim() but the implementation
differed from the specification.
2012-01-14 22:08:28 +01:00
Harald Welte b0f91513cd msgb: introduce msgb_trim() and msgb_l3trim() to trim msgb's 2012-01-14 21:54:17 +01:00
Harald Welte aae2362455 auth_core: don't use anonymous unions to make certain gcc versions happy 2011-12-07 11:35:02 +01:00
Harald Welte a5ab1620f4 auth_core: add functions for parsing algorithm names 2011-12-07 02:33:11 +01:00
Harald Welte d82e0eb697 Add a generic abstraction for GSM/3G authentication algorithms
Indiidual algorithms can be implemented as plugins.  libosmogsm itself
only provides COMP128v1 via this generic interface.
2011-12-06 21:53:42 +01:00
Harald Welte 39a287db74 comp128: mark ki and srand as 'const' input parameters 2011-12-06 21:52:09 +01:00
Harald Welte ad633b0919 SMS: export gsm411_bcdify() and gsm411_unbcdify() functions
The same functions are e.g. required by the NITZ code in 04.08, and we
don't want copy+paste.
2011-12-01 21:09:19 +01:00
Sylvain Munaut ae8dbb4d77 core/conv: Add utility methods to know length of coded/decoded vectors
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 17:47:32 +01:00
Sylvain Munaut 297d13f460 core/conv: Add support for other termination types (trunc & tail biting)
Note that this breaks the ABI and the low level API. But it shouldn't
break the high level API, nor the conv code definitions (because fields
default to 0, and for new fields '0' is the previous behavior)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 17:46:58 +01:00
Sylvain Munaut 03d2c8906b core/conv: Minor documentation improvements
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 11:53:49 +01:00
Sylvain Munaut 2735ac4848 gsm/a5: Add documentation
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 21:01:46 +01:00
Sylvain Munaut 3e387cb35c gsm/a5: Add const qualifier on the key
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 19:45:58 +01:00
Sylvain Munaut 4cfbae8152 utils: Add declaration back for osmo_osmo_hexdump_nospc
As it turns out, if a project uses the old name but without a declaration,
it'll causes a segfault on 64 bits platform (because of the implicit
int return type which doesn't apply since here it's a pointer).

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 23:04:00 +01:00
Sylvain Munaut 0d9b8ec9d3 include/gsm_04_11: Fix compatibility issue with GSM411_TMR_TC1A
We need to keep the old one for compatibility !

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:52:20 +01:00
Andreas Eversberg c1a91a896f gsm/sms: Rewrite of SMR process, extracted from OpenBSC
The SMR process is used to transfer SMS TPDUs. It is now extracted from
OpenBSC. It includes a real state machine now for easier debugging.

Also it implements the TR1M and TR2M timers. The memory notification
procedure is missing, but not required for network side.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas Eversberg bbf9034eaa gsm/sms: Rewrite of SMC process, extracted from OpenBSC
The SMC process is used to transfer RP frames. It is now extracted from
OpenBSC. It includes a real state machine now for easier debugging.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas.Eversberg d84f47abb3 gsm/sms: Moved utility functions of SMS processing to new gsm0411_utils.c
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:37 +01:00
Andreas Eversberg c626da9f87 gsm/sms: Added DLSMS debugging
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg f1f80de007 gsm/lapdm: Fix TA and power level handling in the ACCH header
Timing advance and power level indicated by MS (measurement reports)
and BTS (SI 5/6) are now stored for use at ACCH data link connection.

This is part of a set of commit to fix LAPDm to handle datalink
connection on ACCH (SAPI 3)

This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4).

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg 5ac44784b6 gsm/lapdm: Make T200 timer depends on the link type (SACCH is slower)
This is part of a set of commit to fix LAPDm to handle datalink
connection on ACCH (SAPI 3)

This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4).

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg f948dbc442 vty: Fixed vty_down_level to move down from config nodes
When using ^D at config nodes above the CONFIG_NODE, the
go_parent_cb function is used to go down by one node. This
is equivalent to "exit" command.

Written-by: Andreas.Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Andreas.Eversberg dc3be0a653 vty/telnet_interface: Add telnet_exit function
This frees socket and pending connections

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:36 +01:00
Sylvain Munaut 2179f402e0 core/rbtree: add const qualifier to some functions
See kernel commit f4b477c47332367d35686bd2b808c2156b96d7c7

----
The 'rb_first()', 'rb_last()', 'rb_next()' and 'rb_prev()' calls
take a pointer to an RB node or RB root. They do not change the
pointed objects, so add a 'const' qualifier in order to make life
of the users of these functions easier.

Indeed, if I have my own constant pointer &const struct my_type *p,
and I call 'rb_next(&p->rb)', I get a GCC warning:

warning: passing argument 1 of ?~@~Xrb_next?~@~Y discards qualifiers from pointer target type

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
----

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12 23:23:35 +01:00
Sylvain Munaut ff23d24972 utils: Fix a bad double osmo_ prefix for osmo_hexdump_nospc
Hopefully no project where using them it seems

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-10 23:03:18 +01:00
Sylvain Munaut 07f1103782 timer: Add compatibility header with timer helpers
Some of these are not always present, especially when cross compiling

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-21 21:55:29 +02:00
Pablo Neira Ayuso 066c912fd3 timer: add scalable RB-tree based timer infrastructure
This patch adds RB-tree based timers which scales better than the
previous list-based implementation.

It does not require any API changes. It breaks ABI because the
osmo_timer_list structure has changed though (to avoid this in
the future, we can put internal data in some private structure).

The following table summarizes the worst-case computational complexity
of this new implementation versus the previous one:

                                rb-tree         list-based
                                -------         ----------
calculate next timer to expire  O(1)            O(n)
insertion of new timer          O(log n)        O(n)
deletion of timer               O(log n)        O(1)
timer-fired scheduler           O(log n)        O(3n)

The most repeated cases are:

* the calculation of the next timer to expire, that happens in every
  loop of our select function.

* the timer-fired scheduler execution.

This new implementation only loses in the deletion of timer scenario,
this happens because we may need to rebalance the tree after the
removal.

So I think there is some real gain if we have some situation in which
we have to handle lots of timers.
2011-10-17 13:25:29 +02:00
Pablo Neira Ayuso f74db0b33d add rb-tree implementation to libosmocore
This patch adds red black trees implementation to libosmocore.
This data structure is very useful to search for elements in
ordered sets in O(log n) instead of O(n) that lists provide.

The first client of this code will be one follow up patch that
implements rbtree-based timer scheduler.
2011-10-17 13:25:29 +02:00
Harald Welte 226ef1d143 add header file containing UMA/GAN protocol definitions 2011-10-10 09:21:27 +02:00
Andreas Eversberg 78122ab568 Added defines to use primitive/operation tuples in switch/case statements 2011-10-10 08:38:58 +02:00
root af48bed556 Split of LAPDm into a core part and a GSM specific part
Instead of mixing together the GSM layer 1 interface and RSL interface
with the implementation of LAPD, the core function of LAPD is now
extracted from LAPDm. The core implementation is now in lapd_core.c
and lapd_core.h respectively.

The lapd_core.c implements exactly one datalink instance for one SAP.
The surrounding implementation "lapdm.c" codes/decodes the layer 2
headers and handles multiplexing and datalink instances, as well as
translates primitives from/to RSL layer.

lapd_core.c can now be used for other LAPD implementations. (ISDN/ABIS)
2011-10-10 08:38:58 +02:00
root 8a996b4844 Changed logging of LAPD from DLLAPDM to DLLAPD 2011-10-10 08:38:58 +02:00
Sylvain Munaut f84571d0f4 gsmtap: Add type/subtypes for GMR-1 protocol
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-09 16:57:33 +02:00
Harald Welte ccd040f61e GSMTAP: Add comments to explain how to make GSMTAP changes 2011-10-08 14:40:14 +02:00
Harald Welte fae779ac54 GSMTAP: Import changes from Wireshark
There have been some changes in the wireshark source code that have
never been submitted to gsmtap.h

GSMTAP_CHANNEL_PACCH has been defined in an incompatible way in mainline
wirshark :(
2011-10-08 14:40:09 +02:00
Sylvain Munaut 15ae715b0d gsmtap: Add a _ex version of gsmtap_{makemsg,send} to specify content type
From: iZsh <izsh@fail0verflow.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-26 13:05:07 +02:00
Harald Welte aa244bfe63 bring gsmtap.h in sync with recent wireshark additions 2011-09-26 00:24:59 +02:00
Sylvain Munaut 2749c0bfbf core: Add generic CRC functions (templates expended to 8 16 32 64 bits)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-16 22:59:18 +02:00
Alexander Huemer 4d7bcea870 correct declaration of osmo_sitype2rsl 2011-09-05 09:50:47 +02:00
Harald Welte d61d517a2e add missing declarations of cfg_description_cmd to vty/vty.h 2011-09-04 22:56:10 +02:00
Sylvain Munaut fe28dedd4c core/serial: Add utilities to deal with serial ports
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-02 22:21:09 +02:00
Sylvain Munaut bf9d25039c build/include: Only install headers for enabled options
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-02 20:41:42 +02:00
Harald Welte a24026a499 RSL: add rsl_ipac_msg_name() for ipa specific RSL extension names 2011-09-02 12:26:50 +02:00
Christoph Fritz ab7c9c766b logging: include stdarg.h for va_list
fixes tiny compile error:

  CC     socket.lo
  In file included from socket.c:13:
  ../include/osmocom/core/logging.h:31: error: expected declaration
specifiers or ‘...’ before ‘va_list’
  make[3]: *** [socket.lo] Error 1
2011-09-01 17:44:35 +02:00
Harald Welte 712691d8d8 add functions for bit-reversal
Sometimes we need stuff like reversing every bit in each byte (but not
the byte-order).
2011-09-01 14:47:31 +02:00
Harald Welte 36c5a3e285 logging: add osmo_vlogp() as vararg / va_list compatible function 2011-08-31 19:40:03 +02:00
Holger Hans Peter Freyther c2c0ad7832 signal: Fix compiler warning about signedness of constant
Use the u suffix to mark the constant as unsiged integer.

This fixes:
warning: this decimal constant is unsigned only in ISO C90
2011-08-22 15:31:17 +02:00
Harald Welte be145198df doxygen: document some more structure members for RSL 2011-08-18 11:45:18 +02:00
Harald Welte 4e777c300f doxygen: Add documentation for Abis OML 2011-08-17 19:15:24 +02:00
Harald Welte e881b1b9eb doxygen: split VTY configuration in multiple files 2011-08-17 18:52:30 +02:00
Harald Welte 8f2c7e5b2b RSL: add doxygen documentation 2011-08-17 18:52:21 +02:00
Harald Welte 6bdf0b158c doxygen: Add documentation for LAPDm code 2011-08-17 18:22:08 +02:00
Harald Welte 57c7d37059 doxygen: Add documentation about TLV parser 2011-08-17 17:50:55 +02:00
Harald Welte 7acb30c69b doxygen: Add (partial) VTY API documentation 2011-08-17 17:14:12 +02:00
Harald Welte 47379ca95b doxygen: Add documentation for gsmtap_util.[ch] 2011-08-17 17:14:12 +02:00
Harald Welte af8e4352b5 doxygen: Add documentation to signal.[ch] 2011-08-17 17:14:12 +02:00
Harald Welte eee3790d24 doxygen: Add documentation for prim.h 2011-08-17 17:14:12 +02:00
Harald Welte a523d14096 doxygen: document panic.[ch] 2011-08-17 17:14:12 +02:00
Harald Welte 9327c6dc0f doxygen: Add docs for rate_ctr 2011-08-17 17:14:12 +02:00
Harald Welte 2777ecd987 doxygen: Add 'write_queue' module 2011-08-17 17:14:12 +02:00
Harald Welte 8598f1866e doxygen: add doxygen module 'utils' 2011-08-17 17:14:12 +02:00
Harald Welte 18fc465b7f doxygen documentation for logging framework 2011-08-17 17:14:12 +02:00
Harald Welte ba6988bd89 some more doxygen work (include the notion of modules) 2011-08-17 17:14:11 +02:00
Harald Welte bd598e3c5e start to add doxygen documentation to libosmocore headers 2011-08-16 23:26:52 +02:00
Harald Welte 2af435986f fix off-by-one error in OSMO_NUM_DLIB
This bug was introduced in 95f7eb288c and
it caused a segfault on 'write terminal'
2011-07-29 15:12:41 +02:00
Harald Welte 430be84994 add definition of OSMO_MIN macro, similar to OSMO_MAX 2011-07-27 23:28:41 +02:00
Dennis Wehrle 291e61346b sms: SMS where cropped (from VTY), concatenation of SMS where not possible
Additionally it wasn't possible to send concatenated sms from the vty.
To send multiple sms, it is necessary to use padding bits and add a user_data_header.
Therefore the gsm_7bit_encode function was splitted to gsm_7bit_encode and gsm_septets2octets.
gsm_septets2octets: this is the old gsm_7bit_encode function + additional padding parameter

Additionally the gsm_7bit_decode function was modified to take account for the user_data_header.
With the new gsm_get_octet_len function you can get the octet length for a given septet length.

I also added several sms tests.
2011-07-24 20:14:13 +02:00
Holger Hans Peter Freyther c0dbe0be05 vty: Increase the number of arguments one can have in VTY commands
For some interactive commands (e.g. sending a SMS in OpenBSC) we
are using the "NAME." arg definition. For the usecase of sending SMS
it is not enough to only allow about 13 spaces. Increase the limit.

Original patch is coming from Dennis Wehrle.
2011-07-24 19:58:06 +02:00
Harald Welte b7b61236d8 don't call a function argoment 'class' for the benefit of c++ users
This had broken lcr compilation...
2011-07-23 10:50:36 +02:00
Holger Hans Peter Freyther 59b3175dfb ipaccess: Reserve an extensions for an external SMSC connection
This could be used to submit SMS to OpenBSC and to get informed
about new SMS coming from OpenBSC.
2011-07-23 09:59:24 +02:00
Harald Welte 95f7eb288c remove DLRSL and DLNM, we don't need them
They are not used anywhere in our libraries, so they should be defined
by the respective applications
2011-07-21 16:58:44 +02:00
Harald Welte 892e621fec make sure we don't have namespace clashes between libraries and apps
* All loging prefixes in libraries should be DL like DLINP
* All signals / subsystems should be called S_L_* SS_L_*
* All command nodes should be called L_*_NODE

This makes sure existinc code still compiles as expected
2011-07-19 14:31:44 +02:00
Harald Welte c5a0ded53f mkae the new 'void *dst' member part of a union with the trx pointer
this ensures struct msgb is the same size as before, which will ensure
binary compatibility
2011-07-18 17:00:08 +02:00
Pablo Neira Ayuso 2ade3a0222 vty: reserve nodes for libosmo-abis
This patch reserves E1INP_NODE and IPA_NODE for libosmo-abis
VTY interfaces.
2011-07-18 17:00:08 +02:00
Pablo Neira Ayuso 29cbf618e3 msgb: add ->dst attribute to store routing information
This patch adds a new attribute to msgb objects. This new
attribute will store a pointer to the routing information,
in the case of the A-bis link, this will be used to store
e1inp_sign_link instead of struct gsm_bts_trx.

This deprecates msg->trx, that can be removed once all
application are ported to use msg->dst.
2011-07-18 17:00:08 +02:00
Pablo Neira Ayuso 199f37723b logging: add libosmo-abis logging subsystems
This adds the libosmo-abis logging subsystems to libosmocore,
it uses the new change that harald proposed based on negative
numbers for library logging subsystems.
2011-07-18 17:00:08 +02:00
Pablo Neira Ayuso 39c0243d9b signal: reserve signal subsystems >= INT_MAX/2 for libraries
The first range (from 0 to INT_MAX/2) of signal subsystems can be
used by client applications while the second range (from INT_MAX)
is reserved for libraries.

This is useful to support signals defined in libraries that
may be used by different client applications.
2011-07-18 17:00:07 +02:00
Harald Welte e0aa5bb9f7 gsm 04.80: fix typo (256, not 265!)
This was introduced by me in commit
79599ba0eb

Thanks to Alexander Huemer for detecting it
2011-07-16 15:42:46 +02:00
Harald Welte 39b44bbca7 gsm 04.80: ussd_request.text can contain 0xff, needs to be unsigned
Found by Smatch
2011-07-16 13:28:59 +02:00
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