gbproxy: Parse additional IMSI/PTMSI/TLLI fields

This adds parsing support for the following messages:
  - Attach Request: IMSI/PTMSI
  - Identity Response: IMSI/PTMSI
  - BSSGP: Optional TLLI IE
  - BSSGP/PAGING_PS: PTMSI

A new new_ptmsi_enc field is added for newly assigned PTMSI in
SGSN->BSS messages (instead of ptmsi_enc). The ptmsi_enc field is now
used for informational PTMSI IE in messages.

Sponsored-by: On-Waves ehf
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index a3768ae..769dc67 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -146,6 +146,22 @@
 	0x16, 0x6d, 0x01
 };
 
+/* Base Station Subsystem GPRS Protocol: GSM A-I/F DTAP - Identity Request */
+static const unsigned char bssgp_identity_req[] = {
+	0x00, 0xbb, 0xc5, 0x46, 0x79, 0x00, 0x50, 0x20,
+	0x16, 0x82, 0x02, 0x58, 0x0e, 0x89, 0x41, 0xc0,
+	0x01, 0x08, 0x15, 0x01, 0xff, 0x6c, 0xba
+};
+
+/* Base Station Subsystem GPRS Protocol: GSM A-I/F DTAP - Identity Response */
+static const unsigned char bssgp_identity_resp[] = {
+	0x01, 0xbb, 0xc5, 0x46, 0x79, 0x00, 0x00, 0x04,
+	0x08, 0x88, 0x11, 0x22, 0x33, 0x40, 0x50, 0x60,
+	0x75, 0x30, 0x00, 0x80, 0x0e, 0x00, 0x11, 0x01,
+	0xc0, 0x0d, 0x08, 0x16, 0x08, 0x11, 0x12, 0x13,
+	0x14, 0x15, 0x16, 0x17, 0x18, 0xb7, 0x1b, 0x9a
+};
+
 /* Base Station Subsystem GPRS Protocol: GSM A-I/F DTAP - Attach Accept */
 static const unsigned char bssgp_attach_acc[88] = {
 	0x00, 0xbb, 0xc5, 0x46, 0x79, 0x00, 0x50, 0x20,
@@ -984,6 +1000,12 @@
 	send_ns_unitdata(nsi, "ATTACH REQUEST", &bss_peer[0], 0x1002,
 			 bssgp_attach_req, sizeof(bssgp_attach_req));
 
+	send_ns_unitdata(nsi, "IDENT REQUEST", &sgsn_peer, 0x1002,
+			 bssgp_identity_req, sizeof(bssgp_identity_req));
+
+	send_ns_unitdata(nsi, "IDENT RESPONSE", &bss_peer[0], 0x1002,
+			 bssgp_identity_resp, sizeof(bssgp_identity_resp));
+
 	send_ns_unitdata(nsi, "ATTACH ACCEPT", &sgsn_peer, 0x1002,
 			 bssgp_attach_acc, sizeof(bssgp_attach_acc));