use new libosmocore gsm_23_003.h for IMEI/IMSI length

... rather than our private definitions everwhere.  As an added benefit,
gprs_gsup_messages.h is now free of any header dependencies within
openbsc.
diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c
index 0b1dc9b..b3c8dab 100644
--- a/openbsc/src/gprs/gprs_gsup_messages.c
+++ b/openbsc/src/gprs/gprs_gsup_messages.c
@@ -31,6 +31,7 @@
 
 #include <osmocom/gsm/tlv.h>
 #include <osmocom/core/msgb.h>
+#include <osmocom/gsm/gsm48_ie.h>
 
 #include <stdint.h>
 
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 5b0bf39..648f912 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -757,8 +757,9 @@
 	}
 
 	if (strcpy(subscr->equipment.imei, mmctx->imei) != 0) {
-		strncpy(subscr->equipment.imei, mmctx->imei, GSM_IMEI_LENGTH-1);
-		subscr->equipment.imei[GSM_IMEI_LENGTH-1] = 0;
+		strncpy(subscr->equipment.imei, mmctx->imei,
+			sizeof(subscr->equipment.imei)-1);
+		subscr->equipment.imei[sizeof(subscr->equipment.imei)-1] = 0;
 	}
 
 	if (subscr->lac != mmctx->ra.lac)
diff --git a/openbsc/src/gprs/gtphub_ares.c b/openbsc/src/gprs/gtphub_ares.c
index 947f2dd..667013b 100644
--- a/openbsc/src/gprs/gtphub_ares.c
+++ b/openbsc/src/gprs/gtphub_ares.c
@@ -55,7 +55,7 @@
 
 	struct gtphub *hub;
 
-	char imsi_str[GSM_IMSI_LENGTH];
+	char imsi_str[GSM23003_IMSI_MAX_DIGITS+1];
 	char apn_ni_str[GSM_APN_LENGTH];
 	char apn_oi_str[GSM_APN_LENGTH];
 	int have_3dig_mnc;
diff --git a/openbsc/src/libcommon/gsm_subscriber_base.c b/openbsc/src/libcommon/gsm_subscriber_base.c
index a455824..50f4118 100644
--- a/openbsc/src/libcommon/gsm_subscriber_base.c
+++ b/openbsc/src/libcommon/gsm_subscriber_base.c
@@ -112,7 +112,7 @@
 	if (!subscr)
 		return NULL;
 
-	strncpy(subscr->imsi, imsi, GSM_IMSI_LENGTH-1);
+	strncpy(subscr->imsi, imsi, sizeof(subscr->imsi)-1);
 	subscr->group = sgrp;
 	return subscr;
 }
diff --git a/openbsc/src/libmsc/ctrl_commands.c b/openbsc/src/libmsc/ctrl_commands.c
index 9ac39de..0d6a37c 100644
--- a/openbsc/src/libmsc/ctrl_commands.c
+++ b/openbsc/src/libmsc/ctrl_commands.c
@@ -56,7 +56,7 @@
 
 	if (!imsi || !msisdn)
 		rc = 1;
-	else if (strlen(imsi) >= GSM_IMSI_LENGTH)
+	else if (strlen(imsi) > GSM23003_IMSI_MAX_DIGITS)
 		rc = 1;
 	else if (strlen(msisdn) >= GSM_EXTENSION_LENGTH)
 		rc = 1;
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index a23ec89..e5017ae 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -34,6 +34,7 @@
 #include <openbsc/db.h>
 #include <openbsc/debug.h>
 
+#include <osmocom/gsm/protocol/gsm_23_003.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/statistics.h>
 #include <osmocom/core/rate_ctr.h>
@@ -529,7 +530,7 @@
 		return NULL;
 	}
 	subscr->id = dbi_conn_sequence_last(conn, NULL);
-	strncpy(subscr->imsi, imsi, GSM_IMSI_LENGTH-1);
+	strncpy(subscr->imsi, imsi, sizeof(subscr->imsi)-1);
 	dbi_result_free(result);
 	LOGP(DDB, LOGL_INFO, "New Subscriber: ID %llu, IMSI %s\n", subscr->id, subscr->imsi);
 	db_subscriber_alloc_exten(subscr);
@@ -803,7 +804,7 @@
 	const char *string;
 	string = dbi_result_get_string(result, "imsi");
 	if (string)
-		strncpy(subscr->imsi, string, GSM_IMSI_LENGTH-1);
+		strncpy(subscr->imsi, string, sizeof(subscr->imsi)-1);
 
 	string = dbi_result_get_string(result, "tmsi");
 	if (string)
@@ -1317,7 +1318,7 @@
 	return 0;
 }
 
-int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char imei[GSM_IMEI_LENGTH])
+int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char imei[GSM23003_IMEISV_NUM_DIGITS])
 {
 	unsigned long long equipment_id, watch_id;
 	dbi_result result;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index e080905..2f68381 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -400,7 +400,7 @@
 	if (parsed->bssap != BSSAP_MSG_DTAP)
 		return 0;
 
-	if (strlen(con->filter_state.imsi) >= GSM_IMSI_LENGTH)
+	if (strlen(con->filter_state.imsi) > GSM23003_IMSI_MAX_DIGITS)
 		return 0;
 
 	hdr48 = bsc_unpack_dtap(parsed, msg, &len);