gsup: Add encoding/decoding for the pdp charging characteristics

These fields can be in the ISD and the PDP Context inofmration. Store
pointers to this IE in both cases. It needs to be used by the SGSN
when opening a PDP context.

Change-Id: Iedc7c02adcf77ca5c9545119e19c968dfbbb3e6b
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 2629eb7..685c91f 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -103,6 +103,11 @@
 			pdp_info->qos_enc_len = value_len;
 			break;
 
+		case OSMO_GSUP_CHARG_CHAR_IE:
+			pdp_info->pdp_charg_enc = value;
+			pdp_info->pdp_charg_enc_len = value_len;
+			break;
+
 		default:
 			LOGP(DLGSUP, LOGL_ERROR,
 			     "GSUP IE type %d not expected in PDP info\n", iei);
@@ -375,6 +380,11 @@
 			gsup_msg->cn_domain = *value;
 			break;
 
+		case OSMO_GSUP_CHARG_CHAR_IE:
+			gsup_msg->pdp_charg_enc = value;
+			gsup_msg->pdp_charg_enc_len = value_len;
+			break;
+
 		default:
 			LOGP(DLGSUP, LOGL_NOTICE,
 			     "GSUP IE type %d unknown\n", iei);
@@ -415,6 +425,11 @@
 				pdp_info->qos_enc_len, pdp_info->qos_enc);
 	}
 
+	if (pdp_info->pdp_charg_enc) {
+		msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
+				pdp_info->pdp_charg_enc_len, pdp_info->pdp_charg_enc);
+	}
+
 	/* Update length field */
 	*len_field = msgb_length(msg) - old_len;
 }
@@ -540,6 +555,11 @@
 		uint8_t dn = gsup_msg->cn_domain;
 		msgb_tlv_put(msg, OSMO_GSUP_CN_DOMAIN_IE, 1, &dn);
 	}
+
+	if (gsup_msg->pdp_charg_enc) {
+		msgb_tlv_put(msg, OSMO_GSUP_CHARG_CHAR_IE,
+				gsup_msg->pdp_charg_enc_len, gsup_msg->pdp_charg_enc);
+	}
 }
 
 /*! @} */