service request is initially added

This commit is contained in:
Sukchan Lee 2017-04-26 09:33:26 +09:00
parent 0bdc7de4d0
commit cca339eff4
9 changed files with 134 additions and 5 deletions

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* This file had been created by gtpv2c_tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2017-04-26 09:18:26.252078 by acetcom
* Created on: 2017-04-26 09:32:08.187786 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -849,6 +849,23 @@ c_int32_t nas_decode_extended_service_request(nas_message_t *message, pkbuf_t *p
return decoded;
}
c_int32_t nas_decode_service_request(nas_message_t *message, pkbuf_t *pkbuf)
{
nas_service_request_t *service_request = &message->emm.service_request;
c_int32_t decoded = 0;
c_int32_t size = 0;
size = nas_decode_ksi_and_sequence_number(&service_request->ksi_and_sequence_number, pkbuf);
d_assert(size >= 0, return -1, "decode failed");
decoded += size;
size = nas_decode_short_mac(&service_request->message_authentication_code, pkbuf);
d_assert(size >= 0, return -1, "decode failed");
decoded += size;
return decoded;
}
c_int32_t nas_decode_service_reject(nas_message_t *message, pkbuf_t *pkbuf)
{
nas_service_reject_t *service_reject = &message->emm.service_reject;
@ -1701,6 +1718,9 @@ status_t nas_emm_decode(nas_message_t *message, pkbuf_t *pkbuf)
decoded += size;
break;
case NAS_SERVICE_REQUEST:
size = nas_decode_service_request(message, pkbuf);
d_assert(size >= CORE_OK, return CORE_ERROR, "decode error");
decoded += size;
break;
case NAS_SERVICE_REJECT:
size = nas_decode_service_reject(message, pkbuf);

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* This file had been created by gtpv2c_tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2017-04-26 09:18:26.270191 by acetcom
* Created on: 2017-04-26 09:32:08.207370 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -1087,6 +1087,23 @@ c_int32_t nas_encode_extended_service_request(pkbuf_t *pkbuf, nas_message_t *mes
return encoded;
}
c_int32_t nas_encode_service_request(pkbuf_t *pkbuf, nas_message_t *message)
{
nas_service_request_t *service_request = &message->emm.service_request;
c_int32_t encoded = 0;
c_int32_t size = 0;
size = nas_encode_ksi_and_sequence_number(pkbuf, &service_request->ksi_and_sequence_number);
d_assert(size >= 0, return -1, "encode failed");
encoded += size;
size = nas_encode_short_mac(pkbuf, &service_request->message_authentication_code);
d_assert(size >= 0, return -1, "encode failed");
encoded += size;
return encoded;
}
c_int32_t nas_encode_service_reject(pkbuf_t *pkbuf, nas_message_t *message)
{
nas_service_reject_t *service_reject = &message->emm.service_reject;
@ -1939,6 +1956,9 @@ status_t nas_emm_encode(pkbuf_t **pkbuf, nas_message_t *message)
encoded += size;
break;
case NAS_SERVICE_REQUEST:
size = nas_encode_service_request(*pkbuf, message);
d_assert(size >= 0, return CORE_ERROR, "decode error");
encoded += size;
break;
case NAS_SERVICE_REJECT:
size = nas_encode_service_reject(*pkbuf, message);

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* This file had been created by gtpv2c_tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2017-04-26 09:18:26.217661 by acetcom
* Created on: 2017-04-26 09:32:08.162694 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -665,6 +665,30 @@ c_int16_t nas_encode_imeisv_request(pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv
return size;
}
/* 9.9.3.19 KSI and sequence number
* M V 1 */
c_int16_t nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, pkbuf_t *pkbuf)
{
c_uint16_t size = sizeof(nas_ksi_and_sequence_number_t);
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
memcpy(ksi_and_sequence_number, pkbuf->payload - size, size);
return size;
}
c_int16_t nas_encode_ksi_and_sequence_number(pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number)
{
c_uint16_t size = sizeof(nas_ksi_and_sequence_number_t);
nas_ksi_and_sequence_number_t target;
memcpy(&target, ksi_and_sequence_number, size);
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
memcpy(pkbuf->payload - size, &target, size);
return size;
}
/* 9.9.3.2 Authentication parameter AUTN
* M LV 17 */
c_int16_t nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, pkbuf_t *pkbuf)
@ -938,6 +962,34 @@ c_int16_t nas_encode_service_type(pkbuf_t *pkbuf, nas_service_type_t *service_ty
return size;
}
/* 9.9.3.28 Short MAC
* M V 2 */
c_int16_t nas_decode_short_mac(nas_short_mac_t *short_mac, pkbuf_t *pkbuf)
{
c_uint16_t size = sizeof(nas_short_mac_t);
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
memcpy(short_mac, pkbuf->payload - size, size);
*short_mac = ntohs(*short_mac);
return size;
}
c_int16_t nas_encode_short_mac(pkbuf_t *pkbuf, nas_short_mac_t *short_mac)
{
c_uint16_t size = sizeof(nas_short_mac_t);
nas_short_mac_t target;
memcpy(&target, short_mac, size);
target = htons(*short_mac);
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
memcpy(pkbuf->payload - size, &target, size);
return size;
}
/* 9.9.3.29 Time zone
* O TV 2 */
c_int16_t nas_decode_time_zone(nas_time_zone_t *time_zone, pkbuf_t *pkbuf)

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* This file had been created by gtpv2c_tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2017-04-26 09:18:26.211334 by acetcom
* Created on: 2017-04-26 09:32:08.158008 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -65,6 +65,7 @@ CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_2(nas_gprs_timer_2_t *gprs_timer_2
CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_3(nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_identity_type_2(nas_identity_type_2_t *identity_type_2, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_imeisv_request(nas_imeisv_request_t *imeisv_request, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_ksi_and_sequence_number(nas_ksi_and_sequence_number_t *ksi_and_sequence_number, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_authentication_parameter_autn(nas_authentication_parameter_autn_t *authentication_parameter_autn, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_ms_network_capability(nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_ms_network_feature_support(nas_ms_network_feature_support_t *ms_network_feature_support, pkbuf_t *pkbuf);
@ -76,6 +77,7 @@ CORE_DECLARE(c_int16_t) nas_decode_nonce(nas_nonce_t *nonce, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_p_tmsi_signature(nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_extended_emm_cause(nas_extended_emm_cause_t *extended_emm_cause, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_service_type(nas_service_type_t *service_type, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_short_mac(nas_short_mac_t *short_mac, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_time_zone(nas_time_zone_t *time_zone, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_authentication_parameter_rand(nas_authentication_parameter_rand_t *authentication_parameter_rand, pkbuf_t *pkbuf);
CORE_DECLARE(c_int16_t) nas_decode_time_zone_and_time(nas_time_zone_and_time_t *time_zone_and_time, pkbuf_t *pkbuf);
@ -143,6 +145,7 @@ CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_2(pkbuf_t *pkbuf, nas_gprs_timer_2
CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_3(pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3);
CORE_DECLARE(c_int16_t) nas_encode_identity_type_2(pkbuf_t *pkbuf, nas_identity_type_2_t *identity_type_2);
CORE_DECLARE(c_int16_t) nas_encode_imeisv_request(pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request);
CORE_DECLARE(c_int16_t) nas_encode_ksi_and_sequence_number(pkbuf_t *pkbuf, nas_ksi_and_sequence_number_t *ksi_and_sequence_number);
CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf, nas_authentication_parameter_autn_t *authentication_parameter_autn);
CORE_DECLARE(c_int16_t) nas_encode_ms_network_capability(pkbuf_t *pkbuf, nas_ms_network_capability_t *ms_network_capability);
CORE_DECLARE(c_int16_t) nas_encode_ms_network_feature_support(pkbuf_t *pkbuf, nas_ms_network_feature_support_t *ms_network_feature_support);
@ -154,6 +157,7 @@ CORE_DECLARE(c_int16_t) nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce);
CORE_DECLARE(c_int16_t) nas_encode_p_tmsi_signature(pkbuf_t *pkbuf, nas_p_tmsi_signature_t *p_tmsi_signature);
CORE_DECLARE(c_int16_t) nas_encode_extended_emm_cause(pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause);
CORE_DECLARE(c_int16_t) nas_encode_service_type(pkbuf_t *pkbuf, nas_service_type_t *service_type);
CORE_DECLARE(c_int16_t) nas_encode_short_mac(pkbuf_t *pkbuf, nas_short_mac_t *short_mac);
CORE_DECLARE(c_int16_t) nas_encode_time_zone(pkbuf_t *pkbuf, nas_time_zone_t *time_zone);
CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf, nas_authentication_parameter_rand_t *authentication_parameter_rand);
CORE_DECLARE(c_int16_t) nas_encode_time_zone_and_time(pkbuf_t *pkbuf, nas_time_zone_and_time_t *time_zone_and_time);

View File

@ -26,7 +26,7 @@
/*******************************************************************************
* This file had been created by gtpv2c_tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2017-04-26 09:18:26.233286 by acetcom
* Created on: 2017-04-26 09:32:08.173277 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -517,6 +517,17 @@ typedef struct _nas_extended_service_request_t {
} nas_extended_service_request_t;
/*******************************************************
* SERVICE REQUEST
******************************************************/
typedef struct _nas_service_request_t {
/* Mandatory fields */
nas_ksi_and_sequence_number_t ksi_and_sequence_number;
nas_short_mac_t message_authentication_code;
} nas_service_request_t;
/*******************************************************
* SERVICE REJECT
******************************************************/
@ -905,6 +916,7 @@ typedef struct _nas_emm_message_t {
nas_tracking_area_update_accept_t tracking_area_update_accept;
nas_tracking_area_update_reject_t tracking_area_update_reject;
nas_extended_service_request_t extended_service_request;
nas_service_request_t service_request;
nas_service_reject_t service_reject;
nas_authentication_request_t authentication_request;
nas_authentication_response_t authentication_response;

View File

@ -512,6 +512,13 @@ ED3(c_uint8_t type:4;,
c_uint8_t imeisv_request_value:3;)
} __attribute__ ((packed)) nas_imeisv_request_t;
/* 9.9.3.19 KSI and sequence number
* M V 1 */
typedef struct _nas_ksi_and_sequence_number_t {
ED2(c_uint8_t ksi:3;,
c_uint8_t sequence_number:5;)
} __attribute__ ((packed)) nas_ksi_and_sequence_number_t;
/* 9.9.3.20 MS network capability
* See subclause 10.5.5.12 in 3GPP TS 24.008
* O TLV 4-10 */
@ -639,6 +646,10 @@ ED3(c_uint8_t tsc:1;,
c_uint8_t service_type:4;)
} __attribute__ ((packed)) nas_service_type_t;
/* 9.9.3.28 Short MAC
* M V 2 */
typedef c_uint16_t nas_short_mac_t;
/* 9.9.3.29 Time zone
* See subclause 10.5.3.8 in 3GPP TS 24.008 [13].
* O TV 2 */

View File

@ -1,2 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "KSI and sequence number", "type" : "KSI and sequence number", "reference" : "9.9.3.19", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "", "value" : "Message authentication code", "type" : "Short MAC", "reference" : "9.9.3.28", "presence" : "M", "format" : "V", "length" : "2"})
msg_list[key]["ies"] = ies

View File

@ -269,6 +269,9 @@ for key in msg_list.keys():
cells = get_cells(row.cells);
if cells["type"].find('Message type') != -1:
break
if cells["type"].find('KSI and sequence number') != -1:
start_row -= 1
break
assert start_row <= 4, "Can't find message type"

View File

@ -81,3 +81,8 @@ type_list["Header compression configuration"]["decode"] = \
" header_compression_configuration->max_cid = ntohs(header_compression_configuration->max_cid);\n\n"
type_list["Header compression configuration"]["encode"] = \
" target.max_cid = htons(header_compression_configuration->max_cid);\n\n"
type_list["Short MAC"]["decode"] = \
" *short_mac = ntohs(*short_mac);\n\n"
type_list["Short MAC"]["encode"] = \
" target = htons(*short_mac);\n\n"