Rename gprs_gsup_* to osmo_gsup_*

This is a preparation to move the related code to libosmocore, whilst
at the same time generalizing it from GPRS Subscriber Update Protocol
to the Osmocom Generic Subscriber Update Protoco.
diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am
index 104bd29..7889d5f 100644
--- a/openbsc/src/gprs/Makefile.am
+++ b/openbsc/src/gprs/Makefile.am
@@ -26,7 +26,7 @@
 			sgsn_main.c sgsn_vty.c sgsn_libgtp.c \
 			gprs_llc.c gprs_llc_parse.c gprs_llc_vty.c crc24.c \
 			sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \
-			gprs_gsup_messages.c gprs_utils.c gprs_gsup_client.c \
+			osmo_gsup_messages.c gprs_utils.c gprs_gsup_client.c \
 			sgsn_cdr.c sgsn_ares.c \
 			oap.c oap_messages.c
 osmo_sgsn_LDADD = 	\
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 648f912..d9bc10a 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -27,7 +27,7 @@
 #include <openbsc/sgsn.h>
 #include <openbsc/gprs_sgsn.h>
 #include <openbsc/gprs_gmm.h>
-#include <openbsc/gprs_gsup_messages.h>
+#include <openbsc/osmo_gsup_messages.h>
 #include <openbsc/gprs_utils.h>
 
 #include <openbsc/debug.h>
@@ -159,14 +159,14 @@
 }
 
 static int gprs_subscr_tx_gsup_message(struct gsm_subscriber *subscr,
-				       struct gprs_gsup_message *gsup_msg)
+				       struct osmo_gsup_message *gsup_msg)
 {
 	struct msgb *msg = gprs_gsup_msgb_alloc();
 
 	if (strlen(gsup_msg->imsi) == 0 && subscr)
 		strncpy(gsup_msg->imsi, subscr->imsi, sizeof(gsup_msg->imsi) - 1);
 
-	gprs_gsup_encode(msg, gsup_msg);
+	osmo_gsup_encode(msg, gsup_msg);
 
 	LOGGSUBSCRP(LOGL_INFO, subscr,
 		    "Sending GSUP, will send: %s\n", msgb_hexdump(msg));
@@ -180,21 +180,21 @@
 }
 
 static int gprs_subscr_tx_gsup_error_reply(struct gsm_subscriber *subscr,
-					   struct gprs_gsup_message *gsup_orig,
+					   struct osmo_gsup_message *gsup_orig,
 					   enum gsm48_gmm_cause cause)
 {
-	struct gprs_gsup_message gsup_reply = {0};
+	struct osmo_gsup_message gsup_reply = {0};
 
 	strncpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi) - 1);
 	gsup_reply.cause = cause;
 	gsup_reply.message_type =
