bts: Add some simple dependency between different BTS

E.g. for the sysmoBTS2050 we have the requirement that the first
board connects before the second due clocking. The easiest point
to enforce this is the BSC. Add a simple bitmask based system to
allow to express dependencies for IP based systems.
bts: When one link drops.. check what needs to be dropped

In case a BTS is dropped, iterate over the list of BTS and check
if a dependency is now missing and then drop the BTS. This check
could lead to check of 256*256 checks (e.g. all BTS on each other
in the chain and the master is being dropped). The performance
aspect of it doesn't matter for our usecase. We expect to have
pairs of BTS right now.
ho: Make sure the timer is always stopped

In case of a ho_chan_activ_nack (sent due another bug inside
both sysmobts and openbsc) the code would not stop the timer
but free the datastructure. This can lead to a clear segfault
when the timer has expired. Create a "free" function which is
responsible to detach the handover structure, stop the timer
(which is idempotent) and free the structure.
ho: Copy the multirate config to the new lchan

The new lchan will be in speech mode already but for AMR we will
need to provide a working multirate config in the channel activation,
otherwise the channel act might be nacked.

Copy the config from the current lchan into the new lchan. The
abis code simply added the mrconf if the speech mode was amr.
Before this commit the invalidate mrconf with all zeroes was
copied/sent.
sgsn: Add support for authentication triplets

This commit add data structures, functions, initialization, and VTY
commands for per subscriber authentication triplets.

The following VTY command is added:

  - update-subscriber imsi IMSI \
    insert auth-triplet <1-5> sres SRES rand RAND kc KC

Note that the triplets are not really used by the SGSN yet.

Sponsored-by: On-Waves ehf
sgsn: Add a subscriber based authentication phase

This implements the MAP way of subscriber validation when the MS
tries to perform an Attach Request:

  1. perform authentication (optionally invoke the sendAuthInfo
     procedure), starts the Auth & Ciph procedure
  2. perform update location
  3. insert subscriber data
  4. finish the update location
  5. Attach Accept / Attach Reject

The authentication triplet are used and eventually updated if all of
them have been used.

This is currently accessible via the VTY interface by the following
commands:

  - update-subscriber imsi IMSI update-auth-info
  - update-subscriber imsi IMSI update-location-result (ok|ERR-CAUSE)

Sponsored-by: On-Waves ehf
sgsn: Add missing LF in log message

Sponsored-by: On-Waves ehf
gprs: Move TLV parser functions to gprs_utils.c and rename them

Currently the parser functions for single information elements are
defined within gprs_gb_parse.c and not exported explicitely. In
addition they are named like libosmocore's TLV parser functions and
do not have a proper name prefix. Since it is planned to use them for
other protocols, they need to be globally accessible.

This patch moves them to gprs_utils.c and renames them.

The new names are:
    lv_shift             -> gprs_shift_lv
    v_fixed_shift        -> gprs_shift_v_fixed
    lv_shift             -> gprs_shift_lv
    v_fixed_shift        -> gprs_shift_v_fixed

In the long term, these functions should be moved to libosmocore (and
renamed again).

Sponsored-by: On-Waves ehf
gprs: Add gprs_shift_tlv function

This function is similar to gprs_match_tlv with the exception, that
the tag is not compared but returned in *tag instead.

Sponsored-by: On-Waves ehf
sgsn/doc: Add protocol specification for remote subscriber update

This is the first version of the specification for the GPRS
Subscriber Update Protocol.

Sponsored-by: On-Waves ehf
gprs: Add encoder/decoder for the Subscriber Update Protocol

This patch adds functions to encode and decode GSUP messages. This
does not include the layer 1 framing (IPA). The messages so far
supported are: send_auth_info_*, update_location_*,
location_cancellation_*.

Sponsored-by: On-Waves ehf
gprs: Add subscriber functions to create/handle GSUP messages

This patch extends gprs_subscr_query_auth_info and
gprs_subscr_location_update to create GSUP messages with the help of
a static gprs_subscr_tx_gsup_message function. A corresponding
gprs_subscr_rx_gsup_message is added which takes a messages, gets the
subscr, and updates it accordingly.

Sponsored-by: On-Waves ehf
sgsn/doc: Add IPA default parameters

This commit adds the default protocol identifiers that should be used
for GSUP by the IPA protocol.

Sponsored-by: On-Waves ehf
sgsn: Add GSUP client

This commit adds the client code to get subscriber information from a
remote server. It provides an IPA over TCP connection to transmit and
receive GSUP messages.

Sponsored-by: On-Waves ehf
sgsn: Integrate the GSUP client into the SGSN

This commit adds GSUP client configuration (via VTY), connection set
up, and real message sending.

The following configuration commands are added:

 - gsup remote-ip A.B.C.D            set server IP address
 - gsup remote-port PORT             set server TCP port

Sponsored-by: On-Waves ehf
openbsc: Ignore generated coverage analysis files

This patch adds *.gcda and *.gcno to .gitignore to skip files that
are generated by gcc --coverage and related tools.

Sponsored-by: On-Waves ehf
sgsn: Replace subscr.authenticate by global require_authentication flag

Currently the flag 'authenticate' is managed per subscriber.

This patch replaces that flag by a global cfg.require_authentication
flag that enables/disables the use of the Auth & Ciph procedure for
every subscriber. The flag is set by the VTY, if and only if the
authorization policy is 'remote'.

The VTY command

  - update-subscriber imsi IMSI insert authenticate <0-1>

is removed.

Sponsored-by: On-Waves ehf
sgsn: Add global require_update_location flag

This flag is used to determine, whether the Update Location procedure
shall be invoked. This is currently only set, when the 'remote'
authorization policy is set. When the flag is set, sgsn_auth_update
will not never be called directly by sgsn_auth_request, if an Attach
Request procedure is pending, even if the remote connection fails for
some reason.

Sponsored-by: On-Waves ehf
sgsn: Log requested state change in sgsn_auth_update

Sponsored-by: On-Waves ehf
sgsn/test: Add wrapper for gprs_subscr_rx_gsup_message

Currently, several lines of boiler plate are needed around a call to
gprs_subscr_rx_gsup_message.

This patch puts all of this (including the call to
gprs_subscr_rx_gsup_message) into a separate function.

Sponsored-by: On-Waves ehf