Compare commits

...

848 Commits

Author SHA1 Message Date
Harald Welte
b7849987e5 properly reset the MO state of all MO on Abis disconnect
When we loose the A-bis link, we should properly re-set the
administrative, operational and availability state of all MOs
2011-06-29 16:49:03 +02:00
Harald Welte
c7921c9205 add lchan->meas for BTS side code
TODO: move all of the BTS side per-lchan data behind a 'void *role'
pointer like 'struct gsm_bts'
2011-06-29 10:39:27 +02:00
Harald Welte
e86b3ebf2e Revert "HACK: disable NM_ATTR for CELL GLOBAL ID for sysmo-bts"
This reverts commit 8b65ab9d91, which
should never have been committed to master.  In fact, it is not even
needed anymore with recent osmo-bts code.
2011-06-27 21:15:59 +02:00
Harald Welte
23cf666359 update debug_test with logging system changes
Thanks to Konrad Meier
2011-06-27 14:23:40 +02:00
Harald Welte
e31816c83b make channel_test build again 2011-06-26 14:55:06 +02:00
Harald Welte
c90499bb28 move gsm0502_calc_paging_group() to libosmocore 2011-06-26 14:54:55 +02:00
Harald Welte
1cf43ece12 generalize function for calculation of the paging group 2011-06-26 14:43:46 +02:00
Harald Welte
bc82f92a8d move gsm 05.02 related calculations into libosmocore 2011-06-26 14:41:58 +02:00
Harald Welte
457a081379 use new gsm48_number_of_paging_subchannels from libosmocore 2011-06-26 14:21:43 +02:00
Harald Welte
2c1ae479ab system information related bits for osmo-bts 2011-06-26 14:13:37 +02:00
Harald Welte
1a07e21eaf osmo-bsc: bring in sync with recent NM MO changes 2011-06-25 21:10:23 +02:00
Harald Welte
f6093a4d0e move {ts,lchan}2chan_nr() functions to gsm_data_shared.c
... this way osmo-bts can use them
2011-06-25 10:02:33 +02:00
Harald Welte
8b65ab9d91 HACK: disable NM_ATTR for CELL GLOBAL ID for sysmo-bts
Do not commit this to master.  It disables a non-standard IE in the BTS
attributes.
2011-06-09 11:03:49 +02:00
Harald Welte
d134cc7d9d add back-pointer for l1 as part of BTS role. 2011-06-07 00:12:53 +02:00
Harald Welte
df680288a9 initialize NM state for all objects to known state 2011-06-07 00:12:34 +02:00
Harald Welte
850dc6bbfa gsm_data_shared: make sure to initialzie the MO obj_class/obj_inst 2011-06-06 20:31:15 +02:00
Harald Welte
32bc11698a add mo->bts member so we can discover which BTS a MO belong sto 2011-06-06 18:58:48 +02:00
Harald Welte
978714d752 move objclass2{nmstate,mo,}obj() to gsm_data_shared.c (and prefix) 2011-06-06 18:31:20 +02:00
Harald Welte
28307643d7 gsm_data: don't free a bts that's not even allocated yet 2011-06-06 17:52:56 +02:00
Harald Welte
5ac0179f47 make sure to include gsm_data.h, not gsm_data_shared.h 2011-06-06 17:52:38 +02:00
Harald Welte
3300c01e82 split gsm_data.c in gsm_data_shared.c and gsm_data.c
This facilitates the use of gsm_data.c from osmo-bts
2011-06-05 13:31:33 +02:00
Harald Welte
472e7e937c abis_nm.h: Use osmocom/core/abis_nm.h 2011-06-05 11:24:08 +02:00
Harald Welte
135a648ad7 Introduce per-ts TSC
This allows us to configure a TSC for each timeslot, not just one globally for
the entire BTS.
2011-06-03 14:03:27 +02:00
Harald Welte
d64c0bca17 gsm_data_shared: introduce 'struct gsm_abis_mo'
... as a common wrapper around nm_attr and nm_state
2011-06-03 14:03:27 +02:00
Harald Welte
6be350c045 split gsm_data.h in gsm_data_shared.h and gsm_data.h
gsm_data.h is the part that contains BSC-specific data, whereas
gsm_data_shared.h is now shareda with osmo-bts
2011-06-03 14:03:27 +02:00
Harald Welte
b96be39d47 gsm_data: Use osmocom/gsm/sysinfo.h
and include rest_octets.h only in case of BSC
2011-06-03 14:03:27 +02:00
Harald Welte
bb6034e2d8 add HSL femtocell openbsc.cfg example 2011-06-03 14:02:56 +02:00
Holger Hans Peter Freyther
9bdf5a9ef7 mgcp: Fix a typo in the function name 2011-06-02 19:04:22 +02:00
Holger Hans Peter Freyther
e36b487958 nat: Add VTY code to configure the SMSC rewriting 2011-06-01 20:47:01 +02:00
Holger Hans Peter Freyther
acc4031cf5 nat: Look into the TPDU/SMS-SUBMIT and use the TP-DestAddress for matches
Match the used SMSC and the destination of the SMS and change
the SMSC address if both are matched.
2011-06-01 20:45:12 +02:00
Holger Hans Peter Freyther
9c20571280 nat: Patch the destination SMS address of a message
Use the same filtering infrasturcture to patch the SMSC
address in a CP-DATA/RP-DATA message. Add a very simple
testcase for this code.
2011-06-01 20:45:03 +02:00
Holger Hans Peter Freyther
2e2ff34021 nat: Move the common new message generation code into the base method 2011-06-01 20:41:46 +02:00
Holger Hans Peter Freyther
df8e6e9e4a nat: Prepare to patch more than the CC Setup message
Refactor the code to allow having different handlers. The goal
is to be able to patch some SMS messages too.
2011-06-01 20:41:30 +02:00
Holger Hans Peter Freyther
ad75eababc nat: Allow to have a regexp to match the MSISDN
The idea that MCC and MNC is enough to classify a subscriber
turns out to be wrong. Certain operatos license a number range
of IMSIs to others. When we see a '^' in the MCC field we treat
it as a regexp. The code now turns the MCC/MNC into a regexp
for the IMSI. It is not using extended POSIX regexp to match
the behavior of the access list.
2011-06-01 20:40:35 +02:00
Holger Hans Peter Freyther
384ef09920 nat: Add a test utility for the number rewriting 2011-05-31 00:37:48 +02:00
Holger Hans Peter Freyther
1d54c40dd6 nat: Allow to rewrite any non international number
Remove the arteficial limitation of the number format
of an unknown number.
2011-05-31 00:37:48 +02:00
Holger Hans Peter Freyther
20102b0c82 nat: Refactor the number patching code into a new method
Separate the code to patch the code and the code to find a
new number based on the old number. This will allow to add
multiple targets for number changing.
2011-05-31 00:37:47 +02:00
Holger Hans Peter Freyther
f2c1f25612 abis: Get the structs and values from libosmocore
Remove the forward declarations for functions and structs
that have been moved to libosmocore.
2011-05-31 00:37:47 +02:00
Holger Hans Peter Freyther
4e318f5938 misc: Provide a uninstall-hook to remove the extra files
Fix make distcheck to uninstall files that were installed
by our custom hook.

This is fixing:
ERROR: files left after uninstall:
./share/doc/openbsc/examples/osmo-bsc_mgcp/mgcp.cfg
./share/doc/openbsc/examples/osmo-nitb/nanobts/openbsc.cfg
./share/doc/openbsc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg
./share/doc/openbsc/examples/osmo-nitb/bs11/openbsc-1bts-2trx.cfg
./share/doc/openbsc/examples/osmo-nitb/bs11/openbsc.cfg
./share/doc/openbsc/examples/osmo-nitb/bs11/openbsc-1bts-2trx-hopping.cfg
./share/doc/openbsc/examples/osmo-nitb/bs11/openbsc-2bts-2trx.cfg
./share/doc/openbsc/examples/osmo-nitb/rbs2308/openbsc.cfg
2011-05-31 00:37:47 +02:00
Harald Welte
4e4fa4ce9b move some more abis_nm related code into libosmocore
This syncs openbsc.git with libosmocore.git commit rev
11c7193ad8ceb4f3898799dc44b700b8b93a59b8
2011-05-24 17:24:44 +02:00
Alexander Huemer
792edebb4f libabis: fix segfault on malformed ipaccess RSL link
This patch fixes a segfault that occured when a ipaccess RSL link gets
closed unexpectedly.
The segfault can be provoked by connecting to the RSL port with ncat and
hitting ^C.
2011-05-24 17:21:32 +02:00
Alexander Huemer
9e26773167 openbsc: update .gitignore 2011-05-24 17:21:32 +02:00
Alexander Huemer
2b245c4f2b openbsc: rename configure.in -> configure.ac
rename autoconf input file to align with osmocom-bb host applications,
and because that suffix is preferred nowadays.
2011-05-24 17:21:32 +02:00
Alexander Huemer
db1bd6998b openbsc: add missing AC_LANG_SOURCE for current autoconf
autoconf >=2.68 demands the body of an AC_COMPILE_IFELSE to be wrapped in
an AC_LANG_SOURCE macro, otherwise outputs annoying warnings on the
invocation of `autoreconf -i`. this patch follows that demand.
2011-05-24 17:21:32 +02:00
Harald Welte
80cffaf323 Move system information related defines and code to libosmocore
This brings openbsc in sync with the following libosmocore commit:
b5503136fa234690d5493b19a8aee3a4ef74190d
2011-05-24 15:02:20 +02:00
Harald Welte
f142c97907 prepare gsm_data.h header file sharing with osmo-bts
This should not introduce any functional changes, it just re-arranges
some definitions in the header file, and introduces the ROLE_BSC
define that we enable for the BSC-specific fields.
2011-05-24 13:25:38 +02:00
Harald Welte
cdc59ff5cc abis_nm: Some more fall-out from the abis_nm move to libosmocore
we want get_string_value(), not the equivalent of get_value_string()
2011-05-23 20:42:26 +02:00
Harald Welte
867d9f3985 abis_nm: fix some fallout regarding abis_nm migration to libosmocore
Thanks to Holger for noticing this.
2011-05-23 20:30:39 +02:00
Harald Welte
15c6172a8d abis_nm: Move lots of generic definitions + code to libosmocore 2011-05-22 22:45:37 +02:00
Harald Welte
a85515bea5 use new libosmogsm ip.access protocol header file 2011-05-22 21:57:36 +02:00
Pablo Neira Ayuso
0d2881ad58 bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.

This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.

I added two new attributes to the gsm_bts object, they are:

* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.

* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().

Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.

While I was at it, I added several changes/cleanups to this patch:

* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.

* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.

* Add missing e1inp_init() in osmo-bsc.

* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-22 21:03:35 +02:00
Pablo Neira Ayuso
c68f754b3b abis: add init function for emulated ipaccess/HSL emulated E1 input
This patch is a cleanup. It adds an init function for the ipaccess
and HSL emulated E1 input drivers.
2011-05-22 21:02:47 +02:00
Pablo Neira Ayuso
6e52b88a17 bsc: fix bail out in case of problems bootstrapping BTS or E1 input
The error message was missing in case of problems bootstrapping the BTS.
The E1 input driver initialization was displayed in the standard output,
now this error is reported via logs.
2011-05-22 21:02:04 +02:00
Pablo Neira Ayuso
d2a7878b35 abis: skip e1_input nesting if empty
With this patch, we don't include e1_input if it's empty

[...]
    timeslot 7
     phys_chan_config TCH/F
     hopping enabled 0
e1_input <----------------- empty, it should not show up.
msc
[...]
2011-05-22 21:01:42 +02:00
Holger Hans Peter Freyther
1e9ae4be66 ipaccess: Fix the case of specifying the interface
Pablo pointed out that my previous commit was rubish. If we have
less than two arguments we want ifname to remain NULL and if we
have a second argument (or more) we want to use that as the interface
name to bind to.
2011-05-17 20:34:53 +02:00
Holger Hans Peter Freyther
c0370e4399 nat: Use 'paging group' because we have paging forbidden.
Make paging-group deprecated and introduce the new paging group.
2011-05-17 19:28:07 +02:00
Holger Hans Peter Freyther
d3080be131 ipaccess-find: Work without providing an interface name
This will use the default route of the operating system, e.g.
be able to use ipaccess-find without special permission.
2011-05-14 19:46:05 +02:00
Holger Hans Peter Freyther
67cd75f9fa misc: Use the osmo_init code for signals and logging
Use the libosmocore code to ignore certain signals by
default (e.g. SIGHUP, SIGPIPE) and use the new code to
create a default stderr logging target and initialize
it properly.
2011-05-12 16:11:14 +02:00
Harald Welte
99beb96fc0 debian: update Changelog 2011-05-11 22:31:49 +02:00
Harald Welte
ebf8b0a291 debian: examples can now be installed with a single line in .examples 2011-05-11 22:31:19 +02:00
Harald Welte
0e1620ff4a debian: bsc_nat is now called osmo-bsc_nat 2011-05-11 22:30:43 +02:00
Harald Welte
5d41b90e60 add examples for osmocom-bsc 2011-05-11 22:30:30 +02:00
Harald Welte
52defe9506 osmocom-nitb.init: remove reference to old bsc_hack 2011-05-11 22:30:08 +02:00
Harald Welte
eb113137c8 examples: automatically copy all examples in dist and install it to docdir 2011-05-11 22:14:59 +02:00
Harald Welte
88b6a1fa80 move config file examples to doc/examples/ 2011-05-11 20:48:29 +02:00
Harald Welte
66f27ed0cb add git-version-gen script to EXTRA_DIST 2011-05-11 20:37:18 +02:00
Holger Hans Peter Freyther
9cbdf1138f gprs: Add a lua script to collect buffers on the downlink.
This can be used to throw the data into GNUplot. It collects
the time (from the start of the trace), the buffer data in kbyte
and the number of buffered PDUs. It is assuming that no PDU
is delivered toward the target.
2011-05-10 18:45:35 +02:00
Harald Welte
ef466d4f06 configure.in: Require libosmocore >= 0.3.0 for namespace changes 2011-05-08 09:41:45 +02:00
Pablo Neira Ayuso
ab46cf38d4 src: rename msg_entr* to osmo_config_*
Summary of changes:

s/msg_entry_parse/osmo_config_list_parse/g
s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
2011-05-07 13:15:11 +02:00
Pablo Neira Ayuso
c0d17f2266 src: use namespace prefix osmo_* for misc 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-07 12:58:59 +02:00
Pablo Neira Ayuso
dfb342c19a src: 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
2011-05-06 12:14:16 +02:00
Pablo Neira Ayuso
e1273b1f3c 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-06 12:12:49 +02:00
Pablo Neira Ayuso
bbc5b99a6b 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-06 12:12:31 +02:00
Pablo Neira Ayuso
4db9299286 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-06 12:11:23 +02:00
Pablo Neira Ayuso
bf540cb7c3 src: use namespace prefix osmo_timer* for timer functions
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-06 12:11:06 +02:00
Holger Hans Peter Freyther
286ba0e68f bsc: Provide a show statistics command 2011-05-04 11:34:44 +02:00
Holger Hans Peter Freyther
0dc36f1e3a nat: Keep track of the error message. 2011-05-04 11:34:44 +02:00
Pablo Neira Ayuso
ef1e587008 msc: bail out if subscriber VTY command fails
This patch adds several messages that would be displayed if:

* the Ki argument is missing.
* you pass an invalid Ki.
* the database fails to perform the operation (add/delete/update).

Before this patch, no messages were spotted on this errors.

I noticed this while adding Ki to the existing subscribers in the
nanoBTS setup: I introduced a wrong Ki but the VTY command line did
not report any error. A quick look at the database via sqlite
command confirmed that the new authkey information was not added.
2011-05-04 11:03:55 +02:00
Holger Hans Peter Freyther
6860c44071 nat: Create a Paging Group that BSCs can refer to
Introduce a paging group that a BSC can refer to and is used
during the LAC lookup. This way paging can be flooded through
the network and just filtered at the last element in the core.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther
474698abef nat: Introduce the concept of a paging group and use it
A paging group is a list of LACs, different BSCs can point
to a paging group and use it for the LAC lookup.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther
1ffe98c175 nat: Rewrite the paging handling.
The current code tries to find _one_ bsc for a paging message
and then continues. The new code will try to find multiple BSCs
for each LAC. This is done in preparation of having two BSCs
handle the same LAC. This code right now is O(m*n) but it will
be worse once paging groups are landed.
The code to test the function was reduced to just test the lac
lookup code as the other part can not be tested in a standalone
setup anymore.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther
66e14cdda6 paging: Provide the number of pending requests
Address the FIXME and take code from the on-waves/bsc-master
branch. This will count the number of requests.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther
5a081bbb1d paging: Initialize structs internally to avoid a crash
The code to create the struct gsm_bts is in libcommon right now
and we can not call paging_init from there. Right now it appears
to be the easiest of doing the init internally.
2011-05-02 19:19:15 +02:00
Holger Hans Peter Freyther
e188010512 bsc: Allow to have a list of MSCs/MUXs to connect to
Be able to configure a list of destinations (duplicates allowed)
that will be tried in a round robin fashion. The change is in
the bsc_msc_connection to operate on a list. We achieve the
round robin nature with the same trick used in the paging code
to delete and append the current entry. The nat code was updated
to compile but one can only configure one destination.
2011-04-26 09:36:19 +02:00
Holger Hans Peter Freyther
2a9eeaa588 bsc: Allow the NAT to query the list of LACs
Right now the code assumes that any request coming
from the NAT is a query and the code responds to with
a list of configured LACs.
2011-04-26 09:35:31 +02:00
Holger Hans Peter Freyther
a78b6026c9 bsc: Handle MGCP coming from Osmo Extensions header
Start using the new Osmo Extension header and forward MGCP
to the MGCP GW.
2011-04-26 09:33:47 +02:00
Daniel Willmann
163f612326 bsc: Point back from struct osmo_msc_data to struct gsm_network 2011-04-26 09:33:47 +02:00
Holger Hans Peter Freyther
de2b860dff nat: Introduce a block on the NAT to slowly get rid of BSCs
For restarting the NAT we can now block it, it will not accept
new connections and for existing connections it will attempt
to drop them over time. A blocked NAT will end up with no BSC
connections left and then can be safely restarted.
2011-04-26 09:33:47 +02:00
Holger Hans Peter Freyther
c3f28320c2 ipa: Reserve two new values for the Osmo IPA extensions
We want to send MGCP through the Osmo Extension and also
want to send the list of local LACs to it.
2011-04-26 09:33:47 +02:00
Holger Hans Peter Freyther
5deb6c3c5f abis: Use LOGL_ERROR for the Failure Event Report
It is not an error of the BSC but we will treat a
BTS error like an error of the BSC for now.
2011-04-26 09:33:47 +02:00
Holger Hans Peter Freyther
0b03f16cdb ussd: Ignore connection release/clear from the MSC
In case this is a local USSD connection we will ignore
the clear command and respond with a RLC to any RLSD but
will never forward that to the BSC. This way the external
USSD is fully in charge of the connection.
There are theoretical issues if there are multiple transactions
on the same SCCP Connection but this can not be solved properly
right now.
2011-04-21 17:13:51 +02:00
Holger Hans Peter Freyther
71dd06cfcb crc24: Include stdint.h as a possible compile fix 2011-04-19 20:06:26 +02:00
Holger Hans Peter Freyther
123bc32834 ussd: Keep track of used TIs for USSD and forward messages
Keep track of the used transaction identifier and always forward
messages to the USSD provider. E.g. this can be used to have a
dialogue going. Right now it is still possible that the MSC will
close down the connection.
2011-04-19 13:06:47 +02:00
Holger Hans Peter Freyther
91b9a45be4 nat: Inform the USSD Provider about lost connections 2011-04-18 17:32:40 +02:00
Holger Hans Peter Freyther
e5d324981d nat: Remove magic numbers, use enum values for conn classification
Remove the usage of 0, 1, 2 and start using enum values. We can
still assume con_local is a number.
2011-04-18 17:32:38 +02:00
Holger Hans Peter Freyther
a64037cd4a nat: Clarify the documentation of the allow/deny regexp 2011-04-18 17:31:40 +02:00
Holger Hans Peter Freyther
80352e03ca ho: Initialize nmp_worst as it was not initialized
The compiler can't know that on the first iteration we will
assign nmp_worst as we have used a high average value.
2011-04-18 17:31:40 +02:00
Holger Hans Peter Freyther
d447e99587 bsc: Move transaction.c from the libbsc to the libmsc
The BSC code does not use transactions, move it to the libmsc.
2011-04-18 17:31:40 +02:00
Holger Hans Peter Freyther
0e7d071e47 misc: Fix possible crash with setting an extension 2011-04-18 17:31:40 +02:00
Holger Hans Peter Freyther
a8a09df6a6 misc: Remove sys/types.h includes from the files
These are not needed any more. We used them for u_int
types but we now use uint which comes from stdint.h
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther
c42ad8b686 misc: Move from u_int to uint types of stdint.h
This was done with sed on the files.
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther
5cde92cb0e nat: And out the skip_indicator/transaction id from the gsm48 header
We need to and out the protocol discriminator as call control
might have use transactions. This has only failed for the USSD
filter so far as this must deal with transactions.
2011-04-13 18:56:13 +02:00
Holger Hans Peter Freyther
06009c8d5a bsc: Remove the handling of the RTP option from the switch/case stmt
The 'P' code was not present in the getopt call anyway.
2011-04-13 09:18:49 +02:00
Holger Hans Peter Freyther
fede54c821 bsc: Use the new name in the usage statement 2011-04-13 09:18:09 +02:00
Pablo Neira Ayuso
7e737007d9 ipaccess-proxy: get rid of make_gprs_sock()
It is similar to make_sock() available in openbsc/libcommon.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso
4c80a516f8 ipaccess-proxy: remove leftover option `--udp'
It seems it remains unimplemented, remove it.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso
25ffe54118 ipaccess-proxy: more robust option parsing and checking
With this patch, ipaccess-proxy makes more robust option checking:

$ ./ipaccess-proxy -l 1.1.1.1 -b 2.2.2.2 -e
ERROR: missing mandatory argument for `-e' option

And we return to shell to enforce the user to try again with the
appropriate invocation.

Before this patch, the default getopt_long() error handling was
enabled which displayed this message:

./ipaccess-proxy: option requires an argument -- 'e'

and ipaccess-proxy continued working.

This is generic enough to cover other option that require mandatory
arguments like `--bsc' and `--listen'.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso
23b1b808f1 ipaccess-find: get rid of ipac_idtag_name()
Use generic ipaccess_idtag_name() available in libabis instead.
2011-04-12 21:50:47 +02:00
Pablo Neira Ayuso
91afbbc56a libabis: ipaccess: use log instead of debug under errors in ipaccess_send()
This patch was suggested by Zecke.
2011-04-12 21:50:46 +02:00
Pablo Neira Ayuso
ca05d432d7 src: more robust ipaccess_idtag_parse()
Now ipaccess_idtag_parse() returns -EINVAL instead of -1. We also
check for the return value of this function in every invocation to
skip further processing in case of messages with malformed TLVs.

This idea was suggested by Zecke.
2011-04-12 21:50:46 +02:00
Pablo Neira Ayuso
0d20b63574 libabis: ipaccess: more robust ipaccess_idtag_name()
ipaccess_idtag_name() now takes a uint8_t as parameter which is the
length of the type tag.

This patch was suggested by Zecke.
2011-04-12 21:50:46 +02:00
Holger Hans Peter Freyther
81863cde82 db: The forward declaration of the enum does not work with C++
We need to include this directly to help LCR in building.
2011-04-12 21:33:35 +02:00
Holger Hans Peter Freyther
090493863b mncc: Do not permanently disable the listening socket in case of error
When we have no other MNCC connection but the registeration of the
new fd is failing we should not disable reading from the listen_fd
for ever as the situation might not be permanent.
2011-04-12 20:14:51 +02:00
Holger Hans Peter Freyther
18fe88933c nitb: Listen for incoming MNCC connections only once
There is no point in creating the MNCC socket twice. Only
create it if the user requested this when starting the nitb.
2011-04-12 19:16:48 +02:00
Holger Hans Peter Freyther
0e8facca42 ipaccess-config: Allow to invoke tests by names.
Allow to invoke tests by name.
2011-04-11 20:39:16 +02:00
Holger Hans Peter Freyther
390ba3faa0 ipaccess-config: Add option to list possible NVRAM settings
We can handle NVRAM settings via names but there is no way
to discover these names. This commits adds the unusual -H
option to show these values.
2011-04-11 20:39:16 +02:00
Holger Hans Peter Freyther
cfccedd74a ipaccess-config: Allow to automatically loop a test
This makes the commented out code an option that might
or might not work reliable.
2011-04-11 20:39:12 +02:00
Holger Hans Peter Freyther
0d93fb4127 nat: Fix a crash due the refactoring and pass the nat again. 2011-04-11 20:30:56 +02:00
Pablo Neira Ayuso
ffcf66f30e wireshark: update extension of RSL dissector with ip.access nanoBTS support
This patch removes the C99 structure initialization which is not allowed
by the wireshark project (since it has to compile with non-C99 compliant
compilers).

It also adds a new option to enable/disable the dissection of vendor
specific ip.access nanoBTS RSL messages.

Tested with file:
ipaccess-startup-mo_to_mo_call-proxy.pcap
2011-04-08 14:05:42 +02:00
Holger Hans Peter Freyther
b326100b12 misc: Fix compiler warnings in the code 2011-04-07 23:34:54 +02:00
Holger Hans Peter Freyther
5d7b65b407 ipaccess: Add a function to prepend the osmocom ext header
* include/openbsc/ipaccess.h: Reserve a protocol number for control
  commands
* input/ipaccess.c: New function ipaccess_prepend_header_ext prepends
  the extension header
2011-04-07 23:31:58 +02:00
Holger Hans Peter Freyther
755f7442dd Merge branch 'pablo/cleanups' 2011-04-07 23:28:43 +02:00
Pablo Neira Ayuso
9f1294d623 ipaccess-proxy: remove hardcoded IP for options -l' and -b'
This patch removes the hardcoded IP addresses for options `-l'
and `-b'.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso
c281b4e85a libabis: ipaccess: export ipaccess_parse_unitid
Now this is used by ipaccess-proxy, remove redundant implementation in it.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso
625295b14f ipaccess-proxy: get rid of ipac_idtag_parse()
Use ipaccess_idtag_parse() available in libabis instead.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso
66add64b71 libabis: ipaccess: export ipaccess_idtag_name()
Now this is used by ipaccess-proxy, remove redundant implemention in it.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso
22f58a9a58 libabis: ipaccess: conclude new ipaccess_send_*() functions and use them
This patch finishes the new ipaccess_send_*() functions and use them
in the ipaccess-proxy code.

I have also cleanup the definition of the PONG, ID_ACK and ID_REQ
messages (including some minor documentation about them).

I had to rename ipaccess_recvmsg() in ipaccess-proxy to avoid clashing
with the one defined in libabis.
2011-04-07 23:28:00 +02:00
Pablo Neira Ayuso
3ab864a860 ipaccess-proxy: get rid of make_listen_sock() and use make_sock() instead
This patch replaces make_listen_sock() by the generic make_sock()
available in libcommon/socket.
2011-04-07 23:28:00 +02:00
Holger Hans Peter Freyther
55ef5fb7ef bsc: Add the bsc-rf-socket command to master as well
Make it possible to specify the rf-socket path via the
vty configuration as well. The command line setting will
override it though.
2011-04-07 23:26:13 +02:00
Holger Hans Peter Freyther
4b41746ce3 bsc: Include openbsc/ipaccess.h for the drop_oml command
Fix a compiler warning about the drop_oml command.
2011-04-07 23:10:10 +02:00
Holger Hans Peter Freyther
7d73642d0e nat: Fix the call to make_sock and pass a 0 priv_nr and the nat as data 2011-04-07 22:14:58 +02:00
Holger Hans Peter Freyther
ef38e85542 nat: Remember if the MSC accepted the connection on principle
For the USSD module we only want to handle requests that are
legitimate. This is achieved by looking for the CM Service Accept
or the BSSAP CIPHER MODE COMMAND.
2011-04-06 11:29:46 +02:00
Pablo Neira Ayuso
da2f769681 ipaccess: proxy: get rid of internal make_sock() implementation
With this patch, we use the implementation available in libcommon.
2011-04-05 18:33:28 +02:00
Pablo Neira Ayuso
165fe56260 libcommon: socket: extend make_sock() prototype
This patch extends the make_sock() prototype so you can fully set
the fields priv_nr and data of the bsc_fd structure.

This is the first step to get rid of the internal make_sock()
implementation that ipaccess-proxy uses.

This patch includes a minor cleanup to pass INADDR_ANY instead
of zero, if you do not want to bind the socket to one specific
address.
2011-04-05 18:33:24 +02:00
Pablo Neira Ayuso
f22e348287 ipaccess-config: exit if no network interface is specified
ipaccess-config has to exit if no network interface is specified,
otherwise it uses argv[1] which has a uninitialized value.
2011-04-05 18:33:17 +02:00
Holger Hans Peter Freyther
4c9557ef24 nat: Bail out if the regexp fails to compile and avoid a crash
If the regexp fails to compile the internal dfa is NULL and a
regexec will crash nicely. Fail and free the string if the regexp
fails to compile.
2011-04-04 19:19:26 +02:00
Holger Hans Peter Freyther
13673749ff lapd: NULL pointer derefence possible here
The idiom seems to be to allocate the lapd_tei if it does not
exist and use it then. This was found by clang --analyze.
2011-04-04 19:17:58 +02:00
Holger Hans Peter Freyther
a18b11602c nat: Make the USSD number matching a regexp
This allows to match multiple numbers and multiple patterns
2011-04-01 17:32:21 +02:00
Holger Hans Peter Freyther
9e7e55f164 nat: Fix the return to return CMD_SUCCESS; 2011-04-01 16:23:17 +02:00
Holger Hans Peter Freyther
6a7babd658 nat: Add commands to remove access-list from NAT and BSC config 2011-03-29 17:50:49 +02:00
Holger Hans Peter Freyther
d000c27d3b nat: Improve the error message for the failing bind call
Print the IP and port that was used for the address to bind to.
2011-03-29 17:50:49 +02:00
Holger Hans Peter Freyther
06f4fc79a2 bsc: Make the MSC node a child of CONFIG_NODE
The VTY code calls the write function for nodes in the order of
registration of the node and not in terms of hierachy of nodes. This
means that the e1_input code is written before the MSC node that
was the child of the network. Make the MSC_NODE a direct descendant
of the CONFIG_NODE and avoid this issue.
2011-03-29 17:50:49 +02:00
Holger Hans Peter Freyther
fcac2911cf bsc: Fix the generation of the config file, fix indention
Fix the indention of codec-list, bsc-welcome-text, mid-call-text
and the mid-call-timeout. Fix the name of the codec-list in the
write method.
2011-03-29 17:08:27 +02:00
Pablo Neira Ayuso
6110a3f3fa src: include new file osmocom/vty/misc.h for vty_out_rate_ctr_group()
This uses the new include file for vty_out_rate_ctr_group() which
available in libosmocore.
2011-03-28 20:01:03 +02:00
Pablo Neira Ayuso
3c409c249d ipaccess-proxy: fix segfault in handle_dead_socket
This patch fixes a segfault if we or one BTS start a TCP connection
and close it before any IPAC_MSGT_ID_RESP message is sent.
2011-03-27 22:21:08 +02:00
Pablo Neira Ayuso
928cb33eb4 tests: fix bsc-nat test
In 136f453dd2, I forgot to update
the new header path in the test/bsc-nat files (this happened to
me because I forgot to configured openBSC without --enable-nat).
2011-03-26 23:57:53 +01:00
Harald Welte
7c6b8cbbed wireshark abis_oml: remove dead code and update copyright statement 2011-03-24 20:02:25 +01:00
Harald Welte
d36ff76f9d Fix build of bsc-nat and GPRS code after include path change
The last patch changed the osmocore include paths, this fixes some build
problems caused by it
2011-03-23 18:33:26 +01:00
Pablo Neira Ayuso
136f453dd2 src: use new library libosmogsm and new path to headers in libosmocore
libosmogsm is a new library that is distributed in the libosmocore.
Now, openbsc depends on it. This patch gets openbsc with this
change.

This patch also rewrites all include path to the new
osmocom/[gsm|core]

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:17:56 +01:00
Pablo Neira Ayuso
3848770669 src: fix use of logging_vty_add_cmds() without log_info parameter
This patch fixes:

  CC     gb_proxy_main.o
gb_proxy_main.c: In function ‘main’:
gb_proxy_main.c:224: warning: implicit declaration of function ‘logging_vty_add_cmds’

And a similar problem in osmo-bsc_nat.

This was introduced in by myself in patch:
"bsc: change bsc_vty_init to take logging categories as parameter"

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 09:04:10 +01:00
Harald Welte
50e529d44e Depend on libosmocore 0.1.31 due to VTY / logging change 2011-03-20 10:37:06 +01:00
Harald Welte
c76fb5dd10 [RBS2000] Enable TRAU frame handling/muxing similar to BS11
Based on original patch by Gus Bourg <gus@bourg.net>
2011-03-20 06:27:31 -03:00
Pablo Neira Ayuso
739a566961 bsc: change bsc_vty_init to take logging categories as parameter
This change is required to finish the integration of the VTY and
the per-application logging categories that provides:

"vty: integration with logging framework"

in libosmocore.

It has been tested with osmo-nitb. The other just compiled tested.
2011-03-19 18:50:38 -03:00
Pablo Neira Ayuso
5d7ad47386 misc: check for libdbi, mandatory library dependency
Otherwise, openbsc fails to compile:

  CC     db.o
db.c:29:21: error: dbi/dbi.h: File does not exists
2011-03-08 15:41:36 +01:00
Pablo Neira Ayuso
682587748f vty: fix segfault if rf_ctl is not set
This is the case of osmo-nitb, since it does not call
osmo_bsc_rf_create().

term1: $ ./osmo-nitb -c ../openbsc.cfg.nanobts
term2: $ telnet localhost 4242
term2: OpenBSC> show network
term1: Segmentation fault
2011-03-08 15:35:34 +01:00
Holger Hans Peter Freyther
16b7f5c4ef mgcp: Remove some duplicate header files from the list. 2011-03-08 15:33:52 +01:00
Harald Welte
40d1c3fef1 RBS2000: Automatically connect/start/configure/enable most MOs 2011-03-06 23:20:28 +01:00
Harald Welte
8b277ac381 OM2000: Make sure we fill the nsd->bts member for NM state events 2011-03-06 23:00:32 +01:00
Harald Welte
1484d88d7a OM2000: First attempt in automatically configuring most MOs
TS objects are not part yet
2011-03-06 22:12:24 +01:00
Harald Welte
f38ca9aec7 OML: Include a pointer to the BTS in NM STATE CHANGE signals
... this allows the BTS driver to decide if it should handle the event at all
2011-03-06 22:11:32 +01:00
Harald Welte
d529db6e50 OM2000: Move IS conn group list generation out of VTY code 2011-03-06 21:49:21 +01:00
Harald Welte
af9b810419 OM2000: Track the Operational Info and MO state 2011-03-06 21:20:38 +01:00
Harald Welte
217c6b6ad2 OM2000: Remove "is-conf-req" from VTY, use "configuration-request"
This unifies the syntax a bit
2011-03-06 19:46:15 +01:00
Harald Welte
e898ecc57b OM2000: Process MO STATE and ACCORDANCE INFO 2011-03-06 19:26:11 +01:00
Harald Welte
1edc2b4c85 OM2000: Fix configuration of TCH timeslots 2011-03-06 19:01:54 +01:00
Harald Welte
ba9adbb951 OM2000: Fix configuration of Timing Function (missing timing src) 2011-03-06 19:01:16 +01:00
Pablo Neira Ayuso
4fcd3570cb wireshark: gsm-abis-oml: convert C99 structure initialization to ANSI C
This patch applies to the wireshark/0001-abis_oml.patch.