-		GPRS_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
+		OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
 
 	return gprs_subscr_tx_gsup_message(subscr, &gsup_reply);
 }
 
 static int gprs_subscr_handle_gsup_auth_res(struct gsm_subscriber *subscr,
-					    struct gprs_gsup_message *gsup_msg)
+					    struct osmo_gsup_message *gsup_msg)
 {
 	unsigned idx;
 	struct sgsn_subscriber_data *sdata = subscr->sgsn_data;
@@ -261,7 +261,7 @@
 
 
 static void gprs_subscr_gsup_insert_data(struct gsm_subscriber *subscr,
-					 struct gprs_gsup_message *gsup_msg)
+					 struct osmo_gsup_message *gsup_msg)
 {
 	struct sgsn_subscriber_data *sdata = subscr->sgsn_data;
 	unsigned idx;
@@ -298,7 +298,7 @@
 	}
 
 	for (idx = 0; idx < gsup_msg->num_pdp_infos; idx++) {
-		struct gprs_gsup_pdp_info *pdp_info = &gsup_msg->pdp_infos[idx];
+		struct osmo_gsup_pdp_info *pdp_info = &gsup_msg->pdp_infos[idx];
 		size_t ctx_id = pdp_info->context_id;
 		struct sgsn_subscriber_pdp_data *pdp_data;
 
@@ -338,7 +338,7 @@
 }
 
 static int gprs_subscr_handle_gsup_upd_loc_res(struct gsm_subscriber *subscr,
-					       struct gprs_gsup_message *gsup_msg)
+					       struct osmo_gsup_message *gsup_msg)
 {
 	gprs_subscr_gsup_insert_data(subscr, gsup_msg);
 
@@ -368,7 +368,7 @@
 }
 
 static int gprs_subscr_handle_gsup_auth_err(struct gsm_subscriber *subscr,
-					    struct gprs_gsup_message *gsup_msg)
+					    struct osmo_gsup_message *gsup_msg)
 {
 	unsigned idx;
 	struct sgsn_subscriber_data *sdata = subscr->sgsn_data;
@@ -421,7 +421,7 @@
 }
 
 static int gprs_subscr_handle_gsup_upd_loc_err(struct gsm_subscriber *subscr,
-					       struct gprs_gsup_message *gsup_msg)
+					       struct osmo_gsup_message *gsup_msg)
 {
 	int cause_err;
 
@@ -467,9 +467,9 @@
 }
 
 static int gprs_subscr_handle_gsup_purge_no_subscr(
-	struct gprs_gsup_message *gsup_msg)
+	struct osmo_gsup_message *gsup_msg)
 {
-	if (GPRS_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
+	if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
 		LOGGSUPP(LOGL_NOTICE, gsup_msg,
 			 "Purge MS has failed with cause '%s' (%d)\n",
 			 get_value_string(gsm48_gmm_cause_names, gsup_msg->cause),
@@ -482,7 +482,7 @@
 }
 
 static int gprs_subscr_handle_gsup_purge_res(struct gsm_subscriber *subscr,
-					     struct gprs_gsup_message *gsup_msg)
+					     struct osmo_gsup_message *gsup_msg)
 {
 	LOGGSUBSCRP(LOGL_INFO, subscr, "Completing purge MS\n");
 
@@ -494,7 +494,7 @@
 }
 
 static int gprs_subscr_handle_gsup_purge_err(struct gsm_subscriber *subscr,
-					     struct gprs_gsup_message *gsup_msg)
+					     struct osmo_gsup_message *gsup_msg)
 {
 	LOGGSUBSCRP(LOGL_NOTICE, subscr,
 		    "Purge MS has failed with cause '%s' (%d)\n",
@@ -527,17 +527,17 @@
 }
 
 static int gprs_subscr_handle_loc_cancel_req(struct gsm_subscriber *subscr,
-					     struct gprs_gsup_message *gsup_msg)
+					     struct osmo_gsup_message *gsup_msg)
 {
-	struct gprs_gsup_message gsup_reply = {0};
+	struct osmo_gsup_message gsup_reply = {0};
 	int is_update_procedure = !gsup_msg->cancel_type ||
-		gsup_msg->cancel_type == GPRS_GSUP_CANCEL_TYPE_UPDATE;
+		gsup_msg->cancel_type == OSMO_GSUP_CANCEL_TYPE_UPDATE;
 
 	LOGGSUBSCRP(LOGL_INFO, subscr, "Cancelling MS subscriber (%s)\n",
 		    is_update_procedure ?
 		    "update procedure" : "subscription withdraw");
 
-	gsup_reply.message_type = GPRS_GSUP_MSGT_LOCATION_CANCEL_RESULT;
+	gsup_reply.message_type = OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT;
 	gprs_subscr_tx_gsup_message(subscr, &gsup_reply);
 
 	if (is_update_procedure)
@@ -554,16 +554,16 @@
 	return 0;
 }
 
