Commit Graph

182 Commits

Author SHA1 Message Date
Vadim Yanitskiy c572682e79 layer23/l1ctl.c: replace printf() calls by LOGP
Change-Id: I863fb668500b2010dfef7a63217255fd010c06d7
2018-09-21 21:19:46 +07:00
Vadim Yanitskiy f5004affc9 layer23/l1ctl.c: drop redundant printf() call
Change-Id: I02bc581afb5a76c51fdef50ed40e2669c3eb3f2e
2018-09-21 21:17:47 +07:00
Vadim Yanitskiy 65f80df492 common/l1ctl.c: fix: use signed type for TA in l1ctl_tx_param_req()
Despite the correct range of Timing Advance value is [0..63],
there is a special feature in OsmocomBB which allows one to
simulate the distance between both MS and a BTS by playing
with the signal delay.

It was discovered that l1ctl_tx_param_req() is using an unsigned
'uint8_t' type for Timing Advance value, while other code and
L1CTL protocol is using signed 'int8_t'. This may result in
distortion of negative values, so let's fix this!

Change-Id: I6ee42b5fa2ca9ebe187f0b933465c49f840a55c2
2018-09-07 09:02:19 +00:00
Harald Welte fcfe20d3e0 layer23: Use osmo_sock_unix_init_ofd() from libosmocore
We don't need to hand-code unix domain socket initialization but
can simply use our library function for it.  As an added benefit,
the library code already contains corner case handling for non-NUL
terminated unix domain socket path.

Change-Id: I57c724c78dbbbce0546ebe914e370f32c8c89703
2018-09-06 16:16:07 +02:00
Harald Welte d4fb4fdea0 layer23: Replace all instances of strncpy() by osmo_strlcpy
This gives us working/safe zero termination without overflowing
the destination string size.

Change-Id: Ica6098ceba2bd01ce3b216085442cc5eed0ca507
2018-08-11 16:10:31 +02:00
Harald Welte 82d8370f62 layer23: fix unaligned store in osmo_send_l1()
This fixes the following alignment issue uncovered by asan:

l1l2_interface.c:169:7: runtime error: store to misaligned address 0x61600001ab99 for type 'uint16_t', which requires 2 byte alignment
0x61600001ab99: note: pointer points here
 00 00 00  00 00 00 06 0a 01 19 19  40 18 00 07 00 01 03 49  06 15 00 40 01 c0 00 00  00 00 00 00 00
              ^

Change-Id: Ie65b428107d35bac99bc870fdbc4dc509ca2f33c
2018-08-11 12:59:30 +00:00
Holger Hans Peter Freyther 812866daab Move from libc random() to osmo_get_rand_id (2nd attempt)
When starting multiple mobile in the same second, the libc random number
generator will be seeded to exactly the same value.

The random bits inside the RACH request(s) will be exactly the same
across multiple mobile and when the channel fails they all pick the same
randomized back-off timing.

Use stronger random numbers and replace all calls to random(2) with
osmo_get_rand_id. Add a fallback to try random().

[v2: Add helper to make sure the result is int and between 0 and
RAND_MAX]

Change-Id: Icdd4be88c62bba1e9d954568e48f0c12a67ac182
2018-07-23 20:55:45 +01:00
Vadim Yanitskiy d49a748cbb common/l1ctl.c move TCH bit-ordering to the firmware
Previously, TCH frames coming from L1 were reordered to the RTP
format. Moreover, the implementation had a few problems:

  - L1CTL is not the best place for such manipulations;
  - payloads with other than FR codec were corrupted.

Let's use RTP-ordered payloads on the L1CTL interface,
performing TCH frame reordering at the firmware.

Please note, that actual FR reordering was moved to the firmware
as is, without any codec determination. This could be fixed in
a separate change.

Change-Id: I81ec8ed3c9e72a62b22c1720c299cdc68b733cf1
2018-03-14 22:22:43 +07:00
Vadim Yanitskiy a4d255269a L1CTL/L1CTL_CRYPTO_REQ: add key length and channel info
Previously, the L1CTL_CRYPTO_REQ message contained only a ciphering
algorithm and actual Kc key to be used. The key length was
calculated manually using the MSGB API.

