UE Time Zone is added in Create Session Request(GTP) and CCR(Gx)

I'm not sure where this value should be configured.
At this point, MME estimate UE Time Zone from MME's system.
From this, MME generates UE TIme Zone for Create Session Request.
PGW is just forward this value to the PCRF using CCR(Gx) Message.
This commit is contained in:
Sukchan Lee 2018-01-02 22:14:28 +09:00
parent 408ce293de
commit 4501a76d96
6 changed files with 26 additions and 16 deletions

View File

@ -54,6 +54,9 @@ extern "C" {
((__id2) > (__id1) ? ((__id2) - (__id1) < ((__max)-1) ? -1 : 1) : \
(__id1) > (__id2) ? ((__id1) - (__id2) < ((__max)-1) ? 1 : -1) : 0)
#define TIME_TO_BCD(x) \
(((((x) % 10) << 4) & 0xf0) | (((x) / 10) & 0x0f))
/**********************************
* PLMN_ID Structure */
typedef struct _plmn_id_t {

View File

@ -384,7 +384,9 @@ typedef struct _gtp_ue_timezone_t {
* This field uses the same format as the Timezone field used in the
* TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90],
* and its value shall be set as defined in 3GPP TS 22.042 */
c_uint8_t timezone;
#define GTP_TIME_TO_BCD(x) TIME_TO_BCD(x)
ED2(c_uint8_t sign:1;,
c_uint8_t gmtoff:7;) /* quarters of an hour */
ED2(c_uint8_t spare:6;,
c_uint8_t daylight_saving_time:2;)
} __attribute__ ((packed)) gtp_ue_timezone_t;

View File

@ -705,8 +705,7 @@ typedef c_uint8_t nas_time_zone_t;
* See subclause 10.5.3.9 in 3GPP TS 24.008 [13].
* 9.2.3.11 TPServiceCentreTimeStamp (TPSCTS) in 3GPP TS 23.040 [90]
* O TV 8 */
#define NAS_TIME_TO_BCD(x) \
(((((x) % 10) << 4) & 0xf0) | (((x) / 10) & 0x0f))
#define NAS_TIME_TO_BCD(x) TIME_TO_BCD(x)
typedef struct _nas_time_zone_and_time_t {
c_uint8_t year;
c_uint8_t mon;

View File

@ -32,6 +32,9 @@ status_t mme_s11_build_create_session_request(
gtp_ue_timezone_t ue_timezone;
c_int8_t apn[MAX_APN_LEN];
time_exp_t time_exp;
time_exp_lt(&time_exp, time_now());
d_assert(sess, return CORE_ERROR, "Null param");
pdn = sess->pdn;
d_assert(pdn, return CORE_ERROR, "Null param");
@ -198,9 +201,13 @@ status_t mme_s11_build_create_session_request(
gtp_build_bearer_qos(&req->bearer_contexts_to_be_created.bearer_level_qos,
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
/* FIXME : where did we receive this information from MS */
memset(&ue_timezone, 0, sizeof(ue_timezone));
ue_timezone.timezone = 0x40;
if (time_exp.tm_gmtoff > 0)
ue_timezone.sign = 0;
else
ue_timezone.sign = 1;
/* quarters of an hour */
ue_timezone.gmtoff = GTP_TIME_TO_BCD(time_exp.tm_gmtoff / 900);
ue_timezone.daylight_saving_time =
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
req->ue_time_zone.presence = 1;

View File

@ -37,9 +37,13 @@ void pgw_gx_send_ccr(gtp_xact_t *xact, pgw_sess_t *sess,
union avp_value val;
struct sess_state *mi = NULL, *svg;
struct session *session = NULL;
gtp_message_t *message = NULL;
d_assert(sess, return, "Null param");
d_assert(sess->ipv4 || sess->ipv6, return, "Null param");
d_assert(sess, return,);
d_assert(sess->ipv4 || sess->ipv6, return,);
d_assert(gtpbuf, return, );
message = gtpbuf->payload;
d_assert(message, return, );
/* Create the random value to store with the session */
pool_alloc_node(&pgw_gx_sess_pool, &mi);
@ -269,17 +273,12 @@ void pgw_gx_send_ccr(gtp_xact_t *xact, pgw_sess_t *sess,
}
/* Set 3GPP-MS-Timezone */
if (message->create_session_request.ue_time_zone.presence)
{
gtp_ue_timezone_t ue_timezone;
memset(&ue_timezone, 0, sizeof(ue_timezone));
ue_timezone.timezone = 0x40;
ue_timezone.daylight_saving_time =
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
CHECK_FCT_DO( fd_msg_avp_new(gx_3gpp_ms_timezone, 0, &avp),
goto out );
val.os.data = (c_uint8_t*)&ue_timezone;
val.os.len = sizeof(ue_timezone);
val.os.data = message->create_session_request.ue_time_zone.data;
val.os.len = message->create_session_request.ue_time_zone.len;
CHECK_FCT_DO( fd_msg_avp_setvalue(avp, &val), goto out );
CHECK_FCT_DO( fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp),
goto out );

View File

@ -155,7 +155,7 @@ static void gtp_message_test1(abts_case *tc, void *data)
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
memset(&ue_timezone, 0, sizeof(ue_timezone));
ue_timezone.timezone = 0x40;
ue_timezone.gmtoff = 0x40;
ue_timezone.daylight_saving_time =
GTP_UE_TIME_ZONE_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME;
req.ue_time_zone.presence = 1;