-static int gprs_subscr_handle_unknown_imsi(struct gprs_gsup_message *gsup_msg)
+static int gprs_subscr_handle_unknown_imsi(struct osmo_gsup_message *gsup_msg)
 {
-	if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg->message_type)) {
+	if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg->message_type)) {
 		gprs_subscr_tx_gsup_error_reply(NULL, gsup_msg,
 						GMM_CAUSE_IMSI_UNKNOWN);
 		LOGP(DGPRS, LOGL_NOTICE,
 		     "Unknown IMSI %s, discarding GSUP request "
 		     "of type 0x%02x\n",
 		     gsup_msg->imsi, gsup_msg->message_type);
-	} else if (GPRS_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
+	} else if (OSMO_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
 		LOGP(DGPRS, LOGL_NOTICE,
 		     "Unknown IMSI %s, discarding GSUP error "
 		     "of type 0x%02x, cause '%s' (%d)\n",
@@ -586,10 +586,10 @@
 	size_t data_len = msgb_l2len(msg);
 	int rc = 0;
 
-	struct gprs_gsup_message gsup_msg = {0};
+	struct osmo_gsup_message gsup_msg = {0};
 	struct gsm_subscriber *subscr;
 
-	rc = gprs_gsup_decode(data, data_len, &gsup_msg);
+	rc = osmo_gsup_decode(data, data_len, &gsup_msg);
 	if (rc < 0) {
 		LOGP(DGPRS, LOGL_ERROR,
 		     "decoding GSUP message fails with error '%s' (%d)\n",
@@ -600,21 +600,21 @@
 	if (!gsup_msg.imsi[0]) {
 		LOGP(DGPRS, LOGL_ERROR, "Missing IMSI in GSUP message\n");
 
-		if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
+		if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
 			gprs_subscr_tx_gsup_error_reply(NULL, &gsup_msg,
 							GMM_CAUSE_INV_MAND_INFO);
 		return -GMM_CAUSE_INV_MAND_INFO;
 	}
 
-	if (!gsup_msg.cause && GPRS_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
+	if (!gsup_msg.cause && OSMO_GSUP_IS_MSGT_ERROR(gsup_msg.message_type))
 		gsup_msg.cause = GMM_CAUSE_NET_FAIL;
 
 	subscr = gprs_subscr_get_by_imsi(gsup_msg.imsi);
 
 	if (!subscr) {
 		switch (gsup_msg.message_type) {
-		case GPRS_GSUP_MSGT_PURGE_MS_RESULT:
-		case GPRS_GSUP_MSGT_PURGE_MS_ERROR:
+		case OSMO_GSUP_MSGT_PURGE_MS_RESULT:
+		case OSMO_GSUP_MSGT_PURGE_MS_ERROR:
 			return gprs_subscr_handle_gsup_purge_no_subscr(&gsup_msg);
 		default:
 			return gprs_subscr_handle_unknown_imsi(&gsup_msg);
@@ -625,36 +625,36 @@
 		"Received GSUP message of type 0x%02x\n", gsup_msg.message_type);
 
 	switch (gsup_msg.message_type) {
-	case GPRS_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
+	case OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST:
 		rc = gprs_subscr_handle_loc_cancel_req(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
+	case OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
 		rc = gprs_subscr_handle_gsup_auth_res(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
+	case OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
 		rc = gprs_subscr_handle_gsup_auth_err(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_UPDATE_LOCATION_RESULT:
+	case OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT:
 		rc = gprs_subscr_handle_gsup_upd_loc_res(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_UPDATE_LOCATION_ERROR:
+	case OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR:
 		rc = gprs_subscr_handle_gsup_upd_loc_err(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_PURGE_MS_ERROR:
+	case OSMO_GSUP_MSGT_PURGE_MS_ERROR:
 		rc = gprs_subscr_handle_gsup_purge_err(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_PURGE_MS_RESULT:
+	case OSMO_GSUP_MSGT_PURGE_MS_RESULT:
 		rc = gprs_subscr_handle_gsup_purge_res(subscr, &gsup_msg);
 		break;
 
-	case GPRS_GSUP_MSGT_INSERT_DATA_REQUEST:
-	case GPRS_GSUP_MSGT_DELETE_DATA_REQUEST:
+	case OSMO_GSUP_MSGT_INSERT_DATA_REQUEST:
+	case OSMO_GSUP_MSGT_DELETE_DATA_REQUEST:
 		LOGGSUBSCRP(LOGL_ERROR, subscr,
 			"Rx GSUP message type %d not yet implemented\n",
 			gsup_msg.message_type);
@@ -667,7 +667,7 @@
 		LOGGSUBSCRP(LOGL_ERROR, subscr,
 			"Rx GSUP message type %d not valid at SGSN\n",
 			gsup_msg.message_type);
-		if (GPRS_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
+		if (OSMO_GSUP_IS_MSGT_REQUEST(gsup_msg.message_type))
 			gprs_subscr_tx_gsup_error_reply(
 				subscr, &gsup_msg, GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL);
 		rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
@@ -682,11 +682,11 @@
 int gprs_subscr_purge(struct gsm_subscriber *subscr)
 {
 	struct sgsn_subscriber_data *sdata = subscr->sgsn_data;
-	struct gprs_gsup_message gsup_msg = {0};
+	struct osmo_gsup_message gsup_msg = {0};
 
 	LOGGSUBSCRP(LOGL_INFO, subscr, "purging MS subscriber\n");
 
-	gsup_msg.message_type = GPRS_GSUP_MSGT_PURGE_MS_REQUEST;
+	gsup_msg.message_type = OSMO_GSUP_MSGT_PURGE_MS_REQUEST;
 
 	/* Provide the HLR number in case it is known */
 	gsup_msg.hlr_enc_len = sdata->hlr_len;
@@ -697,23 +697,23 @@
 
 int gprs_subscr_query_auth_info(struct gsm_subscriber *subscr)
 {
-	struct gprs_gsup_message gsup_msg = {0};
+	struct osmo_gsup_message gsup_msg = {0};
 
 	LOGGSUBSCRP(LOGL_INFO, subscr,
 		"subscriber auth info is not available\n");
 
-	gsup_msg.message_type = GPRS_GSUP_MSGT_SEND_AUTH_INFO_REQUEST;
+	gsup_msg.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST;
 	return gprs_subscr_tx_gsup_message(subscr, &gsup_msg);
 }
 
 int gprs_subscr_location_update(struct gsm_subscriber *subscr)
 {
-	struct gprs_gsup_message gsup_msg = {0};
+	struct osmo_gsup_message gsup_msg = {0};
 
 	LOGGSUBSCRP(LOGL_INFO, subscr,
 		"subscriber data is not available\n");
 
-	gsup_msg.message_type = GPRS_GSUP_MSGT_UPDATE_LOCATION_REQUEST;
+	gsup_msg.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST;
 	return gprs_subscr_tx_gsup_message(subscr, &gsup_msg);
 }
 
diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/osmo_gsup_messages.c
similarity index 74%
rename from openbsc/src/gprs/gprs_gsup_messages.c
rename to openbsc/src/gprs/osmo_gsup_messages.c
index b3c8dab..00ada5b 100644
--- a/openbsc/src/gprs/gprs_gsup_messages.c
+++ b/openbsc/src/gprs/osmo_gsup_messages.c
@@ -1,4 +1,4 @@
-/* GPRS Subscriber Update Protocol message encoder/decoder */
+/* Osmocom Subscriber Update Protocol message encoder/decoder */
 
 /*
  * (C) 2014 by Sysmocom s.f.m.c. GmbH
@@ -23,10 +23,10 @@
  *
  */
 
-#include <openbsc/gprs_gsup_messages.h>
+#include <openbsc/osmo_gsup_messages.h>
 
 #include <openbsc/debug.h>
-#include <openbsc/gprs_utils.h>
+//#include <openbsc/gprs_utils.h>
 #include <openbsc/utils.h>
 
 #include <osmocom/gsm/tlv.h>
@@ -36,7 +36,7 @@
 #include <stdint.h>
 
 static int decode_pdp_info(uint8_t *data, size_t data_len,
-			  struct gprs_gsup_pdp_info *pdp_info)
+			  struct osmo_gsup_pdp_info *pdp_info)
 {
 	int rc;
 	uint8_t tag;
@@ -45,7 +45,7 @@
 
 	/* specific parts */
 	while (data_len > 0) {
-		enum gprs_gsup_iei iei;
+		enum osmo_gsup_iei iei;
 
 		rc = gprs_shift_tlv(&data, &data_len, &tag, &value, &value_len);
 		if (rc < 0)
@@ -54,21 +54,21 @@
 		iei = tag;
 
 		switch (iei) {
-		case GPRS_GSUP_PDP_CONTEXT_ID_IE:
+		case OSMO_GSUP_PDP_CONTEXT_ID_IE:
 			pdp_info->context_id = decode_big_endian(value, value_len);
 			break;
 
-		case GPRS_GSUP_PDP_TYPE_IE:
+		case OSMO_GSUP_PDP_TYPE_IE:
 			pdp_info->pdp_type =
 				decode_big_endian(value, value_len) & 0x0fff;
 			break;
 
-		case GPRS_GSUP_ACCESS_POINT_NAME_IE:
+		case OSMO_GSUP_ACCESS_POINT_NAME_IE:
 			pdp_info->apn_enc = value;
 			pdp_info->apn_enc_len = value_len;
 			break;
 
-		case GPRS_GSUP_PDP_QOS_IE:
+		case OSMO_GSUP_PDP_QOS_IE:
 			pdp_info->qos_enc = value;
 			pdp_info->qos_enc_len = value_len;
 			break;
@@ -90,7 +90,7 @@
 	uint8_t tag;
 	uint8_t *value;
 	size_t value_len;
-	enum gprs_gsup_iei iei;
+	enum osmo_gsup_iei iei;
 
 	/* specific parts */
 	while (data_len > 0) {
@@ -101,21 +101,21 @@
 		iei = tag;
 
 		switch (iei) {
-		case GPRS_GSUP_RAND_IE:
+		case OSMO_GSUP_RAND_IE:
 			if (value_len != sizeof(auth_vector->rand))
 				goto parse_error;
 
 			memcpy(auth_vector->rand, value, value_len);
 			break;
 
-		case GPRS_GSUP_SRES_IE:
+		case OSMO_GSUP_SRES_IE:
 			if (value_len != sizeof(auth_vector->sres))
 				goto parse_error;
 
 			memcpy(auth_vector->sres, value, value_len);
 			break;
 
-		case GPRS_GSUP_KC_IE:
+		case OSMO_GSUP_KC_IE:
 			if (value_len != sizeof(auth_vector->kc))
 				goto parse_error;
 
@@ -138,8 +138,8 @@
 	return -1;
 }
 
-int gprs_gsup_decode(const uint8_t *const_data, size_t data_len,
-		     struct gprs_gsup_message *gsup_msg)
+int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
+		     struct osmo_gsup_message *gsup_msg)
 {
 	int rc;
 	uint8_t tag;
@@ -150,9 +150,9 @@
 	uint8_t *data = (uint8_t *)const_data;
 	uint8_t *value;
 	size_t value_len;
-	static const struct gprs_gsup_pdp_info empty_pdp_info = {0};
+	static const struct osmo_gsup_pdp_info empty_pdp_info = {0};
 	static const struct osmo_auth_vector empty_auth_info = {0};
-	static const struct gprs_gsup_message empty_gsup_message = {0};
+	static const struct osmo_gsup_message empty_gsup_message = {0};
 
 	*gsup_msg = empty_gsup_message;
 
@@ -163,7 +163,7 @@
 
 	gsup_msg->message_type = decode_big_endian(value, 1);
 
-	rc = gprs_match_tlv(&data, &data_len, GPRS_GSUP_IMSI_IE,
+	rc = gprs_match_tlv(&data, &data_len, OSMO_GSUP_IMSI_IE,
 			    &value, &value_len);
 
 	if (rc <= 0)
@@ -183,8 +183,8 @@
 
 	/* specific parts */
 	while (data_len > 0) {
-		enum gprs_gsup_iei iei;
-		struct gprs_gsup_pdp_info pdp_info;
+		enum osmo_gsup_iei iei;
+		struct osmo_gsup_pdp_info pdp_info;
 		struct osmo_auth_vector auth_info;
 
 		rc = gprs_shift_tlv(&data, &data_len, &tag, &value, &value_len);
@@ -194,34 +194,34 @@
 		iei = tag;
 
 		switch (iei) {
-		case GPRS_GSUP_IMSI_IE:
-		case GPRS_GSUP_PDP_TYPE_IE:
-		case GPRS_GSUP_ACCESS_POINT_NAME_IE:
-		case GPRS_GSUP_RAND_IE:
-		case GPRS_GSUP_SRES_IE:
-		case GPRS_GSUP_KC_IE:
+		case OSMO_GSUP_IMSI_IE:
+		case OSMO_GSUP_PDP_TYPE_IE:
+		case OSMO_GSUP_ACCESS_POINT_NAME_IE:
+		case OSMO_GSUP_RAND_IE:
+		case OSMO_GSUP_SRES_IE:
+		case OSMO_GSUP_KC_IE:
 			LOGP(DGPRS, LOGL_NOTICE,
 			     "GSUP IE type %d not expected (ignored)\n", iei);
 			continue;
 
-		case GPRS_GSUP_CAUSE_IE:
+		case OSMO_GSUP_CAUSE_IE:
 			gsup_msg->cause = decode_big_endian(value, value_len);
 			break;
 
-		case GPRS_GSUP_CANCEL_TYPE_IE:
+		case OSMO_GSUP_CANCEL_TYPE_IE:
 			gsup_msg->cancel_type =
 				decode_big_endian(value, value_len) + 1;
 			break;
 
-		case GPRS_GSUP_PDP_INFO_COMPL_IE:
+		case OSMO_GSUP_PDP_INFO_COMPL_IE:
 			gsup_msg->pdp_info_compl = 1;
 			break;
 
-		case GPRS_GSUP_FREEZE_PTMSI_IE:
+		case OSMO_GSUP_FREEZE_PTMSI_IE:
 			gsup_msg->freeze_ptmsi = 1;
 			break;
 
-		case GPRS_GSUP_PDP_CONTEXT_ID_IE:
+		case OSMO_GSUP_PDP_CONTEXT_ID_IE:
 			/* When these IE appear in the top-level part of the
 			 * message, they are used by Delete Subscr Info to delete
 			 * single entries. We don't have an extra list for
@@ -229,8 +229,8 @@
 
 			/* fall through */
 
-		case GPRS_GSUP_PDP_INFO_IE:
-			if (gsup_msg->num_pdp_infos >= GPRS_GSUP_MAX_NUM_PDP_INFO) {
+		case OSMO_GSUP_PDP_INFO_IE:
+			if (gsup_msg->num_pdp_infos >= OSMO_GSUP_MAX_NUM_PDP_INFO) {
 				LOGP(DGPRS, LOGL_ERROR,
 				     "GSUP IE type %d (PDP_INFO) max exceeded\n",
 				     iei);
@@ -239,7 +239,7 @@
 
 			pdp_info = empty_pdp_info;
 
-			if (iei == GPRS_GSUP_PDP_INFO_IE) {
+			if (iei == OSMO_GSUP_PDP_INFO_IE) {
 				rc = decode_pdp_info(value, value_len, &pdp_info);
 				if (rc < 0)
 					return rc;
@@ -253,8 +253,8 @@
 				pdp_info;
 			break;
 
-		case GPRS_GSUP_AUTH_TUPLE_IE:
-			if (gsup_msg->num_auth_vectors >= GPRS_GSUP_MAX_NUM_AUTH_INFO) {
+		case OSMO_GSUP_AUTH_TUPLE_IE:
+			if (gsup_msg->num_auth_vectors >= OSMO_GSUP_MAX_NUM_AUTH_INFO) {
 				LOGP(DGPRS, LOGL_ERROR,
 				     "GSUP IE type %d (AUTH_INFO) max exceeded\n",
 				     iei);
@@ -271,12 +271,12 @@
 				auth_info;
 			break;
 
-		case GPRS_GSUP_MSISDN_IE:
+		case OSMO_GSUP_MSISDN_IE:
 			gsup_msg->msisdn_enc = value;
 			gsup_msg->msisdn_enc_len = value_len;
 			break;
 
-		case GPRS_GSUP_HLR_NUMBER_IE:
+		case OSMO_GSUP_HLR_NUMBER_IE:
 			gsup_msg->hlr_enc = value;
 			gsup_msg->hlr_enc_len = value_len;
 			break;
@@ -291,8 +291,8 @@
 	return 0;
 }
 
-static void encode_pdp_info(struct msgb *msg, enum gprs_gsup_iei iei,
-			    const struct gprs_gsup_pdp_info *pdp_info)
+static void encode_pdp_info(struct msgb *msg, enum osmo_gsup_iei iei,
+			    const struct osmo_gsup_pdp_info *pdp_info)
 {
 	uint8_t *len_field;
 	size_t old_len;
@@ -302,22 +302,22 @@
 	old_len = msgb_length(msg);
 
 	u8 = pdp_info->context_id;
-	msgb_tlv_put(msg, GPRS_GSUP_PDP_CONTEXT_ID_IE, sizeof(u8), &u8);
+	msgb_tlv_put(msg, OSMO_GSUP_PDP_CONTEXT_ID_IE, sizeof(u8), &u8);
 
 	if (pdp_info->pdp_type) {
-		msgb_tlv_put(msg, GPRS_GSUP_PDP_TYPE_IE,
-			     GPRS_GSUP_PDP_TYPE_SIZE,
+		msgb_tlv_put(msg, OSMO_GSUP_PDP_TYPE_IE,
+			     OSMO_GSUP_PDP_TYPE_SIZE,
 			     encode_big_endian(pdp_info->pdp_type | 0xf000,
-					       GPRS_GSUP_PDP_TYPE_SIZE));
+					       OSMO_GSUP_PDP_TYPE_SIZE));
 	}
 
 	if (pdp_info->apn_enc) {
-		msgb_tlv_put(msg, GPRS_GSUP_ACCESS_POINT_NAME_IE,
+		msgb_tlv_put(msg, OSMO_GSUP_ACCESS_POINT_NAME_IE,
 			     pdp_info->apn_enc_len, pdp_info->apn_enc);
 	}
 
 	if (pdp_info->qos_enc) {
-		msgb_tlv_put(msg, GPRS_GSUP_PDP_QOS_IE,
+		msgb_tlv_put(msg, OSMO_GSUP_PDP_QOS_IE,
 				pdp_info->qos_enc_len, pdp_info->qos_enc);
 	}
 
@@ -325,7 +325,7 @@
 	*len_field = msgb_length(msg) - old_len;
 }
 
-static void encode_auth_info(struct msgb *msg, enum gprs_gsup_iei iei,
+static void encode_auth_info(struct msgb *msg, enum osmo_gsup_iei iei,
 			     const struct osmo_auth_vector *auth_vector)
 {
 	uint8_t *len_field;
@@ -334,20 +334,20 @@
 	len_field = msgb_tlv_put(msg, iei, 0, NULL) - 1;
 	old_len = msgb_length(msg);
 
-	msgb_tlv_put(msg, GPRS_GSUP_RAND_IE,
+	msgb_tlv_put(msg, OSMO_GSUP_RAND_IE,
 		     sizeof(auth_vector->rand), auth_vector->rand);
 
-	msgb_tlv_put(msg, GPRS_GSUP_SRES_IE,
+	msgb_tlv_put(msg, OSMO_GSUP_SRES_IE,
 		     sizeof(auth_vector->sres), auth_vector->sres);
 
-	msgb_tlv_put(msg, GPRS_GSUP_KC_IE,
+	msgb_tlv_put(msg, OSMO_GSUP_KC_IE,
 		     sizeof(auth_vector->kc), auth_vector->kc);
 
 	/* Update length field */
 	*len_field = msgb_length(msg) - old_len;
 }
 
-void gprs_gsup_encode(struct msgb *msg, const struct gprs_gsup_message *gsup_msg)
+void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
 {
 	uint8_t u8;
 	int idx;
@@ -366,32 +366,32 @@
 	/* Note that gsm48_encode_bcd_number puts the length into the first
 	 * octet. Since msgb_tlv_put will add this length byte, we'll have to
 	 * skip it */
-	msgb_tlv_put(msg, GPRS_GSUP_IMSI_IE, bcd_len - 1, &bcd_buf[1]);
+	msgb_tlv_put(msg, OSMO_GSUP_IMSI_IE, bcd_len - 1, &bcd_buf[1]);
 
 	/* specific parts */
 	if (gsup_msg->msisdn_enc)
-		msgb_tlv_put(msg, GPRS_GSUP_MSISDN_IE,
+		msgb_tlv_put(msg, OSMO_GSUP_MSISDN_IE,
 				gsup_msg->msisdn_enc_len, gsup_msg->msisdn_enc);
 	if (gsup_msg->hlr_enc)
-		msgb_tlv_put(msg, GPRS_GSUP_HLR_NUMBER_IE,
+		msgb_tlv_put(msg, OSMO_GSUP_HLR_NUMBER_IE,
 				gsup_msg->hlr_enc_len, gsup_msg->hlr_enc);
 
 	if ((u8 = gsup_msg->cause))
-		msgb_tlv_put(msg, GPRS_GSUP_CAUSE_IE, sizeof(u8), &u8);
+		msgb_tlv_put(msg, OSMO_GSUP_CAUSE_IE, sizeof(u8), &u8);
 
 	if ((u8 = gsup_msg->cancel_type)) {
 		u8 -= 1;
-		msgb_tlv_put(msg, GPRS_GSUP_CANCEL_TYPE_IE, sizeof(u8), &u8);
+		msgb_tlv_put(msg, OSMO_GSUP_CANCEL_TYPE_IE, sizeof(u8), &u8);
 	}
 
 	if (gsup_msg->pdp_info_compl)
-		msgb_tlv_put(msg, GPRS_GSUP_PDP_INFO_COMPL_IE, 0, &u8);
+		msgb_tlv_put(msg, OSMO_GSUP_PDP_INFO_COMPL_IE, 0, &u8);
 
 	if (gsup_msg->freeze_ptmsi)
-		msgb_tlv_put(msg, GPRS_GSUP_FREEZE_PTMSI_IE, 0, &u8);
+		msgb_tlv_put(msg, OSMO_GSUP_FREEZE_PTMSI_IE, 0, &u8);
 
 	for (idx = 0; idx < gsup_msg->num_pdp_infos; idx++) {
-		const struct gprs_gsup_pdp_info *pdp_info;
+		const struct osmo_gsup_pdp_info *pdp_info;
 
 		pdp_info = &gsup_msg->pdp_infos[idx];
 
@@ -399,10 +399,10 @@
 			continue;
 
 		if (pdp_info->have_info) {
-			encode_pdp_info(msg, GPRS_GSUP_PDP_INFO_IE, pdp_info);
+			encode_pdp_info(msg, OSMO_GSUP_PDP_INFO_IE, pdp_info);
 		} else {
 			u8 = pdp_info->context_id;
-			msgb_tlv_put(msg, GPRS_GSUP_PDP_CONTEXT_ID_IE,
+			msgb_tlv_put(msg, OSMO_GSUP_PDP_CONTEXT_ID_IE,
 				     sizeof(u8), &u8);
 		}
 	}
@@ -412,6 +412,6 @@
 
 		auth_vector = &gsup_msg->auth_vectors[idx];
 
-		encode_auth_info(msg, GPRS_GSUP_AUTH_TUPLE_IE, auth_vector);
+		encode_auth_info(msg, OSMO_GSUP_AUTH_TUPLE_IE, auth_vector);
 	}
 }