sgsn: Add PDP info to subscriber data

Currently the PDP info that is transmitted via GSUP is just parsed
and then discarded.

This commit adds a new data structure sgsn_subscriber_pdp_data and
maintains a list of those in sgsn_subscriber_data. The PDP data is
copied from an incoming GSUP UpdateLocationResult message. If that
message contains the PDPInfoComplete flag, the list is cleared before
new entries are added.  The 'show subscriber cache' output now also
shows the PDP data entries.

Note that the InsertSubscriberData message is still not supported.

[hfreyther: Added talloc_free in gprs_subscr_pdp_data_clear]

Sponsored-by: On-Waves ehf
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index f566ab9..516b6cd 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -15,6 +15,7 @@
 #define GSM_IMSI_LENGTH 17
 #define GSM_IMEI_LENGTH 17
 #define GSM_EXTENSION_LENGTH 15
+#define GSM_APN_LENGTH 102
 
 struct gprs_llc_lle;
 struct ctrl_handle;
@@ -273,6 +274,16 @@
 	char imsi[16+1];
 };
 
+/* see GSM 09.02, 17.7.1, PDP-Context and GPRSSubscriptionData */
+/* see GSM 09.02, B.1, gprsSubscriptionData */
+struct sgsn_subscriber_pdp_data {
+	struct llist_head	list;
+
+	unsigned int		context_id;
+	uint16_t		pdp_type;
+	char			apn_str[GSM_APN_LENGTH];
+};
+
 enum sgsn_subscriber_proc {
 	SGSN_SUBSCR_PROC_NONE = 0,
 	SGSN_SUBSCR_PROC_PURGE,
@@ -284,6 +295,7 @@
 	struct sgsn_mm_ctx	*mm;
 	struct gsm_auth_tuple	auth_triplets[5];
 	int			auth_triplets_updated;
+	struct llist_head	pdp_list;
 	int			error_cause;
 	enum sgsn_subscriber_proc blocked_by;
 };