This patch converts the C99 structure initialization which is not
accepted by the wireshark developers (Harald told me that they need
it to compile with non-gcc compilers which don't always support C99).

I have tested it here with four pcap files that Harald passed to me.
2011-03-06 16:47:54 +01:00
Harald Welte
75755c5d87 OM2000: More work on the TS configuration request
It seems the differences for the various channel combinations are big
2011-03-05 20:38:35 +01:00
Harald Welte
8aeac19dbd OM2000: Route TS config requests to the right TRX
The TRX number is encoded in mo.assoc_so, whereas the TS number
is in mo.inst!
2011-03-05 20:15:09 +01:00
Harald Welte
f6d6b21ec2 OM2000: TLV parser definitions for more DEI's 2011-03-05 20:13:52 +01:00
Harald Welte
aff63bc089 OM2000: Consider OP_INFO_REJ and TEST_REQ_REJ as NACK 2011-03-05 19:46:49 +01:00
Harald Welte
1164dce679 OM2000: Add channel combination specific DIEs for TS config request
... and in order to do this reasonably well, we have to get rid of
the pre-computed message length field in the OML header.  Instead,
we now simply compute it at abis_om2k_sendmsg() time based on the
msgb_l2len().
2011-03-05 19:21:26 +01:00
Harald Welte
3ede723cb4 OM2000: Handle (Dis)Connect Reject in NACK handler 2011-03-05 17:58:13 +01:00
Harald Welte
e6e8383a92 OM2000: Print result/reason code when receiving a reject 2011-03-05 17:52:09 +01:00
Harald Welte
5748c20be1 OM2000: fix generation of frequency list DIE 2011-03-05 17:30:07 +01:00
Harald Welte
d4571f41a3 HSL: Make sure not to send HSL specific OML init on non-HSL BTS 2011-03-05 16:24:20 +01:00
Harald Welte
53492c86e8 OM2000: Make sure to set the Associated SO to 255 in case of RX/TX 2011-03-05 16:21:01 +01:00
Harald Welte
52af3aee5a OM2000 VTY: Don't send RX configuration request to TX 2011-03-05 16:14:34 +01:00
Harald Welte
bab983764e Fix Makefile.am for builddir != srcdir 2011-03-05 15:20:18 +01:00
Harald Welte
366d215dbd Makefile: Add libmsc subdirectory to fix 'distcheck' 2011-03-05 15:18:25 +01:00
Harald Welte
f9cf961a66 OM2000: Add support for configuring the TF (Timing Function) 2011-03-05 14:36:47 +01:00
Harald Welte
a0ce349f0c OM2000: Add support for sending TX, RX and TS configuration requests
They can be triggered from the VTY
2011-03-05 14:13:14 +01:00
Harald Welte
c08e8be4ee fix path of bscconfig.h include file 2011-03-04 13:53:51 +01:00
Harald Welte
c1b2cfafd4 Fix build of bsc-nat test 2011-03-04 13:49:02 +01:00
Harald Welte
388cbbfc41 Some more SR1.0.1 related fixes
somehow all the 0x81 in OML became 0x80, and the 0x80 of RSL became
0x80.
2011-03-04 13:45:03 +01:00
Harald Welte
17a7634043 fix erroneous modification of DTX parameter introduced in previous HSL commit 2011-03-04 13:44:49 +01:00
Harald Welte
63467e8f28 Make sure not to feed BSSGP messages into RSL 2011-03-04 13:44:30 +01:00
Harald Welte
26d7907b02 Implement the HSL SR1.0.1 protocol
It seems HSL has fixed most of their obvious issues in the SR1.0.1
release.  However, this creates quite an incompatibility of the
protocol, and we have to adapt accordingly
2011-03-04 13:44:12 +01:00
Harald Welte
fd355a3c6f [HSL] initial support for the HSL 2.75G Femtocell
The HSL Femtocell seems to be a poor man implementation of the
ip.access Abis/IP protocol, but cutting corners wherever possible.

We try to workaround those corners wherever possible...
2011-03-04 13:44:07 +01:00
Harald Welte
89579b4317 prefix sub-directories containing libraries with 'lib'
... and make sure tests work again after restructuring
2011-03-04 13:23:09 +01:00
Harald Welte
5a6b68f416 really delete a3a8 code 2011-03-04 09:24:31 +01:00
Harald Welte
bd34be0a96 bsc_mgcp: use top_builddir instead of top_srcdir 2011-03-03 23:46:55 +01:00
Harald Welte
e5e36af8ae Move 'Gb' protocol stack into its own src/gb subdirectory 2011-03-03 23:45:28 +01:00
Harald Welte
a17faf8512 Rename bsc_nat -> osmo-bsc_nat and bsc_mgcp -> osmo-bsc_mgcp
This now enforces a unique structure: All of our main daemon
programs start with an "osmo-" prefix.
2011-03-03 23:36:48 +01:00
Harald Welte
31c00f7d6f re-structure the OpenBSC directory layout
The new structure divides the code into a number of libraries
for the BSC core functionality, MSC core functionality, Abis transport,
TRAU and other bits.

This doesn't introduce any functional code change but simply moves
around files and alters Makefile.am accordingly.

Next step would be to disentangle a lot of the inter-library
dependencies and make the individual bits of code more independent.
2011-03-03 23:29:05 +01:00
Harald Welte
9349d7ff7c remove a3a8 file that is not used 2011-03-03 23:25:31 +01:00
Holger Hans Peter Freyther
955c3d1894 misc: Fix the make distcheck of the sources. 2011-02-28 20:49:47 +01:00
Holger Hans Peter Freyther
afb883956d mgcp: Fix make distcheck due a copy 'n pasted Makefile.am 2011-02-28 20:45:55 +01:00
Holger Hans Peter Freyther
6990687f4c mgcp: Only allow transcoding on the virtual trunk 2011-02-28 19:40:54 +01:00
Holger Hans Peter Freyther
44016fee14 mgcp: Fix the static allocation of E1 trunks for the BTS/NET side 2011-02-28 19:40:54 +01:00
Holger Hans Peter Freyther
1f0c5b4742 mgcp: Allocate the endpoints for the E1 trunks as well. 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
74e61110e5 mgcp: Look up the E1 trunks through the trunk configuration 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
6ea7e777f5 mgcp: Implement find_trunk to find the E1 trunks as well. 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
cdba04978d mgcp: Make show mgcp print the new trunks we have. 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
0e939fec42 mgcp: Introduce a trunk config for multiple trunks.
A trunk will always have 32 endpoints to be used and we allow
a sparse allocation of endpoints.
2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
ab3bb9d444 mgcp: Update the commands to work on more than the virtual trunk 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
d011c91512 mgcp: Prepare the show mgcp command to work on multiple trunks 2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
88ad7723b4 mgcp: Introduce a mgcp_trunk_config enum for endpoint configs
We want to support real trunks in the MGCP code and we need to
have some better book keeping for those. Move the code around.
2011-02-28 19:40:53 +01:00
Holger Hans Peter Freyther
dfdf8d929a nat: For debugging make it possible to set the last used endpoint
This will influence the allocator from where to search for the
next free endpoint. This can be used to force it to allocate a
specific endpoint next.
2011-02-28 19:40:46 +01:00
Holger Hans Peter Freyther
9212d9d636 nat: Fix some corruption in the test case 2011-02-27 11:18:41 +01:00
Holger Hans Peter Freyther
9ec030d32d nat: Change number of multiplexes to the max-endpoints 2011-02-27 11:05:18 +01:00
Holger Hans Peter Freyther
a9e9331285 nat: Allocate endpoints from multiple multiplexes.
This code allocates endpoints from multiple multiplexes but
will always leave 0x0 and 0x1f unassigned in the multiplex.
2011-02-26 11:38:00 +01:00
Holger Hans Peter Freyther
7b07b2dcff nat: Start making the number of multiplexes configurable
Introduce a VTY setting that right now needs to be set to
one. To make updating this setting possible we will now store
the number of endpoints in the bsc connection as well.
2011-02-26 10:42:01 +01:00
Holger Hans Peter Freyther
86c1db6338 nat: Verify that we are not assigning 0x1f as endpoint.
On a classic BSC we have 32 channels but one is reserved for
signalling. Make sure that we are not assigning 0x1f as we
assume that this is the signalling channel. This means that
from 32 possible voice channels we are only going to use 30
as we are already not using the 0x0.
2011-02-26 10:38:52 +01:00
Holger Hans Peter Freyther
ed500e3877 nat: Allocate the endpoint status dynamically
Allocate the status for an endpoint dynamically. We will support
BSCs with different amount of multiplexes and need to have this
flexibility in the future. Add the proper null checks to the
current users of this code.
2011-02-26 10:35:33 +01:00
Holger Hans Peter Freyther
7e0cc50e44 nat: Update the tests to make them going again
We now need to have access to a mgcp_cfg and the change to the
setup number patching needs new data. We now set the number to
international type.
2011-02-25 17:30:48 +01:00
Holger Hans Peter Freyther
867d69bbcb configure: Require a new libosmovty due to the syslog/logging changes 2011-02-25 17:30:48 +01:00
Harald Welte
ec1921dfa3 Use shorter vty_app_info->name for all apps
... as this is now used as SYSLOG ident
2011-02-24 23:57:06 +01:00
Nico Golde
b62b12398b sms: introduce new command to trigger the sending process for specific subscribers only 2011-02-24 14:48:57 +01:00
Holger Hans Peter Freyther
11762459e8 rf: Delay execution of commands
Delay executing RF commands up to a second. If many commands
arrive within a second then just execute the last command.
2011-02-24 14:40:23 +01:00
Holger Hans Peter Freyther
00c805f213 rf: Verify that the requested mode is entered and drop OML in error
Verify that the BTS is following our orders, if we think there was
an error we will drop the OML connection.
2011-02-24 14:40:11 +01:00
Holger Hans Peter Freyther
37ac420254 rf: Remember the last command requested on the RF CMD interface 2011-02-24 14:37:36 +01:00
Dieter Spaar
6a458eac2c oml: Parse probable cause and additional text in failure reports 2011-02-24 14:37:10 +01:00
Holger Hans Peter Freyther
6c79a68103 misc: Compile fixes due 4d54d0b883 2011-02-24 14:34:03 +01:00
Holger Hans Peter Freyther
ca8f3b59c1 debian: Correct the path for the binaries. 2011-02-20 11:56:12 +01:00
Harald Welte
21bbda242e BSC: Fix empty neighbor list in case of manual SI/SI5 mode 2011-02-19 20:43:37 +01:00
Harald Welte
4d54d0b883 Fix various compiler warnings all over the code 2011-02-19 16:48:17 +01:00
Harald Welte
5ec26fe983 Install programs into $(prefix)/bin, not /sbin
At least in many configurations, there is no need to run any
of our programs as root.  Thus, we shouldn't install them in sbin.
2011-02-19 16:19:19 +09:00
Holger Hans Peter Freyther
f358964fb2 bsc: Use msg->data and msg->len for the hexdump, pick a better name
Rename the method as we send everything to the MSC and not just
SCCP. Put alink into the function name. Also use msg->data and
msg->len in hexdump as this is what we are sending to the server.
2011-02-18 23:44:49 +01:00
Holger Hans Peter Freyther
91fa850791 nat: If the number starts with 00 turn it into a international number
Switch the type to international and skip the '00' of the phone
number. This should fix some issues with gateway MSCs.
2011-02-18 23:44:49 +01:00
Holger Hans Peter Freyther
4446b3bf34 nat: Add extra size check for the number and fail if it does not fit
If the replaced number is too long for the phone number we will
have to stop processing here.
2011-02-18 23:44:49 +01:00
Holger Hans Peter Freyther
6e1a676e21 bsc: core-mobile-country-code and core-mobile-network-code range is too small
Make both VTY commands have the same range as the normal MCC and
NCC command in the config file.
2011-02-18 23:44:49 +01:00
Harald Welte
8dcebd3e7f LOGGING: make sure to make the 'logging filter' compatible with vty log cfg
Recent libosmocore introdues a way how log targets can be configured from
the VTY.

This commit makes the 'log filter (imsi|nsvc|bvc)' compatible with it.
2011-02-18 21:10:05 +01:00
Harald Welte
64c07d213c Allow configuration of SI5 neighbor list != SI2 neighbor list
This introducecs the new VTY command "neighbor-list mode manual-si5"
in combination with "si5 neighbor-list (add|del) arfcn <0-1024>",
which allows you to (optionally) have neighbor channel lists that
differ in SI5 and in SI2.
2011-02-15 11:43:27 +01:00
Harald Welte
b01bf33ad4 add example openbsc.cfg for RBS2308 with 4TRX 2011-02-14 16:45:06 +01:00
Harald Welte
e925205c28 DAHDI: Automatically switch signalling slots to HDLC + FCS mode
This will now make signalling slots work anywhere, even if
/etc/dahdi/system.conf states the timeslot is a bchan.
2011-02-14 16:43:35 +01:00
Harald Welte
da87154093 OM2000: Make sure the IS and CON lists are kept in order 2011-02-14 16:32:44 +01:00
Harald Welte
ebec58e8ba DAHDI: usse lower-case name to parse correctly by vty code 2011-02-14 16:31:53 +01:00
Harald Welte
59eee42b05 OM2000/RBS2000: Make IS+CON configuration persistent in config file
This uses the new bts_model->config_write_bts() callbacks
2011-02-14 16:17:49 +01:00
Harald Welte
face7edc62 VTY: Allow for per-BTS-model specific config file write functions
This way a BTS module can append config data to the TS, TRX and BTS
sections.
2011-02-14 16:15:21 +01:00
Harald Welte
a0fe72de6f LAPD: keep sent/receive sequence numbers per SAPI, not just per TEI
If there are multiple SAPIs active on the same TEI, we need to keep
one set of sequence numbers for each SAPI, not just for the TEI.
2011-02-14 15:51:57 +01:00
Harald Welte
fdb71949db OM2000: Handle various ACKs better, implement CON CONF REQ 2011-02-14 15:31:43 +01:00
Harald Welte
d88a3878cc OM2000: Route outgoing NM message depending on MO
Depending on the MO we adress, select the proper OML link
2011-02-14 15:26:13 +01:00
Harald Welte
9c0958bf4c OM2000: Complete the VTY help message for OM2000 MO commands 2011-02-13 22:51:03 +01:00
Harald Welte
a02085dab0 OM2000: Allow configuration of CON from VTY
However, we have no code that generates the OM2K CON List attribute.
2011-02-13 22:45:02 +01:00
Harald Welte
a8e6a652ca OM2000: Allow VTY based configuration of IS connection groups 2011-02-13 22:13:28 +01:00
Harald Welte
b7eebf8699 OM2000: Don't send START REQ in response to FAULT REP 2011-02-13 20:09:24 +01:00
Harald Welte
c4989a8e5e INPUT: Disable the per-TRX OML Link for now
We need a way for the caller to specify which OML link (BTS or TRX) he wants.
2011-02-13 20:06:58 +01:00
Harald Welte
9f0866c2a3 RBS2000: Differentiate between BTS OML and TRX OML
We don't want to restart the CF on TRX OML link establishment...
2011-02-13 19:44:47 +01:00
Harald Welte
bd3137c2dd INPUT: Include TEI + SAPI in E1 INPUT SIGNAL 2011-02-13 19:44:21 +01:00
Harald Welte
15ccc77f62 INPUT: Allow for a per-TRX OML link
So far, all BTS we have interfaced had one OML link per BTS, independent of the
number of TRX.  In Ericsson RBS 2000, there is an OML link for the DXU/IXU,
and one additional OML link for each TRX/TRU.
2011-02-13 19:36:18 +01:00
Harald Welte
82b03a1f2b RBS2000: fix compiler warning about unhandled enum in switch() 2011-02-13 19:35:39 +01:00
Harald Welte
cca849a825 Merge branch 'rbs2000' 2011-02-13 15:50:43 +01:00
Harald Welte
0896b50197 OM2000: Configure the IS to route both TRX0 and TRX1 2011-02-13 15:49:27 +01:00
Harald Welte
909212fc87 LAPD: Make sure we don't re-start SABM timer for INACTIVE SAPs 2011-02-13 15:49:27 +01:00
Harald Welte
c834b70d04 RBS2000: Generate per-TRX OML link 2011-02-13 15:49:27 +01:00
Harald Welte
174a51a761 DAHDI: Deliver ALARM/NOALARM as input signal to RBS2000 driver
... and re-start LAPD SABM as required
2011-02-13 15:49:27 +01:00
Harald Welte
b3d70fd0bd OM2000: Make sure we ACK an ENABLE RESULT 2011-02-13 15:49:26 +01:00
Harald Welte
dcf42e6cd2 RBS2000: Move SABM re-transmit logic into LAPD code
This means we now can support multiple LAPD links
2011-02-13 15:49:26 +01:00
Harald Welte
334c5ab2e6 RBS2000: Make sure we transmit SABM at 0.3 second intervals
This is apparently the right timing to increase the chance that the RBS detects
it quickly. (10..15 seconds)
2011-02-13 15:49:26 +01:00
Harald Welte
b0ec9e3dae OM2000: Use om2k in VTY prompt 2011-02-13 15:49:26 +01:00
Harald Welte
8bcb1a0a99 OM2000: Add IS Conf Req 2011-02-13 15:49:26 +01:00
Harald Welte
0741ffe69f OM2000: Add enable/disable commands 2011-02-13 15:49:26 +01:00
Harald Welte
56ee6b8075 OM2000: Fix Negotiation parsing 2011-02-13 15:49:26 +01:00
Harald Welte
563d316106 OM2000: Implement proper parsing and response for Negotiation 2011-02-13 15:49:26 +01:00
Harald Welte
8024d8ff58 OM2000: Add support for sending the TEST REQUEST message 2011-02-13 15:49:25 +01:00
Harald Welte
8d4a472cc4 OML2000: Make sure we can properly exit the VTY node 2011-02-13 15:49:25 +01:00
Harald Welte
810e32394d OM2000: Make sure we can properly exit tye VTY node 2011-02-13 15:49:25 +01:00
Harald Welte
6fec79da18 OM2000: Add VTY commands for connect/disconnect and op_info 2011-02-13 15:49:25 +01:00
Harald Welte
51c8238024 OM2000: Add missing file from previous commit 2011-02-13 15:49:25 +01:00
Harald Welte
e1d5eca916 OM2000: Introduce VTY commands to initiate OM2000 procedures 2011-02-13 15:49:25 +01:00
Harald Welte
7354107946 OM2000: Negotiation Resposne, send START on OML-up event 2011-02-13 15:49:25 +01:00
Harald Welte
bc867d9a17 OM2000: Fix computation of length field in header, direct transmit of msgs 2011-02-13 15:49:24 +01:00
Harald Welte
9a311ec25e [RBS2000] Add initial code for Ericsson OM2000 O&M protocol
... and link it from the RBS2000 BTS support
2011-02-13 15:49:24 +01:00
Harald Welte
b80e14e567 [RBS2000] Add FIXMEs in code that is a crude hack 2011-02-13 15:49:24 +01:00
Harald Welte
03cc8a810b [RBS2000] Actually activate the RBS2000 support
The previous patch introduces new code for the RBS2000 but didn't
actually activate/call it yet.

After this patch, you can see LAPD being established and OM2000 messages
will fall into abis_nm.c (which of course has no clue about them).
2011-02-13 15:49:24 +01:00
Harald Welte
db44f6012d [RBS2000] Initial attempt at Ericsson RBS2000 support 2011-02-13 15:49:24 +01:00
Harald Welte
09cefee4db [OML] Allow each BTS model to specify the OML callback
This allows us to add BTS models that do not use the standard TS 12.21 OML
2011-02-13 15:49:09 +01:00
Harald Welte
a4898a868b DAHDI: print debug hexdump of every signalling msg we send 2011-02-13 15:47:26 +01:00
Harald Welte
1a00d823b3 [LAPD] Add minimal support for TE-side LAPD 2011-02-13 15:46:48 +01:00
Harald Welte
00ee4b78db DAHDI: Register every FD in the select() exceptfd-set
This helps us to receive events even if we don't receive or transmit
anything on the line.
2011-02-13 15:46:08 +01:00
Harald Welte
44f04da379 DAHDI: Handle exceptions 2011-02-13 15:44:53 +01:00
Harald Welte
95aa5c4ae3 E1 INPUT: Fix PCAP file generation for non-mISDN case 2011-02-13 15:44:22 +01:00
Harald Welte
f27d043032 E1 Input: Add new S_INP_LINE_INIT signal
This allows other code to listen ot a signal about a new line that
was just configured.
2011-02-11 16:49:41 +01:00
Harald Welte
f338a03b0c [BSC] Move the BTS-type specific code from bcs_init.c to bts_*.c
bsc_init.c was a big mess even only for two supported BTS models,
so before adding more BTS types, this needs a cleanup.

All the BTS specific code from bsc_init.c has now moved into
bts_{siemens_bs11,ipaccess_nanobts}.c

This has required that input_event() and nm_state_event() get both
converted to proper libosmocore signals instead of referencing external
symbols.
2011-02-11 16:26:31 +01:00
Harald Welte
f3956cbb20 [gb_proxy] vty: display the BVC BLOCKED status in 'show gbproxy' 2011-02-06 17:44:14 +01:00
Harald Welte
fb9e06f310 [gb_proxy] make sure bssgp cell id is copied correctly
When we copy a msgb, we need to make sure the msgb_cb->bssgp_cell_id
pointer points to data in the new message, not in the old message.

Thanks to Dieter Spaar for spotting this.
2011-02-06 17:17:05 +01:00
Harald Welte
c471d3d8a2 [gb proxy] treat BVCI=1 consistently like signalling
1 is reserved for point-to-multipoint data, i.e. not a point-to-point BVCI.
2011-02-06 17:13:12 +01:00
Harald Welte
5e106d7765 [gb_proxy] Convert a NS-BLOCK from BSS into BVC-RESET to SGSN
As we only have one NS-VC between gb_proxy and SGSN, we cannot
forward a NS-BLOCK from the BSS to the SGSN, as it would affect
all other BSS's, too.

Thus, we check if we have an unblocked PTP-BVC in the NSVC to the BSS,
and then issue a BVC-BLOCK towards the SGSN.

This should prevent any further PDU's from the SGSN to be sent to
this BSS.
2011-02-06 16:33:29 +01:00
Harald Welte
36f98d9c53 [gb_proxy] Track the state of blocked/unblocked BVC in the proxy
This allows us to reject any additional messages sent by the SGSN
after the BVC was blocked (+ acknowledged to be blocked)
2011-02-06 13:09:29 +01:00
Harald Welte
b63c3639eb remove dead code 2011-02-05 22:17:24 +01:00
Harald Welte
62d460301b [DAHDI] cosmetic fixes 2011-02-05 20:26:27 +01:00
Harald Welte
4ee2eaf3c4 [DAHDI] make sure LAPD transmits with correct SAPI 2011-02-05 20:26:27 +01:00
Harald Welte
8fc66a0c4d [LAPD] fix bug in TEI manager rendering LAPD unusable 2011-02-05 20:26:27 +01:00
Harald Welte
1458ec6571 [DAHDI] remove unused variable 2011-02-05 20:26:27 +01:00
Harald Welte
d38f10593a [LAPD] Support multiple instances of LAPD
We cannot afford static/global state, as we may have multiple E1
lines, each having its own LAPD instance.  Furthermore, we might
even have multiple LAPD instances on the same E1 line (think of
a multi-drop setup).

This also implements dynamic TEI allocation, i.e. no hardcoded
TEI list anymore.
2011-02-05 20:26:27 +01:00
Harald Welte
0ae575536a [LAPD] remove a number of unneeded assert() calls 2011-02-05 20:26:27 +01:00
Harald Welte
716d2a47b2 [LAPD] further code cleanup 2011-02-05 20:26:27 +01:00
Harald Welte
0abc11a0d0 [LAPD] use LOGP/DEBUGP instead of custom logging function 2011-02-05 20:26:26 +01:00
Harald Welte
50d369e1a9 [DAHDI] update to latest e1_input changes 2011-02-05 20:26:26 +01:00
Harald Welte
ca17ef88f5 [DAHDI] build dahdi driver only if dahdi header is present 2011-02-05 20:26:26 +01:00
Harald Welte
1dd68c3d0f [DAHDI] integrate DAHDI driver into E1 Input layer 2011-02-05 20:26:26 +01:00
Harald Welte
ba0db5b7f3 [dahdi] remove lots of dead code and references to mISDN 2011-02-05 20:26:26 +01:00
Harald Welte
d273529a8d [dahdi] don't export private functions from lapd.c 2011-02-05 20:26:26 +01:00
Harald Welte
e1de69af7e [dahdi] support multiple-include of lapd.h 2011-02-05 20:26:25 +01:00
Harald Welte
7e859bc17c [dahdi] Fix LAPD code comments (C-style) 2011-02-05 20:26:25 +01:00
Harald Welte
30fe64165b [dahdi] Fix lapd.c coding style 2011-02-05 20:26:25 +01:00
creslin287
cd8b86f124 Working audio data version 2011-02-05 20:26:25 +01:00
Matthew Fredrickson
69245a0496 Current LAPD with fixes for frames with P/F bit set 2011-02-05 20:26:25 +01:00
Matthew Fredrickson
cc2bc35f2c Current version of mostly working dahdi driver 2011-02-05 20:26:25 +01:00
Xavier Carcelle
17289eda65 first commit 2011-02-05 20:26:25 +01:00
Matthew Fredrickson
b1cb8eb7a6 Latest version of driver from other machine. 2011-02-05 20:26:25 +01:00
Matthew Fredrickson
d105e2048a Add addtional copyright notices for changes 2011-02-05 20:26:24 +01:00
Matthew Fredrickson
bc6649e942 Add lapd.c and lapd.h 2011-02-05 20:26:24 +01:00
Matthew Fredrickson
b5ddc184ff Add dahdi.c 2011-02-05 20:26:24 +01:00
Harald Welte
f933de97ba [E1] fix typo resulting in NM message being logged as RSL 2011-02-05 20:23:44 +01:00
Harald Welte
98c98547d0 [E1 INPUT] update E1 / BS-11 config files
Add the new 'e1_input' config section that is required
2011-02-05 15:58:03 +01:00
Harald Welte
07bb0daaff [E1 input] make sure config file with new E1 input config saves correctly 2011-02-05 15:57:42 +01:00
Harald Welte
889f16eac3 [E1 input] proper config error reporting 2011-02-05 15:43:15 +01:00
Harald Welte
fefb52361a [E1 INPUT] remove debug printf's 2011-02-05 15:31:40 +01:00
Harald Welte
3016d9f299 [E1 INPUT] explicitly configure the E1 input driver for each line
This introduces a new 'e1_input' config node with a command to be
used like:
  e1_line 0 driver misdn

This allows us to have different input drivers in the future
2011-02-05 15:31:34 +01:00
Harald Welte
5455243306 [input] make mi_e1_line_update() a driver specific callback
This helps us to further disentangle the misdn driver and e1_input
in preparation of DAHDI support.
2011-02-05 15:31:31 +01:00
Holger Hans Peter Freyther
a61c709ef0 mncc: Fix a crash in the call release code
When the remote subscriber has not responded yet we could
end up with a crash in the MNCC code. It was enough to dial
the number, then hang up and bsc_hack would end up with a
segfault due the list poisining of linux_list.
2011-01-27 15:05:45 +01:00
Holger Hans Peter Freyther
6e94d6d10d mgcp: Be able to parse RQNT messages and reply to them
We do not implement the request for notification at all but
we will tell the server that we have received something.
2011-01-25 23:33:54 +01:00
Holger Hans Peter Freyther
3fbd244187 bsc: Initialize the subscr to NULL in the default case
The paging response should always have a TMSI or IMSI
and we should be able to find the subscriber using that. If
no IMSI/TMSI is present and we would still accept the LU
we would access the uninitialized memory.
2011-01-16 20:31:59 +01:00
Holger Hans Peter Freyther
b549ddfb04 mncc: Fix crash when memory allocation is failing 2011-01-16 20:31:59 +01:00
Holger Hans Peter Freyther
05bbec7227 bsc: Fix possible crash when the lchan->conn alloc failed
Another null pointer dereference found by clang.
2011-01-16 20:31:59 +01:00
Holger Hans Peter Freyther
91f587ed98 misc: Make clang --analyze happy with the source code
The compiler concludes that if (ts->type == type && ts->line && line
can be false as line is NULL and then we unconditionally access
it, make it happy by adding an extra NULL check.
2011-01-16 20:31:59 +01:00
Harald Welte
1761d02ddb [wireshark] Update HSL wireshark dissector
now it correctly names some of the IEs like DSP/FPGA version,
and also automatically marks the UDP streams as RTP depending on
what it has seen in the RSL CONNECT TRAU message.
2011-01-15 18:09:25 +01:00
Harald Welte
934676e158 [wireshark] some more HSL RSL decoding 2011-01-15 13:09:01 +01:00
Harald Welte
7bbaefb349 update gitignore 2011-01-14 14:38:42 +01:00
Harald Welte
64bb754b40 [RSL] Move RF CHAN REL ACK into its own function
... rather than handling it in the main switch() statement
2011-01-14 14:25:57 +01:00
Harald Welte
da0a99ab0d [wireshark] add some lines to the README about the HSL patches 2011-01-14 10:01:17 +01:00
Harald Welte
95932e7bd0 [wiresehark] Update the HSL patch for wireshark RSL dissector
now it correctly parses BSSGP and displays some more HSL specific IEs
2011-01-13 23:23:13 +01:00
Harald Welte
aace9fc9b9 [SI] Make sure we set BS_AG_BLKS_RES !=0
This parameter indicates how many of the PCH+AGCH blocks are reserved
for the AGCH and thus not used for the PCH.  If we set it to 0,
we basically tell the BTS there is no AGCH - and thus it would be
impossible to send any IMMEDIATE ASSIGNMENTs.

Luckily the BS-11 and the nanoBTS don't seem to care.
2011-01-13 23:20:45 +01:00
Harald Welte
7a69cf0a98 [RSL] add missing hunk from commit 18b590de4a 2011-01-13 23:16:03 +01:00
Harald Welte
4bf40c090d [wireshark] some initial hackish patches to support HSLs Abis/IP 2011-01-13 11:03:51 +01:00
Harald Welte
18b590de4a RSL: add code to generate SACCH INFO MODIFY command
SACCH INFO MODIFY is intended to modify the SACCH content for a single
logical channel (as opposed to the default SACCH FILLING)
2011-01-13 00:08:17 +01:00
Harald Welte
32c0962b10 [BSC] Allow manual override of neighbor cell list
So far, OpenBSC simply assumed that all BTS's configured in openbsc.cfg are
neighbors of each other.  While this is true for small site installations,
it is definitely not true in most real world cases.  We now have the
following new commands at the 'configure bts' level:

'neighbor-list mode (auto|manual)' for selecting the mode

'neighbor-list (add|del) arfcn <0-1024>'
	for adding/deleting ARFCN in manual mode
2011-01-11 23:48:52 +01:00
Holger Hans Peter Freyther
9b5f1d7b43 wireshark: rebase the patches, rename and add a README
Add a short README mentioning the svn version they apply
to, how to rebase them in the future, and what they do.

The renaming is done to add a hint on in which order to
apply them. The abis_oml patch has been updated to some
value_string changes in epan, all patches now add the new
files to the CMakeLists.txt of epan as well.
2011-01-11 16:33:52 +01:00
Holger Hans Peter Freyther
3b0fd2b0b9 wireshark: Remove patches applied in upstream wireshark
These patches were applied to upstream wireshark as of
svn revision r35475.
2011-01-11 15:22:29 +01:00
Holger Hans Peter Freyther
8e3f0e7185 silent sms: Fix the silent SMS feature once again
It got broken in the refactoring of 20474ad029.
2011-01-10 17:04:06 +01:00
Holger Hans Peter Freyther
cdfcbee53b sms: Allow to specify the DCS for the SMS. 2011-01-10 15:34:09 +01:00
Holger Hans Peter Freyther
c464491b0b sms: Move the sms_from_text to gsm_04_11
Move the SMS from text code from the VTY interface into the
gsm_04_11.c code next to the sms_alloc and sms_free.
2011-01-10 15:21:34 +01:00
Holger Hans Peter Freyther
368a0a73d4 ipa: Only use one IPA number for Osmo extensions
Instead of using more numbers from the proto range we will
use the 0xee and then have a mini header with our new proto
id in there. For a start rename the use types to _OLD.
2011-01-07 16:54:46 +01:00
Holger Hans Peter Freyther
45c2184c7e mgcp: Return with NULL if we fail the size check. 2011-01-07 11:36:54 +01:00
Holger Hans Peter Freyther
f43f2fce82 mgcp: We want to count trunks starting from one. 2011-01-07 11:34:50 +01:00
Holger Hans Peter Freyther
9f239a2a0f mgcp: Parse a Digital Trunk endpoint name. 2011-01-06 19:35:10 +01:00
Holger Hans Peter Freyther
6adac17a10 mgcp: Include a MGCP Response String in the response
Switch to a \r\n at the end of the query. Both \n and \r\n
are valid according to the spec but this makes us match
responses of other equipment.
2011-01-06 19:35:10 +01:00
Holger Hans Peter Freyther
49b3ed2226 subscr: Stop stopping paging requests behind the back of subscr
The transaction layer was stopping paging requests that might or
might not have been owned by the transaction. This makes the subscr
code get stuck delivering requests. This code is mostly a band aid
and just makes sure that we will kick the queue if it is needed.
2011-01-06 14:52:53 +01:00
Holger Hans Peter Freyther
182c81f04e subscr: Remember if we need to call subscr_put_channel at the end.
Remember if this channel got opened due a paging response and in
that case when we close it down we will call subscr_put_channel
that will try to page the subscriber again. This highlights the
lack of a good subscriber management in the MSC code.
2011-01-06 14:52:53 +01:00
Holger Hans Peter Freyther
90c0aff174 paging: Handle the possible OOM message as well. 2011-01-06 14:52:53 +01:00
Holger Hans Peter Freyther
52ffb922c4 sms: Improve the logging of the paging callback. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
451eb29e37 subscr: Add a vty option to kick the queue. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
763b42a92a subscr: Dump the pending requests to help with debugging state. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
68c3bf6de8 subscr: Store the state of a subscr request for inspection. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
c02b12086c subscr: Fix subscr leaks in the KI code. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
fc857414ae subscr: Make it possible to clear pending requests for a subscriber 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
ebdd3cbd89 subscr: Show the number of pending requests on this subscriber. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
ffccb77df0 subscr: Stop all paging requests if one is failing.
If one paging request is timing out the others will timeout soon
as well. With the current code the next timeout would expire the
next request in the queue. We will now stop all paging requests
and then issue a next paging request. So for both paging success
and failure we will now stop all the other requests.

This is mostly a workaround, one should count on how many
BTSes we are paging and wait for all failures before we remove
the item from the queue.
2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
f72b3d51fc subscr: Kick the queue in case of a paging timeout
Kick the queue in case the paging was timing out. No one is going
to call subscr_put_channel for us so we will do it on the subscriber.

There is also another problem with multiple BTS in the LAC and paging
timeout. We will need to remember how many BTSes we have paged.
2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
c29043ea24 msc: Attempt to fix a bug with 'stuck' SMS due RF failure on auth
If we have a RF failure between the paging response and the auth
success we will not inform the subscriber layer of the failed paging
and instead just 'drop' the SMS. In case we have not completed the
auth and close the channel we will now send an auth failure.
2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
701076e9d3 sms: Add new SMS requests to the end of the list. 2011-01-06 14:52:52 +01:00
Holger Hans Peter Freyther
96e9f08101 sms: Argh... reset the pending after we have cleared the queue. 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
79eff7eeff sms: Fix crash by saving the gsm_network
The conn might be released during the loop and then conn->bts
is a null pointer and we end up crashing. Store the gsm_network
in a local variable and access this one.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
583e9aef33 sms: Show the amount of failures and the SMS we want to send.
Improve the debugging possibilities and print the failed attempts
and the sms that was attempted to be delivered. this should help
with debugging the code.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
dc53af6721 sms: Fix the log message and end with a new newline. 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
725966d9b4 subscr: Make the subscr_put_channel work with the subscr
The active channel might or might not be gone when the transaction
has been released. Instead of passing an invalid subscriber conn
we will pass the subscr that is ref-counted and guranteed to be
valid at this point. subscr_put_channel could search the connections
for an active connection if that is ever needed.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
8e3eb584a8 mncc: Do not print the BTS at all as it might not be present
In contrast to the previous believe we may not have a conn here
as we are still paging for the sub. Instead of printing the BTS
print the lac where we think the subscriber is located.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
b56a6bbc55 mncc: bts can be NULL, attempt to find the bts from the transaction
Follow trans->conn->lchan to the BTS instead of using the BTS that
is guranteed to be NULL in the codepath we have entered here. The
trans->conn should still be there, and the lchan should be valid as
well as we have reordered the clear statements.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
50c5ff7b94 mncc: Do not use bts->nr as it might be NULL. 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
ebd50a6fd2 bsc: Clear the hand-over in case the new_lchan is failing
When the new_lchan for handover is failing we should stop the
handover operation. This is fixing a crash that we get a timeout
on the lchan and have no conn set to it. Introduce a flag to
the bsc_clear_handover to not free the lchan. In case the ho_lchan
is failing we do not want to call lchan_release as it would
reset the state.
2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
f1ba09b2e6 misc: Remove unused variable from the function. 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
1cc7184bc9 misc: Fix compiler warning about incompatible pointers 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
02d45c00f5 misc: Fix warning about the cast. 2011-01-06 14:52:51 +01:00
Holger Hans Peter Freyther
f4152d1025 misc: Remove unused variable from the db. 2011-01-06 14:52:50 +01:00
Holger Hans Peter Freyther
54146271b6 misc: Forward declare the struct gsm_bts_trx_ts to avoid warning. 2011-01-06 14:52:50 +01:00
Holger Hans Peter Freyther
913bc032b9 mncc: Move the cc_tx_to_mncc code into the libbsc.a
The trau_mux likes to call cc_tx_to_mncc for each received
frame from the E1 link. Using a signal for each audio frame
is messy as well. The best thing I could think of is to put
this into the BSC to deref the pointer. The other option would
be to include the gsm_data.h in the mncc.h header and have
the method as inline.
2011-01-06 14:52:50 +01:00
Holger Hans Peter Freyther
59234a3eb2 mncc: Switch the header file from u_int to uint
Include stdint.h to have the C99 data types.
2011-01-06 14:52:50 +01:00
Holger Hans Peter Freyther
6c4d2443b4 rtp: Move the RTP Proxy code out of RSL into the BSC/MSC domain
Instead of creating the sockets in the RSL code we will do this
in the CRCX_ACK, MDCX_ACK, DLCX_IND signal handler of gsm_04_08.
Introduce a handover signal so we can repatch the RTP sockets in
the gsm_04_08 as well.
2011-01-06 14:31:16 +01:00
Harald Welte
04d362f79d fix spelling mistake in log message 2011-01-01 17:28:55 +01:00
Harald Welte
6349b7f15e re-order the sequence of events in bsc_api:handle_release()
This should make sure conn->lchan is valid throughout the release
cause, especially make trau_mux_unmap() happy that conn->lchan
still exists.
2011-01-01 17:28:49 +01:00
Harald Welte
624e89d3f7 [db] Fix double-quoting in libdbi backend 2011-01-01 17:28:43 +01:00
Harald Welte
b854b29e32 MNCC: avoid segfault in DEBUGP due to non-existing conn->lchan 2011-01-01 17:28:38 +01:00
Harald Welte
f0901f0067 [SGSN] Fix processing of RA Update Request regarding TLLI
In case we get a RA UPD REQ on a new cell (both served by the same
SGSN), the LLC stack should not allocate a ne LLE/LLME, as the latter
would reset the V(u)sent / V(u)recv to zero and make the MS discard
our responses.

Instead, whenever the LLC stack sees a foreign TLLI, it should always
convert it to the local TLLI before doing any lookup for a LLE/LLME.
2011-01-01 17:28:29 +01:00
Harald Welte
91c59c8cb5 MNCC: fix copy+paste mistake in log message and change it to DEBUG 2011-01-01 17:23:43 +01:00
Harald Welte
eb76c7a93f mncc_sock: Fix potential segfault in case MNCC app dies
We create a loop by not setting trans->callref = 0 before calling
trans_free(), as the latter would again send a MNCC_REL_IND up
the stack.

Also: Fix memory leak in case we try to read from mncc_sock
but socket is just gone.
2011-01-01 17:23:43 +01:00
Harald Welte
0d6f930785 mncc_sock: Use proper logging directives and levels, don't printf. 2011-01-01 17:23:43 +01:00
Harald Welte
02d9966053 MNCC: Introduce bsc_hack argument '-m' for enabling MNCC socket 2011-01-01 17:23:42 +01:00
Harald Welte
ea057d9350 mncc_sock: Add new 'mncc handler' function
This adds mncc_sock_from_cc() as a handler function for CC messages
to be passed to the MNCC interface.  If there is no MNCC socket
registered, we immediately release any CC related messages.

Together with flushing all established CC transaction at MNCC socket
close time, this ensures that all resources are released and no
new resources can be established until the MNCC applicaiton has
re-attached.
2011-01-01 17:23:42 +01:00
Harald Welte
29b64e9708 MNCC: pass the actual 'struct msgb' down the mncc_recv() callback
this is required as we no longer have a dequeue-handler that can take
care of free()ing the message after passing it to the MNCC handler.
2011-01-01 17:23:42 +01:00
Harald Welte
04dc88fb9d GSM 04.08 / MNCC interface: verbuse logging of incoming MNCC primitives 2011-01-01 17:23:42 +01:00
Harald Welte
371efe5955 mncc_sock: Clear all calls if MNCC application (LCR) disconnects 2011-01-01 17:23:42 +01:00
Harald Welte
49a2ddeec0 mncc_sock: Add an assert() in case our queue peek trick goes wrong 2011-01-01 17:23:42 +01:00
Harald Welte
e8e432dd59 MNCC: remove 'upqueue'
The MNCC messages now again get directly handled by the net->mncc_recv()
callback.  If the callee wants to put them in a queue, it' his business
to do that.
2011-01-01 17:23:42 +01:00
Harald Welte
fea236e27c MNCC: move cc_tx_to_mncc() from gsm_data.h into mncc.c 2011-01-01 17:23:41 +01:00
Harald Welte
31bbbf4e52 MNCC socket: Export MNCC interface via unix domain socket
Using this code we will soon be able to use LCR or other MNCC
applications via a unix domain socket.

The code is not actually used yet after this patch.
2011-01-01 17:23:41 +01:00
Harald Welte
76556376c3 MNCC: rename mncc_send() to mncc_tx_to_cc()
This name clearly indicates: MNCC api transmits to Call Control,
i.e. down from the L4/application into the L3 04.08 code.
2011-01-01 17:23:41 +01:00
Harald Welte
3e6376d20d MNCC: split into generic mncc.c and mncc_builtin.c
The built-in code to handle call switching inside OpenBSC is
now in mncc_builtin.c, whereas some core/utility functions remain
in mncc.c
2011-01-01 17:23:41 +01:00
Harald Welte
081e14d071 MNCC: make get_call_ref() function static 2011-01-01 17:23:41 +01:00
Harald Welte
e6da14fde4 MNCC: clarify naming / rename mncc_recv() to int_mncc_recv()
the int_ perfix (internal) symbolizes that this is the internal
MNCC handler code, receiving messages from the MNCC interface point.
2011-01-01 17:23:41 +01:00
Harald Welte
54209c2dce MNCC: rename mncc_upq_enqueue() to cc_tx_to_mncc()
The new function name clearly indicates: The Call Control
(TS 04.08, msc-side in OpenBSC) wants to transmit something to the
MNCC interface.
2011-01-01 17:23:41 +01:00
Harald Welte
9af6ddfcec License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00
Holger Hans Peter Freyther
08eebd59b7 lchan: Every SS_LCHAN signal now sends a struct lchan_sig_data
The SS_LCHAN signals now always include the lchan_sig_data. For
the measurement report it will optionally include the measurement
report as well. Attempt to update all handlers of this signal as well
2010-12-27 13:32:20 +01:00
Holger Hans Peter Freyther
9ae7b29e3a bsc: Some S_LCHAN signals don't provide an lchan
Check the signal and only continue if it is any of the
signals we want to handle. In the case of measurement
reports we would cast some random code to a lchan.
2010-12-27 12:30:12 +01:00
Holger Hans Peter Freyther
59f787a4c1 auth: Release the security operation after we sent out a message
The release might release the lchan we want to send the response
on. Reorder the code to first send the message and then give up
the security operation which might release the lchan.
2010-12-27 10:58:55 +01:00
Holger Hans Peter Freyther
8ce8d3a00d bsc: Avoid crashing when no lchan is present in the subscriber connection
If someone wants to send a message but we have no lchan anymore
we will now complain, delete the message and return.
2010-12-27 10:58:55 +01:00
Sylvain Munaut
cfcf7e84bd gsm_04_08_utils: Fix Channel Request mode for e0/e0 and neci=1
According to the specs (GSM 04.08 Table 9.9), the only possibility
if neci=1 and this cause is used is "Originating call and TCH/F is
needed"

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-27 00:59:23 +01:00
Holger Hans Peter Freyther
f64a20f2e8 db: Quote the IMEI string before passing it into the database. 2010-12-26 21:19:29 +01:00
Holger Hans Peter Freyther
9d3e2ec698 ho: Access the network after we are known to have an entry. 2010-12-26 21:19:29 +01:00
Holger Hans Peter Freyther
c839667324 ho: Set the conn to NULL before calling lchan_release
In case we fail to activate the lchan set the connection to
NULL before calling the lchan release function.
2010-12-26 21:19:28 +01:00
Harald Welte
019d0167b6 [db] Properly quote name and extension for SQL access 2010-12-26 19:20:15 +01:00
Harald Welte
c728eeaf9b SGSN: Avoid duplicate MM contexts in case MS and SGSN disagree on P-TMSI 2010-12-26 19:20:07 +01:00
Harald Welte
a9b473a3c2 SGSN: Implement network-initiated PDP CTX DEACT when GGSN restarts
If the GGSN restarts, its restart counter will increase.  We can
detect that and accordingly release/delete all PDP contexts for
that GGSN.
2010-12-26 19:20:03 +01:00
Harald Welte
3357add225 SGSN: some more comments 2010-12-26 19:19:56 +01:00
Holger Hans Peter Freyther
c407ba5ed2 Merge branch 'zecke/sms-queue' 2010-12-26 09:42:19 +01:00
Holger Hans Peter Freyther
5479fc80d5 sms: Make sure that this loop is broken from time to time. 2010-12-26 09:40:49 +01:00
Holger Hans Peter Freyther
203845730f sms: Rewrite the queue to find SMS harder.
With the old code it was possible that we first saw SMS that
we have already in the queue. In that case we had free slots
available but have not filled them. With his new loop we try
harder to find SMS we can send, it attempts (and should work)
to detect a loop to break the loop before finding SMS to deliver.
2010-12-26 09:40:48 +01:00
Holger Hans Peter Freyther
f7e2389eb6 sms: Move the finding of the next SMS to handle to a new method
Prepare changing the loop to fill all the available slots. Set
the last subscriber based on the SMS query.
2010-12-26 09:40:48 +01:00
Holger Hans Peter Freyther
a37e3bc39a sms: Change the default values for the sms_queue
Increase the number of SMS we will try to send at a time and
decrease the failures we handle before going to the next item. With
the default timeout we will attempt to page the subscriber for 60
seconds and we can increase the queue speed by going to the next
item faster.
2010-12-26 09:40:48 +01:00
Holger Hans Peter Freyther
a3a659ba5c sms: Workaround a bug in the db layer and update the data
The sync with the database might fail. Reread the updated
subscriber after we have written it. The source of this
failure is unknown.
2010-12-26 09:40:48 +01:00
Holger Hans Peter Freyther
445e615d03 sms: Always go through the database and the smsqueue to send messages
This is also fixing a memory and subscriber leak. Make sure to
always release the gsm_sms structure.
2010-12-26 09:40:48 +01:00
Holger Hans Peter Freyther
994dcbb201 sms: Allow setting amount of failures through the vty. 2010-12-26 09:40:30 +01:00
Holger Hans Peter Freyther
7e59c83d66 sms: Make the amount of failures configurable as well. 2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
4dcc5e5f8a sms: Add vty command to clear the pending message 2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
3c6f6c25a6 sms: Make the max_pending tunable via a vty runtime setting
Make it possible to change the max pending via the vty. This
can be useful to play with the performance of the queue.
2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
7a0e166fb0 sms: Add vty command to trigger running the queue.
Allow to manually trigger running the queue. This can be useful
if SMS were manually added to the database or such.
2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
81c0e2582f sms: Provide some simple vty command for the state of the SMS queue 2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
17164061a6 sms: Begin sending SMS messages, handle failures
The sms queue will attempt to send one SMS per subscriber
to fill all the available slots. It will handle the case
where paging has not started, timed out or if there was
any kind of other failure. It is also retransmitting SMS
in case of failures.
2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
11b28f9c26 sms: Introduce a SMS queue that will be responsible for delivery
The SMSqueue will be responsible of sending to the user. It will
do so in a loop and will also try not to overload the BTS. This
means the throughput of SMS will be limited.
2010-12-26 09:40:03 +01:00
Holger Hans Peter Freyther
04144c1905 sms: Create signal data for SMS with more information
This is providing access to the paging result, the sms,
the transaction. This will allow the SMS queue to do
decisions based on the source of the failure.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
0eb7666efa sms: Dispatch a failed signal in many of the MT-sms points
This attempts to dispatch a signal whenever a MT-sms is failing. In
some cases, e.g. with freeing the transaction, this will also happen
for MO-sms.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
41c5aaf62c sms: Use the SMS in the signals where it makes sense.
The signal_data was inconsistent. Sometimes we passed the transaction
and sometimes we passed the sms. Change it to always pass the sms. The
S_SMS_SMMA is a bit special as it does not involve any SMS.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
69ac83dd54 sms: Add a simple SystemTap probe to see SQL queries
This will proble all queries done in the system. This can
help to identify some issues with libdbi's performance.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
9d277d3b33 sms: Add a script to query for unsent SMS
This is generating the query statement. It can be used to
play with database indexes and such.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
e3018c7ad6 sms: Add dummy script to create subscribers and SMS
This is creating 1000 subscribers and 30 SMS each. The SMS
itself is badly formatted (not a valid 7bit encoding) but
it should be enough for a stress test.
2010-12-26 09:40:02 +01:00
Holger Hans Peter Freyther
dd715bd2ee sms: Fix a small typo. 2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
73b878a85a db: Introduce a limit in delivery attempts for the SMS search
We do not want to attempt submitting SMS that has failed for
too many times. The failure could be due RF failure or due
a bug in the message handling.
2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
812dad0ff7 db: Add method to load a SMS by id. 2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
e25445b864 subscr: Sync the database before sending the attached signal
If a signal handler accesses the database he will still see
the old lac. Make sure he is seeing the new one. Update the
subscriber from the database in case the query failed or other
things have changed.
2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
3d76e44968 subscr: Print the lac of the subscriber. 2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
d3baf415b1 paging: Introduce a GSM_PAGING_BUSY event for a special timeout
Start counting the attempts of each paging request and call
the callback with the PAGING_BUSY type when the paging request
timed out but the subscriber was not paged at all. This can
only happen with a huge paging backlog.
In case the system has so many pending paging
2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther
ee139e7253 Merge branch 'zecke/subscr' 2010-12-24 21:43:14 +01:00
Holger Hans Peter Freyther
abd0cac0c5 subscr: Add a VTY command to update the subscriber from the database. 2010-12-24 21:40:48 +01:00
Holger Hans Peter Freyther
c577ca1822 subscr: Add VTY command to purge subscribers that are held in memory
Call the subscr_purge_inactive function and mention how many
subscribers were removed from the RAM.
2010-12-24 21:40:48 +01:00
Holger Hans Peter Freyther
ae9006aeed subscr: Introduce VTY option to keep subscribers in ram. 2010-12-24 21:40:48 +01:00
Holger Hans Peter Freyther
f694d5f47a subscr: Introduce subscr_purge_inactive to free unused subscribers
Introduce a method that will remove all subscribers that have a
zero use count. This is useful if someone wants to purge subscribers
from memory or wants to disable the everything in RAM feature.
2010-12-24 21:40:47 +01:00
Holger Hans Peter Freyther
daee5ca7c1 subscr: Make it possible to keep subscribers in RAM.
This is implemented by not freeing the subscriber when the
reference count becomes smaller than zero. We hope that this
will save many database accesses during the congres.
2010-12-24 21:40:47 +01:00
Harald Welte
a29e43a26f BSC Call Control: Actually implement call statistics
The existing call realated statistics counters apparently were
never used.  This introduces a new set of counters, two for the
MO and MT case.
2010-12-24 16:07:40 +01:00
Harald Welte
75e2defc7f BSC VTY: Print some more of the already-generated statistics 2010-12-24 16:07:35 +01:00
Harald Welte
eafe22ca72 SGSN / GMM: Only allow non-roaming IMSIs
As we do not yet use the HLR from the SGSN, we allow all MS to
attach to our GPRS network.  However, if this is running in a public
environment, it could cause service interruption to users of commercial
GPRS networks.

Thus, we now check if the first 5 digits of the IMSI match the MCC/MNC
of the cell that they want to register to.  Thus, any subscribers with
SIM cards from real operators will no longer be accepted.
2010-12-24 15:42:26 +01:00
Harald Welte
2cafc4b309 BSC API: Make 'Got data in non active state' message as LOGL_INFO
LOGL_ERROR will make this message shpw up in everey default log
config.  However, as it seems, this is commonly observed in case
a MS still sends a MS STATUS (in respons to the MM INFO) at the
end of a location area update.

It might be best to actually change the channel release procedure
to make sure we can still pass such 'late' data to the MSC until
the time the Layer2 has been completely released.
2010-12-24 15:42:22 +01:00
Harald Welte
3a3c277b70 RSL: Make "waiting for SAPI=%d to be released" LOGL_DEBUG 2010-12-24 15:42:17 +01:00
Harald Welte
b29cea1d9c Fix some stupid typos resulting in compile errors. 2010-12-24 12:26:13 +01:00
Harald Welte
712ddbcd72 BSC VTY: Fix off-by-one / segfault in 'show bts NR' 2010-12-24 12:24:03 +01:00
Harald Welte
85bded8b50 BTS VTY: Order bts-trx-ts-lchan in 'show lchan' 2010-12-24 12:22:34 +01:00
Harald Welte
cd103a9a5d BSC VTY: Print the current mode of a dynamic TCH/F / PDCH 2010-12-24 12:14:52 +01:00
Harald Welte
026b4cab36 BSC VTY: Change order of elements in 'show timeslot' command
It's not logical to first show TS, then TRX, then BTS.  It should
always be ordered from big to small (BTS, TRX, TS)
2010-12-24 12:12:10 +01:00
Harald Welte
127af34eea BSC VTY: Remove extraneous 'else' from write_ts_single()
This caused the E1 parameters not to be displayed in case the channel
was using frequency hopping.
2010-12-24 12:07:07 +01:00
Harald Welte
274d015cbb BSC VTY: Fix 'show timeslot' command if BTS and/or TRX are specified 2010-12-24 12:05:03 +01:00
Harald Welte
f6bd340df6 GPRS/GMM: Correctly look up MM Context in RA Update
If a MS changes RA, the RA will arrive in the new cell using the old
TLLI (masked as foreign TLLI).  So we need to look-up the TLLI
in a special way, using the old RA as indicated in the 04.08 GMM
message.

There is still another bug remaining: As we somehow create a new LLC,
the sequence numbers of our responses start from 0 again, which is not
what the MS expects.  This needs to be fixed in a follow-up patch.
2010-12-23 23:38:02 +01:00
Harald Welte
985263e55f GPRS: enhance msgb headroom/tailroom for SGSN (GMM)
In the GPRS NS protocol stack, the amount of NS/BSSGP headers like MS RADIO
CAPA INFO can be quite long.  In order to fit the full user message and
those headers, we have to enlarge the head/tailroom of the msgb allocations.
2010-12-23 23:37:55 +01:00
Harald Welte
082b01f18e More verbose logging of authentication internals 2010-12-23 23:37:49 +01:00
Harald Welte
c9f499f7d3 IMM ASS REJ: Actually add t3122 parsing to vty code 2010-12-23 23:37:45 +01:00
Harald Welte
86dda08762 Authentication: use ENUM instead of magic numbers
This improves readability of the code...
2010-12-23 18:09:51 +01:00
Harald Welte
2862dcac58 Use 04.08 IMM ASS REJECT in case we run out of channels
If the user has a non-zero 'timer t3122' in the config file, we will
send an IMM ASS REJECT in case we run out of resources.
2010-12-23 14:41:50 +01:00
Harald Welte
d0d2b0b605 Dynamic PDC: Add VTY comand 'bts N trx M timeslot O pdch [de]activate'
On a nanoBTS, this command can be used to manually switch a given 'dynamic
pdch/tch' timeslot from one mode into the other.

There are no safeguards that the timeslot is not in use at the given time.
2010-12-23 14:41:44 +01:00
Harald Welte
53cd7ac44c Dynamic PDCH: rsl_ipacc_pdch_activate() operates on a timeslot
... not on the lchan.
2010-12-23 14:41:40 +01:00
Holger Hans Peter Freyther
d4e6872d6c gsm48: Release the LU procedure only after the TMSI REALL_COMPL
We send a LU Accept with the TMSI as the MI. According to the
spec the phone should store this new TMSI and send a TMSI
REALLOCATION COMPLETE to us. We will release the LU then and this
should trigger the release procedure.
2010-12-22 20:25:38 +01:00
Harald Welte
434bb3f39f MNCC: introduce mncc_upq_enqueue() wrapper around msgb_enqueue()
This wrapper will allow us to add queue related code at one single
location in the code as opposed to three locations.
2010-12-22 19:03:40 +01:00
Harald Welte
7ce5e259c9 mnccc.c: Add 2 line header describing what this file is all about 2010-12-22 19:03:40 +01:00
Holger Hans Peter Freyther
f93e8fabd8 gsm48: Use NULL instead of 0 for pointers in C. 2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther
6003d6b928 rsl: Remove unimplemented/unused rsl_paging_cmd_subscr
RSL should not know the details of a GSM Subscriber anyway.
2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther
28dcbc5ee5 misc: Remove gsm_subscriber.h from the db.h file
Reduce the dependencies on the header files.
2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther
c5faf66b82 misc: Reorder includes, move osmocore to the end 2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther
3547045c73 misc: Remove gsm_subscriber.h include to reduce dependencies. 2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther
e2fee354cf misc: Include abis_rsl.h to remove some compiler warnings
This was introduced by a recent change to gsm_data.h to include
less header files. We really need to access the RSL information
here so it is fine to include the file.
2010-12-22 18:26:36 +01:00
Harald Welte
c7782dec4a gsm48_tx_release_compl(): Don't use transaction after trans_free()
In commit 39e2eadc99 a bug was introduced
that used the 'trans' after trans_free() had already been called.

This became visible now when the openbsc+lcr combination was calling
an unknown/invalid telephone number in a MO call, resulting in
a segfault.
2010-12-21 19:33:19 +01:00
Holger Hans Peter Freyther
ceeddf87f5 Merge branch 'zecke/e1_speed' 2010-12-21 13:54:45 +01:00
Holger Hans Peter Freyther
d49fc5ae24 ts: Reduce the delay to 0 for OML and RSL
This is possible after not sending more than one OML command that
requires an extra ACK. For the RSL line we do not need any speed
limitation.
2010-12-21 13:53:42 +01:00
Holger Hans Peter Freyther
d85642a1a7 ts Make the e1inp_ts delay configurable
Currently the nanoBTS bootstrap code requires a high delay
otherwise we are not bringing the device up properly. Changing
the init code turns out harder than it seems like. So this is
a workaround for that to allow a high speed RSL/OML connection
after the bringup.

The line driver can have a default TS delay. It is set to the
current default for the nanoBTS and the BS11. For the ipaccess
case we will set the delay lower for the RSL connection and
inside the ipaccess-config we can set it low right away to
have fast firmware flashing and such.
2010-12-21 13:53:41 +01:00
Holger Hans Peter Freyther
6f615551a4 abis_nm: Band aid on OML initialisation by queuing messages
Instead of sending many messages we will queue the OML
messages and wait for the ACK/NACK before sending the
next message from the queue. We tag the msgb to remember
if we need to wait for an ack or not.

We keep the order of all messages, on ACKs and similiar
occassions we will drown the queue until we reach a message
that needs to be acked and then wait for that ack again.

Possible breakage can appear when we send an OML (e.g.
BS11 specific message) msg which does not need to be acked
through the abis_nm_sendmsg call. The fix will be to use
the _direct version of this method.

Re-Enable as it might have fixed something... who knows.

Conflicts:

	openbsc/include/openbsc/abis_nm.h
	openbsc/include/openbsc/gsm_data.h
	openbsc/src/abis_nm.c
	openbsc/src/gsm_data.c
2010-12-21 13:53:41 +01:00
Holger Hans Peter Freyther
39e6ba09c2 oml: In case we get a NACK, drop the OML connection and hope for the best
Assume that a NACK is a onetime failure and that on the next
attempt it will work better. If that is not the case we might
even send a reboot to the BTS.
2010-12-21 13:53:41 +01:00
Holger Hans Peter Freyther
c7a1a1fd2e oml: Another band aid for reliable BTS init...
Sometimes the operative change for the NSE is getting nacked,
this might be due that we send it before we get the OPSTART ACK
for this object class. Send it from the CELL availability as
a workaround. This init code needs to be changed to make these
dependencies work more reliable.
2010-12-21 13:53:41 +01:00
Holger Hans Peter Freyther
d9cdd056ff test: Make it compile but it is segfaulting on start now 2010-12-21 13:43:52 +01:00
Holger Hans Peter Freyther
2391b4c474 ho: On ho failure clear the subscriber connection
Forget about the ho_lchan inside the gsm_subscriber_connection
in case of a handover failure, also clear the gsm_subscriber_connection
pointer before the lchan is passed to the lchan_free routine.
2010-12-21 13:41:33 +01:00
Holger Hans Peter Freyther
90cdd28e6f ho: Make this allocation a child of the BSC talloc context
Do not use the NULL context for this allocation. It should hang
off the gsm_subscriber_connection but for now at least make it
the child of the BSC so it is showing up in the talloc report.
2010-12-21 13:41:33 +01:00
Harald Welte
63dbfc6a2b bsc_vty: Fix unknown 'use-dtx' config parser error
commit 5a3a61d88f introduces a DTX attribute
which is parsed as dtx-used, but written as use-dtx (and thus causes a parser
error).
2010-12-15 15:34:23 +01:00
Harald Welte
f604bba026 osmo-bsc: Make it compile against paging_request_stop() api change
The additional msgb argument was introduced by Sylvain in
c7ff2572a7
2010-12-15 15:33:08 +01:00
Harald Welte
ec073e9f5b bs11_config: more verbose output of ACK/NACK responses 2010-12-14 13:34:35 +01:00
Harald Welte
230cd6a720 bs11_config: fix help message about multi-drop (not 'port') 2010-12-14 13:28:43 +01:00
Harald Welte
5f5189e658 bs11_config: update copyright statement 2010-12-14 13:14:32 +01:00
Harald Welte
f751a10018 bs11_config: show the BPORT0 / BPORT1 configuration in 'query'
This introduces abis_nm_bs11_get_bport_line_cfg() and a parser for the result.
2010-12-14 12:52:16 +01:00
Harald Welte
7e72fa0250 bs11_config: Add option to set BPORT1 in multi-drop mode 2010-12-14 12:35:59 +01:00
Dieter Spaar
df30d40b98 Add mandatory routeing area IE to SUSPEND-NACK 2010-12-12 15:46:00 +01:00
Sylvain Munaut
98b53cba06 include: Add proper predeclaration for struct in mncc.h
We use them, so declare them. (avoid including all gsm_data.h)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:27 +01:00
Sylvain Munaut
81a8bf1039 include: Small fixes to gsm_data.h
We don't really need openbsc/gsm_04_08.h or abis_rsl.h
But we do need some definition from libosmocore

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:27 +01:00
Sylvain Munaut
12e373c218 include: Add proper predeclaration for struct in system_information.h
We use them, so declare them. (avoid including all gsm_data.h)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:26 +01:00
Sylvain Munaut
3f16da2032 include: Add proper predeclaration for struct in abis_rsl.h
We use them, so declare them. (avoid including all gsm_data.h)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:26 +01:00
Sylvain Munaut
8a31a3fcee paging: Dispatch the SS_PAGING signals at the MSC code level
This way the channel is fully ready for use.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:26 +01:00
Sylvain Munaut
5a86e06eb3 auth/ciph: Enable securing of channel directly after paging response
This protects MT services

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 23:04:26 +01:00
Sylvain Munaut
0fbfd1bb52 gsm_04_08: Make gsm48_secure_channel available globally
Can't declare it in gsm_04_08.h tough ... gsm_cbfn is defined in
gsm_data.h and trying to include that in gsm_04_08 just creates a
huge mess.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 22:39:40 +01:00
Sylvain Munaut
567c8dc7c9 gsm_04_08: Use subscr_get_channel instead of directly paging_request
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 22:39:40 +01:00
Sylvain Munaut
c7ff2572a7 paging: Give the msgb that caused paging_stop up to the paging callback
The handler might need to know some info of the paging response

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 22:39:40 +01:00
Sylvain Munaut
1e24550d3d gsm_subscriber: Move the get_channel/put_channel logic in MSC part
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 22:39:40 +01:00
Sylvain Munaut
67706df7c2 gsm_04_08: Don't set ciphering manually but call gsm0808_cipher_mode
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 20:36:34 +01:00
Sylvain Munaut
e0b06b0293 bsc: Allow to configure Optional Cell Selection params from vty
The default values are those where the parameters are encoded
as '0' and they're not output in the config file if that case

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-12-01 20:23:34 +01:00
Harald Welte
6d42dbe35c wireshark: port abis_oml.patch to more recent version of wireshark
Some internals of the value_string_extended have changed
2010-12-01 00:04:09 +01:00
Harald Welte
db2c28aef6 wireshark: update HSL patch to add preferences on where to show HSL debug 2010-12-01 00:02:58 +01:00
Harald Welte
318105d58d wireshark: add patch to make IPA ports configurable preferences 2010-12-01 00:02:42 +01:00
Harald Welte
a36f0ede25 wireshark: More work on Ericsson OML (OM2000) dissector
We now decode virtually everything in a RBS startup.
2010-11-29 22:05:34 +01:00
Harald Welte
0326cd5ac9 wireshark: Add initial patch for adding Ericsson OML-in-HDLC-in-L2TP support
This also hooks up the RSL dissector with the Ericsson HLDC
2010-11-29 16:32:47 +01:00
Harald Welte
3b71247cd0 wireshakrk: add patch to display HSL debug messages in log 2010-11-29 15:58:58 +01:00
Holger Hans Peter Freyther
fbceea4f0f bsc: Add a command to set the ussd_welcome_text
Make the USSD welcome text configurable.
2010-11-26 00:12:24 +01:00
Holger Hans Peter Freyther
414bc4a1f4 mid-call: Do not lose the first word of the message 2010-11-26 00:06:58 +01:00
Holger Hans Peter Freyther
cf6f71aa7f mid-call: Make the mid-call behavior the default for switching things off
When switching the RF off we will always go through the grace
period, add a direct off mode to switch it off directly. Make
the query return a 'g' if we are in the process of switching
things over.
2010-11-26 00:06:15 +01:00
Holger Hans Peter Freyther
70c232f75a mid-call: Implement a timer to go from grace to off.
Start the timer... switch it off when we do the final
tranistion by a command.
2010-11-26 00:06:01 +01:00
Holger Hans Peter Freyther
bb62b3f053 mid-call: Rename ussd-grace to mid-call 2010-11-26 00:03:32 +01:00
Holger Hans Peter Freyther
625b6e4dab mid-call: Introduce a timeout to switch from grace to rf off. 2010-11-26 00:02:12 +01:00
Holger Hans Peter Freyther
d283db496f vty: For ipaccess we will dump if the OML connection is present 2010-11-26 00:00:22 +01:00
Holger Hans Peter Freyther
e17c030b76 test: Add shell script to drop the OML in fixed intervals 2010-11-26 00:00:21 +01:00
Holger Hans Peter Freyther
dab8e27755 ipaccess: Fix dropping the OML/RSL connection.
Use the ipaccess_drop_oml and ipaccess_drop_rsl functions
instead of closing the socket and hoping this is picked up
somehow. This just leads to some weird hangs. And gdb was
not really helpful to say where it was coming from.
2010-11-15 20:30:38 +01:00
Holger Hans Peter Freyther
e19d6fc1ee Merge branch 'zecke/osmo-bsc' 2010-11-15 20:07:10 +01:00
Holger Hans Peter Freyther
09a925b117 bsc: Add script to hang up the MSC connection every 58s 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
e9f7a0d3b9 bsc: Add wild scripts to do dial testing with a Motorola A1200 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
b4e72f881c bsc: Implement queuing of messages to the MSC before the con is established 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
16e958dc68 bsc: Use the BSC Filter to stop a paging_request 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
9c838ae069 bsc: Implement paging by creating a dummy subscr for the paging
In the future we should avoid using a gsm_subscriber at all
and pass the imsi/tmsi to the paging function directly. For
now we can use the old model for paging and go through the
gsm_subscriber. This has the benefit of load balancing on
the BTS and such.
2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
b79c3c97a2 bsc: The ip.access rtp-payload has no useful meaning
Sending this as the RTP_PAYLOAD2 will produce a MDCX NACK
as we send the RTP_PAYLOAD in the CRCX. It does not seem to
be necessary to send anything != 0 for the RTP_PAYLOAD2.
2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
620c2e678a bsc: Add thr audio module to send the MDCX message to the BTS 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
dbc698aef0 bsc: Implement DTAP coming from the MSC and forward to the BSC API 2010-11-15 20:06:50 +01:00
Holger Hans Peter Freyther
50c579b8c5 bsc: Implement the assignment command to the point of calling into the BSC API 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
fae3c65938 bsc: Parse the cipher mode command and pass it to the BSC api. 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
f1f57a84c1 bsc: Parse the CLEAR COMMAND and close the lchan and ack that 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
863a55d44d bsc: Make bsc_queue_for_msc work on the osmo_bsc_sccp_con
The gsm_subscriber_connection can die before the SCCP connection
so we should work on the osmo_bsc_sccp_con.
2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
890dfc58ed bsc: Work on paging and parsing other messages
The paging is not implemented due bad/missing API in the
BSC API, the rest are simple stubs to be merged from the
on-waves/bsc-master.
2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
3485feb49b bsc: Add module for handling BSSAP input
The current implementation is a stub. The code from
bssap.c of on-waves/bsc-master will be migrated into
this new structure
2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
cf256d678f bsc: Implement sending a SCCP CR with the complete layer3 data 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
933daaa016 bsc: Implement SCCP connection confirmed handling. 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
af4b5fb13e bsc: Implement clearing the SCCP connection 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
57d304871e bsc: Implement writing out UDT messages to a MSC Connection 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
00f4cc22c8 bsc: Implement closing the connections when the MSC goes missing
Refactor the closing code of the CC timeout to a new function,
also make sure that the SCCP Connection is forced closed before
we destruct the connection for real.
2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
ca5c022a32 bsc: Implement sending a message toward the MSC. 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
c97d9b4df1 bsc: Implement a CC timeout and the IT timeout, prepare the timers 2010-11-15 20:06:49 +01:00
Holger Hans Peter Freyther
7e9010892d bsc: Make open/close work on the sccp data 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
b8781d2cd5 bsc: Start to open a SCCP connection and prepare timers and such. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
9b17c769b9 bsc: Work a bit on opening the SCCP connection to the MSC.
Most of the code is still stubs but the structure is a lot
cleaner than the one in the on-waves/bsc-master branch.
2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
2a8675e49a bsc: Add a mobile country code setting for the backbone. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
52d42abdb7 bsc: Implement scanning and changing messages from the MSC
This will change the LAI of a LU accept message to the LAI
used for the on-air network. It will also detect when to
send a welcome ussd to the subscriber.
2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
a54732d19d bsc: Add a method to scan messages coming from the MSC. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
d65305f5b4 bsc: Look for location updating requests in messages
Introduce the SCCP connection data and remember that
we were seeing a location updating request from a
different LAC.
2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
5bb874d2f5 bsc: Add a hook where we can scan for LU and other messages. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
cc48fb8083 bsc: Call into the SCCP layer to create a new connection. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
46c5ab3624 bsc: Reduce duplication with a macro. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
e46f1d6cc4 bsc: Implement sending an assignment failure 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
c2b3270e93 bsc: Send a Clear Reques on RF Failures to the MSC. 2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
c8166f3a91 bsc: Implement sending a SAPI n Reject.
It is not clear that the link_id is setup correctly here.
2010-11-15 20:06:48 +01:00
Holger Hans Peter Freyther
58f2cf6494 bsc: Implement the DTAP callback and forward the data to the MSC 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
da488ae343 bsc: Implement sending the assignment complete to the network 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
2d2c910f2c bsc: Implement sending a Cipher Mode Complete message 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
4582586e24 bsc: Add a method that will queue the message on a MSC connection. 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
7225fd18e0 bsc: Add some basic checks to see if a SCCP connection is established 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
1999cf11b9 bsc: Complain about unimplemented stuff. 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
77cd95d5b5 bsc_api: Implement the assignment command for the BSC. 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
f05750ca24 bsc_api: Rework the signal handler to be extendable 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
abf962b096 bsc_api: Clear lchan->conn on lchan_release
Set conn to NULL before starting the release procedure, remove
code to check for a lchan->conn as it can not happen. If there
are any memleaks we will notice them.
Detach the lchan->conn from the channel before detaching.
2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
8d216c7756 bsc_api: Clear the conn->lchan before calling subscr_con_free 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
a2e5cb8601 bsc_api: Clear the conn of the failed lchan to avoid a runtime warning 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
a2828fa4bc bsc_api: Set the lchan->conn to NULL in all of the cases 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
088dde8173 bsc_api: Send a channel modify when we already have a TCH. 2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
7e50c8140b bsc_api: Plug a theoretical window for the RLL callbacks
The timedout could come between lchan_release and the
S_CHALLOC_FREED signal. In the future we might want to
use the gsm0808_clear to stop the RLL timeouts and such.
2010-11-15 20:06:47 +01:00
Holger Hans Peter Freyther
8d380dcadd bsc_api: Change submit dtap to allow to automatically use the SACH
For SAPI=3 on a TCH it might be nice to use the SACH to submit
the message. The api allows to automatically use the SACH if
a message like this is submitted.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
2603c1f545 bsc_api: Clarify the parameters of the assignment command 2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
4be7d41a50 bsc_api: Implement sending the cipher mode method
This will set the encryption algorithm, key and then
send the RR Cipher Mode message to the MS. The method
is also verifying the input.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
2f169d64dd bsc_api: Make the cipher_mode take the 'include imei sv' argument
The cipher mode command should enable encryption and send the
right RR message to the other side.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
45b575fd94 bsc_api: The rr_cause is optional, pass it as a pointer 2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
66dcd925c6 bsc_api: Nuke the clear complete from the API.
There is no place where it can be called. Whoever is calling
the gsm0808_clear method should generate the clear complete
as the result.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
46caa3048d bsc_api: Provide the link_id in the dtap callback. 2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
b094171c9f bsc_api: Add needed parameters to the assignment complete callback
Provide the chosen channel and more information in the assignment
complete method.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
e1996f013c bsc_api: The cipher mode is not a message on the air interface
The cipher mode reject will be send in case the BSC is not
able to support the requested cipher. So this reject can be
handled by however attempts to enable ciphering.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
6c199e7d99 bsc_api: Look into the msg and call the right API functions
For certain messages we will need to call other GSM0808 functions. To
keep the bsc_hack working we will try to send this through the normal
messages first and then fallback to dtap if no handler is registered.

The gsm_04_08.c code is not forced to handle the IPA activation
and channel modify ack anymore. This is done transparently by the
BSC API now.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
fce9307553 bsc_api: Change the cause to a uint8_t for now
The RR Cause can only be one byte. Change from uint16_t to uint8_t for that.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
05c68841a8 bsc_api: Fix a use after free error in the Clear Request path
The implementation of bsc_hack would call subscr_con_free before
the BSC API has had the chance to call gsm0808_clear to try to
release other channels. Fix that by adding a return value.
2010-11-15 20:06:46 +01:00
Holger Hans Peter Freyther
85334f1309 paging: Move the paging data into the paging.h 2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
8dfd241bc6 subscr: Add method to find an active subscriber
This is used by the paging code of the osmo_bsc. When we get
a paging response there should be an active subscriber with
the TMSI or IMSI and we can stop paging. There is no need to
allocate a new subscriber.
2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
d740b688dc subscr: Add the subscr_get_or_create from the on-waves/bsc-master branch
Create a subscriber based on a known IMSI, search the list of
active subscribers if there is already someone like this.
2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
928ca743db subscr: Move the TMSI reserved into the gsm_data
Put it into the gsm_data.h to avoid requiring MSC code
in the BSC code paths.
2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
8cc59036e6 rsl: Allow to hardcode the RTP Payload
In case of a inflexible network it is better to hardcode
the rtp payload to a given type. E.g. when using AMR5.9 on
a TCH/F and TCH/H having the same payload is helpful. For
now this will be only used by the osmo-bsc.
2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
ecd94a4b45 misc: Introduce a --enable-coverage mode to build with gprof coverage
This adds a test coverage build. One can use gcov and lcov on the
resulting data afterwards to see which code paths were executed and
which were not.
2010-11-15 20:06:45 +01:00
Holger Hans Peter Freyther
0b369c582b e1_input: Fix compiler warning by using offsetof
Use the offsetof/__builtin_offsetof to determine the
offset of a variable inside a structure instead of going
via a NULL pointer and taking the address.

This fixes:
warning: variably modified ‘dummyhalen_offset’ at file scope
2010-11-09 23:11:29 +01:00
Andreas Eversberg
5652cfc0e8 mark andreas@eversberg.eu as 'extern' for lcr 2010-11-09 13:39:43 +01:00
Holger Hans Peter Freyther
1406977e7e nat: Verify that the endpoint from the assignment command exists
Make sure that the MSC endpoint exists on the NAT, otherwise
we end up trying to free this endpoint when the SCCP connection
is taken down and will corrupt our memory. This issue started
to pop up as we have reduced the number of endpoints to 60
to allow transcoding on them.
2010-11-04 17:14:41 +01:00
Holger Hans Peter Freyther
f3d1ae7072 bsc: Add simple SCCP binding code. 2010-11-03 16:40:03 +01:00
Holger Hans Peter Freyther
0425c38feb bsc: Fix crash when making a MSC connection.
Use the right types that are passed as void..
2010-11-03 14:46:56 +01:00
Holger Hans Peter Freyther
7bf66c5a6e bsc: Add the audio codec list command to list preferred codecs 2010-11-03 13:56:27 +01:00
Holger Hans Peter Freyther
fe16622bf5 bsc: Add the rtp-base command to osmo-bsc 2010-11-03 13:56:26 +01:00
Holger Hans Peter Freyther
45f9e69ac5 bsc: Add the ip.access rtp-payload command known from bsc_msc_ip 2010-11-03 13:56:26 +01:00
Holger Hans Peter Freyther
4de1116356 bsc: Readd the core network code setting
This will instruct the BSC to patch messages and replace
the old network code with the new one.
2010-11-03 13:56:26 +01:00
Holger Hans Peter Freyther
5b848f37cf bsc: Fix the name of the local vty variable. 2010-11-03 13:11:14 +01:00
Holger Hans Peter Freyther
79dcd719e0 Merge branch 'zecke/mgcp-transcoder' 2010-11-02 19:41:42 +01:00
Holger Hans Peter Freyther
8b19dee437 mgcp: Send data from the network to the transcoder too
We now should be able to transcode in both directions.
2010-11-02 19:08:09 +01:00
Holger Hans Peter Freyther
5f2cd84281 mgcp: Use the calculated remote port from the mgcp_rtp_end 2010-11-02 19:08:09 +01:00
Holger Hans Peter Freyther
3f29cc8303 mgcp: Make the transcoding forwarding work for BTS/NET
Share the implementation for the transcoded packets and
forward them to the network and the bts.
2010-11-02 19:08:09 +01:00
Holger Hans Peter Freyther
386a940736 mgcp: Refactor the network binding routines
Create another wrapper function that takes most of
the arguments from the caller.
2010-11-02 19:08:09 +01:00
Holger Hans Peter Freyther
bd7b3c5e45 mgcp: Introduce trans_bts and send BTS packets from this port
Introduce the trans_bts. Right now only a port is allocated
and the packets from the BTS are sent from this socket.
2010-11-02 19:08:09 +01:00
Holger Hans Peter Freyther
e97155a2af mgcp: Keep the local_port like it was set on allocation
Do not reset statically allocated local_port. The port
might be different to the calculation of endpoint number
and base port. This might be the case for the coming remote
transcoding.
2010-11-02 19:06:13 +01:00
Holger Hans Peter Freyther
2126233590 mgcp: Rename transcoder_end to trans_net
Packets arriving for trans_net will be send out to the
networking. We will introduce a trans_bts in a second.
2010-11-01 21:15:55 +01:00
Holger Hans Peter Freyther
88b597e21c mgcp: Allow to disable the transcoder in a running system. 2010-11-01 21:15:55 +01:00
Holger Hans Peter Freyther
b54048fe25 mgcp: Make transcoding a per Endpoint configuration
This allows to switch off transcoding on the fly, or only enable
it for certain vessels with known problems.
2010-11-01 21:15:55 +01:00
Holger Hans Peter Freyther
fbca4ea117 mgcp: Fix the indetion of this code. it should use tabs 2010-11-01 21:15:55 +01:00
Holger Hans Peter Freyther
43eb1a3db0 nat: Send a clear command in case of connection releases.
This should help the BS+ to release RF channels earlier.
2010-10-29 17:05:28 +02:00
Holger Hans Peter Freyther
74779c68f7 nat: Add test case for matching phone numbers
Add the test case for matching '*' and for not matching at all
2010-10-28 15:27:00 +02:00
Holger Hans Peter Freyther
d414c06fd9 nat: Fix a thinko in allowing '*' as a wildcard...
We need to match everything BUT the wildcard and then
do the normal strcmp...
2010-10-28 13:51:28 +02:00
Holger Hans Peter Freyther
732d9c19bf Merge branch 'zecke/number-rewrite' 2010-10-27 12:41:19 +02:00
Holger Hans Peter Freyther
c4fd45ccf1 Merge branch 'zecke/ussd-side-channel' 2010-10-27 12:37:42 +02:00
Holger Hans Peter Freyther
afa5a394ab Require 0.1.27 for the new gsm0808 methods 2010-10-27 12:37:13 +02:00
Holger Hans Peter Freyther
a8a50a87ea nat: Also send a Clear Command in case of the USSD Provider dies 2010-10-27 12:02:21 +02:00
Holger Hans Peter Freyther
54f5352e07 nat: Close SCCP connections when the USSD Provider is closed.
Send a RLSD down to the BSC in case the USSD Provider is gone. It
is not sending a Clear Command and ut depends if the BS+ will
like this kind of behavior. At least the data on the NAT will
be freed soon afterwards due the RLC message.
2010-10-27 11:01:55 +02:00
Holger Hans Peter Freyther
07dfc70276 nat: Make clear where the RLSD is send to
Add a _msc to the method as we will send a RLSD to the
MSC and will add a method to send it down to the BSC
as well.
2010-10-27 10:54:11 +02:00
Holger Hans Peter Freyther
643931db3d nat: Look at the number type to figure out if we want to rewrite it 2010-10-27 10:40:45 +02:00
Holger Hans Peter Freyther
1400310f05 nat: Explain that we do not want to have a + in the replacement rule 2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther
25adfceb3a nat: Add '*' as wildcard for the IMSI matching.
In case any rule has a '*' we will always match this
rule.
2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther
73bbf89245 nat: Implement rewriting, have a very basic test for that feature 2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther
a914daf174 nat: Add hook for rewriting a setup message
Create a new function, hand the data to this function, take back
a possible modified msgb and invalidate parsed at this point.
2010-10-27 10:40:44 +02:00
Holger Hans Peter Freyther
76424392e0 nat: Add vty option for number rewriting
Parse a msg file in case we do have a list.
2010-10-27 10:40:43 +02:00
Holger Hans Peter Freyther
0586b0fa47 [vty] First set of fixes for the oml/rsl con dropping
The code had wrong documentation in the VTY, it crashed
when OML or RSL was not up yet. These issues are fixed
right now.
2010-10-26 09:44:21 +02:00
Holger Hans Peter Freyther
2484ceb2be [vty] Add ipa specific command to provoke failures to test OML/RSL reconnect
We need to simulate OML/RSL failure in an easy and fast way
and adding a command to do so seems like a good way to achieve
this. The command is a bit misplaced, in one way it is no config
and does not belong into the config node but then again it does
not belong into the VIEW_NODE either as it is manipulating content.

On this merge I have changed it to the ENABLE_NODE.
2010-10-26 09:40:13 +02:00
Holger Hans Peter Freyther
f3ca2eeede Merge branch 'zecke/ussd-side-channel' 2010-10-25 21:08:37 +02:00
Holger Hans Peter Freyther
90bbccfca9 nat: Forward the data coming from the USSD module to the BSC. 2010-10-25 21:06:03 +02:00
Holger Hans Peter Freyther
4c401e7a1a nat: Forward extra state and the message to the USSD provider
Forward the SCCP state and the data to the USSD provider,
also mark the connection as local.
2010-10-25 21:06:03 +02:00
Holger Hans Peter Freyther
ec8a4e23d3 ipaccess: Add a structure for informing the USSD provider about the state
This is used to inform the USSD provider about the state of the
connection.
2010-10-25 21:06:03 +02:00
Holger Hans Peter Freyther
c16c2dc5d3 nat: Implement accepting a USSD Provider connection, do authentication 2010-10-25 21:06:03 +02:00
Holger Hans Peter Freyther
64b12924bf nat: Replace the idiom for replacing a string with a function call
Remove a lot of code in favor of a new function that is freeing
the old string and copying the new one. I should have gotten the
context and the strings right.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther
e393f273e7 nat: Keep a ussd token in the config
We will have the USSD provider connecting to us and we
will use the IPA protocol, including the auth mechanism.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther
3229f442f4 nat: Implement the matching of certain USSD messages
Have various checks, check if the IMSI should be handled,
if there is a USSD query set and then decode and compare
the value.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther
c1578bc747 nat: Add an option to set the query string to match
Allow the query string to be set. The ussd matching code
will check for this string and then forward it to the bypass.
2010-10-25 21:04:46 +02:00
Holger Hans Peter Freyther
c1cac1e31a nat: Make the imsi checking function public.
We will use this method in the USSD module to check if the
IMSI should be handled for USSD queries.
2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther
d1effd835f nat: Provide a USSD access list to check for which to play HLR. 2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther
17870cf533 nat: Create a USSD module to filter out USSDs... 2010-10-25 21:04:45 +02:00
Holger Hans Peter Freyther
74dc303134 nat: Introduce a new connection type for Supplementary Services
If we have a CM Service Request we will look into the message
to see if it is a Supplementary Service Activation.
2010-10-25 21:04:44 +02:00
Holger Hans Peter Freyther
a3967579f8 nat: Move the DTAP unpacking into a new method
DTAP unpacking will be used by the USSD checking code
2010-10-21 12:23:27 +02:00
Holger Hans Peter Freyther
749497eeb3 nat: Copy the IMSI, then free it or move the context to the connection
Extract the IMSI from the first message as well and safe it
in the connection structure. The problem is that we do not
have this structure at this point, so we will allocate the
imsi as child of the bsc_connection and then move/steal it.
2010-10-21 12:22:50 +02:00
Holger Hans Peter Freyther
8c78b480f9 nat: Store the IMSI inside the SCCP Connection data
Store the IMSI for the connections that we are tracking,
it will be freed when the normnal SCCP connection is freed.
2010-10-21 12:22:20 +02:00
Holger Hans Peter Freyther
6b03831495 lua: Mention that the code has some bugs... 2010-10-20 19:21:49 +02:00
Holger Hans Peter Freyther
fbf87a502d lua: Search for clear requests from the network as well 2010-10-20 19:21:07 +02:00
Holger Hans Peter Freyther
def777ae7e lua: Check BSSMAP msgtypes in one function.. 2010-10-20 19:21:07 +02:00
Holger Hans Peter Freyther
8bde2ee61f lua: Check for Cipher Mode Reject failures as well 2010-10-20 19:21:07 +02:00
Holger Hans Peter Freyther
bc3d8dd89e lua: Check for assignment failures 2010-10-20 19:21:06 +02:00
Holger Hans Peter Freyther
721c457e61 lua: Check for disconnects with non normal release too 2010-10-20 19:21:06 +02:00
Holger Hans Peter Freyther
e512e3fd2f lua: Fix the indenting of the file 2010-10-20 18:57:17 +02:00
Holger Hans Peter Freyther
7220ca9778 contrib: Add LUA script to store SCCP connections with Errors
Split the trace based on SCCP Connections, in case an error is
detected, the trace will be stored instead of being deleted and
the full log can be viewed afterwards.

Right now only LU Rejects are recognized, but this can be extended
to other things as well.
2010-10-20 16:58:39 +02:00
Holger Hans Peter Freyther
1fd60631f7 nat: Change the order of the DENY/ALLOW rule for the BSC.
Currently it is not is not easily possible to disable
everyone and then only allow certain SIMs. By changing
the order we can do:
	access-list imsi-deny  only-something ^[0-9]*$
	access-list imsi-allow only-something ^123[0-9]*$

and still keep the usecase of only forbidding certain
SIMs on certain LACs. Adjust test case, test that the
other cases are still functional.
2010-10-19 20:55:33 +02:00
Holger Hans Peter Freyther
a25d579ab9 nat: Convert the ip to host order to allow to bind to other ips 2010-10-19 17:48:13 +02:00
Holger Hans Peter Freyther
7e8da1379e nat: Add a method to add a proper message to the queue.
This will be used by the USSD module to forward the data
without creating another copy of the data.
2010-10-19 16:40:34 +02:00
Holger Hans Peter Freyther
3d38742d1c nat: Find a connection by the real ref 2010-10-19 16:40:17 +02:00
Holger Hans Peter Freyther
f961de1108 nat: Use the make_sock routine to listen for incoming connections. 2010-10-19 16:40:04 +02:00
Holger Hans Peter Freyther
a09b966cd4 nat: Use strncmp on the string in case it is not null terminated 2010-10-19 16:39:01 +02:00
Holger Hans Peter Freyther
e383980a7e ipaccess: Make sure the unitid is null terminated
The nanoBTS is sending null terminated strings, make sure they
are really null terminated.
2010-10-14 22:05:52 +02:00
Holger Hans Peter Freyther
d9e81d0fcf ipaccess: Verify that the data fits in the package.
There is something wrong with the code, the length is
here uint8_t but when we generate a IDGET we put it
as 16bit data.
2010-10-14 22:05:44 +02:00
Holger Hans Peter Freyther
949e0ba648 ipaccess: memset the tlv_parsed structure before parsing
Make sure the tlv_parsed structure is initialized properly,
otherwise we might detect a tag that should not be present.
2010-10-14 22:05:34 +02:00
Holger Hans Peter Freyther
69cfa179ef nat: Make the write_queue write callback a public function 2010-10-13 23:56:01 +02:00
Holger Hans Peter Freyther
4d44fc56e7 nat: Make the queue routine work on any write_queue 2010-10-13 23:55:52 +02:00
Holger Hans Peter Freyther
19c530c5e7 ipaccess: Put our extensions to the protocol into the same enum
Rename NAT_IPAC_PROTO_MGCP to IPAC_PROTO_MGCP and place it in
the enum. We need to be prepared to change this number if IPA
is ever going to use it for something else.
2010-10-13 23:55:32 +02:00
Holger Hans Peter Freyther
833fa0bafa Require libosmocore 0.1.24 due the USSD changes. 2010-10-13 14:03:15 +02:00
Holger Hans Peter Freyther
3e9a7f80bd misc: Replace the idiom for replacing a string with a function call
Remove a lot of code in favor of a new function that is freeing
the old string and copying the new one. I should have gotten the
context and the strings right.
2010-10-12 23:31:53 +02:00
Holger Hans Peter Freyther
9ecf678995 socket: Plug resource leak when the listen call is failing. 2010-10-12 23:29:16 +02:00
Holger Hans Peter Freyther
3cb287919e misc: Attempt to determine byte order in a cross-platform way
OSX does not provide an endian.h, use the other header files that
should define/include what we need. Also check that the byteorder
define is available.
2010-10-12 15:41:03 +02:00
Holger Hans Peter Freyther
88a5fa0a75 ussd: Catch up with libosmocore and pass the gsm48_hdr 2010-10-12 15:34:20 +02:00
Holger Hans Peter Freyther
daa0fe7637 ussd: Move the code libosmocore, increase the version number.
Move the code to libosmocore, update the header file and the
version required in the configure.in.
2010-10-10 17:12:05 +02:00
Holger Hans Peter Freyther
0bd60f3317 nat: Allow a BSC to have multiple LACs
Make it possible that one BSC is serving multiple
cells. Introduce a list of lacs, add functions to
manipulate the lists. The current test cases for
paging by lac continue to work.
2010-10-08 22:21:46 +08:00
Holger Hans Peter Freyther
fad0753b34 msc: Only unregister the fd if the fd value is valid.
This makes sure that someone can call bsc_msc_lost multiple times
even if there is no MSC connection. This makes sense as bsc_msc_lost
is public and be called from client code.
2010-10-07 06:07:57 +08:00
Holger Hans Peter Freyther
d4eed5208f msc: Stop the connection timeout when we unregister the bfd
When we dropped the connection... stop the timer as we might
call bsc_unregister_fd twice...
2010-10-07 06:07:42 +08:00
Holger Hans Peter Freyther
85531cc60d misc: Once again go from "On Waves" to "On-Waves"..
Try to get the company name of our sponsor right...
2010-10-06 20:38:36 +08:00
Dieter Spaar
d6613e05d7 [VTY] T3212 scaling is 6 minutes
The scaling of T3212 is in units of 6 minutes, not 10 minutes.
2010-10-05 21:10:55 +02:00
Holger Hans Peter Freyther
0c41b6933e nat: Possible crash fix, only filter non local connections
For local connections con_msc is not set and sending a RLSD
to the network would have ended up in a segfault.
2010-10-06 00:48:36 +08:00
Holger Hans Peter Freyther
e8e41e611f nat: Work around trying to forward a msg to a msc that does not exist
Instead of segfaulting warn the user that the MSC Connection does
not exist...
2010-10-06 00:24:28 +08:00
Holger Hans Peter Freyther
0c35b5bd79 nat: Use the right access list for the stats (found by clang) 2010-10-06 00:18:20 +08:00
Holger Hans Peter Freyther
76c641635b db.h: Move the '*' to the other side for the gsm_subscriber 2010-10-06 00:03:20 +08:00
Holger Hans Peter Freyther
463dc62ae4 nat: Provide statistics about amount of different messages.
Provide simple statistics on how many LUs, Paging Responses
etc. we are seeing in the network.
2010-10-03 19:41:42 +08:00
Holger Hans Peter Freyther
12eb9b7bd9 gsm_04_80: Require libosmocore for creating USSD messages
Use the libosmocore to create USSD messages, increase the
minimum version of libosmocore, add header files, remove
the code.
2010-09-30 18:56:07 +08:00
Holger Hans Peter Freyther
841c2000d3 gsm0408: Reorder the includes, openbsc first, osmocore second 2010-09-30 18:56:06 +08:00
Holger Hans Peter Freyther
c0714b85c3 gsm0480: Reorder the includes, openbsc first, osmocore second 2010-09-30 18:55:55 +08:00
Holger Hans Peter Freyther
ee8849649b nat: Keep track of how many connections we reject
Keep track of how many connections we reject due the IMSI
filter itself or due not being able to parse the message.
2010-09-25 17:58:22 +08:00
Holger Hans Peter Freyther
520c1f12ef nat: Print the statistics of the access-list matches
Print the statistics for the rule matches via the vty.
2010-09-25 16:25:47 +08:00
Holger Hans Peter Freyther
2f1a984d4f nat: Add statistics to the access-list in the NAT
Count how many times we match a BSC or NAT deny. This will
give us the number of how often something should be filtered.
2010-09-25 16:15:23 +08:00
Holger Hans Peter Freyther
568b9682e0 nat: Fix the filter when searching for a identity response
The filter code will return < 0 for error, 0 for unknown
subscriber, 1 for subscriber checked. Use the same if construct
as for the CR message. This should fix passing LU when it
starts with a TMSI of a different network.
2010-09-24 04:52:38 +08:00
Holger Hans Peter Freyther
cf1c8777a4 mgcp: Return 0 in case transcoding is disabled.
In case transcoding is disabled no error has happened, return
a zero. This is fixing starting the nat without transcoding.
2010-09-24 04:41:28 +08:00
Sylvain Munaut
cd8e810302 auth: Fix AuthTupe re-use condition
It's not the key_seq of the last authtuple we must check, but
the one sent by the MS.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-21 19:04:07 +02:00
Sylvain Munaut
0230b34dc5 auth: Fix XOR algorithm
Thanks to the person on the ml that pointed this bug. Sorry I
don't remember who (it was a while ago and somehow didn't got
fixed at that time)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-21 19:03:09 +02:00
Holger Hans Peter Freyther
af8a010448 Merge branch 'zecke/mgcp-transcoder' 2010-09-20 02:59:25 +08:00
Holger Hans Peter Freyther
9aa8a9c5a7 mgcp: Count the packets that arrive on the transcoder 2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
557b1ab15b mgcp: Remove code duplication for filling out the sockaddr_in
Share the send to transcoder sockaddr sending routines.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
f2eedff052 nat: Send a transcoder reset on start up.
The transcoder RESET is using the same extensions to reset all
endpoints on a remote site. This makes sure that all allocations
can be made in a properly configured network.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
b98ba72e0a mgcp: Make the base port of the transcoder configurable
The code assumes a static mapping from endpoint to RTP port,
be able to configure the start of such a mapping.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
3b5e3c4d6f mgcp: Prepare the CRCX/MDCX/DLCX messages for the transcoder.
Send CRCX/MDCX/DLCX to the transcoder, fill out transcoder_end with
the interesting data and hope that it is going to work.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
218f8564e1 mgcp: Forward data from the BTS-in to the transcoder
Bind a new port for the transcoder, forward data from the BTS
to the transcoder, and from the transcoder to the network. Leave
BTS-IN where it is, BTS-OUT can now be after the transcoding took
place. We send the data from the BTS RTP port.

This whole route will be guarded by the transcoder_ip and if it is
NULL (current default) it will not go through the transcoder.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther
54aaa0fbed mgcp: Add ports for the transcoder as well 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
c5f9248c3f mgcp: Share the range parsing code for net/bts 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
a2a10ebf03 mgcp: Add a transcoder-mgw command to store the address 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
985f5694c7 nat: Keep the audio name and default payload around
For all forwarded messages this will not be used, but it is of
use for the transcoding.
2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
249d69a26c nat: Use the write_queue inside the CFG. 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
6f6801066b mgcp: Keep the gw_fd inside the mgcp_config
Move the bfd from a static var into the mgcp_config.
2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther
e02860af00 mgcp: Be able to parse 'sendonly' for the connection mode. 2010-09-20 02:49:09 +08:00
Holger Hans Peter Freyther
0e940e65c7 mgcp: Switch the default audio codec to AMR 2010-09-20 02:48:59 +08:00
Holger Hans Peter Freyther
3c79214727 nat: NULL check the allocation and print a nice warning. 2010-09-20 02:48:43 +08:00
Holger Hans Peter Freyther
e3946f458a mgcp: Remove the hack to remap timeslot one...
The timeslot one is blocked and should not be used, replace the
code with a warning and watch out for it. Tis is most likely due
the uncovered in the previous commit due the wrong TLV definition.
2010-09-20 02:47:34 +08:00
Holger Hans Peter Freyther
cd702379fe nat: Test for a bug inside the TLV definition for GSM 08.08
The 0x1 inside a CIC IE could indicate a new IE... add test data
and test case to verify that the patching works correctly.
2010-09-20 02:47:17 +08:00
Holger Hans Peter Freyther
d2df4cab43 nat: Test the endpoint finding a bit better... 2010-09-20 02:46:57 +08:00
Holger Hans Peter Freyther
adb6e1cce1 janitor: Move the * to the variable name 2010-09-18 06:44:24 +08:00
Holger Hans Peter Freyther
212e105288 db: Declare db_sms_inc_deliver_attempts. 2010-09-17 00:35:46 +08:00
Nico Golde
1e5ed4e893 gsm 04.11: increase the delivery attempt counter for an SMS right away in gsm411_send_sms
Signed-off-by: Holger Hans Peter Freyther <zecke@selfish.org>
2010-09-17 00:34:36 +08:00
Holger Hans Peter Freyther
1f69b4653b bsc: Fix the clear to release resources first, then set to NULL
This is fixing a crash reported by Nico. Somehow I staged an
unfinished version of this code. The crash should be gone.
2010-09-16 22:50:19 +08:00
Nico Golde
f11af07431 gsm_04_11: count SMS delivery attempts for each CP-DATA
Signed-off-by: Holger Hans Peter Freyther <zecke@selfish.org>
2010-09-16 20:54:14 +08:00
Holger Hans Peter Freyther
aaa40b8688 bsc_api: Do not free the subscriber conn on clear and clear request
Do not free the GSM Subscriber Connection when a channel is failing
or if a clear is requested, instead just give up _all_ the channels,
reset them to NULL and free the remaining channels.
2010-09-16 20:53:04 +08:00
Holger Hans Peter Freyther
2f9d1ef39a bsc: Prepare to store the SCCP connection inside the subscriber 2010-09-16 20:53:04 +08:00
Holger Hans Peter Freyther
32aaef689d bsc; Register the BSC API with many blanks. 2010-09-16 17:27:05 +08:00
Holger Hans Peter Freyther
eea5a1bcd6 nat: Fix a crash when a BSC disconnects while a rejected IMSI
When we reject the IMSI we do not have the msc_con set on the
SCCP connection, but we do have a remote_ref. So the nat_send_rlsd
will end up with a crash due the msc_con being zero. Fix the
crash by only sending a released to the MSC when the connection
is not local.
2010-09-16 06:41:09 +08:00
Holger Hans Peter Freyther
4fcce9ea19 nat; Start to use gcc attribute to say that parameter may not be zero
This is an attempt to hint the compiler that it should check
the parameters and warn when something is null. Sadly it does
not work as expected.
2010-09-16 06:33:27 +08:00
Holger Hans Peter Freyther
0d711632f2 msc: Send a signal when the connections to the MSC dropped
Send a signal, this way another module can close all connections
to the MSC and all local channels.
2010-09-16 02:30:36 +08:00
Holger Hans Peter Freyther
e09919bc70 bsc: Reorder the includes... should be alphabetically now 2010-09-16 02:29:45 +08:00
Holger Hans Peter Freyther
6098038968 bsc: Make the write method public it will be used by other modules 2010-09-16 02:22:20 +08:00
Holger Hans Peter Freyther
5832b3e108 bsc: Add code responsible for connecting, reconnecting to the MSC
Add the code that is forwarding data, from and to the MSC, also
handling ping/pong timers and authentication. Hook it into the
osmo_bsc. The code is only compile tested and ported from the
on-waves/bsc-master branch.
2010-09-16 02:16:02 +08:00
Holger Hans Peter Freyther
469692ca47 bsc: Initialize the MSC data parameters to a sane default 2010-09-16 02:16:02 +08:00
Holger Hans Peter Freyther
79f763fe91 bsc: Keep all active subscriber connections in a list. 2010-09-16 02:16:02 +08:00
Holger Hans Peter Freyther
a2aedad005 bsc: Move the subscriber_con code into the bsc_api 2010-09-16 02:16:01 +08:00
Holger Hans Peter Freyther
1502ddefac chan_alloc: Allocate a subscriber connection as child of the network
Due handover we might leave the BTS and if we ever allocate/release
a BTS dynamically we have a problem here.
2010-09-16 02:16:01 +08:00
Holger Hans Peter Freyther
bd76fab9cb bsc: Add the osmo_bsc_grace from the on-waves/bsc-master branch
The grace code will decide if a given connection is allowed to
be made or if it is going to be rejected. For active connections
it is going to send a USSD message.
2010-09-16 00:20:56 +08:00
Holger Hans Peter Freyther
0ab63d73c1 bsc: Move the gsm_04_80.c code into the libbsc.a 2010-09-16 00:20:19 +08:00
Holger Hans Peter Freyther
7a1591b3cf osmo_rf: Keep the current policy inside the RF struct..
Keep a back pointer to the rf struct inside the connection,
resolve the network through the back pointer. Also assume
that the RF is on. In case we start with RF locked, the policy
is on but we will not see any MS talking to us.
2010-09-16 00:10:18 +08:00
Holger Hans Peter Freyther
9a8b5ae977 bsc: Move the rf_ctl into the msc data struct 2010-09-15 23:53:54 +08:00
Holger Hans Peter Freyther
47b2601e01 bsc: Register a new MSC group with data for the MSC connection
This group contains everything that is related to the MSC connections.
2010-09-15 23:46:03 +08:00
Holger Hans Peter Freyther
13046202eb bsc: Remove the old msc parameter, everything is in the VTY config now 2010-09-15 22:30:37 +08:00
Holger Hans Peter Freyther
3e8e046ee5 bsc: Create struct osmo_msc_data to hold MSC information, handle signals 2010-09-15 22:29:25 +08:00
Holger Hans Peter Freyther
85804a80d4 nat: Fix the grammar of the sentence for listing open sccp connections 2010-09-15 19:01:31 +08:00
Holger Hans Peter Freyther
a594342f71 Merge branch 'zecke/imsi-filter' 2010-09-15 19:00:53 +08:00
Holger Hans Peter Freyther
09ecda49d7 nat: Check if the connection was filtered before the msc connection
This way we avoid seeing many warnings that we will not forward
data to the MSC. For the con_local connections that is actually
the idea, we will not forward them to the MSC.
2010-09-15 18:58:37 +08:00
Holger Hans Peter Freyther
e8223cae3d nat: Remove debug left overs 2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
ac2763b47e nat: Attempt to disconnect a connection when IMSI filtering happens
Attempt to disconnect the connection and make both sides happy
about this. Right now it only handles the LU and should be extended
to the CM Service Request.
2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
11ebe1bf05 nat: And the sequence number away, making it work more reliable 2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
3268540fc3 nat: Parse the id response, extract the IMSI, compare it
Add a test case and also add a basic check that we got some
size checks correct. The next step is to act on the result.
2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
d880f54f4b nat: Update the test for the new <0,0,1 semantic of the filter function
A test case with a TMSI is missing, this would be needed for
better coverage of the filter test case.
2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
74e0a1b91c nat: Start inspecting every message coming from the BSC for the IMSI
Return early in case the IMSI was already checked, if not we need
to look at the connection and check if the message could contain a
imsi we want/need to filter.
2010-09-15 18:58:36 +08:00
Holger Hans Peter Freyther
909e61fddc nat: Remember if we have check the imsi.
Return -1 if the IMSI should be filtered, 0 if the IMSI could not
be checked and 1 if the IMSI was checked and allowed to pass. In
the future this will be used to inspect every message coming by.
2010-09-15 18:58:35 +08:00
Holger Hans Peter Freyther
3837f99e89 nat: Keep the fiter status in the return message. 2010-09-15 18:58:35 +08:00
Holger Hans Peter Freyther
27640fc255 nat: Improve the log message in case we have SCCP data without a connection
Describe which kind of data we have and where it was coming from
as this makes debugging a bit easier.
2010-09-15 18:58:35 +08:00
Holger Hans Peter Freyther
5f54075a8b vty: Use \r\n in the copyright messages
We should use VTY_NEWLINE but our strings are static, always
use \r\n as unix terminals can handle that as well.
2010-09-11 13:32:30 +08:00
Holger Hans Peter Freyther
38158fb941 bsc: Set the copyright for the real BSC. 2010-09-11 13:28:42 +08:00
Holger Hans Peter Freyther
2e4447baa5 [paging] Implement the counting for TCH/H and TCH/F
Add some code to count TCH/H and TCH/F and also handle
the neci bit of the network. Our channel allocator will
allocate a TCH/F if we request a TCH/H but can not allocate it.
2010-09-06 10:13:23 +08:00
Holger Hans Peter Freyther
e66bf1fd46 [paging] Only page if we have some free channels right now
Only page if we have a load that is acceptable for paging. This
option is off by default, and can be enabled per bts. The idea
is that when we have no resources right now we will not page as
it will only create more RACHs and increase the load.

By default we are keeping the old behavior to always page and
only by changing a setting one is using the new behavior.
2010-09-06 10:13:23 +08:00
Holger Hans Peter Freyther
eb241aa1d5 [paging] Continuisly send paging commands.
Instead of throwing a huge pile of paging commands to the BTS
we will submit one paging command every half second. This way
we can have different messages between the paging commands.

This is done to avoid crashes of the nanoBTS when too much
paging messages are send.
2010-09-06 10:13:23 +08:00
Holger Hans Peter Freyther
78fab29fa1 [paging] When giving credit try to send out paging requests too.
Make sure the paging timer is restarted after giving some credit
and send out paging requests.
2010-09-06 10:13:23 +08:00
Holger Hans Peter Freyther
6410d93cf8 [paging] When we ran down to 0 available paging slots start a credit timer
It might be that we run down to zero available slots but the BTS
might not send us a load indication. This can happen if we think
we send paging requests and the BTS disagrees and considers them
as errors and does not count the paging message.
When we drop to zero we will start a credit timer to give us extra
credit after six seconds, if we get a CCCH load indication before
we will stop the timer.
2010-09-06 10:13:22 +08:00
Holger Hans Peter Freyther
b0e88b8644 vty: Fix build due to merge issue. 2010-09-06 10:13:22 +08:00
Holger Hans Peter Freyther
76fc4a34b8 chan: Add configuration to handle paging any with TCH
It is possible that the MSC is not sending the channel type it
needs for the operations it wants to do. Add a configuration option
to assign a TCH in case of paging any requests. It can be a good
idea to leave SDCCHs free for location updating requests and use
the TCH for SMS-MT and CC-MT.
2010-09-06 09:41:50 +08:00
Holger Hans Peter Freyther
78891078fe chan: Store the to be assigned channel type in the GSM Network.
Store the mapping from request to channel type in the GSM Network
struct as there is some policy involved with handling the request.

E.g. in a half rate network we don't want emergy calls to be getting
a TCH/F, or we want to have a different policy for early/late assignment
of phone calls. Update the table when creating the network and when
the neci is changed.
2010-09-06 09:36:02 +08:00
Holger Hans Peter Freyther
5a3a61d88f bsc_init: Allow DTXu and enable DTXd on RSL (experimental)
Allow the MS to use uplink discontinous transmission by
setting the right bit in the SystemInformation and set
DTXd/DTXu on the RSL channel commands.

This is configurable via dtx-used (0|1) on the network
level and still considered as experimental.
2010-09-06 09:26:27 +08:00
Holger Hans Peter Freyther
457c2a879c [alloc] Assign a TCH for LU when all SDCCHs are occupied.
When the cell becomes visible we will be bombed with location
updating requests and to reduce the load on the network we should
assign as many channels for it as possible. During load peek it
is even more important than to have a spare voice channel and in
general the LU procedure is pretty fast.
2010-09-06 08:58:42 +08:00
Holger Hans Peter Freyther
d368a71398 nat: Use ':' to separate the message and strerror 2010-09-05 08:51:12 +08:00
Holger Hans Peter Freyther
6ffca132c1 vty: CONFIG_NODE is the anchor and should not be treated as config.
This is fixing an assert in vty_go_parent due trying to go from
CONFIG_NODE to the parent.
2010-09-04 11:15:27 +08:00
Holger Hans Peter Freyther
81506b4095 vty: Add the config node code to everyone. 2010-09-04 11:00:01 +08:00
Holger Hans Peter Freyther
6262643b45 channel_release: First attempt to update the doc to new code. 2010-09-03 15:34:12 +08:00
Holger Hans Peter Freyther
afdb522ced Merge branch 'on-waves/nat-alloc-bsc-endpoints' 2010-09-01 19:10:17 +08:00
Holger Hans Peter Freyther
85902a4d4a nat: We have 1 to 31 available to the BSC. 2010-09-01 09:31:46 +08:00
Holger Hans Peter Freyther
f7c86c5b4d nat: Replace the MGCP Endpoint if that is required
Add code to replace the Endpoint number for the mgcp.
2010-08-30 13:44:32 +08:00
Holger Hans Peter Freyther
bf812fa83c nat: Use different static transaction numbers for the DLCX/MDCX message 2010-08-30 12:01:36 +08:00
Holger Hans Peter Freyther
d38aa450d7 nat: Document that the MDCX message is not implemented 2010-08-30 11:58:49 +08:00
Holger Hans Peter Freyther
601180f2d9 nat: Send the right MDCX down the stream 2010-08-29 23:40:33 +08:00
Holger Hans Peter Freyther
7d5bb26fdc nat: Remove the code that is wrongly placed..
i refers to the MSC side of endpoints and not the BSC..
2010-08-29 22:44:10 +08:00
Holger Hans Peter Freyther
8574dcf9da nat: Close the right endpoint down the stream. 2010-08-29 22:39:07 +08:00
Holger Hans Peter Freyther
0d8330c8cc nat: Add vty command to show the endpoint allocation status 2010-08-29 16:36:01 +08:00
Holger Hans Peter Freyther
45fd07dc33 nat: Attempt to assign the BSC Timeslot based on a free list
Do attempt to not reassign an endpoint immediately but go
to the next free one.
2010-08-29 16:35:26 +08:00
Holger Hans Peter Freyther
39cd32e650 nat: Remove the CRCX value from the nat
Assume that if the MSC has assigned a timeslot/multiplex it will
also be used for the MGCP. So we just assume that it was allocated
on the BSC as well... in the worse case we will send a DLCX downstream
but it should be fine.
2010-08-29 16:35:25 +08:00
Holger Hans Peter Freyther
c021fbe603 nat: Reindent the code, no functional change 2010-08-29 16:35:25 +08:00
Holger Hans Peter Freyther
f4b3439206 nat: Make the code work in terms of endpoints instead of timeslot/multiplex
We are going to have more than one trunk, so all code hardcoding the
multiplex to zero must go. Avoid this kind of problem by saving the
MGCP endpoint number and comparing that.
2010-08-29 16:35:24 +08:00
Holger Hans Peter Freyther
591003328d nat: Use the bsc_timeslot when talking to the BSC downstream 2010-08-29 16:35:24 +08:00
Holger Hans Peter Freyther
82049d8141 mgcp: Add method to go back from endpoint to multiplex/timeslot 2010-08-29 16:35:23 +08:00
Holger Hans Peter Freyther
cb8c35cd51 mgcp: Speculative mgcp fix...
We really have 32 channels per multiplex... so use the right
number... or at least it seems we do have 32.
2010-08-29 16:35:22 +08:00
Harald Welte
9ae28a128a [gprs] Add option parsing to SGSN 2010-08-27 09:26:44 +02:00
Harald Welte
0e6be0e8f8 debian: add init script, /etc/default file and example config files 2010-08-27 09:09:40 +02:00
Harald Welte
2c67f47dba debian: make more dependencies explicit in 'control' file 2010-08-27 09:09:40 +02:00
Holger Hans Peter Freyther
7a2c86b67d vty: Provide a is_config_node for the VTY and use it for the bsc
Right now only bsc_hack and osmo_bsc need to have a custom
config handling as they use the subscr/oml nodes.
2010-08-26 16:55:37 +08:00
Harald Welte
2c869efcd3 Introduce '-D' commandline option to daemonize processes
This uses the osmo_daemonize() function of libosmocore >= 0.1.18,
and is now implemented for bac_nat, osmo-bsc, bsc_hack, osmo-gbproxy
and bsc_mgcp.  This means only osmo-sgsn is missing, which currently
has no option parsing at all.
2010-08-25 19:43:54 +02:00
Harald Welte
305e2906aa debian: don't buld arch-independent packages with executables in them 2010-08-25 13:57:22 +02:00
Harald Welte
ba43969832 debian: don't use override_dh_* for lenny compatibility 2010-08-25 13:54:58 +02:00
Harald Welte
5c55c4901d debian: add build dependency to pkg-config 2010-08-25 12:59:29 +02:00
Harald Welte
11e79bdbbb debian: add runtime dependency to libdbd-sqlite3 2010-08-25 12:58:32 +02:00
Harald Welte
3edb60de7e debian: add build dependency to libdbi0-dev 2010-08-25 12:58:32 +02:00
Holger Hans Peter Freyther
4dc025b4a8 bsc_init: Compare it with the right enum type
In both cases the int value was zero, so it actually worked
2010-08-25 12:33:57 +08:00
Harald Welte
640d72ab3b Add 'debian' directory containing debian packaging information 2010-08-24 15:33:04 +02:00
Harald Welte
2a90a25c93 Add gprs_sndcp.h to noinst_HEADERS 2010-08-24 13:59:08 +02:00
Holger Hans Peter Freyther
e0009f10ca gsm48: Add method to send a separate facility message...
Send a facility messages with notifySS/CNAP as payload
to the phone... the function is not called from anywhere
in the tree yet but I use it locally.
2010-08-12 01:44:57 +08:00
Harald Welte
c1fa794ed5 [GPRS NS] Fix memory leak in gprs_ns_sendmsg() error path
When gprs_ns_sendmsg() succeeds in sending the message, we free()d the
msgb after transmitting it on the socket.  However, if the NS-VC is
blocked or some other error condition exists, we returned an error
code but didn't free the msgb.

This resulted in an error leak which is now being addressed.
2010-08-09 21:15:40 +08:00
Holger Hans Peter Freyther
5508fe3320 mgcp: Add a vty command to free a given endpoint. 2010-08-08 16:39:57 +08:00
Holger Hans Peter Freyther
9e9392d5b3 mgcp: Use transient errors in more cases... 2010-08-08 16:24:48 +08:00
Holger Hans Peter Freyther
e378cb1341 mgcp: Reduce the log level to debug for these calls. 2010-08-06 20:22:23 +08:00
Holger Hans Peter Freyther
da340638fd nat: Do not report paging to every BTS... 2010-08-06 20:15:40 +08:00
Holger Hans Peter Freyther
7d47601a35 nat: In case the downstream fails on a CRCX, ask it to do a DLCX
If the CRCX is failing, we will send a DLCX downstream and the next
time the callagent tries to do a CRCX we will be more lucky. This is
for the case where we have an endp allocated.
2010-08-06 19:16:34 +08:00
Holger Hans Peter Freyther
39a97e24fb mgcp: Remember if the endpoint was allocated...
Do not use the CI_UNUSED to decide if an endpoint is allocated
but introduce a new flag. This way only the CRCX and free_endp
play with the allocated field.
2010-08-06 18:03:11 +08:00
Holger Hans Peter Freyther
869e38eced mgcp: Add a callback to inform the client that an endpoint got reallocated 2010-08-06 17:54:27 +08:00
Holger Hans Peter Freyther
c2ff55475e nat: Use the state information for the callback. 2010-08-06 09:07:20 +08:00
Holger Hans Peter Freyther
5b2726e6b5 nat: Keep the state (CRCX,MDCX,DLCX) of the operation..
This will allow to have additional debug information and to
use the state inside the forwarding code.
2010-08-06 09:07:07 +08:00
Holger Hans Peter Freyther
b84b5f61ac nat: Free the endpoint when we get an empty CI.
In case the BSC is sending us an empty/unused CI we have
a bug, but for now let us free the endpoint and figure out
which response we are getting.
2010-08-06 08:34:46 +08:00
Holger Hans Peter Freyther
4634013cde mgcp: Make the CI uint32_t all the way to avoid mismatch 2010-08-06 08:29:37 +08:00
Holger Hans Peter Freyther
9c31cfc3a2 nat: Provide information of when a msg does not contain a CI
When we fail to find a CI in a message that should contain it
then print the message so we can analyze the issue and improve
the code later on.
2010-08-06 08:19:05 +08:00
Holger Hans Peter Freyther
52ccf6a480 mgcp: Fix discovering the RTCP port with the more strict check.
If we have found the BTS and we receive data on the RTCP port
from the IP of the BTS we will set our RTCP port and forward it
to the network and hope it will be useful.
2010-08-06 07:49:57 +08:00
Holger Hans Peter Freyther
0d44eb6a24 mgcp: Determine the proto properly... 2010-08-06 07:49:57 +08:00
Holger Hans Peter Freyther
e2170a9f03 bsc_msc: Remove the except code as it is wrong...
Remove wrong code that is luckily not called. We would end up
in a reconnect and attempt to bsc_fd_register the same socket
again. I am removing this part of the code as it is not used
and it would need to know if the fd has ever been registered
or not...
2010-08-06 07:49:57 +08:00
Holger Hans Peter Freyther
7fe2a3d293 mgcp: Add instrumentation code to find a possible port leak/bsc-fd corruption 2010-08-06 07:18:22 +08:00
Holger Hans Peter Freyther
414bf401c7 mgcp: Move the mgcp_free_endp into the right path for the CRCX failure 2010-08-06 07:05:13 +08:00
Holger Hans Peter Freyther
6f36e92cab mgcp: Fix a filedescriptor leak in case the bind is failing. 2010-08-06 03:00:17 +08:00
Holger Hans Peter Freyther
0e01d09500 mgcp: Enable the tap after configuring it... 2010-08-06 02:05:15 +08:00
Holger Hans Peter Freyther
260d6ed02c mgcp: Add a call tap feature to forward audio to another forward port
For debugging it is useful to forward (tee) UDP packets to another
system and use gstreamer to inspect the rtp stream. This is untested
code and might contain bugs.... and of course only tap your own calls.
2010-08-06 01:12:21 +08:00
Holger Hans Peter Freyther
6357a8e311 mgcp: Patch RTP packets again if that is allowed. 2010-08-05 20:08:22 +08:00
Holger Hans Peter Freyther
a39ddd5654 mgcp: Get the for network/for bts flag right. 2010-08-05 19:35:44 +08:00
Holger Hans Peter Freyther
ea97fbf1a1 mgcp: Be more strict on the source addr/source port of the bts
Once we have discovered the bts we will not accept data from
anything else. The call will drop if the BTS is changing the
ip address of the nat anyway.
2010-08-05 19:35:44 +08:00
Holger Hans Peter Freyther
b97c50db0a mgcp: Only discover the bts once, the extra check got lost 2010-08-05 19:35:44 +08:00
Holger Hans Peter Freyther
d5e6c2374b nat: Use the mgcp_config_alloc to have defaults initialized
Initialize the net_base properly and benefit from future
config changes but also reset certain defauls that we do
not want at the nat.
2010-08-05 19:17:25 +08:00
Holger Hans Peter Freyther
f138f917ec mgcp: Allow to dynamically allocate ports from a range..
Allow to switch to a dynamic port allocator and not reuse
the ports for a long time... This should help with a crazy
network sending two streams at the same time.
2010-08-05 08:08:17 +08:00
Holger Hans Peter Freyther
1be9f2fddc mgcp: Allow to have a different port allocation mode 2010-08-05 07:20:09 +08:00
Holger Hans Peter Freyther
15e7389cf0 mgcp: Prepare to have different port allocation strategies. 2010-08-05 07:10:56 +08:00
Holger Hans Peter Freyther
a3b46c9ac0 mgcp: Fix the signature of the change_cb to not carry the port. 2010-08-05 07:09:14 +08:00
Holger Hans Peter Freyther
e602cd6988 mgcp: Separate recv from net/bts and remove autodetection
This allows a more strict check on the source of RTP messages
and we can more easily reject those. For the BTS without an ip
address we will also update the ip address.
2010-08-05 06:57:29 +08:00
Holger Hans Peter Freyther
1fc432984c mgcp: Move the loopback code into the common send as well. 2010-08-05 06:57:29 +08:00
Holger Hans Peter Freyther
b615164d75 mgcp: Remove the receive code into a new method. 2010-08-05 06:57:29 +08:00
Holger Hans Peter Freyther
84e1c47f74 mgcp: Move the selection of the right source port to a new method 2010-08-05 06:57:28 +08:00
Holger Hans Peter Freyther
314584ab44 mgcp: Allocate a different port for the networking...
Use the right source port when sending the message.
2010-08-05 06:12:02 +08:00
Holger Hans Peter Freyther
196349dda1 mgcp: Rename the base port to bts_base as it will be used for the bts 2010-08-05 06:10:58 +08:00
Holger Hans Peter Freyther
c49212778f mgcp: Move the bfd for rtp/rtcp into the port
Stop using the memset in the mgcp_rtp_end_reset as we
will reset the list pointers and then have a mess..
2010-08-05 06:10:58 +08:00
Holger Hans Peter Freyther
bb89aa1430 mgcp: Make the function internal, only used by the init/config code 2010-08-05 06:10:58 +08:00
Holger Hans Peter Freyther
217d712012 mgcp: Rename the bind method to show it is only binding for the bts port 2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther
f1a168dc20 mgcp: Only use early bind for the BTS socket.
Simplify the code by onlt allowing one way to allocate
a socket.
2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther
58ff219c85 mgcp: Attempt to separate the RTP/RTCP port for the Network and for the BTS
We plan to have two different ports for the network and for the
BTS to avoid detecting the BTS and to dynamically allocate the
port to have old data not go to a new socket.
2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther
a17d701a70 mgcp: Group the state for bts/net into a struct and have two instances
Group the data that each end (network/bts) have into a struct and use
this struct throughout the sourcecode.
2010-08-05 06:10:54 +08:00
Holger Hans Peter Freyther
8b5772ebe4 mgcp: Remove the forwarding mode as it was not used. 2010-08-05 06:10:13 +08:00
Holger Hans Peter Freyther
7f8aec2b2b mgcp: Fix the payload_type... it broke in 7cdc62c012 2010-08-05 06:10:10 +08:00
Holger Hans Peter Freyther
e66cac359e nat: Fix the spelling of that comment. 2010-08-05 06:04:13 +08:00
Holger Hans Peter Freyther
7cdc62c012 mgcp: Fix the reversed net/bts... which has not cause any issue.. 2010-08-04 22:21:40 +08:00
Holger Hans Peter Freyther
c02f11a04f mgcp: Pass the whole endpoint to the patch method. 2010-08-04 22:20:34 +08:00
Holger Hans Peter Freyther
f1f6bba16d mgcp: Fix the order of the arguments... 2010-08-04 22:14:46 +08:00
Holger Hans Peter Freyther
aaf8301a19 mgcp: Print the conn mode as well 2010-08-04 21:52:11 +08:00
Holger Hans Peter Freyther
bb14e62a7f mgcp: Disable the actual patching... this is a temporary hack 2010-08-04 21:52:11 +08:00
Holger Hans Peter Freyther
2f10458831 mgcp: Print the system for the duplicate SSRC... 2010-08-04 21:52:11 +08:00
Harald Welte
6526ca720c ipaccess-config / NWL: Decode + print neighbor cell ARFCNs 2010-08-04 13:14:34 +02:00
Holger Hans Peter Freyther
a64c67dd61 vty: Remove the logging command that is in libosmocore 2010-08-04 06:26:25 +08:00
Holger Hans Peter Freyther
cbfd09843a nat: Show if we are connected to the MSC. 2010-08-04 02:34:10 +08:00
Holger Hans Peter Freyther
a99c5b9d0f nat: Count the number of connects to the MSC. 2010-08-04 02:31:55 +08:00
Holger Hans Peter Freyther
03a0ad08cf nat: Indent the connected... to make it belong to the BSC group 2010-08-04 02:29:03 +08:00
Holger Hans Peter Freyther
62abaded39 bsc_msc: Fix the naming of this function. 2010-08-04 02:27:34 +08:00
278 changed files with 28756 additions and 10842 deletions

0
README Normal file
View File

26
openbsc/.gitignore vendored
View File

@@ -6,9 +6,9 @@ Makefile.in
bscconfig.h
bscconfig.h.in
openbsc.pc
bsc_hack
bsc_msc_ip
src/osmo-nitb/osmo-nitb
bsc_mgcp
src/osmo-bsc/osmo-bsc
*.*~
*.sw?
@@ -30,22 +30,26 @@ stamp-h1
# apps and app data
hlr.sqlite3
bs11_config
ipaccess-config
ipaccess-find
ipaccess-firmware
ipaccess-proxy
isdnsync
bsc_nat
osmo-sgsn
osmo-gbproxy
src/utils/bs11_config
src/ipaccess/ipaccess-config
src/ipaccess/ipaccess-find
src/ipaccess/ipaccess-firmware
src/ipaccess/ipaccess-proxy
src/utils/isdnsync
src/nat/bsc_nat
src/gprs/osmo-sgsn
src/gprs/osmo-gbproxy
src/osmo-bsc_nat/osmo-bsc_nat
#tests
tests/bsc-nat/bsc_nat_test
tests/channel/channel_test
tests/db/db_test
tests/debug/debug_test
tests/gsm0408/gsm0408_test
tests/mgcp/mgcp_test
tests/sccp/sccp_test
tests/sms/sms_test
tests/timer/timer_test
src/openbsc.cfg*

View File

@@ -1,285 +1,624 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. Definitions.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
"This License" refers to version 3 of the GNU Affero General Public License.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
1. Source Code.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The Corresponding Source for a work in source code form is that
same work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
2. Basic Permissions.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Remote Network Interaction; Use with the GNU General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
14. Revised Versions of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
NO WARRANTY
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
END OF TERMS AND CONDITIONS
16. Limitation of Liability.
How to Apply These Terms to Your New Programs
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -287,53 +626,36 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View File

@@ -1,12 +1,13 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
INCLUDES = $(all_includes) -I$(top_srcdir)/include
SUBDIRS = include src tests
SUBDIRS = doc include src tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = openbsc.pc
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen
$(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:

View File

@@ -43,11 +43,15 @@ AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo B
])
AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.15)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.1.9)
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0)
dnl checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
dnl Checks for typedefs, structures and compiler characteristics
@@ -55,13 +59,27 @@ dnl Checks for typedefs, structures and compiler characteristics
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden "
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
AC_COMPILE_IFELSE([char foo;],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
[ AC_MSG_RESULT([yes])
SYMBOL_VISIBILITY="-fvisibility=hidden"],
AC_MSG_RESULT([no]))
CFLAGS="$saved_CFLAGS"
AC_SUBST(SYMBOL_VISIBILITY)
# Coverage build taken from WebKit's configure.in
AC_MSG_CHECKING([whether to enable code coverage support])
AC_ARG_ENABLE(coverage,
AC_HELP_STRING([--enable-coverage],
[enable code coverage support [default=no]]),
[],[enable_coverage="no"])
AC_MSG_RESULT([$enable_coverage])
if test "$enable_coverage" = "yes"; then
COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
AC_SUBST([COVERAGE_CFLAGS])
AC_SUBST([COVERAGE_LDFLAGS])
fi
dnl Generate the output
AM_CONFIG_HEADER(bscconfig.h)
@@ -71,14 +89,27 @@ AC_OUTPUT(
include/openbsc/Makefile
include/Makefile
src/Makefile
src/libtrau/Makefile
src/libabis/Makefile
src/libbsc/Makefile
src/libmsc/Makefile
src/libmgcp/Makefile
src/libcommon/Makefile
src/osmo-nitb/Makefile
src/osmo-bsc/Makefile
src/osmo-bsc_nat/Makefile
src/osmo-bsc_mgcp/Makefile
src/ipaccess/Makefile
src/utils/Makefile
src/libgb/Makefile
src/gprs/Makefile
src/nat/Makefile
src/bsc/Makefile
tests/Makefile
tests/debug/Makefile
tests/gsm0408/Makefile
tests/db/Makefile
tests/channel/Makefile
tests/bsc-nat/Makefile
tests/mgcp/Makefile
doc/Makefile
doc/examples/Makefile
Makefile)

