sgsn: Cross-link gsm_subscriber and sgsn_mm_ctx

To implement subscriber based authorization a data structure is
needed that keeps the subscriber data. The MSC already uses a similar
struct named gsm_subscriber whose implementation is split into a
generic part (allocation, retrieval, reference counting, list
maintenance) and MSC related parts. For GPRS, only the generic part
will be used and specific fields may be added when needed.

This patch adds a field mm to struct gsm_subscriber that will be used
by the SGSN to store a reference to the current MM context (or NULL
if there is none). This also adds a field subscr to struct
sgsn_mm_ctx that reversely points to a gsm_subscriber (or NULL if
there is none).  Either both fields are NULL or both fields are
non-NULL. Note that subscr is being reference counted.

Sponsored-by: On-Waves ehf
sgsn: Add gprs_subscriber.c

This patch adds GPRS specific functions for gsm_subscriber objects
(allocation, retrieval, deletion) and subscriber data
requests/updates. The sgsn_update_subscriber_data callback is used to
notify the sgsn about updates and is extended by a parameter that
passes a reference to a gsm_subscriber.

Sponsored-by: On-Waves ehf
sgsn: Integrate subscriber handling into the SGSN (TODO)

This commit adds a new authorization policy 'remote' and uses
the subscriber cache for authorization when this policy is being used.

Note that there is no remote backend implemented yet.

TODO:
 - tests
 - decide, whether 'remote' could be named better, e.g. sth based on
   'subscriber'

Ticket: OW#????
Sponsored-by: On-Waves ehf
sgsn: Add gsm0408_gprs_access_cancelled (TODO)

This function is called to delete an established MM context
without invoking a detach procedure that could disable the GPRS
functionality of the MS until the next power cycle.

It is called when a subscriber is cancelled.

Sponsored-by: On-Waves ehf
sgsn: Add VTY commands to manage subscriber cache

This adds the following commands to the ENABLE node:
  - show subscriber cache
  - update-subscriber imsi IMSI insert authorized (0|1)
  - update-subscriber imsi IMSI cancel

These commands are mainly testing tools and maintenance helpers. The
update commands work asynchronously and can be used to complete a
pending update request or to terminate an existing connection.

Note that the subscriber cache is not stored persistently and will
always be empty after an SGSN restart.

Sponsored-by: On-Waves ehf
sgsn: Do not die in _bssgp_tx_dl_ud on TLLI mismatch (TODO)

Currently an OSMO_ASSERT fails, if the message's and the mmctx's
TLLIs do not match.

This commit turns the assertion into an ERROR log message and uses
the default values for IMSI, DRX, and RA CAP instead of the MM
context values in this case.

TODO:
  - find the real source for the problem
  - add test cases derived from what is being described in the ticket

Ticket: OW#1322
Sponsored-by: On-Waves ehf
sgsn: Notify an affected MM context if an ACL rule is removed (TODO)

Currently if an ACL access rule is removed, MS already attached are
not affected until they try to reattach to the SGSN.

This patch adds sgsn_auth_update_all() that iterates through allMM
contexts and calls sgsn_auth_update() on each of them. This function
is then called when 'imsi-acl del IMSI' is executed after the ACL has
been removed.

TODO:
 - decide, whether ito replace that by a dedicated update command in
   the VTY ENABLE node

Sponsored-by: On-Waves ehf
sgsn: Added TODOs (TODO)

TODO:
  - fix and remove TODOs
  - add test cases for Detach(reattach)
  - add test cases for PDP context deletion (OW#1311)
  - add test cases for Cancel pending timer in sgsn_mm_ctx_free
  - remove this commit

Sponsored-by: On-Waves ehf