Commit Graph

153 Commits

Author SHA1 Message Date
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 53b2096555 Merge branch 'master' of git.osmocom.org:libosmocore 2011-03-03 00:27:15 +01:00
Harald Welte de79cee5a6 LOGGING: Use host.app_info->name instead of FIXME
This should put a useful syslog identity in place.
2011-02-24 23:47:57 +01:00
Harald Welte 7c3b8fb441 rxlev_stat: Fix compiler warning 2011-02-19 16:35:47 +01:00
Harald Welte 49cc32b0a3 vty: Revert Makefile.am change for libosmocore dependency 2011-02-19 16:10:51 +09:00
Harald Welte a62648b0b0 LOGGING: remove duplicated code between vty-logging and cfg-logging 2011-02-18 21:03:27 +01:00
Harald Welte 6b431033b3 LOGGING: Add missing 'nat' subsystem 2011-02-18 20:39:36 +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
Holger Hans Peter Freyther 76681bafa8 write_queue: Only pop the queue if it is not empty
It is possible that the queue is cleared after the select
and before the callback for writable is called. Check if
the list is not empty brefore taking an item out of it.
2011-02-15 01:01:44 +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 549fbb8232 logging: Add isup,m2ua,pcap from the cellmgr.
This is something that we should generate dynamically from
the log_info as well. This is adding bits from the cellmgr_ng.
2011-01-22 23:21:26 +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
Sylvain Munaut 4a4f96d1f6 vty: Fix typo testing return value of bind
Thanks to playya__ (Dr. Fred) on IRC for pointing this out

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-01-03 22:19:40 +01:00
Harald Welte df327f6d81 Use the app_info->name instead of the hostname
This makes more sense in case you run BCS, SGSN and other components
on the same host.  Having multiple telnet sessions with the same
prompt can otherwise be confusing.
2010-12-24 15:10:14 +01:00
Holger Hans Peter Freyther 4f4b0101c4 rate_ctr: No need to include the inttypes.h
There should not be any u_int*_t types in this file, no need
to include this file. It is breaking compilation with the last
x86 build of GNU ARM for GCC 3.4.
2010-12-20 13:38:22 +01:00
Holger Hans Peter Freyther 121f358de0 utils: Fix typo. It is ascii. 2010-11-19 19:21:42 +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
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
Harald Welte 9d92f0e12c select.c: Change license terms from GPLv2 (from ulogd) to GPLv2+ 2010-10-31 13:56:45 +01:00
Holger Hans Peter Freyther aeebe39bd1 gsm0808: Fix the format of the clear IE...
This is really TLV...
2010-10-27 12:36:05 +02: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
Holger Hans Peter Freyther 131bc80b96 msgfile: Allow to have comments in the simple CSV file 2010-10-26 09:32:35 +02:00
Andreas.Eversberg dc0ebdfbdf bitvec: Fix decoding of H / L values
it returns if a given bit in the vector is "high" or "low".
the bitval that represents "high" depends on the bit position.
bitval2mask returns that. so we must check if the bit in the vector
equals the returned bitval.
2010-10-24 11:59:33 +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 8c6332649b ussd: gsm_7bit_decode will null terminate the string 2010-10-11 09:28:23 +02:00
Holger Hans Peter Freyther d65a6985bf ussd: Make sure that we at least have 8 bytes when decoding the string
The actual gsm_7bit_decode can still cause a buffer overrun
but at least we are safe until this point.
2010-10-11 09:26:20 +02:00
Holger Hans Peter Freyther 7d0bce3dfb ussd: Add size checks to the parse_ss_invoke calls
Make sure that the mandatory and optional part fits.
2010-10-11 09:26:19 +02:00
Holger Hans Peter Freyther 4156ec6dd1 ussd: Make sure the component fits.
Use a while() {} to check offset +2 <= length on the first
iteration of the loop. Once we have the component length
check that it is going to fit into the given length.
2010-10-11 09:26:19 +02:00
Holger Hans Peter Freyther 49ad500ac6 ussd: Work with uint16_t for the length
Work with uint16_t for the length all the way.
2010-10-11 09:26:19 +02:00
Holger Hans Peter Freyther 8ac0486c28 ussd: Check the structure of the IE.
This is fixing the current crashes. Next we will need to
manipulate the content...
2010-10-11 09:26:19 +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 47ee693170 gsm48: Fix gsm48_encode_called - Set no extension bit
The highest bit must be set as "No extension byte" marker,
so that the next byte is considered to be the BCD number
and not some more control stuff

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-20 20:59:23 +02:00
Holger Hans Peter Freyther a55caad039 gsm0808: Fix the TLV definition of CIC and Service Handover
The nat code stumbled over the CIC bug as it was detecting
timeslot 0x1 as a new CIC and we were patching the data outside
the actual packet... The TLV parser needs some better size
checking too.
2010-09-20 01:25:54 +08:00
Sylvain Munaut af5ee34c35 Make sure we don't user std{err,in,out} if they don't exist.
This is required for target build in libosmocore

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-17 14:38:17 +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
Holger Hans Peter Freyther 2e228fc2af vty: Use the copyright string from the app_info. 2010-09-11 13:41:41 +08:00