View File

@@ -0,0 +1,170 @@
-- Split trace based on SCCP Source
-- There are still bugs to find... bugs bugs bugs... hmm
do
local function init_listener()
print("CREATED LISTENER")
local tap = Listener.new("ip", "sccp && (ip.src == 172.16.1.81 || ip.dst == 172.16.1.81)")
local sccp_type_field = Field.new("sccp.message_type")
local sccp_src_field = Field.new("sccp.slr")
local sccp_dst_field = Field.new("sccp.dlr")
local msg_type_field = Field.new("gsm_a.dtap_msg_mm_type")
local lu_rej_field = Field.new("gsm_a.dtap.rej_cause")
local ip_src_field = Field.new("ip.src")
local ip_dst_field = Field.new("ip.dst")
--
local bssmap_msgtype_field = Field.new("gsm_a.bssmap_msgtype")
-- assignment failure 0x03
--
--
local dtap_cause_field = Field.new("gsm_a_dtap.cause")
local dtap_cc_field = Field.new("gsm_a.dtap_msg_cc_type")
local connections = {}
function check_failure(con)
check_lu_reject(con)
check_disconnect(con)
check_failures(con)
end
-- cipher mode reject
function check_failures(con)
local msgtype = bssmap_msgtype_field()
if not msgtype then
return
end
msgtype = tonumber(msgtype)
if msgtype == 89 then
print("Cipher mode reject")
con[4] = true
elseif msgtype == 0x03 then
print("Assignment failure")
con[4] = true
elseif msgtype == 0x22 then
print("Clear Request... RF failure?")
con[4] = true
end
end
-- check if a DISCONNECT is normal
function check_disconnect(con)
local msg_type = dtap_cc_field()
if not msg_type then
return
end
if tonumber(msg_type) ~= 0x25 then
return
end
local cause = dtap_cause_field()
if not cause then
return
end
cause = tonumber(cause)
if cause ~= 0x10 then
print("DISCONNECT != Normal")
con[4] = true
end
end
-- check if we have a LU Reject
function check_lu_reject(con)
local msg_type = msg_type_field()
if not msg_type then
return
end
msg_type = tonumber(tostring(msg_type))
if msg_type == 0x04 then
print("LU REJECT with " .. tostring(lu_rej_field()))
con[4] = true
end
end
function tap.packet(pinfo,tvb,ip)
local ip_src = tostring(ip_src_field())
local ip_dst = tostring(ip_dst_field())
local sccp_type = tonumber(tostring(sccp_type_field()))
local sccp_src = sccp_src_field()
local sccp_dst = sccp_dst_field()
local con
if sccp_type == 0x01 then
elseif sccp_type == 0x2 then
local src = string.format("%s-%s", ip_src, tostring(sccp_src))
local dst = string.format("%s-%s", ip_dst, tostring(sccp_dst))
local datestring = os.date("%Y%m%d%H%M%S")
local pcap_name = string.format("alink_trace_%s-%s_%s.pcap", src, dst, datestring)
local dumper = Dumper.new_for_current(pcap_name)
local con = { ip_src, tostring(sccp_src), tostring(sccp_dst), false, dumper, pcap_name }
dumper:dump_current()
connections[src] = con
connections[dst] = con
elseif sccp_type == 0x4 then
-- close a connection... remove it from the list
local src = string.format("%s-%s", ip_src, tostring(sccp_src))
local dst = string.format("%s-%s", ip_dst, tostring(sccp_dst))
local con = connections[src]
if not con then
return
end
con[5]:dump_current()
con[5]:flush()
-- this causes a crash on unpacted wireshark
con[5]:close()
-- the connection had a failure
if con[4] == true then
local datestring = os.date("%Y%m%d%H%M%S")
local new_name = string.format("alink_failure_%s_%s-%s.pcap", datestring, con[2], con[3])
os.rename(con[6], new_name)
else
os.remove(con[6])
end
-- clear the old connection
connections[src] = nil
connections[dst] = nil
elseif sccp_type == 0x5 then
-- not handled yet... we should verify stuff here...
local dst = string.format("%s-%s", ip_dst, tostring(sccp_dst))
local con = connections[dst]
if not con then
return
end
con[5]:dump_current()
elseif sccp_type == 0x6 then
local dst = string.format("%s-%s", ip_dst, tostring(sccp_dst))
local con = connections[dst]
if not con then
print("DON'T KNOW THIS CONNECTION for " .. ip_dst)
return
end
con[5]:dump_current()
check_failure(con)
end
end
function tap.draw()
print("DRAW")
end
function tap.reset()
print("RESET")
end
end
init_listener()
end

View File

@@ -0,0 +1 @@
Some crazy scripts call testing... and MSC link failure simulation

View File

@@ -0,0 +1,8 @@
ABORT BUSY
ABORT 'NO CARRIER'
ABORT 'OK'
'' AT
SAY "Dialing a number\n"
'OK' ATD05660066;

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Evil dial script..
while true;
do
chat -v -f all_dial < /dev/ttyACM0 > /dev/ttyACM0
sleep 5s
chat -v -f hangup < /dev/ttyACM0 > /dev/ttyACM0
sleep 2s
done

View File

@@ -0,0 +1,6 @@
#!/bin/sh
sleep 3
echo "enable"
sleep 1
echo "drop bts connection 0 oml"
sleep 1

View File

@@ -0,0 +1,8 @@
#!/bin/sh
while true;
do
echo "Going to drop the OML connection"
./drop-oml.sh | telnet 127.0.0.1 4242
sleep 58m
done

View File

@@ -0,0 +1,4 @@
TIMEOUT 10
'' ^Z
SAY "Waiting for hangup confirm\n"
'' ATH;

View File

@@ -0,0 +1,8 @@
#!/bin/sh
while true;
do
echo "Kill the osmo-bsc"
/usr/bin/kill -s SIGUSR2 `pidof osmo-bsc`
sleep 58s
done

View File

@@ -0,0 +1,80 @@
-- I count the buffer space needed for LLC PDUs in the worse case and print it
do
local function init_listener()
-- handle the port as NS over IP
local udp_port_table = DissectorTable.get("udp.port")
local gprs_ns_dis = Dissector.get("gprs_ns")
udp_port_table:add(23000,gprs_ns_dis)
-- bssgp filters
local bssgp_pdu_get = Field.new("bssgp.pdu_type")
local bssgp_delay_get = Field.new("bssgp.delay_val")
local llcgprs_get = Field.new("llcgprs")
local pdus = nil
print("START...")
local tap = Listener.new("ip", "udp.port == 23000 && bssgp.pdu_type == 0")
function tap.packet(pinfo,tvb,ip)
local pdu = bssgp_pdu_get()
local len = llcgprs_get().len
local delay = bssgp_delay_get()
-- only handle bssgp, but we also want the IP frame
if not pdu then
return
end
if tonumber(tostring(delay)) == 65535 then
pdus = { next = pdus,
len = len,
expires = -1 }
else
local off = tonumber(tostring(delay)) / 100.0
pdus = { next = pdus,
len = len,
expires = pinfo.rel_ts + off }
end
local now_time = tonumber(tostring(pinfo.rel_ts))
local now_size = 0
local l = pdus
local prev = nil
local count = 0
while l do
if now_time < l.expires or l.expires == -1 then
now_size = now_size + l.len
prev = l
l = l.next
count = count + 1
else
-- delete things
if prev == nil then
pdus = nil
l = nil
else
prev.next = l.next
l = l.next
end
end
end
-- print("TOTAL: " .. now_time .. " PDU_SIZE: " .. now_size)
print(now_time .. " " .. now_size / 1024.0 .. " " .. count)
-- print("NOW: " .. tostring(pinfo.rel_ts) .. " Delay: " .. tostring(delay) .. " Length: " .. tostring(len))
end
function tap.draw()
-- well... this will not be called...
-- for ip,bssgp_histo in pairs(dumpers) do
-- print("IP " .. ip)
-- end
print("END")
end
function tap.reset()
-- well... this will not be called...
end
end
init_listener()
end

View File

@@ -0,0 +1,30 @@
/* make test_regexp */
#include <sys/types.h>
#include <regex.h>
#include <stdio.h>
int main(int argc, char **argv)
{
regex_t reg;
regmatch_t matches[2];
if (argc != 4) {
printf("Invoke with: test_regexp REGEXP REPLACE NR\n");
return -1;
}
if (regcomp(&reg, argv[1], REG_EXTENDED) != 0) {
fprintf(stderr, "Regexp '%s' is not valid.\n", argv[1]);
return -1;
}
if (regexec(&reg, argv[3], 2, matches, 0) == 0 && matches[1].rm_eo != -1)
printf("New Number: %s%s\n", argv[2], &argv[3][matches[1].rm_so]);
else
printf("No match.\n");
regfree(&reg);
return 0;
}

View File

@@ -0,0 +1,66 @@
"I create output for some simple SQL statements for the HLR db"
Eval [
"Create tables if they don't exist"
Transcript show: 'CREATE TABLE SMS (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL,
sent TIMESTAMP,
sender_id INTEGER NOT NULL,
receiver_id INTEGER NOT NULL,
deliver_attempts INTEGER NOT NULL DEFAULT 0,
valid_until TIMESTAMP,
reply_path_req INTEGER NOT NULL,
status_rep_req INTEGER NOT NULL,
protocol_id INTEGER NOT NULL,
data_coding_scheme INTEGER NOT NULL,
ud_hdr_ind INTEGER NOT NULL,
dest_addr TEXT,
user_data BLOB,
header BLOB,
text TEXT);'; nl;
show: 'CREATE TABLE Subscriber (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL,
updated TIMESTAMP NOT NULL,
imsi NUMERIC UNIQUE NOT NULL,
name TEXT,
extension TEXT UNIQUE,
authorized INTEGER NOT NULL DEFAULT 0,
tmsi TEXT UNIQUE,
lac INTEGER NOT NULL DEFAULT 0);'; nl.
"Create some dummy subscribers"
num_sub := 1000.
num_sms := 30.
lac := 1.
Transcript show: 'BEGIN;'; nl.
1 to: num_sub do: [:each |
Transcript show: 'INSERT INTO Subscriber
(imsi, created, updated, authorized, lac, extension)
VALUES
(%1, datetime(''now''), datetime(''now''), 1, %2, %3);' %
{(274090000000000 + each). lac. each}; nl.
].
1 to: num_sms do: [:sms |
1 to: num_sub do: [:sub |
Transcript show: 'INSERT INTO SMS
(created, sender_id, receiver_id, valid_until,
reply_path_req, status_rep_req, protocol_id,
data_coding_scheme, ud_hdr_ind, dest_addr,
text) VALUES
(datetime(''now''), 1, %1, ''2222-2-2'',
0, 0, 0,
0, 0, ''123456'',
''abc'');' % {sub}; nl.
]
].
Transcript show: 'COMMIT;'; nl.
]

View File

@@ -0,0 +1,10 @@
"Query for one SMS"
Eval [
1 to: 100 do: [:each |
Transcript show: 'SELECT SMS.* FROM SMS
JOIN Subscriber ON SMS.receiver_id = Subscriber.id
WHERE SMS.id >= 1 AND SMS.sent IS NULL AND Subscriber.lac > 0
ORDER BY SMS.id LIMIT 1;'; nl.
].
]

View File

@@ -0,0 +1,5 @@
probe process("/usr/lib/libsqlite3.so.0.8.6").function("sqlite3_get_table")
{
a = user_string($zSql);
printf("sqlite3_get_table called '%s'\n", a);
}

11
openbsc/debian/changelog Normal file
View File

@@ -0,0 +1,11 @@
openbsc (0.9.13.115.eb113-1) natty; urgency=low
* New upstream release
-- Harald Welte <laforge@gnumonks.org> Wed, 11 May 2011 18:41:24 +0000
openbsc (0.9.4-1) unstable; urgency=low
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- Harald Welte <laforge@gnumonks.org> Tue, 24 Aug 2010 13:34:24 +0200

1
openbsc/debian/compat Normal file
View File

@@ -0,0 +1 @@
7

44
openbsc/debian/control Normal file
View File

@@ -0,0 +1,44 @@
Source: openbsc
Section: net
Priority: optional
Maintainer: Harald Welte <laforge@gnumonks.org>
Build-Depends: debhelper (>= 7.0.0~), autotools-dev, pkg-config, libgtp, libosmocore-dev, libosmo-sccp-dev, libdbi0-dev
Standards-Version: 3.8.4
Homepage: http://openbsc.osmocom.org/
Vcs-Git: git://bs11-abis.gnumonks.org/openbsc.git
Vcs-Browser: http://openbsc.osmocom.org/trac/browser
Package: osmocom-bsc
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libosmo-sccp
Description: GSM Base Station Controller; BSC-only version of OpenBSC. Needs a real MSC!
Package: osmocom-nitb
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libdbd-sqlite3, libdbi0
Description: GSM Network-in-a-Box, implements BSC, MSC, SMSC, HLR, VLR
Package: osmocom-ipaccess-utils
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore
Description: Command line utilities for ip.access nanoBTS
Package: osmocom-bs11-utils
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore
Description: Command line utilities for Siemens BS-11 BTS
Package: osmocom-sgsn
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore, libgtp
Description: Osmocom Serving GPRS Support Node
Package: osmocom-gbproxy
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore
Description: Osmocom GPRS Gb Interface Proxy
Package: osmocom-bsc-nat
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libosmocore
Description: Osmocom Base Station Controller Network Address Translation

50
openbsc/debian/copyright Normal file
View File

@@ -0,0 +1,50 @@
This work was packaged for Debian by:
Harald Welte <laforge@gnumonks.org> on Tue, 24 Aug 2010 10:55:04 +0200
It was downloaded from:
git://bs11-abis.gnumonks.org/openbsc.git
Upstream Author(s):
Harald Welte <laforge@gnumonks.org>
Dieter Spaar <spaar@mirider.augusta.de>
Holger Hans Peter Freyther <zecke@selfish.org>
Sylvain Munaut <tnt@246tNt.com>
Daniel Willmann <daniel@totalueberwachung.de>
Jan Luebbe <jluebbe@debian.org>
Mike Haben <michael.haben@btinternet.com>
Andreas Eversberg <Andreas.Eversberg@versatel.de>
Copyright:
Copyright (C) 2008-2010 Harald Welte <laforge@gnumonks.org>
Copyright (C) 2008-2009 Dieter Spaar <spaar@mirider.augusta.de>
Copyright (C) 2008-2010 Holger Hans Peter Freyther <zecke@selfish.org>
Copyright (C) 2009-2010 Sylvain Munaut <tnt@246tNt.com>
Copyright (C) 2009-2010 On-Waves
Copyright (C) 2008 Daniel Willmann <daniel@totalueberwachung.de>
Copyright (C) 2008 Jan Luebbe <jluebbe@debian.org>
Copyright (C) 2009 by Mike Haben <michael.haben@btinternet.com>
Copyright (C) 2009 Andreas Eversberg <Andreas.Eversberg@versatel.de>
License:
GNU General Public License, Version 2 or later
The Debian packaging is:
Copyright (C) 2010 Harald Welte <laforge@gnumonks.org>
# Please chose a license for your packaging work. If the program you package
# uses a mainstream license, using the same license is the safest choice.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
# If you just want it to be GPL version 3, leave the following lines in.
and is licensed under the GPL version 3,
see "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.

1
openbsc/debian/docs Normal file
View File

@@ -0,0 +1 @@
README

View File

@@ -0,0 +1,2 @@
/usr/bin/bs11_config
/usr/bin/isdnsync

View File

@@ -0,0 +1 @@
/usr/bin/osmo-bsc_nat

View File

@@ -0,0 +1 @@
doc/examples/osmo-bsc_mgcp

View File

@@ -0,0 +1,2 @@
/usr/bin/bsc_mgcp
/usr/bin/osmo-bsc

View File

@@ -0,0 +1 @@
/usr/bin/osmo-gbproxy

View File

@@ -0,0 +1,3 @@
/usr/bin/ipaccess-config
/usr/bin/ipaccess-find
/usr/bin/ipaccess-proxy

View File

@@ -0,0 +1,2 @@
# Configuration file
CONFIG_FILE="/etc/osmocom/osmo-nitb.cfg"

View File

@@ -0,0 +1 @@
doc/examples/osmo-nitb

156
openbsc/debian/osmocom-nitb.init Executable file
View File

@@ -0,0 +1,156 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: osmo-nitb
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Osmocom GSM network-in-a-box
# Description: A minimal implementation of the GSM Base Station Controller,
# Mobile Switching Center, Home Location regster and all other
# components to run a self-contained GSM network.
### END INIT INFO
# Author: Harald Welte <laforge@gnumonks.org>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=osmo-nitb # Introduce a short description here
NAME=osmo-nitb # Introduce the short server's name here
DAEMON=/usr/sbin/osmo-nitb # Introduce the server's location here
DAEMON_ARGS="-D" # Arguments to run the daemon with
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
DAEMON_ARGS="$DAEMON_ARGS -c $CONFIG_FILE"
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@@ -0,0 +1 @@
/usr/bin/osmo-nitb

View File

@@ -0,0 +1 @@
/usr/bin/osmo-sgsn

View File

@@ -0,0 +1,29 @@
Description: Upstream changes introduced in version 0.9.4-1
This patch has been created by dpkg-source during the package build.
Here's the last changelog entry, hopefully it gives details on why
those changes were made:
.
openbsc (0.9.4-1) unstable; urgency=low
.
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
.
The person named in the Author field signed this changelog entry.
Author: Harald Welte <laforge@gnumonks.org>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- /dev/null
+++ openbsc-0.9.4/.version
@@ -0,0 +1 @@
+0.9.4

View File

@@ -0,0 +1 @@
debian-changes-0.9.4-1

31
openbsc/debian/rules Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# this requires debhelper 7.0.50 or above, which lenny doesn't have yet!
#override_dh_auto_configure:
# dh_auto_configure -- --enable-nat --enable-osmo-bsc
build: build-stamp
build-stamp:
dh build --before configure
dh_auto_configure -- --enable-nat --enable-osmo-bsc
dh build --after configure
touch build-stamp
%:
dh $@

View File

@@ -0,0 +1 @@
3.0 (quilt)

1
openbsc/doc/Makefile.am Normal file
View File

@@ -0,0 +1 @@
SUBDIRS = examples

View File

@@ -31,46 +31,65 @@ GSM 04.08 3.4.13: RR connection release procedure
== Implementation in OpenBSC ==
THIS IS OUTDATED and will be updated...
There are two possible reasons a gsm_subscriber_connection
will be released. One is a network failure, the other is
the completion of an operation/transaction.
=== Failure ===
The BSC API will call the gsm_04_08.c:gsm0408_clear_request callback
and the MSC part will release all transactions, operations and such
and the channels will be released as error case.
=== Success ===
Every time an 'operation' or 'transaction' is finished msc_release_connection
will be called and it will determine if the gsm_subscriber_connection can
be released.
In case it can be released bsc_api.c:gsm0808_clear will be called
which will release all lchan's associated with the connection. For the
primary channel a SACH Deactivate will be send with the release
reason NORMAL RELEASE.
bsc_api.c:gsm0808_clear
* Release a channel used for handover
* Release the primary lchan with normal release, SACH deactivate
chan_alloc.c:lchan_release(chan, sach_deactivate, reason)
* Start release procedure. It is working in steps with callbacks
coming from the abis_rsl.c code.
* Release all SAPI's > 0, wait for them to be released
* Send SACH Deactivate on SAPI=0
* Finally Release the channel
chan_alloc.c:lchan_auto_release()
* checks if use count still > 0 (abort)
* calls gsm48_send_rr_release()
* which calls rsl_deact_sacch()
* calls rsl_release_request()
* which sends RLL Link Release request
RX of RELease INDication:
* call rsl_rf_chan_release() (send RF_CHAN_REL)
* Calls internal rsl_handle_release which might release the RF.
* Informs chan_alloc.c about the release with
rsl_lchan_rll_release.
RX of RELease CONFimem:
* call rsl_rf_chan_release() (send RF_CHAN_REL)
* Calls internal rsl_handle_release which might release the RF.
* Informs chan_alloc.c about the release with
rsl_lchan_rll_release.
* RX of RF_CHAN_REL_ACK
* call lchan_free()
* subscr_put()
* delete release_timer
=== Integration with SMS ===
* RX of CP_ERROR or unimplemented MT
* trigger trans_free() which will lchan_auto_release()
* trigger trans_free() which will msc_release_connection()
* CP TC1* expired while waiting for CP-ACK
* trigger trans_free() which will lchan_auto_release()
* trigger trans_free() which will msc_release_connection()
* RX of RP_ERROR
* trigger trans_free() which will lchan_auto_release()
* trigger trans_free() which will msc_release_connection()
* TX of CP-ACK in MT DELIVER
* trigger trans_free() which will lchan_auto_release()
* trigger trans_free() which will msc_release_connection()
* RX of CP-ACK in MO SUBMIT
* trigger trans_free() which will lchan_auto_release()
* trigger trans_free() which will msc_release_connection()
* RX of RP-ACK in MT DELIVER (and no more messages)
* trigger rsl_release_request() for SAPI3
* RX of RP-SMMA in MT DELIVER (and no more messages)
* trigger rsl_release_request() for SAPI3

View File

@@ -52,10 +52,10 @@ int abis_link_event(int event, void *data);
signal some event (such as layer 1 connect/disconnect) from the
input core to the stack.
int subch_demux_in(mx, const u_int8_t *data, int len);
int subch_demux_in(mx, const uint8_t *data, int len);
receive 'len' bytes from a given E1 timeslot (TRAU frames)
int subchan_mux_out(mx, u_int8_t *data, int len);
int subchan_mux_out(mx, uint8_t *data, int len);
obtain 'len' bytes of output data to be sent on E1 timeslot
Intrface by Input Core for Input Plugins
@@ -112,8 +112,8 @@ struct e1inp_sign_link {
struct llist_head tx_list;
/* SAPI and TEI on the E1 TS */
u_int8_t sapi;
u_int8_t tei;
uint8_t sapi;
uint8_t tei;
}
enum e1inp_ts_type {
@@ -140,7 +140,7 @@ struct e1inp_ts {
union {
struct {
/* mISDN driver has one fd for each ts */
struct bsc_fd;
struct osmo_fd;
} misdn;
} driver;
};
@@ -160,7 +160,7 @@ int e1inp_update_ts(struct e1inp_ts *ts);
/* Receive a packet from the E1 driver */
int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
u_int8_t tei, u_int8_t sapi);
uint8_t tei, uint8_t sapi);
/* Send a packet, callback function in the driver */
int e1driver_tx_ts(struct e1inp_ts *ts, struct msgb *msg)

View File

@@ -0,0 +1,23 @@
CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,'
dist-hook:
for f in $$($(CFG_FILES)); do \
j="$(distdir)/$$f" && \
mkdir -p "$$(dirname $$j)" && \
$(INSTALL_DATA) $(srcdir)/$$f $$j; \
done
install-data-hook:
for f in $$($(CFG_FILES)); do \
j="$(DESTDIR)$(docdir)/examples/$$f" && \
mkdir -p "$$(dirname $$j)" && \
$(INSTALL_DATA) $(srcdir)/$$f $$j; \
done
uninstall-hook:
@$(PRE_UNINSTALL)
for f in $$($(CFG_FILES)); do \
j="$(DESTDIR)$(docdir)/examples/$$f" && \
$(RM) $$j; \
done

View File

@@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver misdn
network
network country code 1
mobile network code 1

View File

@@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver misdn
network
network country code 1
mobile network code 1

View File

@@ -6,6 +6,8 @@ password foo
line vty
no login
!
e1_input
e1_line 0 driver misdn
network
network country code 1
mobile network code 1

View File

@@ -0,0 +1,87 @@
!
! OpenBSC (0.9.11.261-32c0) configuration saved from vty
!!
password foo
!
line vty
no login
!
network
network country code 262
mobile network code 42
short name OpenBSC
long name OpenBSC
auth policy closed
location updating reject cause 13
encryption a5 0
neci 1
paging any use tch 0
rrlp mode none
mm info 0
handover 0
handover window rxlev averaging 10
handover window rxqual averaging 1
handover window rxlev neighbor averaging 10
handover power budget interval 6
handover power budget hysteresis 3
handover maximum distance 9999
timer t3101 10
timer t3103 0
timer t3105 0
timer t3107 0
timer t3109 0
timer t3111 0
timer t3113 60
timer t3115 0
timer t3117 0
timer t3119 0
timer t3122 0
timer t3141 0
dtx-used 1
subscriber-keep-in-ram 0
bts 0
type hsl_femto
band DCS1800
cell_identity 0
location_area_code 1
training_sequence_code 0
base_station_id_code 0
ms max power 15
cell reselection hysteresis 4
rxlev access min 0
channel allocator ascending
rach tx integer 9
rach max transmission 1
hsl serial-number 8303701
neighbor-list mode automatic
gprs mode none
trx 0
rf_locked 0
arfcn 871
nominal power 23
max_power_red 20
rsl e1 tei 0
timeslot 0
phys_chan_config CCCH+SDCCH4
hopping enabled 0
timeslot 1
phys_chan_config TCH/F
hopping enabled 0
timeslot 2
phys_chan_config TCH/F
hopping enabled 0
timeslot 3
phys_chan_config TCH/F
hopping enabled 0
timeslot 4
phys_chan_config TCH/F
hopping enabled 0
timeslot 5
phys_chan_config TCH/F
hopping enabled 0
timeslot 6
phys_chan_config TCH/F
hopping enabled 0
timeslot 7
phys_chan_config TCH/F
hopping enabled 0

View File

@@ -0,0 +1,221 @@
!
! OpenBSC (0.9.11.308-62d46) configuration saved from vty
!!
password foo
!
line vty
no login
!
network
network country code 262
mobile network code 42
short name OpenBSC
long name OpenBSC
auth policy closed
location updating reject cause 13
encryption a5 0
neci 0
paging any use tch 0
rrlp mode none
mm info 0
handover 0
handover window rxlev averaging 10
handover window rxqual averaging 1
handover window rxlev neighbor averaging 10
handover power budget interval 6
handover power budget hysteresis 3
handover maximum distance 9999
timer t3101 10
timer t3103 0
timer t3105 0
timer t3107 0
timer t3109 0
timer t3111 0
timer t3113 60
timer t3115 0
timer t3117 0
timer t3119 0
timer t3122 0
timer t3141 0
dtx-used 0
subscriber-keep-in-ram 0
bts 0
type rbs2000
band GSM900
cell_identity 0
location_area_code 1
training_sequence_code 7
base_station_id_code 63
ms max power 15
cell reselection hysteresis 4
rxlev access min 0
channel allocator descending
rach tx integer 9
rach max transmission 7
oml e1 line 0 timeslot 1 sub-slot full
oml e1 tei 62
neighbor-list mode automatic
gprs mode none
is-connection-list add 4 512 12
is-connection-list add 16 524 12
is-connection-list add 28 536 12
is-connection-list add 40 548 12
trx 0
rf_locked 0
arfcn 55
nominal power 24
max_power_red 12
rsl e1 line 0 timeslot 1 sub-slot full
rsl e1 tei 0
timeslot 0
phys_chan_config CCCH+SDCCH4
hopping enabled 0
e1 line 0 timeslot 1 sub-slot full
timeslot 1
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 2 sub-slot 1
timeslot 2
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 2 sub-slot 2
timeslot 3
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 2 sub-slot 3
timeslot 4
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 3 sub-slot 0
timeslot 5
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 3 sub-slot 1
timeslot 6
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 3 sub-slot 2
timeslot 7
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 3 sub-slot 3
trx 1
rf_locked 0
arfcn 57
nominal power 24
max_power_red 12
rsl e1 line 0 timeslot 4 sub-slot full
rsl e1 tei 1
timeslot 0
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 5 sub-slot 0
timeslot 1
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 5 sub-slot 1
timeslot 2
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 5 sub-slot 2
timeslot 3
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 5 sub-slot 3
timeslot 4
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 6 sub-slot 0
timeslot 5
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 6 sub-slot 1
timeslot 6
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 6 sub-slot 2
timeslot 7
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 6 sub-slot 3
trx 2
rf_locked 0
arfcn 59
nominal power 24
max_power_red 12
rsl e1 line 0 timeslot 7 sub-slot full
rsl e1 tei 2
timeslot 0
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 8 sub-slot 0
timeslot 1
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 8 sub-slot 1
timeslot 2
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 8 sub-slot 2
timeslot 3
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 8 sub-slot 3
timeslot 4
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 9 sub-slot 0
timeslot 5
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 9 sub-slot 1
timeslot 6
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 9 sub-slot 2
timeslot 7
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 9 sub-slot 3
trx 3
rf_locked 0
arfcn 61
nominal power 24
max_power_red 12
rsl e1 line 0 timeslot 10 sub-slot full
rsl e1 tei 3
timeslot 0
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 11 sub-slot 0
timeslot 1
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 11 sub-slot 1
timeslot 2
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 11 sub-slot 2
timeslot 3
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 11 sub-slot 3
timeslot 4
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 12 sub-slot 0
timeslot 5
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 12 sub-slot 1
timeslot 6
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 12 sub-slot 2
timeslot 7
phys_chan_config TCH/F
hopping enabled 0
e1 line 0 timeslot 12 sub-slot 3
e1_input
e1_line 0 driver dahdi

View File

@@ -12,7 +12,7 @@ specific parameters from channel assignment:
hopping sequence generation (6.2.3):
u_int8_t rntable[114] = {
uint8_t rntable[114] = {
48, 98, 63, 1, 36, 95, 78, 102, 94, 73,
0, 64, 25, 81, 76, 59, 124, 23, 104, 100,
101, 47, 118, 85, 18, 56, 96, 86, 54, 2,
@@ -29,15 +29,15 @@ u_int8_t rntable[114] = {
/* mai=0 represents lowest ARFCN in the MA */
u_int8_t hopping_mai(u_int8_t hsn, u_int32_t fn, u_int8_t maio,
u_int8_t t1, u_int8_t t2, u_int8_t t3_)
uint8_t hopping_mai(uint8_t hsn, uint32_t fn, uint8_t maio,
uint8_t t1, uint8_t t2, uint8_t t3_)
{
u_int8_t mai;
uint8_t mai;
if (hsn == 0) /* cyclic hopping */
mai = (fn + maio) % n;
else {
u_int32_t m, m_, t_, s;
uint32_t m, m_, t_, s;
m = t2 + rntable[(hsn xor (t1 % 64)) + t3];
m_ = m % (2^NBIN);

View File

@@ -10,7 +10,9 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \
bss.h gsm_data_shared.h
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
openbscdir = $(includedir)/openbsc

View File

@@ -5,33 +5,32 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _NM_H
#define _NM_H
#include <sys/types.h>
#include <osmocore/tlv.h>
#include <osmocore/protocol/gsm_12_21.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/abis_nm.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
struct cell_global_id {
u_int16_t mcc;
u_int16_t mnc;
u_int16_t lac;
u_int16_t ci;
uint16_t mcc;
uint16_t mnc;
uint16_t lac;
uint16_t ci;
};
/* The BCCH info from an ip.access test, in host byte order
@@ -39,26 +38,22 @@ struct cell_global_id {
struct ipac_bcch_info {
struct llist_head list;
u_int16_t info_type;
u_int8_t freq_qual;
u_int16_t arfcn;
u_int8_t rx_lev;
u_int8_t rx_qual;
uint16_t info_type;
uint8_t freq_qual;
uint16_t arfcn;
uint8_t rx_lev;
uint8_t rx_qual;
int16_t freq_err;
u_int16_t frame_offset;
u_int32_t frame_nr_offset;
u_int8_t bsic;
uint16_t frame_offset;
uint32_t frame_nr_offset;
uint8_t bsic;
struct cell_global_id cgi;
u_int8_t ba_list_si2[16];
u_int8_t ba_list_si2bis[16];
u_int8_t ba_list_si2ter[16];
u_int8_t ca_list_si1[16];
uint8_t ba_list_si2[16];
uint8_t ba_list_si2bis[16];
uint8_t ba_list_si2ter[16];
uint8_t ca_list_si1[16];
};
extern const struct value_string abis_nm_adm_state_names[];
extern const struct value_string abis_nm_obj_class_names[];
extern const struct tlv_definition nm_att_tlvdef;
/* PUBLIC */
struct msgb;
@@ -73,60 +68,58 @@ struct abis_nm_cfg {
extern int abis_nm_rcvmsg(struct msgb *msg);
int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const u_int8_t *buf, int len);
int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len);
int abis_nm_rx(struct msgb *msg);
int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1, u_int8_t i2);
int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state);
int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot,
u_int8_t tei);
int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2);
int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0,
uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state);
int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr,
uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot,
uint8_t tei);
int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot);
uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot);
int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
u_int8_t e1_port, u_int8_t e1_timeslot,
u_int8_t e1_subslot);
int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len);
int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len);
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb);
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
u_int8_t i2, u_int8_t i3, int nack, u_int8_t *attr, int att_len);
int abis_nm_raw_msg(struct gsm_bts *bts, int len, u_int8_t *msg);
uint8_t e1_port, uint8_t e1_timeslot,
uint8_t e1_subslot);
int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len);
int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len);
int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb);
int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1,
uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len);
int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg);
int abis_nm_event_reports(struct gsm_bts *bts, int on);
int abis_nm_reset_resource(struct gsm_bts *bts);
int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname,
u_int8_t win_size, int forced,
uint8_t win_size, int forced,
gsm_cbfn *cbfn, void *cb_data);
int abis_nm_software_load_status(struct gsm_bts *bts);
int abis_nm_software_activate(struct gsm_bts *bts, const char *fname,
gsm_cbfn *cbfn, void *cb_data);
int abis_nm_conn_mdrop_link(struct gsm_bts *bts, u_int8_t e1_port0, u_int8_t ts0,
u_int8_t e1_port1, u_int8_t ts1);
int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0,
uint8_t e1_port1, uint8_t ts1);
int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
u_int8_t test_nr, u_int8_t auton_report, struct msgb *msg);
int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan);
int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class,
uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
uint8_t test_nr, uint8_t auton_report, struct msgb *msg);
/* Siemens / BS-11 specific */
int abis_nm_bs11_reset_resource(struct gsm_bts *bts);
int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin);
int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
u_int8_t idx, u_int8_t attr_len, const u_int8_t *attr);
int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx);
uint8_t idx, uint8_t attr_len, const uint8_t *attr);
int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx);
int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx);
int abis_nm_bs11_delete_object(struct gsm_bts *bts,
enum abis_bs11_objtype type, u_int8_t idx);
int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx);
int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
u_int8_t e1_timeslot, u_int8_t e1_subslot, u_int8_t tei);
enum abis_bs11_objtype type, uint8_t idx);
int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx);
int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port,
uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei);
int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts);
int abis_nm_bs11_get_serno(struct gsm_bts *bts);
int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level);
int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level);
int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx);
int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on);
int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on);
int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on);
int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on);
int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password);
@@ -136,42 +129,36 @@ int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value);
int abis_nm_bs11_get_cclk(struct gsm_bts *bts);
int abis_nm_bs11_get_state(struct gsm_bts *bts);
int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
u_int8_t win_size, int forced, gsm_cbfn *cbfn);
uint8_t win_size, int forced, gsm_cbfn *cbfn);
int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg);
int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport);
int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg);
int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
int abis_nm_bs11_restart(struct gsm_bts *bts);
/* ip.access nanoBTS specific commands */
int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
u_int8_t obj_class, u_int8_t bts_nr,
u_int8_t trx_nr, u_int8_t ts_nr,
u_int8_t *attr, int attr_len);
int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, u_int8_t *attr,
int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type,
uint8_t obj_class, uint8_t bts_nr,
uint8_t trx_nr, uint8_t ts_nr,
uint8_t *attr, int attr_len);
int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr,
int attr_len);
int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx);
int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, u_int8_t obj_class,
u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
u_int8_t *attr, u_int8_t attr_len);
int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class,
uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
uint8_t *attr, uint8_t attr_len);
int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
u_int32_t ip, u_int16_t port, u_int8_t stream);
void abis_nm_ipaccess_cgi(u_int8_t *buf, struct gsm_bts *bts);
int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf);
const char *ipacc_testres_name(u_int8_t res);
uint32_t ip, uint16_t port, uint8_t stream);
void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts);
int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf);
const char *ipacc_testres_name(uint8_t res);
/* Functions calling into other code parts */
enum nm_evt {
EVT_STATECHG_OPER,
EVT_STATECHG_ADM,
};
int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
struct gsm_nm_state *old_state, struct gsm_nm_state *new_state,
struct abis_om_obj_inst *obj_inst);
const char *nm_opstate_name(u_int8_t os);
const char *nm_avail_name(u_int8_t avail);
int nm_is_running(struct gsm_nm_state *s);
int abis_nm_vty_init(void);
void abis_nm_clear_queue(struct gsm_bts *bts);
#endif /* _NM_H */

View File

@@ -0,0 +1,98 @@
#ifndef OPENBSC_ABIS_OM2K_H
#define OPENBSC_ABIS_OM2K_H
/* Ericsson RBS 2xxx GSM O&M (OM2000) messages on the A-bis interface
* implemented based on protocol trace analysis, no formal documentation */
/* (C) 2010-2011 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
enum abis_om2k_mo_cls {
OM2K_MO_CLS_TRXC = 0x01,
OM2K_MO_CLS_TS = 0x03,
OM2K_MO_CLS_TF = 0x04,
OM2K_MO_CLS_IS = 0x05,
OM2K_MO_CLS_CON = 0x06,
OM2K_MO_CLS_DP = 0x07,
OM2K_MO_CLS_CF = 0x0a,
OM2K_MO_CLS_TX = 0x0b,
OM2K_MO_CLS_RX = 0x0c,
};
enum om2k_mo_state {
OM2K_MO_S_RESET = 0,
OM2K_MO_S_STARTED,
OM2K_MO_S_ENABLED,
OM2K_MO_S_DISABLED,
};
struct abis_om2k_mo {
uint8_t class;
uint8_t bts;
uint8_t assoc_so;
uint8_t inst;
} __attribute__ ((packed));
/* on-wire format for IS conn group */
struct om2k_is_conn_grp {
uint16_t icp1;
uint16_t icp2;
uint8_t cont_idx;
} __attribute__ ((packed));
/* internal data formant for IS conn group */
struct is_conn_group {
struct llist_head list;
uint16_t icp1;
uint16_t icp2;
uint8_t ci;
};
extern const struct abis_om2k_mo om2k_mo_cf;
extern const struct abis_om2k_mo om2k_mo_is;
extern const struct abis_om2k_mo om2k_mo_con;
extern const struct abis_om2k_mo om2k_mo_tf;
extern const struct value_string om2k_mo_class_short_vals[];
int abis_om2k_rcvmsg(struct msgb *msg);
extern const struct abis_om2k_mo om2k_mo_cf;
int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_enable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
uint8_t operational);
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts);
int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts);
int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx);
int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx);
int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts);
int abis_om2k_vty_init(void);
struct vty;
void abis_om2k_config_write_bts(struct vty *vty, struct gsm_bts *bts);
#endif /* OPENBCS_ABIS_OM2K_H */

View File

@@ -5,82 +5,83 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _RSL_H
#define _RSL_H
#include <osmocore/protocol/gsm_08_58.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
int rsl_bcch_info(struct gsm_bts_trx *trx, u_int8_t type,
const u_int8_t *data, int len);
int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type,
const u_int8_t *data, int len);
int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr,
u_int8_t act_type,
struct gsm_bts;
struct gsm_lchan;
struct gsm_subscriber;
struct gsm_bts_trx_ts;
int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type,
const uint8_t *data, int len);
int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type,
const uint8_t *data, int len);
int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr,
uint8_t act_type,
struct rsl_ie_chan_mode *chan_mode,
struct rsl_ie_chan_ident *chan_ident,
u_int8_t bs_power, u_int8_t ms_power,
u_int8_t ta);
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type,
u_int8_t ta, u_int8_t ho_ref);
uint8_t bs_power, uint8_t ms_power,
uint8_t ta);
int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type,
uint8_t ta, uint8_t ho_ref);
int rsl_chan_mode_modify_req(struct gsm_lchan *ts);
int rsl_encryption_cmd(struct msgb *msg);
int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
u_int8_t *ms_ident, u_int8_t chan_needed);
int rsl_paging_cmd_subscr(struct gsm_bts *bts, u_int8_t chan_needed,
struct gsm_subscriber *subscr);
int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val);
int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len,
uint8_t *ms_ident, uint8_t chan_needed);
int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val);
int rsl_data_request(struct msgb *msg, u_int8_t link_id);
int rsl_establish_request(struct gsm_lchan *lchan, u_int8_t link_id);
int rsl_relase_request(struct gsm_lchan *lchan, u_int8_t link_id);
int rsl_data_request(struct msgb *msg, uint8_t link_id);
int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id);
int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id);
/* Siemens vendor-specific RSL extensions */
int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
/* ip.access specfic RSL extensions */
int rsl_ipacc_crcx(struct gsm_lchan *lchan);
int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip,
u_int16_t port, u_int8_t rtp_payload2);
int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip,
uint16_t port, uint8_t rtp_payload2);
int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan);
int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan, int act);
int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act);
int abis_rsl_rcvmsg(struct msgb *msg);
unsigned int get_paging_group(u_int64_t imsi, unsigned int bs_cc_chans,
int n_pag_blocks);
unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res);
u_int64_t str_to_imsi(const char *imsi_str);
u_int8_t lchan2chan_nr(const struct gsm_lchan *lchan);
int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t reason);
uint64_t str_to_imsi(const char *imsi_str);
int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason);
int rsl_lchan_set_state(struct gsm_lchan *lchan, int);
/* to be provided by external code */
int abis_rsl_sendmsg(struct msgb *msg);
int rsl_deact_sacch(struct gsm_lchan *lchan);
int rsl_lchan_rll_release(struct gsm_lchan *lchan, u_int8_t link_id);
int rsl_lchan_rll_release(struct gsm_lchan *lchan, uint8_t link_id);
/* BCCH related code */
int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf);
int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf);
int rsl_number_of_paging_subchannels(struct gsm_bts *bts);
int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type,
const uint8_t *data, int len);
int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db);
int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm);

View File

@@ -4,6 +4,13 @@
struct gsm_auth_tuple;
struct gsm_subscriber;
enum auth_action {
AUTH_NOT_AVAIL = 0, /* No auth tuple available */
AUTH_DO_AUTH_THAN_CIPH = 1, /* Firsth authenticate, then cipher */
AUTH_DO_CIPH = 2, /* Only ciphering */
AUTH_DO_AUTH = 3, /* Only authentication, no ciphering */
};
int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple,
struct gsm_subscriber *subscr, int key_seq);

View File

@@ -12,25 +12,24 @@ struct bsc_api {
void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci);
void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint8_t chosen_encr);
void (*cipher_mode_reject)(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint16_t reason);
int (*compl_l3)(struct gsm_subscriber_connection *conn,
struct msgb *msg, uint16_t chosen_channel);
void (*dtap)(struct gsm_subscriber_connection *conn, struct msgb *msg);
void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id,
struct msgb *msg);
void (*assign_compl)(struct gsm_subscriber_connection *conn,
uint16_t rr_cause);
uint8_t rr_cause, uint8_t chosen_channel,
uint8_t encr_alg_id, uint8_t speech_mode);
void (*assign_fail)(struct gsm_subscriber_connection *conn,
uint16_t rr_cause);
void (*clear_request)(struct gsm_subscriber_connection *conn,
uint8_t cause, uint8_t *rr_cause);
int (*clear_request)(struct gsm_subscriber_connection *conn,
uint32_t cause);
void (*clear_compl)(struct gsm_subscriber_connection *conn);
};
int bsc_api_init(struct gsm_network *network, struct bsc_api *api);
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id);
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_type, int audio);
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sach);
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate);
int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
uint8_t *key, int len);
const uint8_t *key, int len, int include_imeisv);
int gsm0808_page(struct gsm_bts *bts, unsigned int page_group,
unsigned int mi_len, uint8_t *mi, int chan_type);
int gsm0808_clear(struct gsm_subscriber_connection *conn);

View File

@@ -5,43 +5,50 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BSC_MSC_H
#define BSC_MSC_H
#include <osmocore/write_queue.h>
#include <osmocore/timer.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/timer.h>
struct bsc_msc_dest {
struct llist_head list;
char *ip;
int port;
int dscp;
};
struct bsc_msc_connection {
struct write_queue write_queue;
struct osmo_wqueue write_queue;
int is_connected;
int is_authenticated;
int first_contact;
const char *ip;
int port;
int prio;
struct llist_head *dests;
void (*connection_loss) (struct bsc_msc_connection *);
void (*connected) (struct bsc_msc_connection *);
struct timer_list reconnect_timer;
struct timer_list timeout_timer;
struct osmo_timer_list reconnect_timer;
struct osmo_timer_list timeout_timer;
};
struct bsc_msc_connection *bsc_msc_create(const char *ip, int port, int prio);
struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
int bsc_msc_connect(struct bsc_msc_connection *);
void bsc_msc_schedule_connect(struct bsc_msc_connection *);

View File

@@ -1,21 +1,20 @@
/*
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010 by On-Waves
* (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010-2011 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@@ -24,35 +23,49 @@
#include "mgcp.h"
#include <sys/types.h>
#include <osmocore/select.h>
#include <osmocore/msgb.h>
#include <osmocore/timer.h>
#include <osmocore/write_queue.h>
#include <osmocore/rate_ctr.h>
#include <osmocore/statistics.h>
#include <osmocom/core/select.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/msgfile.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/statistics.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <regex.h>
#define DIR_BSC 1
#define DIR_MSC 2
#define NAT_IPAC_PROTO_MGCP 0xfc
#define PAGIN_GROUP_UNASSIGNED -1
struct sccp_source_reference;
struct sccp_connections;
struct bsc_nat_parsed;
struct bsc_nat;
struct bsc_nat_ussd_con;
enum {
NAT_CON_TYPE_NONE,
NAT_CON_TYPE_LU,
NAT_CON_TYPE_CM_SERV_REQ,
NAT_CON_TYPE_PAG_RESP,
NAT_CON_TYPE_SSA,
NAT_CON_TYPE_LOCAL_REJECT,
NAT_CON_TYPE_OTHER,
};
/*
* Is this terminated to the MSC, to the local machine (release
* handling for IMSI filtering) or to a USSD provider?
*/
enum {
NAT_CON_END_MSC,
NAT_CON_END_LOCAL,
NAT_CON_END_USSD,
};
/*
* Per BSC data structure
*/
@@ -63,17 +76,23 @@ struct bsc_connection {
int authenticated;
/* the fd we use to communicate */
struct write_queue write_queue;
struct osmo_wqueue write_queue;
/* the BSS associated */
struct bsc_config *cfg;
/* a timeout node */
struct timer_list id_timeout;
struct osmo_timer_list id_timeout;
/* pong timeout */
struct timer_list ping_timeout;
struct timer_list pong_timeout;
struct osmo_timer_list ping_timeout;
struct osmo_timer_list pong_timeout;
/* mgcp related code */
char *_endpoint_status;
int number_multiplexes;
int max_endpoints;
int last_endpoint;
/* a back pointer */
struct bsc_nat *nat;
@@ -92,6 +111,14 @@ enum bsc_cfg_ctr {
BCFG_CTR_NET_RECONN,
BCFG_CTR_DROPPED_SCCP,
BCFG_CTR_DROPPED_CALLS,
BCFG_CTR_REJECTED_CR,
BCFG_CTR_REJECTED_MSG,
BCFG_CTR_ILL_PACKET,
BCFG_CTR_CON_TYPE_LU,
BCFG_CTR_CON_CMSERV_RQ,
BCFG_CTR_CON_PAG_RESP,
BCFG_CTR_CON_SSA,
BCFG_CTR_CON_OTHER,
};
/**
@@ -101,7 +128,6 @@ struct bsc_config {
struct llist_head entry;
char *token;
unsigned int lac;
int nr;
char *description;
@@ -110,17 +136,38 @@ struct bsc_config {
char *acc_lst_name;
int forbid_paging;
int paging_group;
/* audio handling */
int max_endpoints;
/* backpointer */
struct bsc_nat *nat;
struct bsc_config_stats stats;
struct llist_head lac_list;
};
struct bsc_lac_entry {
struct llist_head entry;
uint16_t lac;
};
struct bsc_nat_paging_group {
struct llist_head entry;
/* list of lac entries */
struct llist_head lists;
int nr;
};
/**
* BSCs point of view of endpoints
*/
struct bsc_endpoint {
/* the operation that is carried out */
int transaction_state;
/* the pending transaction id */
char *transaction_id;
/* the bsc we are talking to */
@@ -132,23 +179,35 @@ struct bsc_endpoint {
*/
struct bsc_nat_statistics {
struct {
struct counter *conn;
struct counter *calls;
struct osmo_counter *conn;
struct osmo_counter *calls;
} sccp;
struct {
struct counter *reconn;
struct counter *auth_fail;
struct osmo_counter *reconn;
struct osmo_counter *auth_fail;
} bsc;
struct {
struct counter *reconn;
struct osmo_counter *reconn;
} msc;
struct {
struct osmo_counter *reconn;
} ussd;
};
enum bsc_nat_acc_ctr {
ACC_LIST_BSC_FILTER,
ACC_LIST_NAT_FILTER,
};
struct bsc_nat_acc_lst {
struct llist_head list;
/* counter */
struct rate_ctr_group *stats;
/* the name of the list */
const char *name;
struct llist_head fltr_list;
@@ -177,6 +236,9 @@ struct bsc_nat {
/* access lists */
struct llist_head access_lists;
/* paging groups */
struct llist_head paging_groups;
/* known BSC's */
struct llist_head bsc_configs;
int num_bsc;
@@ -184,13 +246,12 @@ struct bsc_nat {
/* MGCP config */
struct mgcp_config *mgcp_cfg;
struct write_queue mgcp_queue;
uint8_t mgcp_msg[4096];
int mgcp_length;
/* msc things */
char *msc_ip;
int msc_port;
struct llist_head dests;
struct bsc_msc_dest *main_dest;
struct bsc_msc_connection *msc_con;
char *token;
@@ -204,13 +265,47 @@ struct bsc_nat {
/* filter */
char *acc_lst_name;
/* number rewriting */
char *num_rewr_name;
struct llist_head num_rewr;
char *smsc_rewr_name;
struct llist_head smsc_rewr;
char *tpdest_match_name;
struct llist_head tpdest_match;
/* USSD messages we want to match */
char *ussd_lst_name;
char *ussd_query;
regex_t ussd_query_re;
char *ussd_token;
char *ussd_local;
struct osmo_fd ussd_listen;
struct bsc_nat_ussd_con *ussd_con;
/* for maintainenance */
int blocked;
/* statistics */
struct bsc_nat_statistics stats;
};
struct bsc_nat_ussd_con {
struct osmo_wqueue queue;
struct bsc_nat *nat;
int authorized;
struct osmo_timer_list auth_timeout;
};
/* create and init the structures */
struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token, unsigned int lac);
struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token);
struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num);
void bsc_config_free(struct bsc_config *);
void bsc_config_add_lac(struct bsc_config *cfg, int lac);
void bsc_config_del_lac(struct bsc_config *cfg, int lac);
int bsc_config_handles_lac(struct bsc_config *cfg, int lac);
struct bsc_nat *bsc_nat_alloc(void);
struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat);
void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip);
@@ -230,13 +325,15 @@ struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg);
*/
int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed);
int bsc_nat_vty_init(struct bsc_nat *nat);
struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg, int *_lac);
int bsc_nat_find_paging(struct msgb *msg, const uint8_t **,int *len);
/**
* Content filtering.
*/
int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
struct bsc_nat_parsed *, int *con_type);
struct bsc_nat_parsed *, int *con_type, char **imsi);
int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
struct sccp_connections *con, struct bsc_nat_parsed *parsed);
/**
* SCCP patching and handling
@@ -246,36 +343,74 @@ int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *pa
void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed);
struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *);
struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *);
struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *);
/**
* MGCP/Audio handling
*/
int bsc_mgcp_nr_multiplexes(int max_endpoints);
int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length);
int bsc_mgcp_assign(struct sccp_connections *, struct msgb *msg);
int bsc_mgcp_assign_patch(struct sccp_connections *, struct msgb *msg);
void bsc_mgcp_init(struct sccp_connections *);
void bsc_mgcp_dlcx(struct sccp_connections *);
void bsc_mgcp_free_endpoints(struct bsc_nat *nat);
int bsc_mgcp_nat_init(struct bsc_nat *nat);
struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number);
struct msgb *bsc_mgcp_rewrite(char *input, int length, const char *ip, int port);
struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port);
void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc);
int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]);
int bsc_mgcp_extract_ci(const char *resp);
uint32_t bsc_mgcp_extract_ci(const char *resp);
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id);
int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg);
int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg);
/* IMSI allow/deny handling */
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
int bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv) __attribute__ ((warn_unused_result));
struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name);
struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name);
void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst);
struct bsc_nat_acc_lst_entry *bsc_nat_acc_lst_entry_create(struct bsc_nat_acc_lst *);
int bsc_nat_lst_check_allow(struct bsc_nat_acc_lst *lst, const char *imsi);
int bsc_nat_msc_is_connected(struct bsc_nat *nat);
int bsc_conn_type_to_ctr(struct sccp_connections *conn);
struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len);
/** USSD filtering */
int bsc_ussd_init(struct bsc_nat *nat);
int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct msgb *msg);
int bsc_close_ussd_connections(struct bsc_nat *nat);
struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi);
/** paging group handling */
struct bsc_nat_paging_group *bsc_nat_paging_group_num(struct bsc_nat *nat, int group);
struct bsc_nat_paging_group *bsc_nat_paging_group_create(struct bsc_nat *nat, int group);
void bsc_nat_paging_group_delete(struct bsc_nat_paging_group *);
void bsc_nat_paging_group_add_lac(struct bsc_nat_paging_group *grp, int lac);
void bsc_nat_paging_group_del_lac(struct bsc_nat_paging_group *grp, int lac);
/**
* Number rewriting support below
*/
struct bsc_nat_num_rewr_entry {
struct llist_head list;
regex_t msisdn_reg;
regex_t num_reg;
char *replace;
};
void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *);
#endif

View File

@@ -5,25 +5,23 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BSC_NAT_SCCP_H
#define BSC_NAT_SCCP_H
#include <sys/types.h>
#include <osmocom/sccp/sccp_types.h>
/*
@@ -78,11 +76,19 @@ struct sccp_connections {
/* status */
int con_type;
int con_local;
int authorized;
int imsi_checked;
char *imsi;
/* GSM audio handling. That is 32 * multiplex + ts */
int crcx;
int msc_timeslot;
int bsc_timeslot;
/* remember which Transactions we run over the bypass */
char ussd_ti[8];
/*
* audio handling. Remember if we have ever send a CRCX,
* remember the endpoint used by the MSC and BSC.
*/
int msc_endp;
int bsc_endp;
/* timeout handling */
struct timespec creation_time;

View File

@@ -10,10 +10,10 @@ enum bsc_rllr_ind {
BSC_RLLR_IND_TIMEOUT,
};
int rll_establish(struct gsm_lchan *lchan, u_int8_t link_id,
void (*cb)(struct gsm_lchan *, u_int8_t, void *,
int rll_establish(struct gsm_lchan *lchan, uint8_t link_id,
void (*cb)(struct gsm_lchan *, uint8_t, void *,
enum bsc_rllr_ind),
void *data);
void rll_indication(struct gsm_lchan *lchan, u_int8_t link_id, u_int8_t type);
void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type);
#endif /* _BSC_RLL_H */

View File

@@ -0,0 +1,17 @@
#ifndef _BSS_H_
#define _BSS_H_
struct gsm_network;
struct msgb;
/* start and stop network */
extern int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *), const char *cfg_file);
extern int bsc_shutdown_net(struct gsm_network *net);
/* register all supported BTS */
extern int bts_init(void);
extern int bts_model_bs11_init(void);
extern int bts_model_rbs2k_init(void);
extern int bts_model_nanobts_init(void);
extern int bts_model_hslfemto_init(void);
#endif

View File

@@ -4,24 +4,23 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _CHAN_ALLOC_H
#define _CHAN_ALLOC_H
#include "gsm_subscriber.h"
#include "gsm_data.h"
struct gsm_subscriber_connection;
@@ -40,7 +39,7 @@ void ts_free(struct gsm_bts_trx_ts *ts);
struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr);
/* Allocate a logical channel (SDCCH, TCH, ...) */
struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type);
struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger);
/* Free a logical channel (SDCCH, TCH, ...) */
void lchan_free(struct gsm_lchan *lchan);

View File

@@ -1,8 +1,10 @@
#ifndef _CRC24_H
#define _CRC24_H
#include <stdint.h>
#define INIT_CRC24 0xffffff
u_int32_t crc24_calc(u_int32_t fcs, u_int8_t *cp, unsigned int len);
uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len);
#endif

View File

@@ -3,27 +3,31 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _DB_H
#define _DB_H
#include <sys/types.h>
#include "gsm_subscriber.h"
#include <openbsc/gsm_subscriber.h>
struct gsm_equipment;
struct gsm_network;
struct gsm_auth_info;
struct gsm_auth_tuple;
struct gsm_sms;
struct gsm_subscriber;
/* one time initialisation */
int db_init(const char *name);
@@ -31,17 +35,18 @@ int db_prepare();
int db_fini();
/* subscriber management */
struct gsm_subscriber* db_create_subscriber(struct gsm_network *net,
struct gsm_subscriber *db_create_subscriber(struct gsm_network *net,
char *imsi);
struct gsm_subscriber* db_get_subscriber(struct gsm_network *net,
struct gsm_subscriber *db_get_subscriber(struct gsm_network *net,
enum gsm_subscriber_field field,
const char *subscr);
int db_sync_subscriber(struct gsm_subscriber* subscriber);
int db_subscriber_alloc_tmsi(struct gsm_subscriber* subscriber);
int db_subscriber_alloc_exten(struct gsm_subscriber* subscriber);
int db_subscriber_alloc_token(struct gsm_subscriber* subscriber, u_int32_t* token);
int db_subscriber_assoc_imei(struct gsm_subscriber* subscriber, char *imei);
int db_sync_subscriber(struct gsm_subscriber *subscriber);
int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber);
int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber);
int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t* token);
int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char *imei);
int db_sync_equipment(struct gsm_equipment *equip);
int db_subscriber_update(struct gsm_subscriber *subscriber);
/* auth info */
int db_get_authinfo_for_subscr(struct gsm_auth_info *ainfo,
@@ -55,19 +60,21 @@ int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
/* SMS store-and-forward */
int db_sms_store(struct gsm_sms *sms);
struct gsm_sms *db_sms_get(struct gsm_network *net, unsigned long long id);
struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, unsigned long long min_id);
struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id);
struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id, unsigned int failed);
struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr);
int db_sms_mark_sent(struct gsm_sms *sms);
int db_sms_inc_deliver_attempts(struct gsm_sms *sms);
/* APDU blob storage */
int db_apdu_blob_store(struct gsm_subscriber *subscr,
u_int8_t apdu_id_flags, u_int8_t len,
u_int8_t *apdu);
uint8_t apdu_id_flags, uint8_t len,
uint8_t *apdu);
/* Statistics counter storage */
struct counter;
int db_store_counter(struct counter *ctr);
struct osmo_counter;
int db_store_counter(struct osmo_counter *ctr);
struct rate_ctr_group;
int db_store_rate_ctr_group(struct rate_ctr_group *ctrg);

View File

@@ -2,10 +2,10 @@
#define _DEBUG_H
#include <stdio.h>
#include <osmocore/linuxlist.h>
#include <osmocom/core/linuxlist.h>
#define DEBUG
#include <osmocore/logging.h>
#include <osmocom/core/logging.h>
/* Debug Areas of the code */
enum {

View File

@@ -4,10 +4,10 @@
#include <stdlib.h>
#include <netinet/in.h>
#include <osmocore/linuxlist.h>
#include <osmocom/core/linuxlist.h>
#include <openbsc/gsm_data.h>
#include <osmocore/msgb.h>
#include <osmocore/select.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
#include <openbsc/subchan_demux.h>
#define NUM_E1_TS 32
@@ -37,12 +37,12 @@ struct e1inp_sign_link {
struct llist_head tx_list;
/* SAPI and TEI on the E1 TS */
u_int8_t sapi;
u_int8_t tei;
uint8_t sapi;
uint8_t tei;
union {
struct {
u_int8_t channel;
uint8_t channel;
} misdn;
} driver;
};
@@ -66,8 +66,10 @@ struct e1inp_ts {
struct {
/* list of all signalling links on this TS */
struct llist_head sign_links;
/* delay for the queue */
int delay;
/* timer when to dequeue next frame */
struct timer_list tx_timer;
struct osmo_timer_list tx_timer;
} sign;
struct {
/* subchannel demuxer for frames from E1 */
@@ -79,13 +81,17 @@ struct e1inp_ts {
union {
struct {
/* mISDN driver has one fd for each ts */
struct bsc_fd fd;
struct osmo_fd fd;
} misdn;
struct {
/* ip.access driver has one fd for each ts */
struct bsc_fd fd;
struct osmo_fd fd;
} ipaccess;
struct {
/* DAHDI driver has one fd for each ts */
struct osmo_fd fd;
struct lapd_instance *lapd;
} dahdi;
} driver;
};
@@ -93,6 +99,8 @@ struct e1inp_driver {
struct llist_head list;
const char *name;
int (*want_write)(struct e1inp_ts *ts);
int (*line_update)(struct e1inp_line *line);
int default_delay;
};
struct e1inp_line {
@@ -110,22 +118,28 @@ struct e1inp_line {
/* register a driver with the E1 core */
int e1inp_driver_register(struct e1inp_driver *drv);
/* fine a previously registered driver */
struct e1inp_driver *e1inp_driver_find(const char *name);
/* register a line with the E1 core */
int e1inp_line_register(struct e1inp_line *line);
/* ensure a certain line exists, return pointer to it */
struct e1inp_line *e1inp_line_get_create(u_int8_t e1_nr);
/* get a line by its ID */
struct e1inp_line *e1inp_line_get(uint8_t e1_nr);
/* create a line in the E1 input core */
struct e1inp_line *e1inp_line_create(uint8_t e1_nr, const char *driver_name);
/* find a sign_link for given TEI and SAPI in a TS */
struct e1inp_sign_link *
e1inp_lookup_sign_link(struct e1inp_ts *ts, u_int8_t tei,
u_int8_t sapi);
e1inp_lookup_sign_link(struct e1inp_ts *ts, uint8_t tei,
uint8_t sapi);
/* create a new signalling link in a E1 timeslot */
struct e1inp_sign_link *
e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
struct gsm_bts_trx *trx, u_int8_t tei,
u_int8_t sapi);
struct gsm_bts_trx *trx, uint8_t tei,
uint8_t sapi);
/* configure and initialize one e1inp_ts */
int e1inp_ts_config(struct e1inp_ts *ts, struct e1inp_line *line,
@@ -136,20 +150,20 @@ int e1inp_update_ts(struct e1inp_ts *ts);
/* Receive a packet from the E1 driver */
int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
u_int8_t tei, u_int8_t sapi);
uint8_t tei, uint8_t sapi);
/* called by driver if it wants to transmit on a given TS */
struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
struct e1inp_sign_link **sign_link);
/* called by driver in case some kind of link state event */
int e1inp_event(struct e1inp_ts *ts, int evt, u_int8_t tei, u_int8_t sapi);
int e1inp_event(struct e1inp_ts *ts, int evt, uint8_t tei, uint8_t sapi);
/* Write LAPD frames to the fd. */
void e1_set_pcap_fd(int fd);
/* called by TRAU muxer to obtain the destination mux entity */
struct subch_mux *e1inp_get_mux(u_int8_t e1_nr, u_int8_t ts_nr);
struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
int e1inp_line_update(struct e1inp_line *line);
@@ -161,8 +175,14 @@ int e1_reconfig_bts(struct gsm_bts *bts);
int ia_config_connect(struct gsm_bts *bts, struct sockaddr_in *sin);
int ipaccess_setup(struct gsm_network *gsmnet);
int hsl_setup(struct gsm_network *gsmnet);
extern struct llist_head e1inp_driver_list;
extern struct llist_head e1inp_line_list;
int e1inp_vty_init(void);
void e1inp_init(void);
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
#endif /* _E1_INPUT_H */

View File

@@ -1,16 +1,15 @@
#ifndef _GB_PROXY_H
#define _GB_PROXY_H
#include <sys/types.h>
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <openbsc/gprs_ns.h>
#include <osmocom/vty/command.h>
struct gbproxy_config {
/* parsed from config file */
u_int16_t nsip_sgsn_nsei;
uint16_t nsip_sgsn_nsei;
/* misc */
struct gprs_ns_inst *nsi;

View File

@@ -182,7 +182,7 @@ struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t
/* Find a BTS context based on BVCI+NSEI tuple */
struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei);
#include <osmocore/tlv.h>
#include <osmocom/gsm/tlv.h>
/* BSSGP-UL-UNITDATA.ind */
int gprs_bssgp_rcvmsg(struct msgb *msg);

View File

@@ -1,9 +1,10 @@
#ifndef _GPRS_GMM_H
#define _GPRS_GMM_H
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <openbsc/gprs_sgsn.h>
int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause);
int gsm48_tx_gsm_act_pdp_rej(struct sgsn_mm_ctx *mm, uint8_t tid,
uint8_t cause, uint8_t pco_len, uint8_t *pco_v);
int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp);

View File

@@ -99,8 +99,8 @@ struct gprs_llc_lle {
enum gprs_llc_lle_state state;
struct timer_list t200;
struct timer_list t201; /* wait for acknowledgement */
struct osmo_timer_list t200;
struct osmo_timer_list t201; /* wait for acknowledgement */
uint16_t v_sent;
uint16_t v_ack;

View File

@@ -77,10 +77,10 @@ enum ns_cause {
/* Our Implementation */
#include <netinet/in.h>
#include <osmocore/linuxlist.h>
#include <osmocore/msgb.h>
#include <osmocore/timer.h>
#include <osmocore/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/select.h>
#define NS_TIMERS_COUNT 7
#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)"
@@ -133,13 +133,13 @@ struct gprs_ns_inst {
/* NS-over-IP specific bits */
struct {
struct bsc_fd fd;
struct osmo_fd fd;
uint32_t local_ip;
uint16_t local_port;
} nsip;
/* NS-over-FR-over-GRE-over-IP specific bits */
struct {
struct bsc_fd fd;
struct osmo_fd fd;
uint32_t local_ip;
int enabled:1;
} frgre;
@@ -163,7 +163,7 @@ struct gprs_nsvc {
uint32_t state;
uint32_t remote_state;
struct timer_list timer;
struct osmo_timer_list timer;
enum nsvc_timer_mode timer_mode;
int alive_retries;

View File

@@ -4,7 +4,7 @@
#include <stdint.h>
#include <netinet/in.h>
#include <osmocore/gsm48.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/crypt/gprs_cipher.h>
@@ -102,7 +102,7 @@ struct sgsn_mm_ctx {
uint16_t nsei;
uint16_t bvci;
struct rate_ctr_group *ctrg;
struct timer_list timer;
struct osmo_timer_list timer;
unsigned int T; /* Txxxx number */
unsigned int num_T_exp; /* number of consecutive T expirations */
@@ -119,12 +119,17 @@ struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
/* Allocate a new SGSN MM context */
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli,
const struct gprs_ra_id *raid);
void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm);
enum pdp_ctx_state {
PDP_STATE_NONE,
PDP_STATE_CR_REQ,
PDP_STATE_CR_CONF,
/* 04.08 / Figure 6.2 / 6.1.2.2 */
PDP_STATE_INACT_PEND,
PDP_STATE_INACTIVE = PDP_STATE_NONE,
};
enum pdp_type {
@@ -162,6 +167,10 @@ struct sgsn_pdp_ctx {
uint32_t rx_gtp_snu;
//uint32_t charging_id;
int reordering_reqd;
struct osmo_timer_list timer;
unsigned int T; /* Txxxx number */
unsigned int num_T_exp; /* number of consecutive T expirations */
};
@@ -182,10 +191,12 @@ struct sgsn_ggsn_ctx {
uint32_t id;
unsigned int gtp_version;
struct in_addr remote_addr;
int remote_restart_ctr;
struct gsn_t *gsn;
};
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr);
struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id);
struct apn_ctx {
@@ -202,4 +213,8 @@ extern struct llist_head sgsn_pdp_ctxts;
uint32_t sgsn_alloc_ptmsi(void);
/* High-level function to be called in case a GGSN has disappeared or
* ottherwise lost state (recovery procedure) */
int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn);
#endif /* _GPRS_SGSN_H */

View File

@@ -3,8 +3,8 @@
#include <openbsc/meas_rep.h>
#include <osmocore/protocol/gsm_04_08.h>
#include <osmocore/gsm48.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm48.h>
struct msgb;
struct gsm_bts;
@@ -13,8 +13,8 @@ struct gsm_network;
struct gsm_trans;
struct gsm_subscriber_connection;
#define GSM48_ALLOC_SIZE 1024
#define GSM48_ALLOC_HEADROOM 128
#define GSM48_ALLOC_SIZE 2048
#define GSM48_ALLOC_HEADROOM 256
static inline struct msgb *gsm48_msgb_alloc(void)
{
@@ -25,40 +25,40 @@ static inline struct msgb *gsm48_msgb_alloc(void)
/* config options controlling the behaviour of the lower leves */
void gsm0408_allow_everyone(int allow);
void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
void gsm0408_clear_all_trans(struct gsm_network *net, int protocol);
int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg);
int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id);
int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id);
int gsm0408_new_conn(struct gsm_subscriber_connection *conn);
enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci);
enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci);
enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra);
enum gsm_chreq_reason_t get_reason_by_chreq(uint8_t ra, int neci);
void gsm_net_update_ctype(struct gsm_network *net);
int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn);
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, u_int8_t *rand, int key_seq);
int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq);
int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn);
int gsm48_send_rr_release(struct gsm_lchan *lchan);
int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv);
int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, u_int8_t apdu_id,
u_int8_t apdu_len, const u_int8_t *apdu);
int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, u_int8_t power_class);
int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id,
uint8_t apdu_len, const uint8_t *apdu);
int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class);
int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
u_int8_t power_command, u_int8_t ho_ref);
uint8_t power_command, uint8_t ho_ref);
int bsc_upqueue(struct gsm_network *net);
int mncc_send(struct gsm_network *net, int msg_type, void *arg);
int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg);
/* convert a ASCII phone number to call-control BCD */
int encode_bcd_number(u_int8_t *bcd_lv, u_int8_t max_len,
int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len,
int h_len, const char *input);
int decode_bcd_number(char *output, int output_len, const u_int8_t *bcd_lv,
int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv,
int h_len);
int send_siemens_mrpci(struct gsm_lchan *lchan, u_int8_t *classmark2_lv);
int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv);
int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type);
int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, u_int8_t *mi_type);
int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type);
int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr);
int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode);
int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode);
int gsm48_rx_rr_modif_ack(struct msgb *msg);
int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg);

View File

@@ -2,7 +2,7 @@
#define _GSM48_GPRS_H
#include <stdint.h>
#include <osmocore/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
#define GSM48_MT_GMM_ATTACH_REQ 0x01

View File

@@ -1,26 +1,26 @@
#ifndef _GSM_04_11_H
#define _GSM_04_11_H
#include <osmocore/protocol/gsm_04_11.h>
#include <osmocom/gsm/protocol/gsm_04_11.h>
#define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */
/* SMS deliver PDU */
struct sms_deliver {
u_int8_t mti:2; /* message type indicator */
u_int8_t mms:1; /* more messages to send */
u_int8_t rp:1; /* reply path */
u_int8_t udhi:1; /* user data header indicator */
u_int8_t sri:1; /* status report indication */
u_int8_t *orig_addr; /* originating address */
u_int8_t pid; /* protocol identifier */
u_int8_t dcs; /* data coding scheme */
uint8_t mti:2; /* message type indicator */
uint8_t mms:1; /* more messages to send */
uint8_t rp:1; /* reply path */
uint8_t udhi:1; /* user data header indicator */
uint8_t sri:1; /* status report indication */
uint8_t *orig_addr; /* originating address */
uint8_t pid; /* protocol identifier */
uint8_t dcs; /* data coding scheme */
/* service centre time stamp */
u_int8_t ud_len; /* user data length */
u_int8_t *user_data; /* user data */
uint8_t ud_len; /* user data length */
uint8_t *user_data; /* user data */
u_int8_t msg_ref; /* message reference */
u_int8_t *smsc;
uint8_t msg_ref; /* message reference */
uint8_t *smsc;
};
struct msgb;
@@ -29,9 +29,12 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn, struct msgb *msg);
struct gsm_sms *sms_alloc(void);
void sms_free(struct gsm_sms *sms);
struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, int dcs, const char *text);
void _gsm411_sms_trans_free(struct gsm_trans *trans);
int gsm411_send_sms_subscr(struct gsm_subscriber *subscr,
struct gsm_sms *sms);
int gsm411_send_sms(struct gsm_subscriber_connection *conn,
struct gsm_sms *sms);
void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn);
#endif

View File

@@ -1,21 +1,12 @@
#ifndef _GSM_04_80_H
#define _GSM_04_80_H
#include <osmocore/msgb.h>
#include <osmocore/protocol/gsm_04_80.h>
#define MAX_LEN_USSD_STRING 31
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/protocol/gsm_04_80.h>
#include <osmocom/gsm/gsm0480.h>
struct gsm_subscriber_connection;
struct ussd_request {
char text[MAX_LEN_USSD_STRING + 1];
u_int8_t transaction_id;
u_int8_t invoke_id;
};
int gsm0480_decode_ussd_request(const struct msgb *msg,
struct ussd_request *request);
int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
const struct msgb *in_msg, const char* response_text,
const struct ussd_request *req);
@@ -23,12 +14,6 @@ int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
const struct msgb *msg,
const struct ussd_request *request);
struct msgb *gsm0480_create_notifySS(const char *text);
struct msgb *gsm0480_create_unstructuredSS_Notify(int alertLevel, const char *text);
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
int gsm0480_wrap_facility(struct msgb *msg);
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text);
int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);

View File

@@ -1,87 +1,14 @@
#ifndef _GSM_DATA_H
#define _GSM_DATA_H
#include <sys/types.h>
#include <stdint.h>
enum gsm_phys_chan_config {
GSM_PCHAN_NONE,
GSM_PCHAN_CCCH,
GSM_PCHAN_CCCH_SDCCH4,
GSM_PCHAN_TCH_F,
GSM_PCHAN_TCH_H,
GSM_PCHAN_SDCCH8_SACCH8C,
GSM_PCHAN_PDCH, /* GPRS PDCH */
GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */
GSM_PCHAN_UNKNOWN,
};
#include <osmocom/core/timer.h>
#include <osmocom/core/select.h>
enum gsm_chan_t {
GSM_LCHAN_NONE,
GSM_LCHAN_SDCCH,
GSM_LCHAN_TCH_F,
GSM_LCHAN_TCH_H,
GSM_LCHAN_UNKNOWN,
};
#include <openbsc/rest_octets.h>
/* RRLP mode of operation */
enum rrlp_mode {
RRLP_MODE_NONE,
RRLP_MODE_MS_BASED,
RRLP_MODE_MS_PREF,
RRLP_MODE_ASS_PREF,
};
/* Channel Request reason */
enum gsm_chreq_reason_t {
GSM_CHREQ_REASON_EMERG,
GSM_CHREQ_REASON_PAG,
GSM_CHREQ_REASON_CALL,
GSM_CHREQ_REASON_LOCATION_UPD,
GSM_CHREQ_REASON_OTHER,
};
#include <osmocore/timer.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/system_information.h>
#include <openbsc/mncc.h>
#include <osmocore/tlv.h>
#include <osmocore/bitvec.h>
#include <osmocore/statistics.h>
#include <osmocore/gsm_utils.h>
#include <osmocore/utils.h>
#include <osmocore/rxlev_stat.h>
#define TRX_NR_TS 8
#define TS_MAX_LCHAN 8
#define HARDCODED_ARFCN 123
#define HARDCODED_TSC 7
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
/* for multi-drop config */
#define HARDCODED_BTS0_TS 1
#define HARDCODED_BTS1_TS 6
#define HARDCODED_BTS2_TS 11
enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
GSM_HOOK_RR_PAGING,
GSM_HOOK_RR_SECURITY,
};
enum gsm_paging_event {
GSM_PAGING_SUCCEEDED,
GSM_PAGING_EXPIRED,
GSM_PAGING_OOM,
};
enum bts_gprs_mode {
BTS_GPRS_NONE = 0,
BTS_GPRS_GPRS = 1,
BTS_GPRS_EGPRS = 2,
};
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
/* the data structure stored in msgb->cb for openbsc apps */
struct openbsc_msgb_cb {
@@ -92,11 +19,11 @@ struct openbsc_msgb_cb {
unsigned char *bssgp_cell_id;
/* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
u_int16_t nsei;
u_int16_t bvci;
uint16_t nsei;
uint16_t bvci;
/* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
u_int32_t tlli;
uint32_t tlli;
} __attribute__((packed));
#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
@@ -132,32 +59,18 @@ enum gsm_auth_algo {
struct gsm_auth_info {
enum gsm_auth_algo auth_algo;
unsigned int a3a8_ki_len;
u_int8_t a3a8_ki[16];
uint8_t a3a8_ki[16];
};
struct gsm_auth_tuple {
int use_count;
int key_seq;
u_int8_t rand[16];
u_int8_t sres[4];
u_int8_t kc[8];
uint8_t rand[16];
uint8_t sres[4];
uint8_t kc[8];
};
#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
struct gsm_lchan;
struct gsm_subscriber;
struct gsm_mncc;
struct rtp_socket;
struct bsc_api;
/* Network Management State */
struct gsm_nm_state {
u_int8_t operational;
u_int8_t administrative;
u_int8_t availability;
};
/*
* LOCATION UPDATING REQUEST state
*
@@ -166,7 +79,7 @@ struct gsm_nm_state {
* - Accept/Reject according to global policy
*/
struct gsm_loc_updating_operation {
struct timer_list updating_timer;
struct osmo_timer_list updating_timer;
unsigned int waiting_for_imsi : 1;
unsigned int waiting_for_imei : 1;
unsigned int key_seq : 4;
@@ -186,7 +99,7 @@ struct gsm_security_operation {
* a couple of seconds to work around MSC issues.
*/
struct gsm_anchor_operation {
struct timer_list timeout;
struct osmo_timer_list timeout;
};
/* Maximum number of neighbor cells whose average we track */
@@ -196,36 +109,17 @@ struct gsm_anchor_operation {
/* processed neighbor measurements for one cell */
struct neigh_meas_proc {
u_int16_t arfcn;
u_int8_t bsic;
u_int8_t rxlev[MAX_WIN_NEIGH_AVG];
uint16_t arfcn;
uint8_t bsic;
uint8_t rxlev[MAX_WIN_NEIGH_AVG];
unsigned int rxlev_cnt;
u_int8_t last_seen_nr;
};
#define MAX_A5_KEY_LEN (128/8)
#define A38_XOR_MIN_KEY_LEN 12
#define A38_XOR_MAX_KEY_LEN 16
#define A38_COMP128_KEY_LEN 16
#define RSL_ENC_ALG_A5(x) (x+1)
/* is the data link established? who established it? */
#define LCHAN_SAPI_UNUSED 0
#define LCHAN_SAPI_MS 1
#define LCHAN_SAPI_NET 2
/* state of a logical channel */
enum gsm_lchan_state {
LCHAN_S_NONE, /* channel is not active */
LCHAN_S_ACT_REQ, /* channel activatin requested */
LCHAN_S_ACTIVE, /* channel is active and operational */
LCHAN_S_REL_REQ, /* channel release has been requested */
LCHAN_S_REL_ERR, /* channel is in an error state */
LCHAN_S_INACTIVE, /* channel is set inactive */
uint8_t last_seen_nr;
};
/* the per subscriber data for lchan */
struct gsm_subscriber_connection {
struct llist_head entry;
/* To whom we are allocated at the moment */
struct gsm_subscriber *subscr;
@@ -238,409 +132,77 @@ struct gsm_subscriber_connection {
/* Are we part of a special "silent" call */
int silent_call;
int put_channel;
/* bsc structures */
struct osmo_bsc_sccp_con *sccp_con;
/* back pointers */
int in_release;
struct gsm_lchan *lchan;
struct gsm_lchan *ho_lchan;
struct gsm_bts *bts;
/* for assignment handling */
struct osmo_timer_list T10;
struct gsm_lchan *secondary_lchan;
};
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
/* The logical subslot number in the TS */
u_int8_t nr;
/* The logical channel type */
enum gsm_chan_t type;
/* RSL channel mode */
enum rsl_cmod_spd rsl_cmode;
/* If TCH, traffic channel mode */
enum gsm48_chan_mode tch_mode;
/* State */
enum gsm_lchan_state state;
/* Power levels for MS and BTS */
u_int8_t bs_power;
u_int8_t ms_power;
/* Encryption information */
struct {
u_int8_t alg_id;
u_int8_t key_len;
u_int8_t key[MAX_A5_KEY_LEN];
} encr;
struct timer_list T3101;
struct timer_list T3111;
struct timer_list error_timer;
#define ROLE_BSC
#include "gsm_data_shared.h"
/* AMR bits */
struct gsm48_multi_rate_conf mr_conf;
/* Established data link layer services */
u_int8_t sapis[8];
int sach_deact;
int release_reason;
/* GSM Random Access data */
struct gsm48_req_ref *rqd_ref;
uint8_t rqd_ta;
/* cache of last measurement reports on this lchan */
struct gsm_meas_rep meas_rep[6];
int meas_rep_idx;
/* table of neighbor cell measurements */
struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
struct {
u_int32_t bound_ip;
u_int32_t connect_ip;
u_int16_t bound_port;
u_int16_t connect_port;
u_int16_t conn_id;
u_int8_t rtp_payload;
u_int8_t rtp_payload2;
u_int8_t speech_mode;
struct rtp_socket *rtp_socket;
} abis_ip;
struct gsm_subscriber_connection *conn;
};
struct gsm_e1_subslot {
/* Number of E1 link */
u_int8_t e1_nr;
/* Number of E1 TS inside E1 link */
u_int8_t e1_ts;
/* Sub-slot within the E1 TS, 0xff if full TS */
u_int8_t e1_ts_ss;
};
#define TS_F_PDCH_MODE 0x1000
/* One Timeslot in a TRX */
struct gsm_bts_trx_ts {
struct gsm_bts_trx *trx;
/* number of this timeslot at the TRX */
u_int8_t nr;
enum gsm_phys_chan_config pchan;
unsigned int flags;
struct gsm_nm_state nm_state;
struct tlv_parsed nm_attr;
u_int8_t nm_chan_comb;
struct {
/* Parameters below are configured by VTY */
int enabled;
u_int8_t maio;
u_int8_t hsn;
struct bitvec arfcns;
u_int8_t arfcns_data[1024/8];
/* This is the pre-computed MA for channel assignments */
struct bitvec ma;
u_int8_t ma_len; /* part of ma_data that is used */
u_int8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
} hopping;
/* To which E1 subslot are we connected */
struct gsm_e1_subslot e1_link;
struct gsm_lchan lchan[TS_MAX_LCHAN];
};
/* One TRX in a BTS */
struct gsm_bts_trx {
/* list header in bts->trx_list */
struct llist_head list;
struct gsm_bts *bts;
/* number of this TRX in the BTS */
u_int8_t nr;
/* human readable name / description */
char *description;
/* how do we talk RSL with this TRX? */
struct gsm_e1_subslot rsl_e1_link;
u_int8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
struct gsm_nm_state nm_state;
struct tlv_parsed nm_attr;
struct {
struct gsm_nm_state nm_state;
} bb_transc;
u_int16_t arfcn;
int nominal_power; /* in dBm */
unsigned int max_power_red; /* in actual dB */
union {
struct {
struct {
struct gsm_nm_state nm_state;
} bbsig;
struct {
struct gsm_nm_state nm_state;
} pa;
} bs11;
struct {
unsigned int test_state;
u_int8_t test_nr;
struct rxlev_stats rxlev_stat;
} ipaccess;
};
struct gsm_bts_trx_ts ts[TRX_NR_TS];
};
#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
enum gsm_bts_type {
GSM_BTS_TYPE_UNKNOWN,
GSM_BTS_TYPE_BS11,
GSM_BTS_TYPE_NANOBTS,
};
struct gsm_bts_model {
struct llist_head list;
enum gsm_bts_type type;
const char *name;
struct tlv_definition nm_att_tlvdef;
struct bitvec features;
uint8_t _features_data[128/8];
};
enum gsm_bts_features {
BTS_FEAT_HSCSD,
BTS_FEAT_GPRS,
BTS_FEAT_EGPRS,
BTS_FEAT_ECSD,
BTS_FEAT_HOPPING,
};
/**
* A pending paging request
*/
struct gsm_paging_request {
/* list_head for list of all paging requests */
struct llist_head entry;
/* the subscriber which we're paging. Later gsm_paging_request
* should probably become a part of the gsm_subscriber struct? */
struct gsm_subscriber *subscr;
/* back-pointer to the BTS on which we are paging */
struct gsm_bts *bts;
/* what kind of channel type do we ask the MS to establish */
int chan_type;
/* Timer 3113: how long do we try to page? */
struct timer_list T3113;
/* callback to be called in case paging completes */
gsm_cbfn *cbfn;
void *cbfn_param;
};
/*
* This keeps track of the paging status of one BTS. It
* includes a number of pending requests, a back pointer
* to the gsm_bts, a timer and some more state.
*/
struct gsm_bts_paging_state {
/* pending requests */
struct llist_head pending_requests;
struct gsm_bts *bts;
struct timer_list work_timer;
/* load */
u_int16_t available_slots;
};
struct gsm_envabtse {
struct gsm_nm_state nm_state;
};
struct gsm_bts_gprs_nsvc {
struct gsm_bts *bts;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
u_int16_t nsvci;
u_int16_t local_port; /* on the BTS */
u_int16_t remote_port; /* on the SGSN */
u_int32_t remote_ip; /* on the SGSN */
struct gsm_nm_state nm_state;
};
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
struct llist_head list;
struct gsm_network *network;
/* number of ths BTS in network */
u_int8_t nr;
/* human readable name / description */
char *description;
/* Cell Identity */
u_int16_t cell_identity;
/* location area code of this BTS */
u_int16_t location_area_code;
/* Training Sequence Code */
u_int8_t tsc;
/* Base Station Identification Code (BSIC) */
u_int8_t bsic;
/* type of BTS */
enum gsm_bts_type type;
struct gsm_bts_model *model;
enum gsm_band band;
/* should the channel allocator allocate channels from high TRX to TRX0,
* rather than starting from TRX0 and go upwards? */
int chan_alloc_reverse;
/* maximum Tx power that the MS is permitted to use in this cell */
int ms_max_power;
/* how do we talk OML with this TRX? */
struct gsm_e1_subslot oml_e1_link;
u_int8_t oml_tei;
struct e1inp_sign_link *oml_link;
/* Abis network management O&M handle */
struct abis_nm_h *nmh;
struct gsm_nm_state nm_state;
struct tlv_parsed nm_attr;
/* number of this BTS on given E1 link */
u_int8_t bts_nr;
/* paging state and control */
struct gsm_bts_paging_state paging;
/* CCCH is on C0 */
struct gsm_bts_trx *c0;
struct {
struct gsm_nm_state nm_state;
} site_mgr;
/* parameters from which we build SYSTEM INFORMATION */
struct {
struct gsm48_rach_control rach_control;
u_int8_t ncc_permitted;
struct gsm48_cell_sel_par cell_sel_par;
struct gsm48_cell_options cell_options;
struct gsm48_control_channel_descr chan_desc;
struct bitvec neigh_list;
struct bitvec cell_alloc;
struct {
/* bitmask large enough for all possible ARFCN's */
u_int8_t neigh_list[1024/8];
u_int8_t cell_alloc[1024/8];
} data;
} si_common;
/* do we use static (user-defined) system information messages? (bitmask) */
uint32_t si_mode_static;
/* bitmask of all SI that are present/valid in si_buf */
uint32_t si_valid;
/* buffers where we put the pre-computed SI */
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
union {
struct {
u_int16_t site_id;
u_int16_t bts_id;
u_int32_t flags;
} ip_access;
struct {
struct {
struct gsm_nm_state nm_state;
} cclk;
struct {
struct gsm_nm_state nm_state;
} rack;
struct gsm_envabtse envabtse[4];
} bs11;
};
/* Not entirely sure how ip.access specific this is */
struct {
enum bts_gprs_mode mode;
struct {
struct gsm_nm_state nm_state;
u_int16_t nsei;
uint8_t timer[7];
} nse;
struct {
struct gsm_nm_state nm_state;
u_int16_t bvci;
uint8_t timer[11];
} cell;
struct gsm_bts_gprs_nsvc nsvc[2];
u_int8_t rac;
} gprs;
/* RACH NM values */
int rach_b_thresh;
int rach_ldavg_slots;
/* transceivers */
int num_trx;
struct llist_head trx_list;
};
/* Some statistics of our network */
struct gsmnet_stats {
struct {
struct counter *total;
struct counter *no_channel;
struct osmo_counter *total;
struct osmo_counter *no_channel;
} chreq;
struct {
struct counter *attempted;
struct counter *no_channel; /* no channel available */
struct counter *timeout; /* T3103 timeout */
struct counter *completed; /* HO COMPL received */
struct counter *failed; /* HO FAIL received */
struct osmo_counter *attempted;
struct osmo_counter *no_channel; /* no channel available */
struct osmo_counter *timeout; /* T3103 timeout */
struct osmo_counter *completed; /* HO COMPL received */
struct osmo_counter *failed; /* HO FAIL received */
} handover;
struct {
struct counter *attach;
struct counter *normal;
struct counter *periodic;
struct counter *detach;
struct osmo_counter *attach;
struct osmo_counter *normal;
struct osmo_counter *periodic;
struct osmo_counter *detach;
} loc_upd_type;
struct {
struct counter *reject;
struct counter *accept;
struct osmo_counter *reject;
struct osmo_counter *accept;
} loc_upd_resp;
struct {
struct counter *attempted;
struct counter *detached;
struct counter *completed;
struct counter *expired;
struct osmo_counter *attempted;
struct osmo_counter *detached;
struct osmo_counter *completed;
struct osmo_counter *expired;
} paging;
struct {
struct counter *submitted; /* MO SMS submissions */
struct counter *no_receiver;
struct counter *delivered; /* MT SMS deliveries */
struct counter *rp_err_mem;
struct counter *rp_err_other;
struct osmo_counter *submitted; /* MO SMS submissions */
struct osmo_counter *no_receiver;
struct osmo_counter *delivered; /* MT SMS deliveries */
struct osmo_counter *rp_err_mem;
struct osmo_counter *rp_err_other;
} sms;
struct {
struct counter *dialled; /* total number of dialled calls */
struct counter *alerted; /* we alerted the other end */
struct counter *connected;/* how many calls were accepted */
struct osmo_counter *mo_setup;
struct osmo_counter *mo_connect_ack;
struct osmo_counter *mt_setup;
struct osmo_counter *mt_connect;
} call;
struct {
struct counter *rf_fail;
struct counter *rll_err;
struct osmo_counter *rf_fail;
struct osmo_counter *rll_err;
} chan;
struct {
struct counter *oml_fail;
struct counter *rsl_fail;
struct osmo_counter *oml_fail;
struct osmo_counter *rsl_fail;
} bts;
};
@@ -655,8 +217,8 @@ enum gsm_auth_policy {
struct gsm_network {
/* global parameters */
u_int16_t country_code;
u_int16_t network_code;
uint16_t country_code;
uint16_t network_code;
char *name_long;
char *name_short;
enum gsm_auth_policy auth_policy;
@@ -684,7 +246,7 @@ struct gsm_network {
struct gsmnet_stats stats;
/* layer 4 */
int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
int (*mncc_recv) (struct gsm_network *net, struct msgb *msg);
struct llist_head upqueue;
struct llist_head trans_list;
struct bsc_api *bsc_api;
@@ -703,13 +265,29 @@ struct gsm_network {
int T3115;
int T3117;
int T3119;
int T3122;
int T3141;
/* Radio Resource Location Protocol (TS 04.31) */
struct {
enum rrlp_mode mode;
} rrlp;
int msc_prio;
/* enable the DTXu and DTXd for this network */
int dtx_enabled;
enum gsm_chan_t ctype_by_chreq[16];
/* Use a TCH for handling requests of type paging any */
int pag_any_tch;
/* MSC data in case we are a true BSC */
struct osmo_msc_data *msc_data;
int hardcoded_rtp_payload;
/* subscriber related features */
int keep_subscr;
struct gsm_sms_queue *sms_queue;
};
#define SMS_HDR_SIZE 128
@@ -720,56 +298,32 @@ struct gsm_sms {
struct gsm_subscriber *receiver;
unsigned long validity_minutes;
u_int8_t reply_path_req;
u_int8_t status_rep_req;
u_int8_t ud_hdr_ind;
u_int8_t protocol_id;
u_int8_t data_coding_scheme;
u_int8_t msg_ref;
uint8_t reply_path_req;
uint8_t status_rep_req;
uint8_t ud_hdr_ind;
uint8_t protocol_id;
uint8_t data_coding_scheme;
uint8_t msg_ref;
char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
* BCD == 20 bytes string */
u_int8_t user_data_len;
u_int8_t user_data[SMS_TEXT_SIZE];
uint8_t user_data_len;
uint8_t user_data[SMS_TEXT_SIZE];
char text[SMS_TEXT_SIZE];
};
struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
int (*mncc_recv)(struct gsm_network *, int, void *));
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
u_int8_t tsc, u_int8_t bsic);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code,
int (*mncc_recv)(struct gsm_network *, struct msgb *));
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
/* Get reference to a neighbor cell on a given BCCH ARFCN */
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
u_int16_t arfcn, u_int8_t bsic);
uint16_t arfcn, uint8_t bsic);
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
const char *gsm_lchant_name(enum gsm_chan_t c);
const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
char *gsm_trx_name(struct gsm_bts_trx *trx);
char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
char *gsm_lchan_name(struct gsm_lchan *lchan);
const char *gsm_lchans_name(enum gsm_lchan_state s);
enum gsm_e1_event {
EVT_E1_NONE,
EVT_E1_TEI_UP,
EVT_E1_TEI_DN,
};
void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
u_int8_t e1_ts, u_int8_t e1_ts_ss);
enum gsm_bts_type parse_btstype(const char *arg);
const char *btstype2str(enum gsm_bts_type type);
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
struct gsm_bts *start_bts);
@@ -799,7 +353,6 @@ static inline int is_siemens_bts(struct gsm_bts *bts)
return 0;
}
enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
@@ -809,17 +362,24 @@ const char *rrlp_mode_name(enum rrlp_mode mode);
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
int gsm48_ra_id_by_bts(u_int8_t *buf, struct gsm_bts *bts);
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
int gsm_bts_model_register(struct gsm_bts_model *model);
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
void subscr_con_free(struct gsm_subscriber_connection *conn);
#endif
struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
enum gsm_bts_type type,
uint8_t tsc, uint8_t bsic);
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
uint8_t e1_ts, uint8_t e1_ts_ss);
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
#endif /* _GSM_DATA_H */

View File

@@ -0,0 +1,590 @@
#ifndef _GSM_DATA_SHAREDH
#define _GSM_DATA_SHAREDH
#include <stdbool.h>
#include <stdint.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/bitvec.h>
#include <osmocom/core/statistics.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/rxlev_stat.h>
#include <osmocom/gsm/sysinfo.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/gsm/protocol/gsm_12_21.h>
struct osmo_msc_data;
struct osmo_bsc_sccp_con;
struct gsm_sms_queue;
/* RRLP mode of operation */
enum rrlp_mode {
RRLP_MODE_NONE,
RRLP_MODE_MS_BASED,
RRLP_MODE_MS_PREF,
RRLP_MODE_ASS_PREF,
};
/* Channel Request reason */
enum gsm_chreq_reason_t {
GSM_CHREQ_REASON_EMERG,
GSM_CHREQ_REASON_PAG,
GSM_CHREQ_REASON_CALL,
GSM_CHREQ_REASON_LOCATION_UPD,
GSM_CHREQ_REASON_OTHER,
};
#define TRX_NR_TS 8
#define TS_MAX_LCHAN 8
#define HARDCODED_ARFCN 123
#define HARDCODED_TSC 7
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
/* for multi-drop config */
#define HARDCODED_BTS0_TS 1
#define HARDCODED_BTS1_TS 6
#define HARDCODED_BTS2_TS 11
/* reserved according to GSM 03.03 § 2.4 */
#define GSM_RESERVED_TMSI 0xFFFFFFFF
enum gsm_hooks {
GSM_HOOK_NM_SWLOAD,
GSM_HOOK_RR_PAGING,
GSM_HOOK_RR_SECURITY,
};
enum gsm_paging_event {
GSM_PAGING_SUCCEEDED,
GSM_PAGING_EXPIRED,
GSM_PAGING_OOM,
GSM_PAGING_BUSY,
};
enum bts_gprs_mode {
BTS_GPRS_NONE = 0,
BTS_GPRS_GPRS = 1,
BTS_GPRS_EGPRS = 2,
};
struct gsm_lchan;
struct gsm_subscriber;
struct gsm_mncc;
struct rtp_socket;
struct bsc_api;
/* Network Management State */
struct gsm_nm_state {
uint8_t operational;
uint8_t administrative;
uint8_t availability;
};
struct gsm_abis_mo {
uint8_t obj_class;
struct abis_om_obj_inst obj_inst;
const char *name;
struct gsm_nm_state nm_state;
struct tlv_parsed *nm_attr;
struct gsm_bts *bts;
};
#define MAX_A5_KEY_LEN (128/8)
#define A38_XOR_MIN_KEY_LEN 12
#define A38_XOR_MAX_KEY_LEN 16
#define A38_COMP128_KEY_LEN 16
#define RSL_ENC_ALG_A5(x) (x+1)
/* is the data link established? who established it? */
#define LCHAN_SAPI_UNUSED 0
#define LCHAN_SAPI_MS 1
#define LCHAN_SAPI_NET 2
/* state of a logical channel */
enum gsm_lchan_state {
LCHAN_S_NONE, /* channel is not active */
LCHAN_S_ACT_REQ, /* channel activatin requested */
LCHAN_S_ACTIVE, /* channel is active and operational */
LCHAN_S_REL_REQ, /* channel release has been requested */
LCHAN_S_REL_ERR, /* channel is in an error state */
LCHAN_S_INACTIVE, /* channel is set inactive */
};
/* BTS ONLY */
#define MAX_NUM_UL_MEAS 104
#define LC_UL_M_F_L1_VALID (1 << 0)
#define LC_UL_M_F_RES_VALID (1 << 1)
struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
/* timing advance offset (in quarter bits) */
int16_t ta_offs_qbits;
/* C/I ratio in dB */
float c_i;
/* flags */
uint8_t is_sub:1;
/* RSSI in dBm * -1 */
uint8_t inv_rssi;
};
/* /BTS ONLY */
struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;
/* The logical subslot number in the TS */
uint8_t nr;
/* The logical channel type */
enum gsm_chan_t type;
/* RSL channel mode */
enum rsl_cmod_spd rsl_cmode;
/* If TCH, traffic channel mode */
enum gsm48_chan_mode tch_mode;
/* State */
enum gsm_lchan_state state;
/* Power levels for MS and BTS */
uint8_t bs_power;
uint8_t ms_power;
/* Encryption information */
struct {
uint8_t alg_id;
uint8_t key_len;
uint8_t key[MAX_A5_KEY_LEN];
} encr;
/* AMR bits */
struct gsm48_multi_rate_conf mr_conf;
/* Established data link layer services */
uint8_t sapis[8];
int sach_deact;
int release_reason;
struct {
uint32_t bound_ip;
uint32_t connect_ip;
uint16_t bound_port;
uint16_t connect_port;
uint16_t conn_id;
uint8_t rtp_payload;
uint8_t rtp_payload2;
uint8_t speech_mode;
struct rtp_socket *rtp_socket;
} abis_ip;
uint8_t rqd_ta;
#ifdef ROLE_BSC
struct osmo_timer_list T3101;
struct osmo_timer_list T3111;
struct osmo_timer_list error_timer;
/* table of neighbor cell measurements */
struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
/* cache of last measurement reports on this lchan */
struct gsm_meas_rep meas_rep[6];
int meas_rep_idx;
/* GSM Random Access data */
struct gsm48_req_ref *rqd_ref;
struct gsm_subscriber_connection *conn;
#else
struct lapdm_channel lapdm_ch;
struct {
/* bitmask of all SI that are present/valid in si_buf */
uint32_t valid;
uint32_t last;
/* buffers where we put the pre-computed SI */
sysinfo_buf_t buf[_MAX_SYSINFO_TYPE];
} si;
struct {
uint8_t flags;
/* RSL measurment result number, 0 at lchan_act */
uint8_t res_nr;
/* current Tx power level of the BTS */
uint8_t bts_tx_pwr;
/* number of measurements stored in array below */
uint8_t num_ul_meas;
struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
/* last L1 header from the MS */
uint8_t l1_info[2];
struct {
uint8_t rxlev_full;
uint8_t rxlev_sub;
uint8_t rxqual_full;
uint8_t rxqual_sub;
} res;
} meas;
#endif
};
struct gsm_e1_subslot {
/* Number of E1 link */
uint8_t e1_nr;
/* Number of E1 TS inside E1 link */
uint8_t e1_ts;
/* Sub-slot within the E1 TS, 0xff if full TS */
uint8_t e1_ts_ss;
};
#define TS_F_PDCH_MODE 0x1000
/* One Timeslot in a TRX */
struct gsm_bts_trx_ts {
struct gsm_bts_trx *trx;
/* number of this timeslot at the TRX */
uint8_t nr;
enum gsm_phys_chan_config pchan;
unsigned int flags;
struct gsm_abis_mo mo;
struct tlv_parsed nm_attr;
uint8_t nm_chan_comb;
int tsc; /* -1 == use BTS TSC */
struct {
/* Parameters below are configured by VTY */
int enabled;
uint8_t maio;
uint8_t hsn;
struct bitvec arfcns;
uint8_t arfcns_data[1024/8];
/* This is the pre-computed MA for channel assignments */
struct bitvec ma;
uint8_t ma_len; /* part of ma_data that is used */
uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
} hopping;
/* To which E1 subslot are we connected */
struct gsm_e1_subslot e1_link;
struct gsm_lchan lchan[TS_MAX_LCHAN];
};
/* One TRX in a BTS */
struct gsm_bts_trx {
/* list header in bts->trx_list */
struct llist_head list;
struct gsm_bts *bts;
/* number of this TRX in the BTS */
uint8_t nr;
/* human readable name / description */
char *description;
/* how do we talk RSL with this TRX? */
struct gsm_e1_subslot rsl_e1_link;
uint8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
struct e1inp_sign_link *oml_link;
struct gsm_abis_mo mo;
struct tlv_parsed nm_attr;
struct {
struct gsm_abis_mo mo;
} bb_transc;
uint16_t arfcn;
int nominal_power; /* in dBm */
unsigned int max_power_red; /* in actual dB */
struct {
void *l1h;
} role_bts;
union {
struct {
struct {
struct gsm_abis_mo mo;
} bbsig;
struct {
struct gsm_abis_mo mo;
} pa;
} bs11;
struct {
unsigned int test_state;
uint8_t test_nr;
struct rxlev_stats rxlev_stat;
} ipaccess;
};
struct gsm_bts_trx_ts ts[TRX_NR_TS];
};
#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
enum gsm_bts_type {
GSM_BTS_TYPE_UNKNOWN,
GSM_BTS_TYPE_BS11,
GSM_BTS_TYPE_NANOBTS,
GSM_BTS_TYPE_RBS2000,
GSM_BTS_TYPE_HSL_FEMTO,
};
struct vty;
struct gsm_bts_model {
struct llist_head list;
enum gsm_bts_type type;
const char *name;
bool started;
int (*start)(struct gsm_network *net);
int (*oml_rcvmsg)(struct msgb *msg);
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
struct tlv_definition nm_att_tlvdef;
struct bitvec features;
uint8_t _features_data[128/8];
};
enum gsm_bts_features {
BTS_FEAT_HSCSD,
BTS_FEAT_GPRS,
BTS_FEAT_EGPRS,
BTS_FEAT_ECSD,
BTS_FEAT_HOPPING,
};
/*
* This keeps track of the paging status of one BTS. It
* includes a number of pending requests, a back pointer
* to the gsm_bts, a timer and some more state.
*/
struct gsm_bts_paging_state {
/* pending requests */
struct llist_head pending_requests;
struct gsm_bts *bts;
struct osmo_timer_list work_timer;
struct osmo_timer_list credit_timer;
/* free chans needed */
int free_chans_need;
/* load */
uint16_t available_slots;
};
struct gsm_envabtse {
struct gsm_abis_mo mo;
};
struct gsm_bts_gprs_nsvc {
struct gsm_bts *bts;
/* data read via VTY config file, to configure the BTS
* via OML from BSC */
int id;
uint16_t nsvci;
uint16_t local_port; /* on the BTS */
uint16_t remote_port; /* on the SGSN */
uint32_t remote_ip; /* on the SGSN */
struct gsm_abis_mo mo;
};
enum neigh_list_manual_mode {
NL_MODE_AUTOMATIC = 0,
NL_MODE_MANUAL = 1,
NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */
};
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
struct llist_head list;
/* number of ths BTS in network */
uint8_t nr;
/* human readable name / description */
char *description;
/* Cell Identity */
uint16_t cell_identity;
/* location area code of this BTS */
uint16_t location_area_code;
/* Training Sequence Code */
uint8_t tsc;
/* Base Station Identification Code (BSIC) */
uint8_t bsic;
/* type of BTS */
enum gsm_bts_type type;
struct gsm_bts_model *model;
enum gsm_band band;
/* maximum Tx power that the MS is permitted to use in this cell */
int ms_max_power;
/* how do we talk OML with this TRX? */
struct gsm_e1_subslot oml_e1_link;
uint8_t oml_tei;
struct e1inp_sign_link *oml_link;
/* Abis network management O&M handle */
struct abis_nm_h *nmh;
struct gsm_abis_mo mo;
/* number of this BTS on given E1 link */
uint8_t bts_nr;
/* paging state and control */
struct gsm_bts_paging_state paging;
/* CCCH is on C0 */
struct gsm_bts_trx *c0;
struct {
struct gsm_abis_mo mo;
} site_mgr;
/* bitmask of all SI that are present/valid in si_buf */
uint32_t si_valid;
/* buffers where we put the pre-computed SI */
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
union {
struct {
uint16_t site_id;
uint16_t bts_id;
uint32_t flags;
} ip_access;
struct {
struct {
struct gsm_abis_mo mo;
} cclk;
struct {
struct gsm_abis_mo mo;
} rack;
struct gsm_envabtse envabtse[4];
} bs11;
struct {
struct {
struct gsm_abis_mo mo;
struct llist_head conn_groups;
} is;
struct {
struct gsm_abis_mo mo;
struct llist_head conn_groups;
} con;
struct {
struct gsm_abis_mo mo;
} dp;
struct {
struct gsm_abis_mo mo;
} tf;
} rbs2000;
struct {
unsigned long serno;
} hsl;
};
/* Not entirely sure how ip.access specific this is */
struct {
enum bts_gprs_mode mode;
struct {
struct gsm_abis_mo mo;
uint16_t nsei;
uint8_t timer[7];
} nse;
struct {
struct gsm_abis_mo mo;
uint16_t bvci;
uint8_t timer[11];
} cell;
struct gsm_bts_gprs_nsvc nsvc[2];
uint8_t rac;
} gprs;
/* RACH NM values */
int rach_b_thresh;
int rach_ldavg_slots;
/* transceivers */
int num_trx;
struct llist_head trx_list;
#ifdef ROLE_BSC
/* Abis NM queue */
struct llist_head abis_queue;
int abis_nm_pend;
struct gsm_network *network;
/* should the channel allocator allocate channels from high TRX to TRX0,
* rather than starting from TRX0 and go upwards? */
int chan_alloc_reverse;
enum neigh_list_manual_mode neigh_list_manual_mode;
/* parameters from which we build SYSTEM INFORMATION */
struct {
struct gsm48_rach_control rach_control;
uint8_t ncc_permitted;
struct gsm48_cell_sel_par cell_sel_par;
struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */
struct gsm48_cell_options cell_options;
struct gsm48_control_channel_descr chan_desc;
struct bitvec neigh_list;
struct bitvec cell_alloc;
struct bitvec si5_neigh_list;
struct {
/* bitmask large enough for all possible ARFCN's */
uint8_t neigh_list[1024/8];
uint8_t cell_alloc[1024/8];
/* If the user wants a different neighbor list in SI5 than in SI2 */
uint8_t si5_neigh_list[1024/8];
} data;
} si_common;
/* do we use static (user-defined) system information messages? (bitmask) */
uint32_t si_mode_static;
#endif /* ROLE_BSC */
void *role;
};
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
const char *gsm_lchant_name(enum gsm_chan_t c);
const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
char *gsm_trx_name(struct gsm_bts_trx *trx);
char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
char *gsm_lchan_name(struct gsm_lchan *lchan);
const char *gsm_lchans_name(enum gsm_lchan_state s);
void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
struct gsm_abis_mo *
gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
struct abis_om_obj_inst *obj_inst);
struct gsm_nm_state *
gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class,
struct abis_om_obj_inst *obj_inst);
void *
gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
struct abis_om_obj_inst *obj_inst);
/* reset the state of all MO in the BTS */
void gsm_bts_mo_reset(struct gsm_bts *bts);
uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr);
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
#endif