Let's avoid manual calculations here, as it may cause unexpected
behavior if the message structure is changed. Also, let's fill
the UL header with minimal information about a channel, which
is going to be encrypted.

Change-Id: I5fab079907c5276322d3ec2b46cab81f10c7ed09
2018-03-14 22:22:39 +07:00
Holger Hans Peter Freyther 32dec4236e mobile: Add LUA as debug category to the applications
Change-Id: Id2d266c48d30c06dfdc3b8c84d875038b43f2ad8
2017-12-03 12:58:52 +00:00
Holger Hans Peter Freyther a8726d977a mobile: Begin with a primitive interface on top of the code
We want the script interface to interface through a primitive
interface. This will allow to move it to a different thread or
a process in the future. The script interface will just use the
primitives.

It is not clear how "sap" will be used here. I am keeping it
at 0 right now. The first primitive is starting a timer with a
request and then getting an indication as a response.

Change-Id: Id2456b7fae35546553c4805f12a40c0812d9255c
2017-12-03 12:58:52 +00:00
Holger Hans Peter Freyther 42888ed947 mobile: Switch from printf to LOGP statements
Add a mobile application logging category and replace printf with
a LOGP. The code is sadly still using exit in the middle of handling.

Change-Id: I71e7f6e6375a485b45bad76ada2be17b0901577d
2017-11-27 09:48:39 +00:00
Vadim Yanitskiy d0ed4de085 host/mobile: use osmocom_ms as talloc context
As we use talloc, it's absurdly not to use the main feature of
the library - hierarchical memory management. This change sets
talloc context of all sub-allocated objects to related osmocom_ms
instance. So, as soon as osmocom_ms instance is destroyed, all
sub-allocated chunks are getting destroyed too.

Change-Id: I6e3467ff739f3e6dc8dd60cc6d1fcd3f8e490ce9
2017-11-08 18:46:57 +07:00
Vadim Yanitskiy 064ffe6563 host/mobile: use talloc for ms->name allocation
The approach of talloc memory management reduces memory usage,
and prevents some buffer overflows, which were possible before.

Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
2017-05-25 11:43:49 +00:00
Vadim Yanitskiy 0f39694210 sap_interface.c: drop meaningless condition
If sap_state is equal to SAP_NOT_CONNECTED, it cannot
be equal to another value at the same time. So the
second part of condition doesn't make sense.

Change-Id: I3038fc15745dc4be796d894002524e6b2dd5c90e
2017-05-25 02:11:53 +03:00
Яницкий Ва дим bec943f0b7 host/mobile: Improved SAP interface integration
1) Now the SAP interface is selectable as SIM source using the 'sim sap'
   command in VTY.
2) SAP connection starts only if it is configured as SIM source.
3) Fixed sap_socket_path configuration r/w errors.

Written-by: Яницкий Ва дим <axilirator@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2016-01-18 21:08:45 +01:00
Harald Welte c400827539 autoconf: Migrate from INCLUDES to AM_CPPFLAGS 2015-12-31 14:12:14 +01:00
Sylvain Munaut fc20a37cb3 host/mobile: Finish working support for the SAP interface
Patch mostly written by Nico Golde
and some cleanup/testing by Domonkos Tomcsanyi

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-04-28 15:57:54 +02:00
Igor Almeida e6372a2c24 layer23: initialize l2h/l3h pointers in rx_l1_rach_conf
Signed-off-by: Igor Almeida <igor.contato@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-09-06 23:47:15 +02:00
Andreas Eversberg fdf7d2f8a5 layer23: Send SIM APDUs via GSMTAP, if enabled 2013-01-12 08:59:05 +01:00
Andreas Eversberg 43b368b66d fix: Use only single CCCH block to determine path loss
The downlink singalling failure counter DSC is decremented by 4
in case of unsuccessfull decoding of CCCH block and incremented
by 1 in case of successfull decoding of CCCH block. The initial
and maximum value of 90 requires to check the signal only once
per 51 multiframe.

If DRX would be supported, only a subset of 51 multiframes are
received, so the initial / maximum value of 90 must be reduced
accordingly.
2013-01-08 09:12:15 +01:00
Alex Badea dccf41703a l23 sysinfo: defer SI4 CBCH mobile allocation until SI1 is received
When parsing SI4, there's a check and a log message saying that CBCH
MA is ignored until SI1 is received.  Then the MA is decoded anyway --
incorrectly -- such that it remains incorrect even after receiving
the next SI1.

Fix that with an "else".

Signed-off-by: Alex Badea <vamposdecampos@gmail.com>
Signed-off-by: Andreas Eversberg <jolly@eversberg.eu>
2013-01-02 18:31:30 +01:00
Harald Welte 73a809e57b Tell L1CTL_FBSB_REQ the expected received signal level
As Dieter points out, this drastically improves the resiliance to high
receive levels on the C155.  We cannot blindly assume a received signal
level of -85 dBm if the BTS is 2m away and we actually receive -40 dBm.

This patch extends the L1CTL_FBSB_REQ data structure in layer 1 with the
respective field, as well as the l1ctl_tx_fbsb_req() API function called
from the various layer23 apps.

"mobile" and "bcch_scan" already did a PM request and thus know the
expected signal power.  "ccch_scan" and "cbch_sniff" apparently don't
do, so the -85 dBm constant is now hardcoded into the host-side source
code there, and should probably be fixed in a follow-up patch.
2012-11-20 10:13:44 +01:00
Andreas Eversberg 07f8345646 Fixed decoding of hexadecimal LAI components
libosmocore has changed its LAI decoding from hex to decimal. This caused
wrong decoding of MCC and MNC. In order to provide required hex
transcoding, special hex encoding and decoding function are added to
mobile/sysinfo.c.
2012-10-30 10:26:20 +01:00
Kevin Redon ca05975c8f Fix linking with GNU ld 2.22 and libgps
Error:
gcc -Wall -I/home/kevredon/osmocom-bb/src/shared/libosmocore/include -I/home/kevredon/osmocom-bb/src/shared/libosmocore/include -g -O2 -D_HAVE_GPSD  -lgps -o cell_log main.o app_cell_log.o cell_log.o geo.o ../common/liblayer23.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/.libs/libosmocore.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/gsm/.libs/libosmogsm.a /home/kevredon/osmocom-bb/src/shared/libosmocore/build-host/src/codec/.libs/libosmocodec.a -lm
../common/liblayer23.a(gps.o): In function `osmo_gpsd_cb':
/home/kevredon/osmocom-bb/src/host/layer23/src/common/gps.c:79: undefined reference to `gps_waiting'

Fix:
Holger told me to do so (he knows better then me about autoconf)
- set CFLAGS and LIBS for LIBGPS in layer23
- add libgps CFLAGS and LIBS in Makefile.am for common, misc, mobile
I would have done the following (which also works):
-AC_CHECK_LIB(gps, gps_waiting, CFLAGS+=" -D_HAVE_GPSD" LDFLAGS+=" -lgps",,)
+AC_CHECK_LIB(gps, gps_waiting, CFLAGS+=" -D_HAVE_GPSD" LDFLAGS+=" -lgps" LIBS+=" -lgps",,)
2012-09-17 08:40:44 +02:00
Harald Welte a8ce4ea469 layer23: gsm48_decode_lai() is now in libosmogsm 2012-09-08 22:43:50 +02:00
Andreas Eversberg 24df176826 layer23: Fixed size of power offset (SI 3 rest octets)
This is importaint on certan cells to finish BCCH scanning. If SI2ter
indication is falsely detected, BCCH reading will timeout, because no
expected SI2ter is received.
2012-07-12 15:54:06 +02:00
Sylvain Munaut ce60deff7b host/l1ctl: Make sure to initialize tn in neigh_pm_req
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-03-29 09:21:57 +02:00
Tim 43c588b6c6 l23: Add option for mobile-app to bind to other interfaces than localhost
Signed-off-by: Tim Ehlers <osmocom@ehlers.info>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-03-01 22:45:51 +01:00
Paul Wise 9dd1f00e83 host: Add support for the new gpsd API
Written-by: Paul Wise <pabs3@bonedaddy.net>
Acked-by: Peter Stuge <peter@stuge.se>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-01-17 08:11:07 +01:00
Andreas Eversberg 42004880e6 layer23/mobile: Fixed variable type, so home network is detected correctly 2012-01-02 02:10:54 +01:00
Andreas Eversberg 3426063f56 host/mobile: Adding (partly implemented) supplementary service support
Use VTY to request your extension number form OpenBSC:

en
service 1 *100#

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Andreas Eversberg 928b224539 host/layer23: Flush L1CTL/SAP workqueues when exitting
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:20 +01:00
Andreas Eversberg 4d13b401ae host/layer23: SIM client now supports reading records correctly
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:19 +01:00
Andreas Eversberg 8f77cbecb4 host/layer23: Removed local copy of LAPDm, using libosmocore instad
Since libosmocore already has LAPDm implementation, we don't need the
local copy of LAPDm code anymore.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13 20:25:19 +01:00
Holger Hans Peter Freyther 6d1f116338 misc: u_intX -> uintX in the host directory
Use C99 stdint.h for the inttypes.
2011-11-06 21:55:40 +01:00
Andreas.Eversberg 1a5461fb2b layer23: Add mobile support for sending / receiving voice frame through MNCC
Support GSM FR codec only so far.

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28 21:30:51 +02:00
Sylvain Munaut 98a1051475 l23/l1ctl: Add default values for audio_mode
Theses value should simulate the old behavior

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28 21:30:50 +02:00
Andreas.Eversberg aa4a819d68 layer23: Adapt to new logging API: fix calls to log_init
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28 21:30:50 +02:00
Andreas Eversberg 051dedd235 [layer23] Added special return value for invalid MCC/MNC input
This way an MNC of 000 can be entered.
2011-07-17 12:15:04 +02:00
Andreas Eversberg ff42943fe7 [layer23] Fixes and improvements of system information decoding 2011-07-17 12:12:18 +02:00
Andreas Eversberg 9548ac0a41 [layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.

The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.

There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.

In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:

enable
monitor network 1  (where '1' is the instance of the MS)

In order to see the current state of the processes, enter:

show ms
2011-07-17 11:12:15 +02:00
Andreas Eversberg af06f00219 [layer23] Adding "neighbour cell" logging category: DNB 2011-07-17 10:03:34 +02:00
Andreas Eversberg 87c597abf6 [layer23] Adding neighbour cell measurement to L1CTL interface. 2011-07-17 09:36:49 +02:00
Holger Hans Peter Freyther 58a1b81425 misc: Fix crash in cell_log due missing l1_prim_cb
Commit 3538c38835 introduced the
l1_prim_cb but the init of the misc apps were not updated, make
it us the generic callback that should restore the previous behavior
2011-07-16 09:33:35 +02:00
Harald Welte d6663ad996 lapdm: fix use-after-free
We cannot msgb_free() the msgb and then later reference msg->l2h!
2011-06-27 08:41:32 +02:00
Harald Welte 4a8fb6111b lapdm: properly set the msg->l3h to the contents of the RSL L3_INFO IE 2011-06-25 18:32:08 +02:00
Harald Welte 7506e29c61 lapdm: introduce a new lapdm_phsap_dequeue_prim()
This function can be called by a TDMA-driven L1 which will never actually want
to receive unsolicited/asynchronous PH-DATA.req primitives, but who will simply
directly poll the LAPDm transmit queue by calling the abovementioned function
2011-06-24 22:05:46 +02:00
Harald Welte 50c035c309 lapdm: Don't try to send data using a PH-RACH.req, use PH-DATA.req 2011-06-24 15:57:59 +02:00
Harald Welte 619038bc9d lapdm: some more error reporting in case strange primitives arrive from L1 2011-06-24 15:28:02 +02:00
Harald Welte a9da9b730d L1CTL is sending PH-DATA.ind, not PH-DATA.req up to LAPDm 2011-06-24 15:26:59 +02:00
Harald Welte ec71711ebf introduce LAPDM entity flags for PH-EMPTY_FRAME.req and pollling
polling means that we never try to proactively generate a PH-DATA.req
unless there was a PH-RTS.ind first.
2011-06-24 13:56:48 +02:00
Harald Welte 04190eabd3 lapdm: Introduce LAPDM_MODE_{BTS,MS} to run on both sides
We also introduce some related functions like
	lapdm_{entity,channel}_set_mode()
	lapdm_{entity,channel}_reset()

This is all in preparation for the Osmo-BTS Work.
2011-06-24 12:23:17 +02:00
Harald Welte 68d03b86f4 lapdm: implement RSL CHAN RQD generation from PH-RA.ind 2011-06-24 00:42:01 +02:00
Harald Welte bee8a01b8d lapdm: use msgb_tlv_put instead of manual equivalent 2011-06-24 00:13:17 +02:00
Harald Welte 3008f31074 lapdm: remove dependency to osmocom_data.h 2011-06-24 00:04:37 +02:00
Harald Welte e4ea01041e lapdm: remove get_rsl_name() and use libosmogsm:gsm_rsl_name() instead 2011-06-23 23:57:34 +02:00
Harald Welte 3538c38835 further decouple lapdm code from osmocom_ms and l1ctl
we introduce a new primitive layer betwen PH and DL, enabling the
use of the LAPDm code in applications that are not based on L1CTL
2011-06-23 23:55:20 +02:00
Harald Welte f36e4fe86c remove l1ctl data structure form l2_ph_chan_conf()
This brings us one step closer to de-couple LAPDm from L1CTL
2011-06-22 23:04:20 +02:00
Harald Welte 4d5f74375a remove l1ctl data structure from l2_ph_data_ind() 2011-06-22 23:01:18 +02:00
Harald Welte f47de03fe1 lapdm.c: remove unneeded header file #includes 2011-06-21 19:51:01 +02:00
Harald Welte 7ad100b94e layer23: make LAPDm code mostly independent of 'struct osmocom_ms'
This is one step in the direction of re-using the lapdm code in osmo-bts.
2011-06-21 19:51:01 +02:00
Harald Welte ddb20b8b4e remove osmocom_ms reference from lapdm_init()
... yet another step in making lapdm code independent of osmocom_ms
2011-06-21 19:48:20 +02:00
Harald Welte a2f615e522 remove 'osmocom_ms' from struct lapdm_enetity
and replace it with more general l1_ctx nad l3_ctx.
2011-06-21 19:47:34 +02:00
Andreas.Eversberg 58ac7e0e98 [layer23] Adding Quadband support and GSM 4x0 support
This makes it possible to use GSM 850 and PCS 1900 bands, as used in the
US. The support relies on the phone hardware.

Each band (900, DCS, 850, PCS, 480 and 450) can be enabled and
disabled individually for each setting.
2011-05-29 19:51:54 +02:00
Harald Welte 308f9e506e layer23: update to new GSMTAP API in libosmocore >= 0.3.1 2011-05-22 12:36:55 +02:00
Pablo Neira Ayuso a1d1680245 src: use namespace prefix osmo_* for utils
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-15 17:33:26 +02:00
Pablo Neira Ayuso 0e6cea9b51 src: 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/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-15 17:33:23 +02:00
Pablo Neira Ayuso 404f634406 src: 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-15 14:39:39 +02:00
Pablo Neira Ayuso ffcc29b5fb src: 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-15 14:39:33 +02:00
Pablo Neira Ayuso d3ba2f6037 src: 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-15 14:39:30 +02:00
Nico Golde 9ddeae9d42 [sim] Fixed path handling in sim client and mobile app. 2011-05-02 15:55:36 +02:00
Pablo Neira Ayuso ade79a0083 src: use new libosmogsm and include/osmocom/[gsm|core] path to headers
This patch changes include paths to get osmocom-bb working with
the current libosmocore tree.

Among all these renames, you can notice several tweaks that I
added on purpose, and that require some explanation, they are:

* hexdump() in osmocon.c and osmoload.c has been renamed to avoid
clashing with hexdump() defined in libosmocore.

* gsmmap now depends on libosmogsm. Actually I had to cleanup
Makefile.am because I was experiencing weird linking problems,
probably due to a bug in the autotools. With the change included
in this patch, I got it compiled and linked here correctly.

This patch has been tested with the phone Motorola C123 and the
following images files:

* firmware/board/compal_e88/hello_world.compalram.bin
* firmware/board/compal_e88/layer1.compalram.bin

Using the osmocon, bcch_scan and mobile tools.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-04-26 02:55:30 +02:00
Dario Lombardo aa2f2fdfa1 [PATCH] Added runtime selection of gps device. 2011-03-09 16:27:20 +00:00
Dario Lombardo b7a4d8d912 Added gpsd support. 2011-02-16 15:15:12 +01:00
Dario Lombardo 26ff2ee880 Renamed gps_* functions to osmo_gps_* functions to avoid overlap with libgps functions. 2011-02-16 15:15:07 +01:00
Andreas.Eversberg 837710c285 [l1ctl] Adding missing msgb_free()
When a corrupt frame cannot be delivered, it is dropped. Also it must be freed.
2011-01-27 16:33:04 +00:00
Holger Hans Peter Freyther 661d9a33e1 logging: Move DRSL, DLAPDM, DL1C to LOGL_NOTICE as default
All these layers are mostly stable, increase the default log
level to LOGL_NOTICE.
2011-01-23 14:29:44 +01:00
Holger Hans Peter Freyther ace267cfc2 layer23: Enable combining the long options
Combine the long options from the base and the application. Provide
the long option for the cell log application.
2010-12-27 19:01:37 +01:00
Holger Hans Peter Freyther 63c0e6d199 layer23: Make the logfile configurable with cell_log
Be able to add extra (short) options from the 'applet' to
the main application. Use this to print the help mentioning
app specific options, pass the getopt string and handle the
command line parsing for it.

Change cell_log to keep the logname in the app_cell_log.c
and then access it from the cell_log.c implementation.
2010-12-27 19:01:37 +01:00
Holger Hans Peter Freyther 738f9d892a layer23: Not every application supports every option add enum
Allow each application to specify the options it is supporting.
2010-12-27 19:01:37 +01:00
Holger Hans Peter Freyther 2934d0a4f4 layer23: Create an l23_app_info for various information and cb's
Make it possible that each l23 app can inject the copyright string,
also prepare to have callbacks for the config handling and other
places. This will be useful to add app specific config options.
2010-12-27 19:01:37 +01:00
Harald Welte deee3d3f69 update list of networks with information from ITU
http://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.212B-2010-PDF-E.pdf
2010-12-19 00:25:46 +01:00
David Wilson 80600c5a08 layer23: use correct sizeof(sockaddr) for connecting to L1CTL socket
connect's addrlen should be sizeof(local), not the contained path's length.

With the previous code, on OS X connect() will fail with ENOENT.

This permits layer23 to work on OS X using the pl2303 driver,
/dev/tty.usbserial , MacPorts arm-elf-gcc and RANLIB=arm-elf-ranlib

Signed-off-by: Harald Welte <laforge@gnumonks.org>
2010-12-11 11:31:57 +08:00
Alex Badea 30f17f5dd7 layer23 sysinfo: fix parsing of CBCH Mobile Allocation
When calling gsm48_decode_mobile_alloc(), read the length
byte from payload data[], rather than from si->data[].
2010-11-21 23:33:27 +01:00
Alex Badea ec7349f28b layer23 sysinfo: store chan_nr when decoding CBCH Channel Description 2010-11-21 23:33:27 +01:00
Andreas.Eversberg 2d8b427ef8 [layer23] Prevent layer23 apps from abort, if socket to layer1 fails 2010-11-14 11:50:14 +00:00
Andreas.Eversberg 6f2b172780 [layer23] Added support for multiple MS instances
To create another instance: 'ms <name> create'

To remove an instance: 'no ms <name>'

If no instance exists, 'ms 1' is created automatically on startup.

Each instance can be enabled / disabled by using 'shutdown' or
'no shutdown'. Multiple instances may share the same layer2 socket (same
phone hardware), but in this case only one instance can be enabled at the
same time. This makes it much easier to select different settings without
modifying them.

A 'shutdown' initiates the IMSI detach procedure before shutdown is
completed. A 'shutdown force' will immidiately shutdown.

There is no need to restart the software anymore, if fundamental settings
are changed. In this case, a 'shutdown' followed by a 'no shutdown' will
do the job.

If you already have an old osmocom.cfg, you need to "no shutdown" it.
Everything else behaves as before.
2010-11-13 18:45:09 +00:00
Andreas.Eversberg 4df881932c [layer23] msgb_free() must in l1ctl.c must called after reading its header 2010-11-13 18:23:57 +00:00
Andreas.Eversberg a0246e07ff layer23: Use the new rach_req format in l1ctl and update l23 apps to use it
This removes an old hack

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-30 17:32:09 +02:00
Andreas.Eversberg 794c85387c [layer23] Fixed T3 value in RACH confirm message 2010-10-30 08:53:22 +00:00
Andreas.Eversberg 42f0e39d4e [layer23] Fix of LAPDm when handling "timer recovery state"
Sylvain found out that the state was not cleared when receiving an RR
response with F-bit == 1. The missing handling is now added and tested.

Furthermore there is a minor fix to prevent underflow when resending last
frame in "timer recovery state".
2010-10-25 20:33:39 +00:00
Andreas.Eversberg a5445fe8a3 [layer23] Reverted commit ece1463...
The timer recovery state is cleared already,if  a supervisory frame
response is received with "F bit set to 1".
2010-10-24 22:31:06 +00:00
Andreas.Eversberg 4d211a27b8 [layer23] Moving sysinfo.c and gps.c (.h) to liblayer23
This makes sense, since multiple applications use it.
2010-10-24 13:30:17 +00:00
Andreas.Eversberg c0500693a6 [layer23] Added debugging for GPS at logging.c 2010-10-24 12:23:05 +00:00
Sylvain Munaut ece1463f6f layer23/lapdm: Properly handle S frame with F=1 when in timer recovery
This is the signal to exit recovery mode !
See GSM 04.06 Section 5.5.7

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-24 12:14:47 +00:00
Andreas.Eversberg 6a1ab2dab5 [layer23] Reconnect of layer 2 link must be performed in idle mode also 2010-10-12 11:19:06 +00:00
Andreas.Eversberg 2a5e0f3cb7 [layer23] Fixed resume of datalink (after assignment or handover)
In order to resume correctly, the first message (ASSIGNMENT COMPLETE or
HANDOVER COMPLETE) must be sent after the link is resumed. Therefore it
must be given with the resume command. Unacknowledged messages are
transmitted afterwards, if any.
2010-10-12 09:03:34 +00:00
Andreas.Eversberg 4e9656c819 [layer23] Adding some debugging output 2010-10-12 08:44:18 +00:00
Andreas.Eversberg 6d4915b91b [layer23] Implementation of signal loss criteria as defined in TS 05.08
There are two criterions for lossing a signal, idle mode and dedicated mode.
A counter counts down when a frame is dropped, and counts up when a valid
frame is received on  certain channel. The loss criterion is reached, if the
counter reaches 0. The values added to / removed from the counter and the
limits depend on the process.
2010-10-12 08:26:48 +00:00