Commit Graph

466 Commits

Author SHA1 Message Date
Harald Welte 7584aeac42 * add more GSM 04.08 IEIs
* implement function for CHANNEL MODE MODIFY
* don't use hard-coded SETUP message but construct it with tlv functions
2009-02-11 11:44:12 +00:00
Harald Welte 45f83a10d8 include already-exported lchan2chan_nr() function in header file 2009-02-11 11:43:19 +00:00
Holger Freyther b1ffbb62ee [paging] Send paging requests as response to the PAGING LOAD indicator
Kill the paging timer and send paging upon paging load notifications.
2009-02-11 01:49:15 +00:00
Holger Freyther f6535bb444 [paging] Stop counting the requests... harald implemented sepc conform timer support
We do have a dispose timer, there is no need to discard the
paging request this way... remove the code.
2009-02-11 01:02:45 +00:00
Holger Freyther c009f3fa65 [misc] Add header files to fix make distcheck 2009-02-10 23:36:14 +00:00
Harald Welte cd06bfbc9d * fill the e1_link member of every bts_trx_ts structure
* introduce new timer as part of every paging request
2009-02-10 17:33:56 +00:00
Holger Freyther 392209cbb5 [paging] Introduce a variable containing the free paging slots
Start with a large number of available slots. It is guranteed
that we will - at some point - get a paging load and will properly
update the counter and keep it updated.
2009-02-10 00:06:19 +00:00
Holger Freyther 1fd34141c2 [paging] Cleanup page -> paging in function names 2009-02-09 23:42:03 +00:00
Holger Freyther 9c564b85e6 introduce lookup of subscribers based on their extension number 2009-02-09 23:39:20 +00:00
Harald Welte 1fa60c8ab0 * add trau_mux implementation to relay from one incoming TRAU
channel to another one (simple voice call switching)
* add a way more generic E1 input layer, abstracting out the misdn
  low-level interface. This also adds infrastructure for multiple TRX
  in one BTS, as well as multiple BTS on one E1 link
* add a E1 subchannel multiplexer for sending multiple 16kbit sub-channels
  one one 64kBps E1 channel
* add TRAU IDLE frame generation
* terminate bsc_hack in case there is a E1 / mISDN init error
* introduce 'e1_config.c' file with static configuration of our
  E1 setup (which TRX/BTS is configured for which TEI/SAPI/E1). This should
  later become a config file rather than a compiled C file.

WARNING: all this compiles but is not tested yet.  Expect fix-up committs over
the next hours or so
2009-02-09 18:13:26 +00:00
Harald Welte e79769b926 make sure certain functions are per TRX, not per BTS, such as
* rsl_chan_activate()
* rsl_bcch_info()
* rsl_sacch_filling()
2009-02-07 00:48:17 +00:00
Holger Freyther 7b2ef7ff4e [dist] Fix make distcheck by adding the new header files 2009-02-06 22:08:17 +00:00
Holger Freyther e64a7a3c3b [rr] Send a Channel Release before deactivating the channel
After auto releasing a channel the next paging request will
not be immediately answered. The hypothesis was that we do
not release the channel properly. Implementing Channel Release
of GSM 04.08 should have fixed it, but it didn't. According
to the wireshark dissectors the message is correct though.

- Add the RR cause values to gsm_04_08.
- Implement the Channel Release message
- Invoke the release channel function before deallocating
  the lchan.
2009-02-06 21:55:37 +00:00
Holger Freyther ceb59b72c2 [paging] Move the paging state into struct gsm_bts
There is a 1:1 relationship between gsm_bts and the paging
operation. Move the paging state into the gsm_bts which is
simplfying the code a lot. This was hinted by LaF0rge.

