Commit 461d022d authored by Chenyu's avatar Chenyu

encode Security mode complete AND Registration complete

parent 141b56ba
...@@ -180,6 +180,20 @@ void nr_nas_proc_dl_transfer_ind (UENAS_msg *msg, Byte_t *data, uint32_t len) { ...@@ -180,6 +180,20 @@ void nr_nas_proc_dl_transfer_ind (UENAS_msg *msg, Byte_t *data, uint32_t len) {
break; break;
} }
case SECURITY_MODE_COMMAND: {
len1 += securityModeComplete5g((void **)&msg1->securitymode_complete);
size = encodeNasMsg(msg1, buffer, len1);
nas_itti_ul_data_req(0,buffer,size,0);
break;
}
case REGISTRATION_ACCEPT: {
len1 += registrationComplete5g((void **)&msg1->registration_complete);
size = encodeNasMsg(msg1, buffer, len1);
nas_itti_ul_data_req(0,buffer,size,0);
break;
}
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
printf("aaaaaaaaaaaaa%x",*(buffer+i)); printf("aaaaaaaaaaaaa%x",*(buffer+i));
...@@ -237,6 +251,16 @@ int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len) { //QUES:UENAS_m ...@@ -237,6 +251,16 @@ int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len) { //QUES:UENAS_m
encode_result = encode_authentication_response5g(&msg->authentication_response, buffer, len); encode_result = encode_authentication_response5g(&msg->authentication_response, buffer, len);
break; break;
} }
case SECURITY_MODE_COMPLETE: {
encode_result = encode_security_mode_complete5g(&msg->securitymode_complete, buffer, len);//TODO:encode_security_mode_complete5g
break;
}
case REGISTRATION_COMPLETE: {
encode_result = encode_registration_complete5g(&msg->registration_complete, buffer, len);//TODO:encode_security_mode_complete5g
break;
}
} }
LOG_FUNC_RETURN (header_result + encode_result); LOG_FUNC_RETURN (header_result + encode_result);
} }
...@@ -303,5 +327,36 @@ int encode_authentication_response5g(authenticationresponse_t *authentication_re ...@@ -303,5 +327,36 @@ int encode_authentication_response5g(authenticationresponse_t *authentication_re
} }
return encoded; return encoded;
}
int encode_security_mode_complete5g(securityModeComplete_t *securitymodecomplete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
return encoded;
}
int encode_registration_complete5g(registrationcomplete_t *registrationcomplete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
return encoded;
}
int securityModeComplete5g(void **msg) {
myCalloc(resp, securityModeComplete_t);
resp->epd=SGSmobilitymanagementmessages;
resp->sh=0;
resp->mt=Registrationcomplete;
*msg=resp;
return sizeof(securityModeComplete_t);
}
int registrationComplete5g(void **msg) {
myCalloc(resp, registrationcomplete_t);
resp->epd=SGSmobilitymanagementmessages;
resp->sh=0;
resp->mt=Securitymodecomplete;
*msg=resp;
return sizeof(registrationcomplete_t);
} }
...@@ -34,12 +34,43 @@ ...@@ -34,12 +34,43 @@
#include "NR_NAS_defs.h" #include "NR_NAS_defs.h"
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
# define REGISTRATION_ACCEPT 0b01000010
# define REGISTRATION_COMPLETE 0b01000011
typedef struct __attribute__((packed)) {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
} securityModeComplete_t;
typedef struct __attribute__((packed)) {
unsigned int len:8;
unsigned int allowed:4;
unsigned int value:4;
} SGSregistrationresult;
typedef struct __attribute__((packed)) {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
SGSregistrationresult rr;
} registrationaccept_t;
typedef struct __attribute__((packed)) {
Extendedprotocoldiscriminator_t epd:8;
Security_header_t sh:8;
SGSmobilitymanagementmessages_t mt:8;
} registrationcomplete_t;
typedef union { typedef union {
mm_msg_header_t header; mm_msg_header_t header;
authenticationrequestHeader_t authentication_request; authenticationrequestHeader_t authentication_request;
authenticationresponse_t authentication_response; authenticationresponse_t authentication_response;
Identityrequest_t identity_request; Identityrequest_t identity_request;
IdentityresponseIMSI_t identity_response; IdentityresponseIMSI_t identity_response;
securityModeCommand_t securitymode_command;
securityModeComplete_t securitymode_complete;
registrationaccept_t registration_accept;
registrationcomplete_t registration_complete;
} UENAS_msg; } UENAS_msg;
void *nas_nrue_task(void *args_p); void *nas_nrue_task(void *args_p);
...@@ -47,5 +78,9 @@ void nr_nas_proc_dl_transfer_ind (UENAS_msg *msg, Byte_t *data, uint32_t len); ...@@ -47,5 +78,9 @@ void nr_nas_proc_dl_transfer_ind (UENAS_msg *msg, Byte_t *data, uint32_t len);
int decodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len); int decodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len);
int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len); int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len);
int encode_authentication_response5g(authenticationresponse_t *authentication_response, uint8_t *buffer, uint32_t len); int encode_authentication_response5g(authenticationresponse_t *authentication_response, uint8_t *buffer, uint32_t len);
int encode_security_mode_complete5g(securityModeComplete_t *securitymodecomplete, uint8_t *buffer, uint32_t len);
int encode_registration_complete5g(registrationcomplete_t *registrationcomplete, uint8_t *buffer, uint32_t len);
int securityModeComplete5g(void **msg);
int registrationComplete5g(void **msg);
#endif /* NAS_TASK_H_ */ #endif /* NAS_TASK_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment