Intoduce Packet Switch CGI

This structure is needed in order to identify a given cell within the
BSS during RIM transactions.
The naming was made up by myself since I couldn't find any naming
reference for this kind of data (RAI + CI).
Since LAI + CI = CGI, then RAI + CI = CGI-PS

osmo_rai_name2 family of functions get a "2" suffix due to already
existing functions handling struct struct gprs_ra_id in gsm48.h

Change-Id: If48f412c32e8e5a3e604a78d12b74787a4786374
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 6bf771f..c1b0a00 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -784,6 +784,8 @@
 	case CELL_IDENT_BSS:
 	case CELL_IDENT_NO_CELL:
 		return 0;
+	case CELL_IDENT_WHOLE_GLOBAL_PS:
+		return 8;
 	default:
 		return -EINVAL;
 	}
@@ -828,6 +830,13 @@
 	case CELL_IDENT_NO_CELL:
 		/* Does not have any list items */
 		break;
+	case CELL_IDENT_WHOLE_GLOBAL_PS:
+		if (len < 8)
+			return -EINVAL;
+		decode_lai(buf, (struct osmo_location_area_id *)&out->global_ps.rai); /* rai contains lai + non-decoded rac */
+		out->global_ps.rai.rac = *(buf + sizeof(struct gsm48_loc_area_id));
+		out->global_ps.cell_identity = osmo_load16be(buf + sizeof(struct gsm48_loc_area_id) + 1);
+		break;
 	default:
 		/* Remaining cell identification types are not implemented. */
 		return -EINVAL;
@@ -869,6 +878,15 @@
 	case CELL_IDENT_NO_CELL:
 		/* Does not have any list items */
 		break;
+	case CELL_IDENT_WHOLE_GLOBAL_PS: {
+		const struct osmo_cell_global_id_ps *id = &u->global_ps;
+		struct gsm48_loc_area_id lai;
+		gsm48_generate_lai2(&lai, &id->rai.lac);
+		memcpy(msgb_put(msg, sizeof(lai)), &lai, sizeof(lai));
+		memcpy(msgb_put(msg, 1), &id->rai.rac, 1);
+		msgb_put_u16(msg, id->cell_identity);
+		break;
+	}
 	default:
 		/* Support for other identifier list types is not implemented. */
 		OSMO_ASSERT(false);
@@ -1592,6 +1610,8 @@
 		return snprintf(buf, buflen, "%s", osmo_lai_name(&u->lai_and_lac));
 	case CELL_IDENT_WHOLE_GLOBAL:
 		return snprintf(buf, buflen, "%s", osmo_cgi_name(&u->global));
+	case CELL_IDENT_WHOLE_GLOBAL_PS:
+		return snprintf(buf, buflen, "%s", osmo_cgi_ps_name(&u->global_ps));
 	default:
 		/* For CELL_IDENT_BSS and CELL_IDENT_NO_CELL, just print the discriminator.
 		 * Same for kinds we have no string representation of yet. */
@@ -1613,6 +1633,11 @@
 		*dst = u->global;
 		return;
 
+	case CELL_IDENT_WHOLE_GLOBAL_PS:
+		dst->lai = u->global_ps.rai.lac;
+		dst->cell_identity = u->global_ps.cell_identity;
+		return;
+
 	case CELL_IDENT_LAC_AND_CI:
 		dst->lai.lac = u->lac_and_ci.lac;
 		dst->cell_identity = u->lac_and_ci.ci;
@@ -1805,6 +1830,11 @@
 		*cgi = cid->id.global;
 		return OSMO_CGI_PART_PLMN | OSMO_CGI_PART_LAC | OSMO_CGI_PART_CI;
 
+	case CELL_IDENT_WHOLE_GLOBAL_PS:
+		cgi->lai = cid->id.global_ps.rai.lac;
+		cgi->cell_identity = cid->id.global_ps.cell_identity;
+		return OSMO_CGI_PART_PLMN | OSMO_CGI_PART_LAC | OSMO_CGI_PART_CI;
+
 	case CELL_IDENT_LAC_AND_CI:
 		cgi->lai.lac = cid->id.lac_and_ci.lac;
 		cgi->cell_identity = cid->id.lac_and_ci.ci;
@@ -1844,6 +1874,7 @@
 	{ CELL_IDENT_UTRAN_PLMN_LAC_RNC, "UTRAN-PLMN-LAC-RNC" },
 	{ CELL_IDENT_UTRAN_RNC, "UTRAN-RNC" },
 	{ CELL_IDENT_UTRAN_LAC_RNC, "UTRAN-LAC-RNC" },
+	{ CELL_IDENT_WHOLE_GLOBAL_PS, "CGI-PS"},
 	{ 0, NULL }
 };