(I'm not happy with the names of the structs)
2009-02-06 18:54:00 +00:00
Harald Welte a7dbe49a19 BS11 logon message type 2009-02-06 16:44:37 +00:00
Harald Welte 763da00e97 add new routine to stop paging 2009-02-06 12:52:14 +00:00
Harald Welte 91b5b0d41d add some initial simplistic TLV parser 2009-02-06 12:51:39 +00:00
Harald Welte 6ddd1683b5 introduce new "DEBUGPC" macro for continuing on the same line without prefix of file/line/time 2009-02-06 12:38:29 +00:00
Harald Welte 2d35ae6d3b implement parsing of PAGING RESPONSE 2009-02-06 12:02:13 +00:00
Holger Freyther 3aa8d6c46d [paging] This is paging my phone but it looks completely wrong...
- The paging block calculation is wrong but I have a hard time finding
  the right information. The table of 05.02 (Table 5 of 9) looks good
  but my phone is not happy with that group...
2009-02-04 02:14:45 +00:00
Holger Freyther 2976c40cd1 [paging] Allow call the paging related helper functions
they alread had external linkage
2009-02-04 01:09:20 +00:00
Holger Freyther 1adb4ff002 [paging] Keep a copy of the Control Channel Description in the bts struct
- Initialize Control Channel Description of SI3 
- Patch the table
- Setting ATT now is easy
- Paging can now extract all required information... to determine
  the right paging group.
2009-02-04 00:04:52 +00:00
Holger Freyther b01554493f [rsl] Prepare to properly handle the paging command add defines to the RSL
For finding the right paging group one needs to know various
settings that are broadcasted as part of system settings 3. This
includes the CCCH Conf, the BS_PA_MFRMS, BS_AG_BLKS_RES.... The
next step will be to move away from the hardcoded System Settings 3
so one can calculate the paging group...
2009-02-03 23:24:04 +00:00
Harald Welte 3ffd1376b7 * add abis_nm_software_load_status() to header file
* new abis_nm_bs11_bsc_disconnect() function to disconnect BSC/BTS link
* add support for 'forced load' of BS-11 software to abis_nm.c and bs11_config
* remove lots of debug output
* print progress during software load
2009-02-01 22:15:49 +00:00
Harald Welte c12d52bae4 * improve parsing of status/phase response from BTS
* split rs232 support into separate file (like misdn.c)
2009-02-01 21:39:06 +00:00
Harald Welte 268bb40b35 * add more detailed status printout to bs11_config
* add support for real LMT logon time
* add support for abis external time
* move 'create_trx1_objects' to separate function
2009-02-01 19:11:56 +00:00
Harald Welte 4fc898a0d5 add missing 'requests' field that zecke probably forgot to commit 2009-02-01 17:57:04 +00:00
Harald Welte 5e4d1b3663 * rename NM_MT_BS11_LOGOFF to NM_MT_BS11_LMT_LOGOFF
* add more BS11 specific attributes
* define all valid BS11 PA power classes
* add callback function to software load
* introduce SWL load function for BS-11 style SWL file lists
* separate activation of software from loading of software
* add function to obtain BS-11 serial number
2009-02-01 13:36:56 +00:00
Harald Welte 8e1e3eece8 introduce generic callback function and hook enum 2009-02-01 13:32:45 +00:00
Harald Welte 043d04a99a * Use new NM_ATT_BS11 definitions instead of magic numbers
* rename FECTORY_LOGON into LMT_LOGON since it's not always factory level
2009-01-29 23:15:30 +00:00
Harald Welte 934e68bbcf more BS11 specific attribute definitions 2009-01-29 23:08:12 +00:00
Harald Welte 3b8ba215b9 * Fix BS11 software download routines in abis_nm.c
* Introduce user-configurable delay when sending serial msgs from bs11_config
2009-01-29 12:27:58 +00:00
Holger Freyther 245c534806 [pedantic] Declare abis_nm_bs11_reset_resource to avoid a warning in bsc_hack.c
This command is BS11 specific and was put in the appropriate section
of the header file.
2009-01-27 19:00:44 +00:00
Harald Welte f3066bb17e add zero-length data field to abis_fom_hdr 2009-01-18 19:02:46 +00:00
Harald Welte 4724f99d19 Implementation of GSM12.21 LOAD SOFTWARE (BS11 dialect thereof) 2009-01-18 18:01:49 +00:00
Harald Welte 978cb42911 add BTS TYPE field to facilitate future non-BS11 BTS support 2009-01-18 17:57:27 +00:00
Harald Welte 85770c7aa4 * use #define for number of TS in one TRX
* use data structure to indicate E1 timeslot/subslot for every TRX:TS
2009-01-18 17:47:32 +00:00
Harald Welte 1bc0906436 abis_nm: more BS11 specific messages for configuration 2009-01-18 14:17:52 +00:00
Harald Welte 05188ee7a7 * prefix all BS11 specific OML functions with proper name
* add more BS11 specific OML commands (TRX power, logon, OML TEI, ...)
2009-01-18 11:39:08 +00:00
Harald Welte adaf08bec8 add some more BS11 specific OML definitions 2009-01-18 11:08:10 +00:00
Harald Welte ba4cf164b0 Start working on CM Service Request
Be able to send Accept/Reject the Service Request. Use mi_string
instead of the the msgb buffer (even if it is memsetted and such)...

The TMSI allocation seems to be a bit problematic and needs some
further checking. The rough idea is that we try to find the subscriber
for a CM Service Request and then decide based on the subscriber
if we want to handle the call.
2009-01-10 01:49:35 +00:00
Harald Welte 38c2f13098 Hook the paging code into bsc_hack.c and telnet_interface.c
Wrote and test code to add and remove paging requests... This
will be using the fact that the linux list is building a circle
on each tick we can send one/x paging requests and continue round
robin...
2009-01-06 23:10:57 +00:00
Harald Welte b68899d3e3 Start creating a paging layer...
You can request to open a channel to a MS and the paging layer
will call you once the channel is allocated. Internally the CCCH
Load Indication will be handled and retry to page a terminal.
2009-01-06 21:47:18 +00:00
Harald Welte ce281c0772 add initializer function for subchan_demux 2009-01-05 20:14:14 +00:00
Harald Welte 418f5a4e25 * add function to change c-bits in TRAU frame from uplink to downlink
* add function to re-encode an exploded TRAU frame into a bit-per-byte stream
2009-01-05 20:12:47 +00:00
Harald Welte 38e04372e5 handle IDLE speech frames in trau_frame code 2009-01-05 19:42:46 +00:00
Harald Welte 2a8ee52ced add (untested) TRAU frame decoder with support for FR/EFR and AMR 2009-01-05 19:01:01 +00:00
Harald Welte 54bd94d8b7 add (untested) 16kbit E1 sub-channel demux with TRAU frame sync 2009-01-05 19:00:01 +00:00
Holger Freyther ca362a6028 Make gcc happy and remove a couple of warnings
Remove the callbacks from gsm_network for now. A set of different
callbacks will be back. E.g. when the paging is completed, when the
Q.931 like call handling is there...

Remove var's or move them into #if 0, remove unused stuff that looks
like we do not need it anytime soon or #if 0 them, move stuff around.
2009-01-04 21:05:01 +00:00
Holger Freyther 7448a53ddb Be able to initiate paging from the telnet interface
The actual paging by subscriber needs to be implemented
2009-01-04 20:18:23 +00:00
Holger Freyther a553d098e7 Export the gsm0411 alloc and send function 2009-01-04 20:16:25 +00:00
Harald Welte a72c98eb2f functions to convert lchan/pchan type into human-readable string 2009-01-04 16:10:38 +00:00
Harald Welte 47d88aecaf Add some functions to CREATE OBJECTs in the BS-11 internal database 2009-01-04 12:02:08 +00:00
Holger Freyther 3e2c32322e Make gsm48_sendmsg public as well 2009-01-04 03:55:31 +00:00
Holger Freyther 819dd205a9 Make gsm48_msgb_alloc public and usable for the telnet_interface 2009-01-04 03:52:50 +00:00
Holger Freyther f87573dc4e Implement put_channel/get_channel, save on which bts we currently operate
Allow to change the refcount for a given channel. Store which
bts is our primary bts. A command to switch the primary bts will
be added as well. This makes entering and parsing of commands more
easy.
2009-01-04 03:49:41 +00:00
Holger Freyther d0e38c3cad Add implementation to find a lchan by the struct gsm_subscriber
Really compare pointers to check if the one gsm_subscriber
is equal to the other... gsm_subscriber should be unique for
a given IMSI so comparing the pointers should be fine.
2009-01-04 03:48:30 +00:00
Holger Freyther a471a41680 Define the gsm_subscriber getter functions in the header 2009-01-04 03:47:05 +00:00
Harald Welte 4668fdaa26 define and use enum values for BS11 (or Siemens?) specific OML message types 2009-01-03 08:19:29 +00:00
Holger Freyther 460af8b794 Clean up struct gsm_network and remove the gsm_subscriber 2009-01-03 05:48:32 +00:00
Harald Welte b8f04ea5a9 Add new management function to struct timer_list
Make sure that del_timer succeeds and removes an entry from the list. Currently
sending the LOCATION UPDATING REJECT from within the timer will not remove the
list element as ->active gets set to 0 in the timer updating before calling the
callback. Fix the segfault and allow the timer to be removed from within its
own callback.
2009-01-02 23:57:22 +00:00
Holger Freyther 219518d064 Add simplistic telnet control interface
This might turn into a complete wire protocol with special
client software. For now it will be a simple client interface
that you can use with telnet to do certain things.

This is using flex to implement the parsing. Implementation
and more commands will follow.
2009-01-02 22:04:43 +00:00
Holger Freyther b21b305d7c Fix make distcheck by adding some header files 2009-01-02 02:00:35 +00:00
Holger Freyther 9a3ee0ff1b Add the option to write the communication on the D Channel to a pcap file
When using ISDN as network type and using a fake LAPD encapsulation
wireshark should be able to recognize some bits if dump.

Append a dummy LAPD header. It is not clear to me if the Control field
of the LAPD frame is part of the msg or if we need to add it as well.

TODO:
    - Do the same for the B Channel
    - Write out time
    - Check if more of the LAPD frame needs to be prepended. The
      information from the mISDNhead comes into mind. Maybe it makes
      sense to start a custom wireshark mISDN dissector.
2009-01-02 00:40:15 +00:00
Holger Freyther 12aa50d5a2 Change the subscriber and database backend
gsm_subscriber is now refcounted, the db backend is leaking
a lot less, db_get_subscriber will allocate the subscr record
now, subscr_* will look up a subscriber in the list of currently
active subscribers and add an ref to this one.

The db test cases pass, more testing will be when next to the bts
2009-01-01 18:02:05 +00:00
Holger Freyther 67b4b9a017 Do not call rsl_chan_release directly but use the use_count of the lchan
Call use_lchan early in allocate_loc_updating_req, do not directly call
rsl_chan_release but go through channel alloc to take the use_count into
account.
2009-01-01 03:46:11 +00:00
Holger Freyther 73487a23da Introduce logical updating request operation on the gsm_lchan
We are going to have logical operations like Phone Call, SMS,
Paging, Updating Request on a logical channel and for each of
these operations we might need to store state. For now pointers
in gsm_lchan look like the best way of doing this and we start
by introducing an operation for the location updating request.

The new flow of things are:
    - We get the location updating request and update/create
      the subscriber and maybe send the identity requests to
      the mobile station
    - We start the updating timer, if it times out we will
      reject the mobile station.
    - Once we get the Identity Responses we have asked for
      and the reject timer did not fire yet we might accept
      the user.
2008-12-31 18:53:57 +00:00
Holger Freyther e97f7fba97 Add an option to set the global reject cause
This will need to be moved into bsc_hack.c together with the
policy to accept/reject a UPDATING LOCATION REQUEST.
2008-12-31 18:52:11 +00:00
Holger Freyther c6ea9dbeba Recylce a gsm_lchan when the refcount drops to zero
When a channel is allocated, start a timeout, when a lchan_use
is used the timer will be restarted, when the timeout fires
we will try to recycle or restart the timer.
2008-12-30 19:18:21 +00:00
Holger Freyther 590d66acec Fix the reference. The names and values are described in 9.1 of 04.08 2008-12-30 19:13:13 +00:00
Harald Welte c6ba9c2a97 * 04:08: add MM INFO information elements
* gsm_data: add network name to gsm_network
2008-12-30 18:01:02 +00:00
Holger Freyther 89824fc466 Add an option to allow everyone to the network.
This should move out of gsm_04_08 and the accept, reject
policy should be controllable by the higher levels.
2008-12-30 16:18:18 +00:00
Holger Freyther a767794d96 [gsm0408] Add enum values for the LOCATION UPDATING REJECT cause
Convert spec to the enum
2008-12-30 16:18:16 +00:00
Harald Welte b0f4793f90 export debug_flags 2008-12-30 14:59:01 +00:00
Holger Freyther b7193e4e94 Introduce new callbacks, remember that we have LOC UPD REQ, reject things only once
gsm_data.h add new callbacks, add some parameters, update bsc_hack and
other call sites.

Remember that we need to ACCEPT/REJECT the LOCATION UPDATE REQUEST and
then send the ACCEPT or schedule the sending of the reject. Currently
it is possible that for a new subscriber that we do not have a !subscbr
yet, we will trigger an IDENTITY REQUEST and schedule the reject timer.
This may lead to rejecting AND accepting (a new subscriber). This issue
is triggered when allowing everyone to connect to the network.
2008-12-29 17:44:08 +00:00
Holger Freyther 2eafef599c Up on call released release the channel and take the next item
Once a call is released, release the gsm_lchan and move to the
next item in pending_stations or wait for more work.
2008-12-29 06:42:17 +00:00
Holger Freyther abade7af88 Initiate a call once we have a channel assigned 2008-12-29 06:42:15 +00:00
Holger Freyther 88ea832ed7 Unite the acked/nacked handling in a common response... 2008-12-29 06:23:52 +00:00
Holger Freyther 24893de3cb Inform the bsc about acked or nacked channels...
On channel allocation the bsc_hack added a cookie to the lchan on
ack and nack we will take a look and then assume it is the channel
we have allocated. This can be easily exploited by a MS sending fake
responses to paging commands. After the channel has been acked we would
have to ask for the tmsi or find the information on the channel
allocation. For now we will guess.
2008-12-29 06:23:51 +00:00
Holger Freyther 3186bf209a Add callback for allocated lchannels
Currently it is not possible to know for which tmsi the channel
is going to be allocated. The bsc_hack will guess.. in the future
it might be forced to ask for the tmsi after the channel has been
opened...
2008-12-29 06:23:49 +00:00
Holger Freyther 07cc8d8bee Improve page command handling in the bsc_hack
Add a callback to the gsm_network. When updating the location and
assigning a new tmsi callback into the bsc_hack.c and have a queue
of mobile stations to page, allocate a channel for and ultimately
dial.
2008-12-29 06:23:46 +00:00
Daniel Willmann 6fe997e9dd Implement sending SMS and send one on network registration 2008-12-29 04:20:41 +00:00
Harald Welte e14a57cc0e Create request channel reason to see channel requests originating from PAG 2008-12-29 04:08:28 +00:00
Harald Welte d35b6a7b12 debug: Create a region for Paging Command 2008-12-29 04:06:41 +00:00
Harald Welte de9226de16 Split out rach_control, missing mask from the last commit 2008-12-29 02:37:23 +00:00
Daniel Willmann 471712b133 ACK sms-submit 2008-12-29 01:54:02 +00:00
Daniel Willmann e0fbec823b Parse sms-submit messages 2008-12-29 00:44:41 +00:00
Harald Welte b84e2f4f1b * use 16bit for network and country code
* use aligned attribute for more data structures
* add command line arguments for operator/country code
2008-12-28 23:42:04 +00:00
Holger Freyther bde361064a make it optional where the hlr database is stored
Add --database to define where the database is stored. The default
was changed to not store the file in /tmp anymore.
2008-12-28 22:51:39 +00:00
Holger Freyther 177466199f [gsm0408] Make the generate_lai usable by other code
Prefix generate_lai with gsm0408 and update call sites. It will
be used from within bsc_hack.c
2008-12-28 16:32:44 +00:00
Holger Freyther 1ad732c699 [debug.h] Introduce a static assert using the array with negative size trick
It is inspired by the COMPILE_ASSERT from WebKit and is using the well
known trick to get compile time assertions.
2008-12-28 16:32:41 +00:00
Holger Freyther 5e85c8ea40 [gsm_04_08] Add structs for system information type 1 to 6
system information type 4 is a bit tricky as it has
a variable length and is terminated by a manadantory field.

System Information Type 6 has a mandantory SI 6 Reset Octet
but our BTS is happy with not receiving it. Make it optional
by the adding a 'pointer'.

System Information Type 5 and System Information Type 6 are
send through rsl_sacch_filling and it looks like we do not
need to send the L2 pseudo length. So far we have not found
the documentation confirming this. This is why the header
from Type 1 to Type 4 is not used.
2008-12-28 16:32:39 +00:00
Harald Welte 255539c742 working state up to location update and classmark inquiry 2008-12-28 02:26:27 +00:00
Daniel Willmann fdd0a6c157 Add SMS (GSM 04.11) testing program 2008-12-28 01:51:14 +00:00
Daniel Willmann 8b3390effd Start implementing GSM 04.11 (short message service) 2008-12-28 00:31:09 +00:00
Stefan Schmidt 4d4661d65b Draft ideas for high level call handling 2008-12-27 22:59:48 +00:00
Jan Luebbe 391d86e0d5 add extension field to subscriber struct and name column to db 2008-12-27 22:33:34 +00:00
Harald Welte bcae43fe1b SMS stub 2008-12-27 21:45:37 +00:00
Jan Luebbe fac25fccbd add a equipment table 2008-12-27 18:04:34 +00:00
Harald Welte a3d0438ff7 missing header file changes 2008-12-27 17:02:56 +00:00
Jan Luebbe 6e2e545fa1 add authorized state to subscribers in db 2008-12-27 16:47:55 +00:00
Jan Luebbe 5c15c85be3 rewrite db backend 2008-12-27 15:59:25 +00:00
Holger Freyther b332f61f0d Use getopt in the bsc_hack to parse options
Current options include a draft of the help screen, an option
to disable the colors and to specify the debug categories to
show.
2008-12-27 12:46:51 +00:00
Holger Freyther 5ee72eeeb1 Prefix debug symbols with debug_ to reduce the namesapce pollution 2008-12-27 12:46:49 +00:00
Holger Freyther d546e31628 Add code to parse a debug category string
Use strdup to be able to use strtok on the category string and add
a test case. Also safe some more information to be able to use color
in the print statement.
2008-12-27 12:03:07 +00:00
Holger Freyther 5f75598c28 Introduce a simple timer API....
One can use add_timer or schedule_timer to add a timer. After
the timeout time has been reached the callback will be called.
One can call add_time/schedule_timer and del_timer from within
the callback.
2008-12-27 09:42:59 +00:00
Holger Freyther 5677ae35ba misdn.h forward declare mi_setup 2008-12-27 09:41:03 +00:00
Harald Welte 4b634544e6 now we get up to the SETUP of MO calls 2008-12-27 01:55:51 +00:00
Jan Luebbe faaa49ca51 db: add GPL headers and integrate with autofoo 2008-12-27 01:07:07 +00:00
Harald Welte 5b6cfaf933 mISDN header files 2008-12-27 00:51:07 +00:00
Harald Welte 702d8707a9 working state up to location update and classmark inquiry 2008-12-26 20:25:35 +00:00
Harald Welte ad38464728 this is the first version that actually talks to the BTS
* initialize OML and RSL based on TEI establish (ACTIVATE_IND) events
* fix abis_nm_raw_msg() to not overwrite the OML header with payload
* fix debug print statements
* fix msgb_dequeue: actually dequeue it from the list ;)
2008-12-26 10:20:07 +00:00
Harald Welte 3633a6daf9 * fix DEBUGP defines, activate DEBUG functionality
* fix typo in db_transmission function
2008-12-26 00:06:02 +00:00
Harald Welte 8470bf200d no reasonable commit message possible. tons of changes of the last 2 days 2008-12-25 23:28:35 +00:00
Harald Welte de729a139e autoconf 2008-12-23 21:01:25 +00:00
Harald Welte 52b1f98889 initial commit of current OpenBSC state 2008-12-23 20:25:15 +00:00