View File

@@ -1,9 +1,8 @@
#ifndef _GSM_SUBSCR_H
#define _GSM_SUBSCR_H
#include <sys/types.h>
#include "gsm_data.h"
#include <osmocore/linuxlist.h>
#include <osmocom/core/linuxlist.h>
#define GSM_IMEI_LENGTH 17
#define GSM_IMSI_LENGTH 17
@@ -13,37 +12,35 @@
#define GSM_MIN_EXTEN 20000
#define GSM_MAX_EXTEN 49999
/* reserved according to GSM 03.03 § 2.4 */
#define GSM_RESERVED_TMSI 0xFFFFFFFF
#define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001
#define tmsi_from_string(str) strtoul(str, NULL, 10)
struct vty;
struct gsm_equipment {
long long unsigned int id;
char imei[GSM_IMEI_LENGTH];
char name[GSM_NAME_LENGTH];
struct gsm48_classmark1 classmark1;
u_int8_t classmark2_len;
u_int8_t classmark2[3];
u_int8_t classmark3_len;
u_int8_t classmark3[14];
uint8_t classmark2_len;
uint8_t classmark2[3];
uint8_t classmark3_len;
uint8_t classmark3[14];
};
struct gsm_subscriber {
struct gsm_network *net;
long long unsigned int id;
char imsi[GSM_IMSI_LENGTH];
u_int32_t tmsi;
u_int16_t lac;
uint32_t tmsi;
uint16_t lac;
char name[GSM_NAME_LENGTH];
char extension[GSM_EXTENSION_LENGTH];
int authorized;
/* Temporary field which is not stored in the DB/HLR */
u_int32_t flags;
uint32_t flags;
/* Every user can only have one equipment in use at any given
* point in time */
@@ -74,20 +71,34 @@ enum gsm_subscriber_update_reason {
struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net,
u_int32_t tmsi);
uint32_t tmsi);
struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net,
const char *imsi);
struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net,
const char *ext);
struct gsm_subscriber *subscr_get_by_id(struct gsm_network *net,
unsigned long long id);
struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net,
const char *imsi);
int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason);
void subscr_put_channel(struct gsm_subscriber_connection *conn);
void subscr_put_channel(struct gsm_subscriber *subscr);
void subscr_get_channel(struct gsm_subscriber *subscr,
int type, gsm_cbfn *cbfn, void *param);
struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net,
uint32_t tmsi);
struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net,
const char *imsi);
int subscr_pending_requests(struct gsm_subscriber *subscr);
int subscr_pending_clear(struct gsm_subscriber *subscr);
int subscr_pending_dump(struct gsm_subscriber *subscr, struct vty *vty);
int subscr_pending_kick(struct gsm_subscriber *subscr);
char *subscr_name(struct gsm_subscriber *subscr);
int subscr_purge_inactive(struct gsm_network *net);
void subscr_update_from_db(struct gsm_subscriber *subscr);
/* internal */
struct gsm_subscriber *subscr_alloc(void);
extern struct llist_head active_subscribers;

View File

@@ -9,6 +9,6 @@ struct gsm_subscriber_connection;
int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts);
/* clear any operation for this connection */
void bsc_clear_handover(struct gsm_subscriber_connection *conn);
void bsc_clear_handover(struct gsm_subscriber_connection *conn, int free_lchan);
#endif /* _HANDOVER_H */

View File

@@ -2,92 +2,50 @@
#define _IPACCESS_H
#include "e1_input.h"
#include <osmocore/linuxlist.h>
#include "gsm_subscriber.h"
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/protocol/ipaccess.h>
#define IPA_TCP_PORT_OML 3002
#define IPA_TCP_PORT_RSL 3003
struct ipac_msgt_sccp_state {
uint8_t src_ref[3];
uint8_t dst_ref[3];
uint8_t trans_id;
uint8_t invoke_id;
char imsi[GSM_IMSI_LENGTH];
} __attribute__((packed));
struct ipaccess_head {
u_int16_t len; /* network byte order */
u_int8_t proto;
u_int8_t data[0];
} __attribute__ ((packed));
enum ipaccess_proto {
IPAC_PROTO_RSL = 0x00,
IPAC_PROTO_IPACCESS = 0xfe,
IPAC_PROTO_SCCP = 0xfd,
IPAC_PROTO_OML = 0xff,
};
enum ipaccess_msgtype {
IPAC_MSGT_PING = 0x00,
IPAC_MSGT_PONG = 0x01,
IPAC_MSGT_ID_GET = 0x04,
IPAC_MSGT_ID_RESP = 0x05,
IPAC_MSGT_ID_ACK = 0x06,
};
enum ipaccess_id_tags {
IPAC_IDTAG_SERNR = 0x00,
IPAC_IDTAG_UNITNAME = 0x01,
IPAC_IDTAG_LOCATION1 = 0x02,
IPAC_IDTAG_LOCATION2 = 0x03,
IPAC_IDTAG_EQUIPVERS = 0x04,
IPAC_IDTAG_SWVERSION = 0x05,
IPAC_IDTAG_IPADDR = 0x06,
IPAC_IDTAG_MACADDR = 0x07,
IPAC_IDTAG_UNIT = 0x08,
};
/*
* @add_remove 0 for remove, 1 for add, 3 to asK
* @nr_lacs Number of extra lacs inside this package
* @lac One lac entry
*/
struct ipac_ext_lac_cmd {
uint8_t add_remove;
uint8_t nr_extra_lacs;
uint16_t lac;
uint8_t data[0];
} __attribute__((packed));
int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
/*
* methods for parsing and sending a message
*/
int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd);
struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error);
int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
struct msgb *ipaccess_read_msg(struct osmo_fd *bfd, int *error);
void ipaccess_prepend_header(struct msgb *msg, int proto);
void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
int ipaccess_send_pong(int fd);
int ipaccess_send_id_ack(int fd);
int ipaccess_send_id_req(int fd);
const char *ipaccess_idtag_name(uint8_t tag);
int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
int ipaccess_parse_unitid(const char *str, uint16_t *site_id, uint16_t *bts_id, uint16_t *trx_id);
int ipaccess_drop_oml(struct gsm_bts *bts);
int ipaccess_drop_rsl(struct gsm_bts_trx *trx);
/*
* Firmware specific header
*/
struct sdp_firmware {
char magic[4];
char more_magic[2];
u_int16_t more_more_magic;
u_int32_t header_length;
u_int32_t file_length;
char sw_part[20];
char text1[64];
char time[12];
char date[14];
char text2[10];
char version[20];
u_int16_t table_offset;
/* stuff i don't know */
} __attribute__((packed));
struct sdp_header_entry {
u_int16_t something1;
char text1[64];
char time[12];
char date[14];
char text2[10];
char version[20];
u_int32_t length;
u_int32_t addr1;
u_int32_t addr2;
u_int32_t start;
} __attribute__((packed));
struct sdp_header_item {
struct sdp_header_entry header_entry;
struct llist_head entry;

View File

@@ -1,21 +1,23 @@
#ifndef _MEAS_REP_H
#define _MEAS_REP_H
#include <stdint.h>
#define MRC_F_PROCESSED 0x0001
/* extracted from a L3 measurement report IE */
struct gsm_meas_rep_cell {
u_int8_t rxlev;
u_int8_t bsic;
u_int8_t neigh_idx;
u_int16_t arfcn;
uint8_t rxlev;
uint8_t bsic;
uint8_t neigh_idx;
uint16_t arfcn;
unsigned int flags;
};
/* RX Level and RX Quality */
struct gsm_rx_lev_qual {
u_int8_t rx_lev;
u_int8_t rx_qual;
uint8_t rx_lev;
uint8_t rx_qual;
};
/* unidirectional measumrement report */
@@ -38,7 +40,7 @@ struct gsm_meas_rep {
struct gsm_lchan *lchan;
/* number of the measurement report */
u_int8_t nr;
uint8_t nr;
/* flags, see MEAS_REP_F_* */
unsigned int flags;
@@ -46,11 +48,11 @@ struct gsm_meas_rep {
struct gsm_meas_rep_unidir ul;
struct gsm_meas_rep_unidir dl;
u_int8_t bs_power;
u_int8_t ms_timing_offset;
uint8_t bs_power;
uint8_t ms_timing_offset;
struct {
int8_t pwr; /* MS power in dBm */
u_int8_t ta; /* MS timing advance */
uint8_t ta; /* MS timing advance */
} ms_l1;
/* neighbor measurement reports for up to 6 cells */

View File

@@ -1,34 +1,37 @@
/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
/*
* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2010 by On-Waves
* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2011 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef OPENBSC_MGCP_H
#define OPENBSC_MGCP_H
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/write_queue.h>
#include "debug.h"
#include <arpa/inet.h>
#define RTP_PORT_DEFAULT 4000
#define RTP_PORT_NET_DEFAULT 16000
/**
* Calculate the RTP audio port for the given multiplex
@@ -60,6 +63,7 @@ static inline int rtp_calculate_port(int multiplex, int base)
*/
struct mgcp_endpoint;
struct mgcp_config;
struct mgcp_trunk_config;
#define MGCP_ENDP_CRCX 1
#define MGCP_ENDP_DLCX 2
@@ -75,61 +79,115 @@ struct mgcp_config;
#define MGCP_POLICY_REJECT 5
#define MGCP_POLICY_DEFER 6
typedef int (*mgcp_change)(struct mgcp_config *cfg, int endpoint, int state, int local_rtp);
typedef int (*mgcp_policy)(struct mgcp_config *cfg, int endpoint, int state, const char *transactio_id);
typedef int (*mgcp_realloc)(struct mgcp_trunk_config *cfg, int endpoint);
typedef int (*mgcp_change)(struct mgcp_trunk_config *cfg, int endpoint, int state);
typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int state, const char *transactio_id);
typedef int (*mgcp_reset)(struct mgcp_config *cfg);
#define PORT_ALLOC_STATIC 0
#define PORT_ALLOC_DYNAMIC 1
/**
* This holds information on how to allocate ports
*/
struct mgcp_port_range {
int mode;
/* pre-allocated from a base? */
int base_port;
/* dynamically allocated */
int range_start;
int range_end;
int last_port;
};
struct mgcp_trunk_config {
struct llist_head entry;
struct mgcp_config *cfg;
int trunk_nr;
int trunk_type;
char *audio_name;
int audio_payload;
int audio_loop;
/* spec handling */
int force_realloc;
unsigned int number_endpoints;
struct mgcp_endpoint *endpoints;
};
struct mgcp_config {
int source_port;
char *local_ip;
char *source_addr;
unsigned int number_endpoints;
char *bts_ip;
char *call_agent_addr;
struct in_addr bts_in;
char *audio_name;
int audio_payload;
int audio_loop;
int early_bind;
int rtp_base_port;
/* transcoder handling */
char *transcoder_ip;
struct in_addr transcoder_in;
int transcoder_remote_base;
struct osmo_wqueue gw_fd;
struct mgcp_port_range bts_ports;
struct mgcp_port_range net_ports;
struct mgcp_port_range transcoder_ports;
int endp_dscp;
char *forward_ip;
int forward_port;
/* spec handling */
int force_realloc;
mgcp_change change_cb;
mgcp_policy policy_cb;
mgcp_reset reset_cb;
mgcp_realloc realloc_cb;
void *data;
struct mgcp_endpoint *endpoints;
unsigned int last_call_id;
uint32_t last_call_id;
/* trunk handling */
struct mgcp_trunk_config trunk;
struct llist_head trunks;
/* only used for start with a static configuration */
int last_net_port;
int last_bts_port;
};
/* config management */
struct mgcp_config *mgcp_config_alloc(void);
int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg);
int mgcp_vty_init(void);
int mgcp_endpoints_allocate(struct mgcp_config *cfg);
int mgcp_bind_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
void mgcp_free_endp(struct mgcp_endpoint *endp);
int mgcp_reset_transcoder(struct mgcp_config *cfg);
/*
* format helper functions
*/
struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg);
struct msgb *mgcp_create_response_with_data(int code, const char *msg, const char *trans, const char *data);
struct msgb *mgcp_create_response_with_data(int code, const char *txt, const char *msg, const char *trans, const char *data);
/* adc helper */
static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot)
{
if (timeslot == 0)
timeslot = 1;
return timeslot + (31 * multiplex);
if (timeslot == 0) {
LOGP(DMGCP, LOGL_ERROR, "Timeslot should not be 0\n");
timeslot = 255;
}
return timeslot + (32 * multiplex);
}
static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *timeslot)
{
*multiplex = endpoint / 32;
*timeslot = endpoint % 32;
}

View File

@@ -1,30 +1,29 @@
/* MGCP Private Data */
/*
* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2010 by On-Waves
* (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2011 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef OPENBSC_MGCP_DATA_H
#define OPENBSC_MGCP_DATA_H
#include <osmocore/select.h>
#include <osmocom/core/select.h>
#define CI_UNUSED 0
@@ -36,6 +35,11 @@ enum mgcp_connection_mode {
MGCP_CONN_LOOPBACK = 4,
};
enum mgcp_trunk_type {
MGCP_TRUNK_VIRTUAL,
MGCP_TRUNK_E1,
};
struct mgcp_rtp_state {
int initialized;
int patch;
@@ -49,47 +53,78 @@ struct mgcp_rtp_state {
int32_t timestamp_offset;
};
struct mgcp_rtp_end {
/* statistics */
unsigned int packets;
struct in_addr addr;
/* in network byte order */
int rtp_port, rtcp_port;
int payload_type;
/*
* Each end has a socket...
*/
struct osmo_fd rtp;
struct osmo_fd rtcp;
int local_port;
int local_alloc;
};
enum {
MGCP_TAP_BTS_IN,
MGCP_TAP_BTS_OUT,
MGCP_TAP_NET_IN,
MGCP_TAP_NET_OUT,
/* last element */
MGCP_TAP_COUNT
};
struct mgcp_rtp_tap {
int enabled;
struct sockaddr_in forward;
};
struct mgcp_endpoint {
int ci;
int allocated;
uint32_t ci;
char *callid;
char *local_options;
int conn_mode;
int orig_mode;
int bts_payload_type;
int net_payload_type;
/* the local rtp port we are binding to */
int rtp_port;
/*
* RTP mangling:
* - we get RTP and RTCP to us and need to forward to the BTS
* - we get RTP and RTCP from the BTS and forward to the network
*/
struct bsc_fd local_rtp;
struct bsc_fd local_rtcp;
struct in_addr remote;
struct in_addr bts;
/* in network byte order */
int net_rtp, net_rtcp;
int bts_rtp, bts_rtcp;
/* backpointer */
struct mgcp_config *cfg;
struct mgcp_trunk_config *tcfg;
/* statistics */
unsigned int in_bts;
unsigned int in_remote;
/* port status for bts/net */
struct mgcp_rtp_end bts_end;
struct mgcp_rtp_end net_end;
/*
* For transcoding we will send from the local_port
* of trans_bts and it will arrive at trans_net from
* where we will forward it to the network.
*/
struct mgcp_rtp_end trans_bts;
struct mgcp_rtp_end trans_net;
int is_transcoded;
/* sequence bits */
struct mgcp_rtp_state net_state;
struct mgcp_rtp_state bts_state;
/* SSRC/seq/ts patching for loop */
int allow_patch;
/* tap for the endpoint */
struct mgcp_rtp_tap taps[MGCP_TAP_COUNT];
};
#define ENDPOINT_NUMBER(endp) abs(endp - endp->cfg->endpoints)
#define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints)
struct mgcp_msg_ptr {
unsigned int start;
@@ -100,5 +135,20 @@ int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg,
struct mgcp_msg_ptr *ptr, int size,
const char **transaction_id, struct mgcp_endpoint **endp);
int mgcp_send_dummy(struct mgcp_endpoint *endp);
int mgcp_bind_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port);
int mgcp_bind_trans_bts_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
int mgcp_bind_trans_net_rtp_port(struct mgcp_endpoint *enp, int rtp_port);
int mgcp_free_rtp_port(struct mgcp_rtp_end *end);
/* For transcoding we need to manage an in and an output that are connected */
static inline int endp_back_channel(int endpoint)
{
return endpoint + 60;
}
struct mgcp_trunk_config *mgcp_trunk_alloc(struct mgcp_config *cfg, int index);
struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index);
#endif

View File

@@ -2,18 +2,17 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@@ -23,7 +22,6 @@
#include "e1_input.h"
int mi_setup(int cardnr, struct e1inp_line *line, int release_l2);
int _abis_nm_sendmsg(struct msgb *msg);
int mi_e1_line_update(struct e1inp_line *line);
#endif

View File

@@ -7,26 +7,31 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _MNCC_H
#define _MNCC_H
#include <osmocore/linuxlist.h>
#include <osmocore/mncc.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/mncc.h>
#include <stdint.h>
struct gsm_network;
struct msgb;
/* One end of a call */
struct gsm_call {
@@ -36,9 +41,9 @@ struct gsm_call {
void *net;
/* the 'local' transaction */
u_int32_t callref;
uint32_t callref;
/* the 'remote' transaction */
u_int32_t remote_ref;
uint32_t remote_ref;
};
#define MNCC_SETUP_REQ 0x0101
@@ -112,11 +117,11 @@ struct gsm_call {
struct gsm_mncc {
/* context based information */
u_int32_t msg_type;
u_int32_t callref;
uint32_t msg_type;
uint32_t callref;
/* which fields are present */
u_int32_t fields;
uint32_t fields;
/* data derived informations (MNCC_F_ based) */
struct gsm_mncc_bearer_cap bearer_cap;
@@ -147,13 +152,21 @@ struct gsm_mncc {
};
struct gsm_data_frame {
u_int32_t msg_type;
u_int32_t callref;
uint32_t msg_type;
uint32_t callref;
unsigned char data[0];
};
char *get_mncc_name(int value);
int mncc_recv(struct gsm_network *net, int msg_type, void *arg);
void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg);
/* input from CC code into mncc_builtin */
int int_mncc_recv(struct gsm_network *net, struct msgb *msg);
/* input from CC code into mncc_sock */
int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg);
int mncc_sock_init(struct gsm_network *gsmnet);
#endif

View File

@@ -4,18 +4,17 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

View File

@@ -5,6 +5,39 @@
#include "bsc_api.h"
struct sccp_connection;
struct osmo_bsc_sccp_con {
struct llist_head entry;
int ciphering_handled;
int rtp_port;
/* SCCP connection realted */
struct sccp_connection *sccp;
struct bsc_msc_connection *msc_con;
struct osmo_timer_list sccp_it_timeout;
struct osmo_timer_list sccp_cc_timeout;
struct llist_head sccp_queue;
unsigned int sccp_queue_size;
struct gsm_subscriber_connection *conn;
uint8_t new_subscriber;
};
struct bsc_api *osmo_bsc_api();
int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg);
int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg);
int bsc_create_new_connection(struct gsm_subscriber_connection *conn);
int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_handle_udt(struct gsm_network *net, struct bsc_msc_connection *conn, struct msgb *msg, unsigned int length);
int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
#endif

View File

@@ -0,0 +1,28 @@
/*
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef OSMO_BSC_GRACE_H
#define OSMO_BSC_GRACE_H
#include "gsm_data.h"
int bsc_grace_allow_new_connection(struct gsm_network *network);
#endif

View File

@@ -1,18 +1,33 @@
#ifndef OSMO_BSC_RF
#define OSMO_BSC_RF
#include <osmocore/write_queue.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/timer.h>
struct gsm_network;
struct osmo_bsc_rf {
struct bsc_fd listen;
/* the value of signal.h */
int policy;
struct osmo_fd listen;
struct gsm_network *gsm_network;
const char *last_state_command;
/* delay the command */
char last_request;
struct osmo_timer_list delay_cmd;
/* verify that RF is up as it should be */
struct osmo_timer_list rf_check;
/* some handling for the automatic grace switch */
struct osmo_timer_list grace_timeout;
};
struct osmo_bsc_rf_conn {
struct write_queue queue;
struct gsm_network *gsm_network;
struct osmo_wqueue queue;
struct osmo_bsc_rf *rf;
};
struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net);

View File

@@ -0,0 +1,80 @@
/*
* Data for the true BSC
*
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef _OSMO_MSC_DATA_H
#define _OSMO_MSC_DATA_H
#include "bsc_msc.h"
#include <osmocom/core/timer.h>
struct osmo_bsc_rf;
struct gsm_network;
struct gsm_audio_support {
uint8_t hr : 1,
ver : 7;
};
struct osmo_msc_data {
/* Back pointer */
struct gsm_network *network;
/* Connection data */
char *bsc_token;
int ping_timeout;
int pong_timeout;
struct osmo_timer_list ping_timer;
struct osmo_timer_list pong_timer;
struct bsc_msc_connection *msc_con;
int core_ncc;
int core_mcc;
int rtp_base;
/* audio codecs */
struct gsm_audio_support **audio_support;
int audio_length;
/* destinations */
struct llist_head dests;
/* mgcp agent */
struct osmo_wqueue mgcp_agent;
/* rf ctl related bits */
char *mid_call_txt;
int mid_call_timeout;
char *rf_ctrl_name;
struct osmo_bsc_rf *rf_ctl;
/* ussd welcome text */
char *ussd_welcome_txt;
};
int osmo_bsc_msc_init(struct gsm_network *network);
int osmo_bsc_sccp_init(struct gsm_network *gsmnet);
int msc_queue_write(struct bsc_msc_connection *conn, struct msgb *msg, int proto);
int osmo_bsc_audio_init(struct gsm_network *network);
#endif

View File

@@ -3,18 +3,17 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@@ -24,13 +23,35 @@
#include <stdlib.h>
#include <string.h>
#include <osmocore/linuxlist.h>
#include <osmocom/core/linuxlist.h>
#include "gsm_data.h"
#include "gsm_subscriber.h"
#include <osmocore/timer.h>
#include <osmocom/core/timer.h>
/* call once for every gsm_bts... */
void paging_init(struct gsm_bts *bts);
/**
* A pending paging request
*/
struct gsm_paging_request {
/* list_head for list of all paging requests */
struct llist_head entry;
/* the subscriber which we're paging. Later gsm_paging_request
* should probably become a part of the gsm_subscriber struct? */
struct gsm_subscriber *subscr;
/* back-pointer to the BTS on which we are paging */
struct gsm_bts *bts;
/* what kind of channel type do we ask the MS to establish */
int chan_type;
/* Timer 3113: how long do we try to page? */
struct osmo_timer_list T3113;
/* How often did we ask the BTS to page? */
int attempts;
/* callback to be called in case paging completes */
gsm_cbfn *cbfn;
void *cbfn_param;
};
/* schedule paging request */
int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
@@ -38,9 +59,13 @@ int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
/* stop paging requests */
void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
struct gsm_subscriber_connection *conn);
struct gsm_subscriber_connection *conn,
struct msgb *msg);
/* update paging load */
void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t);
void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
/* pending paging requests */
unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
#endif

View File

@@ -1,14 +1,13 @@
#ifndef _REST_OCTETS_H
#define _REST_OCTETS_H
#include <sys/types.h>
#include <openbsc/gsm_04_08.h>
/* generate SI1 rest octets */
int rest_octets_si1(u_int8_t *data, u_int8_t *nch_pos);
int rest_octets_si1(uint8_t *data, uint8_t *nch_pos);
struct gsm48_si_selection_params {
u_int16_t penalty_time:5,
uint16_t penalty_time:5,
temp_offs:3,
cell_resel_off:6,
cbq:1,
@@ -16,18 +15,18 @@ struct gsm48_si_selection_params {
};
struct gsm48_si_power_offset {
u_int8_t power_offset:2,
uint8_t power_offset:2,
present:1;
};
struct gsm48_si3_gprs_ind {
u_int8_t si13_position:1,
uint8_t si13_position:1,
ra_colour:3,
present:1;
};
struct gsm48_lsa_params {
u_int32_t prio_thr:3,
uint32_t prio_thr:3,
lsa_offset:3,
mcc:12,
mnc:12;
@@ -37,26 +36,26 @@ struct gsm48_lsa_params {
struct gsm48_si_ro_info {
struct gsm48_si_selection_params selection_params;
struct gsm48_si_power_offset power_offset;
u_int8_t si2ter_indicator;
u_int8_t early_cm_ctrl;
uint8_t si2ter_indicator;
uint8_t early_cm_ctrl;
struct {
u_int8_t where:3,
uint8_t where:3,
present:1;
} scheduling;
struct gsm48_si3_gprs_ind gprs_ind;
/* SI 4 specific */
struct gsm48_lsa_params lsa_params;
u_int16_t cell_id;
u_int8_t break_ind; /* do we have SI7 + SI8 ? */
uint16_t cell_id;
uint8_t break_ind; /* do we have SI7 + SI8 ? */
};
/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
int rest_octets_si3(u_int8_t *data, const struct gsm48_si_ro_info *si3);
int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3);
/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
int rest_octets_si4(u_int8_t *data, const struct gsm48_si_ro_info *si4);
int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4);
enum pbcch_carrier_type {
PBCCH_BCCH,
@@ -75,59 +74,59 @@ enum gprs_nmo {
struct gprs_cell_options {
enum gprs_nmo nmo;
/* T3168: wait for packet uplink assignment message */
u_int32_t t3168; /* in milliseconds */
uint32_t t3168; /* in milliseconds */
/* T3192: wait for release of the TBF after reception of the final block */
u_int32_t t3192; /* in milliseconds */
u_int32_t drx_timer_max;/* in seconds */
u_int32_t bs_cv_max;
uint32_t t3192; /* in milliseconds */
uint32_t drx_timer_max;/* in seconds */
uint32_t bs_cv_max;
u_int8_t ext_info_present;
uint8_t ext_info_present;
struct {
u_int8_t egprs_supported;
u_int8_t use_egprs_p_ch_req;
u_int8_t bep_period;
u_int8_t pfc_supported;
u_int8_t dtm_supported;
u_int8_t bss_paging_coordination;
uint8_t egprs_supported;
uint8_t use_egprs_p_ch_req;
uint8_t bep_period;
uint8_t pfc_supported;
uint8_t dtm_supported;
uint8_t bss_paging_coordination;
} ext_info;
};
/* TS 04.60 Table 12.9.2 */
struct gprs_power_ctrl_pars {
u_int8_t alpha;
u_int8_t t_avg_w;
u_int8_t t_avg_t;
u_int8_t pc_meas_chan;
u_int8_t n_avg_i;
uint8_t alpha;
uint8_t t_avg_w;
uint8_t t_avg_t;
uint8_t pc_meas_chan;
uint8_t n_avg_i;
};
struct gsm48_si13_info {
struct gprs_cell_options cell_opts;
struct gprs_power_ctrl_pars pwr_ctrl_pars;
u_int8_t bcch_change_mark;
u_int8_t si_change_field;
u_int8_t pbcch_present;
uint8_t bcch_change_mark;
uint8_t si_change_field;
uint8_t pbcch_present;
union {
struct {
u_int8_t rac;
u_int8_t spgc_ccch_sup;
u_int8_t net_ctrl_ord;
u_int8_t prio_acc_thr;
uint8_t rac;
uint8_t spgc_ccch_sup;
uint8_t net_ctrl_ord;
uint8_t prio_acc_thr;
} no_pbcch;
struct {
u_int8_t psi1_rep_per;
u_int8_t pb;
u_int8_t tsc;
u_int8_t tn;
uint8_t psi1_rep_per;
uint8_t pb;
uint8_t tsc;
uint8_t tn;
enum pbcch_carrier_type carrier_type;
u_int16_t arfcn;
u_int8_t maio;
uint16_t arfcn;
uint8_t maio;
} pbcch;
};
};
/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
int rest_octets_si13(u_int8_t *data, const struct gsm48_si13_info *si13);
int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13);
#endif /* _REST_OCTETS_H */

View File

@@ -7,26 +7,27 @@
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <netinet/in.h>
#include <osmocore/linuxlist.h>
#include <osmocore/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/select.h>
#include <openbsc/mncc.h>
#define RTP_PT_GSM_FULL 3
#define RTP_PT_GSM_HALF 96
@@ -49,7 +50,7 @@ struct rtp_sub_socket {
struct sockaddr_in sin_local;
struct sockaddr_in sin_remote;
struct bsc_fd bfd;
struct osmo_fd bfd;
/* linked list of to-be-transmitted msgb's */
struct llist_head tx_queue;
};
@@ -68,23 +69,23 @@ struct rtp_socket {
} proxy;
struct {
struct gsm_network *net;
u_int32_t callref;
uint32_t callref;
} receive;
};
enum rtp_tx_action tx_action;
struct {
u_int16_t sequence;
u_int32_t timestamp;
u_int32_t ssrc;
uint16_t sequence;
uint32_t timestamp;
uint32_t ssrc;
struct timeval last_tv;
} transmit;
};
struct rtp_socket *rtp_socket_create(void);
int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip);
int rtp_socket_connect(struct rtp_socket *rs, u_int32_t ip, u_int16_t port);
int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip);
int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port);
int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other);
int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, u_int32_t callref);
int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, uint32_t callref);
int rtp_socket_free(struct rtp_socket *rs);
int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame);

View File

@@ -1,9 +1,8 @@
#ifndef _SGSN_H
#define _SGSN_H
#include <sys/types.h>
#include <osmocore/msgb.h>
#include <osmocom/core/msgb.h>
#include <openbsc/gprs_ns.h>
#include <openbsc/gprs_sgsn.h>
@@ -22,11 +21,11 @@ struct sgsn_instance {
char *config_file;
struct sgsn_config cfg;
/* File descriptor wrappers for LibGTP */
struct bsc_fd gtp_fd0;
struct bsc_fd gtp_fd1c;
struct bsc_fd gtp_fd1u;
struct osmo_fd gtp_fd0;
struct osmo_fd gtp_fd1c;
struct osmo_fd gtp_fd1u;
/* Timer for libGTP */
struct timer_list gtp_timer;
struct osmo_timer_list gtp_timer;
/* GSN instance for libgtp */
struct gsn_t *gsn;
};

View File

@@ -1,21 +1,21 @@
/* Generic signalling/notification infrastructure */
/* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009 by Harald Welte <laforge@gnumonks.org>
* (C) 2010 by On-Waves
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@@ -27,7 +27,7 @@
#include <openbsc/gsm_data.h>
#include <osmocore/signal.h>
#include <osmocom/core/signal.h>
/*
* Signalling subsystems
@@ -45,6 +45,9 @@ enum signal_subsystems {
SS_NS,
SS_IPAC_NWL,
SS_RF,
SS_MSC,
SS_HO,
SS_INPUT,
};
/* SS_PAGING signals */
@@ -59,6 +62,7 @@ enum signal_sms {
S_SMS_DELIVERED, /* A SMS has been successfully delivered to a MS */
S_SMS_SMMA, /* A MS tells us it has more space available */
S_SMS_MEM_EXCEEDED, /* A MS tells us it has no more space available */
S_SMS_UNKNOWN_ERROR, /* A MS tells us it has an error */
};
/* SS_ABISIP signals */
@@ -78,6 +82,9 @@ enum signal_nm {
S_NM_IPACC_RESTART_ACK, /* nanoBTS has send a restart ack */
S_NM_IPACC_RESTART_NACK,/* nanoBTS has send a restart ack */
S_NM_TEST_REP, /* GSM 12.21 Test Report */
S_NM_STATECHG_OPER, /* Operational State changed*/
S_NM_STATECHG_ADM, /* Administrative State changed */
S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */
};
/* SS_LCHAN signals */
@@ -123,6 +130,7 @@ enum signal_ipaccess {
enum signal_global {
S_GLOBAL_SHUTDOWN,
S_GLOBAL_BTS_CLOSE_OM,
};
/* SS_RF signals */
@@ -132,12 +140,24 @@ enum signal_rf {
S_RF_GRACE,
};
/* SS_INPUT signals */
enum signal_input {
S_INP_NONE,
S_INP_TEI_UP,
S_INP_TEI_DN,
S_INP_LINE_INIT,
S_INP_LINE_ALARM,
S_INP_LINE_NOALARM,
};
struct gsm_subscriber;
struct paging_signal_data {
struct gsm_subscriber *subscr;
struct gsm_bts *bts;
int paging_result;
/* NULL in case the paging didn't work */
struct gsm_subscriber_connection *conn;
};
@@ -150,7 +170,30 @@ struct scall_signal_data {
struct ipacc_ack_signal_data {
struct gsm_bts_trx *trx;
u_int8_t msg_type;
uint8_t msg_type;
};
struct abis_om2k_mo;
struct nm_statechg_signal_data {
struct gsm_bts *bts;
uint8_t obj_class;
void *obj;
struct gsm_nm_state *old_state;
struct gsm_nm_state *new_state;
/* This pointer is vaold for TS 12.21 MO */
struct abis_om_obj_inst *obj_inst;
/* This pointer is vaold for RBS2000 MO */
struct abis_om2k_mo *om2k_mo;
};
struct nm_om2k_signal_data {
struct gsm_bts *bts;
void *obj;
struct abis_om2k_mo *om2k_mo;
uint8_t accordance_ind;
};
struct nm_nack_signal_data {
@@ -168,6 +211,22 @@ struct rf_signal_data {
struct gsm_network *net;
};
struct sms_signal_data {
/* The transaction where this occured */
struct gsm_trans *trans;
/* Can be NULL for SMMA */
struct gsm_sms *sms;
/* int paging result. Only the ones with > 0 */
int paging_result;
};
struct lchan_signal_data {
/* The lchan the signal happened on */
struct gsm_lchan *lchan;
/* Measurement reports on this lchan */
struct gsm_meas_rep *mr;
};
enum signal_ns {
S_NS_RESET,
S_NS_BLOCK,
@@ -180,4 +239,33 @@ struct ns_signal_data {
uint8_t cause;
};
/* MSC signals */
enum signal_msc {
S_MSC_LOST,
S_MSC_CONNECTED,
};
struct osmo_msc_data;
struct msc_signal_data {
struct osmo_msc_data *data;
};
/* handover */
enum signal_ho {
S_HANDOVER_ACK,
};
struct ho_signal_data {
struct gsm_lchan *old_lchan;
struct gsm_lchan *new_lchan;
};
struct input_signal_data {
int link_type;
uint8_t tei;
uint8_t sapi;
struct gsm_bts_trx *trx;
struct e1inp_line *line;
};
#endif

View File

@@ -0,0 +1,17 @@
#ifndef SMS_QUEUE_H
#define SMS_QUEUE_H
struct gsm_network;
struct gsm_sms_queue;
struct vty;
int sms_queue_start(struct gsm_network *, int in_flight);
int sms_queue_trigger(struct gsm_sms_queue *);
/* vty helper functions */
int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty);
int sms_queue_set_max_pending(struct gsm_sms_queue *, int max);
int sms_queue_set_max_failure(struct gsm_sms_queue *, int fail);
int sms_queue_clear(struct gsm_sms_queue *);
#endif

View File

@@ -1,14 +1,14 @@
#ifndef _BSC_SOCKET_H
#define _BSC_SOCKET_H
#include <sys/types.h>
#include <osmocore/select.h>
#include <osmocom/core/select.h>
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47
#endif
int make_sock(struct bsc_fd *bfd, int proto, u_int32_t ip, u_int16_t port,
int (*cb)(struct bsc_fd *fd, unsigned int what));
int make_sock(struct osmo_fd *bfd, int proto,
uint32_t ip, uint16_t port, int priv_nr,
int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
#endif /* _BSC_SOCKET_H */

Some files were not shown because too many files have changed in this diff Show More