Commit f256ebc8 authored by Raymond Knopp's avatar Raymond Knopp

Remote UE Report message with payload (Default PKMF address) addition

parent dadff785
...@@ -2345,7 +2345,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2345,7 +2345,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
phr_p->R = 0; phr_p->R = 0;
LOG_I(MAC, LOG_D(MAC,
"[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n", "[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n",
module_idP, frameP, get_PHR(module_idP, CC_id, eNB_index), module_idP, frameP, get_PHR(module_idP, CC_id, eNB_index),
phr_p->PH, POWER_HEADROOM); phr_p->PH, POWER_HEADROOM);
......
...@@ -15,19 +15,39 @@ ...@@ -15,19 +15,39 @@
#include "TLVDecoder.h" #include "TLVDecoder.h"
#include "RemoteUEReport.h" #include "RemoteUEReport.h"
#include "PKMFAddress.h" #include "PKMFAddress.h"
#include "RemoteUEContext.h"
int decode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffer, uint32_t len) int decode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffer, uint32_t len)
{ {
uint32_t decoded = 0; uint32_t decoded = 0;
int decoded_result = 0; int decoded_result = 0;
//remoteuereport->pkmfaddress.pkmfipv4address = 1 ;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, REMOTE_UE_REPORT_RESPONSE_MINIMUM_LENGTH, len); CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, REMOTE_UE_REPORT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
if ((decoded_result = decode_pkmf_address(&remoteuereport->pkmfaddress, 0, buffer + decoded, len - decoded)) < 0) switch(ieiDecoded) {
case REMOTE_UE_REPORT_PKMF_ADDRESS_IEI:
if ((decoded_result = decode_pkmf_address(&remoteuereport->pkmfaddress,
REMOTE_UE_REPORT_PKMF_ADDRESS_IEI,
buffer + decoded,
len - decoded)) < 0)
return decoded_result; return decoded_result;
else else
decoded += decoded_result; decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
remoteuereport->presencemask |= REMOTE_UE_REPORT_PKMF_ADDRESS_PRESENT;
break;
}
}
return decoded; return decoded;
} }
...@@ -35,13 +55,44 @@ int encode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffe ...@@ -35,13 +55,44 @@ int encode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffe
{ {
int encoded = 0; int encoded = 0;
int encode_result = 0; int encode_result = 0;
//uint32_t testip [4] = {0,1,2,3};
//remoteuereport->pkmfaddress.pkmfipv4address = testip ;
/* Checking IEI and pointer */ /* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, REMOTE_UE_REPORT_RESPONSE_MINIMUM_LENGTH, len); CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, REMOTE_UE_REPORT_MINIMUM_LENGTH, len);
if ((remoteuereport->presencemask & REMOTE_UE_CONTEXT_PRESENT) == REMOTE_UE_CONTEXT_PRESENT)
{
if ((encode_result = encode_remote_ue_context(&remoteuereport->remoteuecontext,
REMOTE_UE_REPORT_REMOTE_UE_CONTEXT_IEI,
buffer + encoded,
len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
}
if ((remoteuereport->presencemask & REMOTE_UE_REPORT_PKMF_ADDRESS_PRESENT)
== REMOTE_UE_REPORT_PKMF_ADDRESS_PRESENT)
{
if ((encode_result = encode_pkmf_address(&remoteuereport->pkmfaddress,
REMOTE_UE_REPORT_PKMF_ADDRESS_IEI ,
buffer + encoded,
len - encoded)) < 0)//Return in case of error
return encode_result;
remoteuereport->pkmfaddress.pkmfipv4address = 0;
if ((encode_result = encode_pkmf_address(&remoteuereport->pkmfaddress, 0, buffer + encoded, len - encoded)) < 0)//Return in case of error
return encode_result;
else else
encoded += encode_result; encoded += encode_result;
return encoded;
} }
LOG_TRACE(INFO, "ESM-SAP - Remote UE Report message is out %d", len);
return encoded;
}
...@@ -12,22 +12,36 @@ ...@@ -12,22 +12,36 @@
#include "EpsBearerIdentity.h" #include "EpsBearerIdentity.h"
#include "ProcedureTransactionIdentity.h" #include "ProcedureTransactionIdentity.h"
#include "PKMFAddress.h" #include "PKMFAddress.h"
#include "MessageType.h"
#include "RemoteUEContext.h"
#ifndef OPENAIR3_NAS_COMMON_ESM_MSG_REMOTEUEREPORT_H_ #ifndef OPENAIR3_NAS_COMMON_ESM_MSG_REMOTEUEREPORT_H_
#define OPENAIR3_NAS_COMMON_ESM_MSG_REMOTEUEREPORT_H_ #define OPENAIR3_NAS_COMMON_ESM_MSG_REMOTEUEREPORT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */ /* Minimum length macro. Formed by minimum length of each mandatory field */
#define REMOTE_UE_REPORT_RESPONSE_MINIMUM_LENGTH (0) #define REMOTE_UE_REPORT_MINIMUM_LENGTH (0)
#define REMOTE_UE_REPORT_MAXIMUM_LENGTH (20)
# define REMOTE_UE_CONTEXT_PRESENT (1<<0)
# define REMOTE_UE_REPORT_PKMF_ADDRESS_PRESENT (1<<1)
typedef enum remote_ue_report_iei_tag {
REMOTE_UE_REPORT_REMOTE_UE_CONTEXT_IEI = 0x79,
REMOTE_UE_REPORT_PKMF_ADDRESS_IEI = 0x6f,
} remote_ue_report_iei;
typedef struct remote_ue_report_msg_tag { typedef struct remote_ue_report_msg_tag {
/* Mandatory fields */ /* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4; ProtocolDiscriminator protocoldiscriminator:4;
EpsBearerIdentity epsbeareridentity:4; EpsBearerIdentity epsbeareridentity:4;
ProcedureTransactionIdentity proceduretransactionidentity; ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
/* Optional fields */ /* Optional fields */
uint32_t presencemask;
remote_ue_context_t remoteuecontext;
pkmf_address_t pkmfaddress; pkmf_address_t pkmfaddress;
//RemoteUEContext remoteuecontext; } remote_ue_report_msg;
} remote_ue_report_msg;
int decode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffer, uint32_t len); int decode_remote_ue_report(remote_ue_report_msg *remoteuereport, uint8_t *buffer, uint32_t len);
......
...@@ -369,8 +369,10 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) ...@@ -369,8 +369,10 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
break; break;
case REMOTE_UE_REPORT: case REMOTE_UE_REPORT:
//LOG_TRACE(INFO, "Remote UE Report is encoded");
encode_result = encode_remote_ue_report(&msg->remote_ue_report, buffer, len); encode_result = encode_remote_ue_report(&msg->remote_ue_report, buffer, len);
break; //LOG_TRACE(INFO, "Remote UE Report is encoded");
break;
case REMOTE_UE_REPORT_RESPONSE: case REMOTE_UE_REPORT_RESPONSE:
encode_result = encode_remote_ue_report_response(&msg->remote_ue_report_response, buffer, len); encode_result = encode_remote_ue_report_response(&msg->remote_ue_report_response, buffer, len);
......
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
#include <stdbool.h> #include <stdbool.h>
#include "PKMFAddress.h" #include "PKMFAddress.h"
#include "TLVDecoder.h" #include "TLVDecoder.h"
#include "TLVEncoder.h"
//static int encode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len); //static int encode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len);
//static int decode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len); //static int decode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len);
//static int encode_pkmf_addressfield(pkmfaddress_t *pkmf, uint8_t *buffer);
int decode_pkmf_address( int decode_pkmf_address(
pkmf_address_t *pkmfaddress, pkmf_address_t *pkmfaddress,
...@@ -36,12 +39,12 @@ int decode_pkmf_address( ...@@ -36,12 +39,12 @@ int decode_pkmf_address(
memset (pkmfaddress, 0, sizeof (pkmf_address_t)); memset (pkmfaddress, 0, sizeof (pkmf_address_t));
//OAILOG_TRACE (LOG_NAS_EMM, "decode_pkmf_address = %d\n", ielen); //OAILOG_TRACE (LOG_NAS_EMM, "decode_pkmf_address = %d\n", ielen);
CHECK_LENGTH_DECODER (len - decoded, ielen); CHECK_LENGTH_DECODER (len - decoded, ielen);
pkmfaddress->spare = (*(buffer + decoded) >> 3) & 0x1; pkmfaddress->spare = (*(buffer + decoded) >> 3) & 0xf;
pkmfaddress->addresstype = *(buffer + decoded) & 0x1; pkmfaddress->addresstype = *(buffer + decoded) & 0xf;
decoded++; decoded++;
if (iei > 1) if (iei > 1)
{ {
pkmfaddress->pkmfipv4address = *(buffer + decoded ) & 0xf; //pkmfaddress->pkmfipaddress = *(buffer + decoded ) & 0xf;
decoded++; decoded++;
} }
...@@ -62,23 +65,57 @@ int encode_pkmf_address( ...@@ -62,23 +65,57 @@ int encode_pkmf_address(
{ {
uint8_t *lenPtr; uint8_t *lenPtr;
uint32_t encoded = 0; uint32_t encoded = 0;
int encoded_rc = TLV_ENCODE_VALUE_DOESNT_MATCH;
LOG_TRACE(INFO, "Send PKMF address %d", len);
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PKMF_ADDRESS_MINIMUM_LENGTH, len);
#if defined (NAS_DEBUG)
dump_pkmf_address_xml(pkmfaddress, iei);
#endif
if (iei > 0) if (iei > 0)
{ {
*buffer = iei; *buffer = iei;
encoded++; encoded++;
lenPtr = (buffer + encoded);
encoded++;
*(buffer + encoded) = 0x00 | ((pkmfaddress->spare & 0x1) << 3) | (pkmfaddress->addresstype & 0x1);
encoded++;
lenPtr = (buffer + encoded);
encoded++;
*(buffer + encoded) = pkmfaddress->pkmfipv4address;
encoded++;
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
} }
return encoded;
lenPtr = (buffer + encoded);
encoded++;
//pkmfaddress->addresstype = ADDRESS_TYPE_IPV4;
*(buffer + encoded) = 0x00 | (((pkmfaddress->spare) & 0x1f) << 3)|
((pkmfaddress->addresstype = ADDRESS_TYPE_IPV4)& 0x7);
encoded++;
//if (pkmfaddress->addresstype = ADDRESS_TYPE_IPV4){
*(buffer + encoded) = (&pkmfaddress->pkmfipaddress);
memcpy((void*)(buffer + encoded), (const void*)(&pkmfaddress->pkmfipaddress.ipv4), 4);
encoded += 4;
// }
//else if(pkmfaddress->addresstype = ADDRESS_TYPE_IPV6)
// {
//*(buffer + encoded) = (&pkmfaddress->pkmfipaddress);
// memcpy((void*)(buffer + encoded), (const void*)(&pkmfaddress->pkmfipaddress.ipv6),6);
// encoded +=6;
//}
//encoded++;
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
LOG_TRACE(INFO, "Send PKMF address %d", len);
return encoded;
} }
void dump_pkmf_address_xml(pkmf_address_t *pkmfaddress, uint8_t iei)
{
printf("<PKMF Address>\n");
if (iei > 0)
/* Don't display IEI if = 0 */
printf(" <IEI>0x%X</IEI>\n", iei);
printf("%s</Access Point Name>\n",
dump_octet_string_xml(&pkmfaddress->pkmfipaddress));
}
...@@ -8,17 +8,36 @@ ...@@ -8,17 +8,36 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <netinet/in.h>
#ifndef OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_ #ifndef OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_
#define OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_ #define OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_
#define PKMF_ADDRESS_MINIMUM_LENGTH 2
#define PKMF_ADDRESS_MAXIMUM_LENGTH 5
//typedef struct pkmf_s{
//uint8_t digit1:8;
//uint8_t digit2:8;
//uint8_t digit3:8;
//uint8_t digit4:8;
//}pkmf_t;
//typedef pkmf_t pkmfaddress_t;
typedef struct pkmf_address_s { typedef struct pkmf_address_s {
uint8_t spare:5; uint8_t spare:5;
#define ADDRESS_TYPE 001 #define ADDRESS_TYPE_IPV4 0b001
uint8_t addresstype:3; #define ADDRESS_TYPE_IPV6 0b010
#define PKMF_IPV4_ADDRESS uint8_t addresstype:3;
//uint32_t pkmfipv4address; #define PKMF_IP_ADDRESS
uint32_t pkmfipv4address; union {
struct in_addr ipv4; // char ipv4[4]; 4 bytes
struct in6_addr ipv6; // char ipv6[16] // 16 bytes
}pkmfipaddress;
//pkmfaddress_t pkmfipv4address;
}pkmf_address_t; }pkmf_address_t;
...@@ -26,5 +45,6 @@ int encode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffe ...@@ -26,5 +45,6 @@ int encode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffe
int decode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len); int decode_pkmf_address(pkmf_address_t *pkmfaddress, uint8_t iei, uint8_t *buffer, uint32_t len);
void dump_pkmf_address_xml(pkmf_address_t *pkmfaddress, uint8_t iei);
#endif /* OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_ */ #endif /* OPENAIR3_NAS_COMMON_IES_PKMFADDRESS_H_ */
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "RemoteUEContext.h" #include "RemoteUEContext.h"
#include "RemoteUserID.h"
#include "TLVEncoder.h" #include "TLVEncoder.h"
#include "TLVDecoder.h" #include "TLVDecoder.h"
#include "nas_log.h" #include "nas_log.h"
//#include "RemoteUserID.h"
...@@ -117,19 +118,19 @@ int encode_remote_ue_context( ...@@ -117,19 +118,19 @@ int encode_remote_ue_context(
imsi->num_digits += 2; imsi->num_digits += 2;
if (decoded < ie_len) if (decoded < ie_len)
{ {
imsi->identity_digit4 = *(buffer + decoded) & 0xf; imsi->identity_digit4 = *(buffer + decoded) & 0xf;
imsi->num_digits++; imsi->num_digits++;
imsi->identity_digit5 = (*(buffer + decoded) >> 4) & 0xf; imsi->identity_digit5 = (*(buffer + decoded) >> 4) & 0xf;
if ((IMSI_EVEN == imsi->oddeven) && (imsi->identity_digit5 != 0x0f)) if ((IMSI_EVEN == imsi->oddeven) && (imsi->identity_digit5 != 0x0f))
{ {
return (TLV_DECODE_VALUE_DOESNT_MATCH); return (TLV_DECODE_VALUE_DOESNT_MATCH);
} }
else else
{ {
imsi->num_digits++; imsi->num_digits++;
} }
decoded++; decoded++;
if (decoded < ie_len) if (decoded < ie_len)
{ {
imsi->identity_digit6 = *(buffer + decoded) & 0xf; imsi->identity_digit6 = *(buffer + decoded) & 0xf;
imsi->num_digits++; imsi->num_digits++;
...@@ -218,6 +219,7 @@ int nas_encode_imsi (imsi_identity_t * imsi, uint8_t * buffer) ...@@ -218,6 +219,7 @@ int nas_encode_imsi (imsi_identity_t * imsi, uint8_t * buffer)
*(buffer + encoded) = 0x00 | (imsi->identity_digit3 << 4) | imsi->identity_digit2; *(buffer + encoded) = 0x00 | (imsi->identity_digit3 << 4) | imsi->identity_digit2;
encoded++; encoded++;
// Quick fix, should do a loop, but try without modifying struct! // Quick fix, should do a loop, but try without modifying struct!
if (imsi->num_digits > 3) { if (imsi->num_digits > 3) {
if (imsi->oddeven != IMSI_EVEN) { if (imsi->oddeven != IMSI_EVEN) {
*(buffer + encoded) = 0x00 | (imsi->identity_digit5 << 4) | imsi->identity_digit4; *(buffer + encoded) = 0x00 | (imsi->identity_digit5 << 4) | imsi->identity_digit4;
......
...@@ -48,7 +48,7 @@ typedef struct remote_ue_context_s { ...@@ -48,7 +48,7 @@ typedef struct remote_ue_context_s {
#define EVEN_IDENTITY 0 #define EVEN_IDENTITY 0
#define ODD_IDENTITY 1 #define ODD_IDENTITY 1
uint8_t oddevenindic:1; uint8_t oddevenindic:1;
bool flags_present; uint8_t flags_present;
imsi_identity_t *imsi_identity; imsi_identity_t *imsi_identity;
}remote_ue_context_t; }remote_ue_context_t;
......
...@@ -94,13 +94,13 @@ int encode_remote_user_id( ...@@ -94,13 +94,13 @@ int encode_remote_user_id(
lenPtr = (buffer + encoded); lenPtr = (buffer + encoded);
encoded++; encoded++;
if(remoteuserid->spare_instance){ if(remoteuserid->spare_instance){
*(buffer + encoded) = 0x00 | ((remoteuserid->spare & 0x1) << 4) | (remoteuserid->instance & 0x1); *(buffer + encoded) = 0x00 | ((remoteuserid->spare & 0x1f) << 4) | (remoteuserid->instance & 0x1f);
encoded++; encoded++;
} }
if(remoteuserid->flags_present){ if(remoteuserid->flags_present){
*(buffer + encoded) = ((remoteuserid->spare1 & 0x7) << 2) | // spare coded as zero *(buffer + encoded) = ((remoteuserid->spare1 & 0x3f) << 2) | // spare coded as zero
((remoteuserid->imeif & 0x1) << 1) | ((remoteuserid->imeif & 0x1) << 1) |
(remoteuserid->msisdnf & 0x1); (remoteuserid->msisdnf & 0x1);
encoded++; encoded++;
......
...@@ -47,7 +47,7 @@ typedef struct imsi_identity_s { ...@@ -47,7 +47,7 @@ typedef struct imsi_identity_s {
uint8_t num_digits; uint8_t num_digits;
} imsi_identity_t; } imsi_identity_t;
typedef imsi_identity_t; //#define imsi_identity_t;
typedef struct remote_user_id_s { typedef struct remote_user_id_s {
...@@ -60,8 +60,8 @@ typedef struct remote_user_id_s { ...@@ -60,8 +60,8 @@ typedef struct remote_user_id_s {
#define REMOTE_USER_ID_MSISDN 0 #define REMOTE_USER_ID_MSISDN 0
uint8_t msisdnf:1; uint8_t msisdnf:1;
bool flags_present; uint8_t flags_present;
bool spare_instance; uint8_t spare_instance;
imsi_identity_t *imsi_identity; imsi_identity_t *imsi_identity;
}remote_user_id_t; }remote_user_id_t;
......
...@@ -198,6 +198,8 @@ const char* esmMsgType(int type) ...@@ -198,6 +198,8 @@ const char* esmMsgType(int type)
return "ESM_INFORMATION_RESPONSE"; return "ESM_INFORMATION_RESPONSE";
} else if (type == ESM_STATUS) { } else if (type == ESM_STATUS) {
return "ESM_STATUS"; return "ESM_STATUS";
}else if (type == REMOTE_UE_REPORT) {
return "REMOTE_UE_REPORT";
} else { } else {
return "Unknown ESM message type"; return "Unknown ESM message type";
} }
......
...@@ -112,6 +112,7 @@ static int _deactivate_eps_bearer_context_request(char* buffer, int length, cons ...@@ -112,6 +112,7 @@ static int _deactivate_eps_bearer_context_request(char* buffer, int length, cons
static int _deactivate_eps_bearer_context_accept(char* buffer, int length, const deactivate_eps_bearer_context_accept_msg* msg); static int _deactivate_eps_bearer_context_accept(char* buffer, int length, const deactivate_eps_bearer_context_accept_msg* msg);
static int _esm_status(char* buffer, int length, const esm_status_msg* msg); static int _esm_status(char* buffer, int length, const esm_status_msg* msg);
static int _remote_ue_report(char* buffer, int length, const remote_ue_report_msg* msg);
/****************************************************************************/ /****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** E X P O R T E D F U N C T I O N S ******************/
...@@ -781,6 +782,12 @@ _nas_process_esm( ...@@ -781,6 +782,12 @@ _nas_process_esm(
&msg->deactivate_eps_bearer_context_accept); &msg->deactivate_eps_bearer_context_accept);
break; break;
case REMOTE_UE_REPORT:
index += _remote_ue_report(buffer + index, length - index,
&msg->remote_ue_report);
break;
case ESM_STATUS: case ESM_STATUS:
index += _esm_status(buffer + index, length - index, index += _esm_status(buffer + index, length - index,
&msg->esm_status); &msg->esm_status);
...@@ -1036,6 +1043,23 @@ _deactivate_eps_bearer_context_accept( ...@@ -1036,6 +1043,23 @@ _deactivate_eps_bearer_context_accept(
return (index); return (index);
} }
/*
-----------------------------------------------------------------------------
* Process Deactivate EPS Bearer Context Accept
*-----------------------------------------------------------------------------
*/
static int
_remote_ue_report
(char* buffer,
int length,
const remote_ue_report_msg* msg)
{
int index = 0;
return (index);
}
/* /*
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
* Process ESM Status * Process ESM Status
......
...@@ -227,6 +227,7 @@ static int _process_pdn_disconnect_request(const pdn_disconnect_request_msg* msg ...@@ -227,6 +227,7 @@ static int _process_pdn_disconnect_request(const pdn_disconnect_request_msg* msg
static int _process_activate_default_eps_bearer_context_accept(const activate_default_eps_bearer_context_accept_msg* msg); static int _process_activate_default_eps_bearer_context_accept(const activate_default_eps_bearer_context_accept_msg* msg);
static int _process_activate_default_eps_bearer_context_reject(const activate_default_eps_bearer_context_reject_msg* msg); static int _process_activate_default_eps_bearer_context_reject(const activate_default_eps_bearer_context_reject_msg* msg);
static int _process_deactivate_eps_bearer_context_accept(const deactivate_eps_bearer_context_accept_msg* msg); static int _process_deactivate_eps_bearer_context_accept(const deactivate_eps_bearer_context_accept_msg* msg);
static int _process_remote_ue_report(remote_ue_report_msg* msg);
static void _dump_buffer(const Byte_t* buffer, size_t len) static void _dump_buffer(const Byte_t* buffer, size_t len)
{ {
...@@ -962,6 +963,11 @@ static int _process_esm_msg(ESM_msg* msg) ...@@ -962,6 +963,11 @@ static int _process_esm_msg(ESM_msg* msg)
&msg->activate_default_eps_bearer_context_reject); &msg->activate_default_eps_bearer_context_reject);
break; break;
case REMOTE_UE_REPORT:
rc = _process_remote_ue_report(
&msg->remote_ue_report);
break;
case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT:
rc = _process_deactivate_eps_bearer_context_accept( rc = _process_deactivate_eps_bearer_context_accept(
&msg->deactivate_eps_bearer_context_accept); &msg->deactivate_eps_bearer_context_accept);
...@@ -1163,6 +1169,22 @@ static int _process_activate_default_eps_bearer_context_reject(const activate_de ...@@ -1163,6 +1169,22 @@ static int _process_activate_default_eps_bearer_context_reject(const activate_de
return (0); return (0);
} }
/*
* Process Remote UE Report ESM message
*/
static int _process_remote_ue_report(remote_ue_report_msg* msg)
{
printf("Remote UE Report\n");
printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator);
printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity);
printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity);
//printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype);
//printf("INFO\t:\tESM cause\t\t\t= %d\n", msg->esmcause);
return (0);
}
/* /*
* Process Deactivate EPS Bearer Context Accept ESM message * Process Deactivate EPS Bearer Context Accept ESM message
*/ */
......
...@@ -158,8 +158,7 @@ int esm_proc_pdn_connectivity(nas_user_t *user, int cid, int is_to_define, ...@@ -158,8 +158,7 @@ int esm_proc_pdn_connectivity(nas_user_t *user, int cid, int is_to_define,
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} else if (pti != NULL) { } else if (pti != NULL) {
LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity " LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity ""(cid=%d)", cid);
"(cid=%d)", cid);
/* Assign new procedure transaction identity */ /* Assign new procedure transaction identity */
*pti = esm_pt_assign(esm_pt_data); *pti = esm_pt_assign(esm_pt_data);
......
...@@ -80,13 +80,14 @@ int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti) ...@@ -80,13 +80,14 @@ int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
int pid = cid - 1; int pid;
//int pid = cid - 1;
esm_data_t *esm_data = user-> esm_data; esm_data_t *esm_data = user-> esm_data;
esm_pt_data_t *esm_pt_data = user-> esm_pt_data; esm_pt_data_t *esm_pt_data = user-> esm_pt_data;
if (pti != NULL) if (pti != NULL)
{ {
LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity "); LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity ""(cid=%d)", cid);
/* Assign new procedure transaction identity */ /* Assign new procedure transaction identity */
*pti = esm_pt_assign(esm_pt_data); *pti = esm_pt_assign(esm_pt_data);
...@@ -105,3 +106,56 @@ int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti) ...@@ -105,3 +106,56 @@ int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti)
} }
LOG_FUNC_RETURN(rc); LOG_FUNC_RETURN(rc);
} }
/****************************************************************************
** **
** Name: esm_proc_remote_ue_report_low_layer **
** **
** Description: Initiates Remote UE Report procedure **
** **
** **
** 3GPP TS 24.301, section 6.5.1.2 **
** The Relay UE requests send Remote UE Report message to inform
** the network about a new Off network UE. **
** **
** **
** Inputs: is_standalone: Indicates whether the Remote UE Report **
** procedure is initiated as part of the at- **
** tach procedure **
** pti: Procedure transaction identity **
** msg: Encoded Remote UE Report message **
** to be sent **
** sent_by_ue: Not used - Always TRUE **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int esm_proc_remote_ue_report_low_layer(nas_user_t *user, int is_standalone, int pti,
OctetString *msg)
{
LOG_FUNC_IN;
esm_pt_data_t *esm_pt_data = user->esm_pt_data;
int rc = RETURNok;
LOG_TRACE(INFO, "ESM-PROC - Initiate Remote UE Report (pti=%d)", pti);
if (is_standalone) {
emm_sap_t emm_sap;
emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
/*
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
emm_sap.u.emm_esm.ueid = user->ueid;
emm_esm->msg.length = msg->length;
emm_esm->msg.value = msg->value;
rc = emm_sap_send(user, &emm_sap);
}
LOG_FUNC_RETURN(rc);
}
...@@ -161,17 +161,21 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg) ...@@ -161,17 +161,21 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
switch (primitive) { switch (primitive) {
case ESM_REMOTE_UE_REPORT_REQ: case ESM_REMOTE_UE_REPORT_REQ:
//case ESM_REMOTE_UE_REPORT:
{ {
esm_remote_ue_report_t *remote_ue_report = &msg->data.remote_ue_report; esm_remote_ue_report_t *remote_ue_report = &msg->data.remote_ue_report;
unsigned int pti = 0; unsigned int pti;
int cid; int cid;
/* Assign new procedure transaction identity */ /* Assign new procedure transaction identity */
rc = esm_proc_remote_ue_report(user, cid, &pti); rc = esm_proc_remote_ue_report(user, cid, &pti);
rc = _esm_sap_send(user, REMOTE_UE_REPORT, rc = _esm_sap_send(user, REMOTE_UE_REPORT,
msg->is_standalone, msg->is_standalone,
pti, EPS_BEARER_IDENTITY_UNASSIGNED, pti, EPS_BEARER_IDENTITY_UNASSIGNED,
&msg->data, &msg->send); &msg->data, &msg->send);
} }
break; break;
case ESM_PDN_CONNECTIVITY_REQ: case ESM_PDN_CONNECTIVITY_REQ:
...@@ -773,12 +777,19 @@ static int _esm_sap_send(nas_user_t *user, int msg_type, int is_standalone, ...@@ -773,12 +777,19 @@ static int _esm_sap_send(nas_user_t *user, int msg_type, int is_standalone,
case BEARER_RESOURCE_MODIFICATION_REQUEST: case BEARER_RESOURCE_MODIFICATION_REQUEST:
break; break;
case REMOTE_UE_REPORT: case REMOTE_UE_REPORT: {
esm_msg.header.message_type = REMOTE_UE_REPORT; /*
rc = esm_send_remote_ue_report(ebi, &esm_msg.remote_ue_report); * Process Remote UE Report message to send to the MME
//#error "TODO"// */
const esm_remote_ue_report_t *msg = &data->remote_ue_report; // test message
//esm_msg.header.message_type = REMOTE_UE_REPORT;
rc = esm_send_remote_ue_report(ebi, &esm_msg.remote_ue_report);
/* Setup callback function used to send Remote UE Report
* message onto the network */
esm_procedure = esm_proc_remote_ue_report_low_layer;
//#error "TODO"//
break; break;
}
default: default:
LOG_TRACE(WARNING, "ESM-SAP - Send unexpected ESM message 0x%x", LOG_TRACE(WARNING, "ESM-SAP - Send unexpected ESM message 0x%x",
msg_type); msg_type);
......
...@@ -78,6 +78,7 @@ typedef enum esm_primitive_s { ...@@ -78,6 +78,7 @@ typedef enum esm_primitive_s {
/* ESM data indication ("raw" ESM message) */ /* ESM data indication ("raw" ESM message) */
ESM_UNITDATA_IND, ESM_UNITDATA_IND,
ESM_REMOTE_UE_REPORT_REQ, ESM_REMOTE_UE_REPORT_REQ,
//ESM_REMOTE_UE_REPORT,
ESM_END ESM_END
} esm_primitive_t; } esm_primitive_t;
...@@ -142,7 +143,7 @@ typedef struct esm_eps_bearer_context_deactivate_s { ...@@ -142,7 +143,7 @@ typedef struct esm_eps_bearer_context_deactivate_s {
* --------------------------------------------------------- * ---------------------------------------------------------
*/ */
typedef struct esm_remote_ue_report_s { typedef struct esm_remote_ue_report_s {
unsigned int dummy; int pkmfaddress;
} esm_remote_ue_report_t; } esm_remote_ue_report_t;
/* /*
......
...@@ -478,14 +478,25 @@ int esm_send_remote_ue_report(int ebi, ...@@ -478,14 +478,25 @@ int esm_send_remote_ue_report(int ebi,
remote_ue_report_msg *msg) remote_ue_report_msg *msg)
{ {
LOG_FUNC_IN; LOG_FUNC_IN;
//uint32_t testip [4] = {0,1,2,3};
/* Mandatory - ESM message header */ /* Mandatory - ESM message header */
msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
msg->epsbeareridentity = ebi; msg->epsbeareridentity = ebi;
//msg->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT; msg->messagetype = REMOTE_UE_REPORT;
msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
/* Optional IEs */ /* Optional IEs */
msg->pkmfaddress.pkmfipv4address = 0; //msg->pkmfaddress ;
//{
/* Optional IEs */
msg->presencemask = 0;
msg->presencemask |= REMOTE_UE_CONTEXT_PRESENT;
msg->remoteuecontext;
msg->presencemask = 0;
msg->presencemask |= REMOTE_UE_REPORT_PKMF_ADDRESS_PRESENT;
msg->pkmfaddress;
//#define ADDRESS_TYPE_IPV4 0b001
//msg ->pkmfaddress.addresstype==ADDRESS_TYPE_IPV4;
//}
LOG_TRACE(INFO, "ESM-SAP - Send Remote UE Report message" LOG_TRACE(INFO, "ESM-SAP - Send Remote UE Report message"
" message (pti=%d, ebi=%d)", " message (pti=%d, ebi=%d)",
...@@ -494,9 +505,6 @@ int esm_send_remote_ue_report(int ebi, ...@@ -494,9 +505,6 @@ int esm_send_remote_ue_report(int ebi,
LOG_FUNC_RETURN(RETURNok); LOG_FUNC_RETURN(RETURNok);
} }
/****************************************************************************/ /****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/ /********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/ /****************************************************************************/
......
...@@ -123,6 +123,8 @@ int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *m ...@@ -123,6 +123,8 @@ int esm_proc_status(nas_user_t *user, int is_standalone, int pti, OctetString *m
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti); int esm_proc_remote_ue_report(nas_user_t *user,int cid, unsigned int *pti);
int esm_proc_remote_ue_report_low_layer(nas_user_t *user, int is_standalone, int pti,
OctetString *msg);
/* /*
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* PDN connectivity procedure * PDN connectivity procedure
......
...@@ -83,6 +83,7 @@ static const uint8_t esm_message_ids[] = { ...@@ -83,6 +83,7 @@ static const uint8_t esm_message_ids[] = {
ESM_INFORMATION_REQUEST, ESM_INFORMATION_REQUEST,
ESM_INFORMATION_RESPONSE, ESM_INFORMATION_RESPONSE,
ESM_STATUS, ESM_STATUS,
REMOTE_UE_REPORT,
}; };
......
...@@ -1416,8 +1416,9 @@ int _nas_proc_remote_ue_report(nas_user_t *user, int cid) ...@@ -1416,8 +1416,9 @@ int _nas_proc_remote_ue_report(nas_user_t *user, int cid)
* for the specified PDN * for the specified PDN
*/ */
esm_sap.primitive = ESM_REMOTE_UE_REPORT_REQ; esm_sap.primitive = ESM_REMOTE_UE_REPORT_REQ;
//esm_sap.primitive = ESM_REMOTE_UE_REPORT;
esm_sap.is_standalone = TRUE; esm_sap.is_standalone = TRUE;
esm_sap.data.remote_ue_report.dummy = 0; esm_sap.data.remote_ue_report.pkmfaddress = 0;
rc = esm_sap_send(user, &esm_sap); rc = esm_sap_send(user, &esm_sap);
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
......
...@@ -206,14 +206,14 @@ void *nas_ue_task(void *args_p) ...@@ -206,14 +206,14 @@ void *nas_ue_task(void *args_p)
//for Remote UE Report //for Remote UE Report
case NAS_REMOTE_UE_REPORT: { case NAS_REMOTE_UE_REPORT: {
int cid = 0; // unused now int cid = 1; // unused now
int UEid = 0; int UEid = 0;
int ret = nas_proc_remote_ue_report_test(user, cid); // generate NAS PDU (remote ue report) int ret = nas_proc_remote_ue_report_test(user, cid); // generate NAS PDU (remote ue report)
// To send remote ue report to be sent by RRC UE to CN // To send remote ue report to be sent by RRC UE to CN
//int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t length, int user_id); //int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t length, int user_id);
uint8_t testdata [] = {0,1,2,3}; //uint8_t testdata [] = {0,1,2,5};
nas_itti_ul_data_req(UEid, testdata, sizeof(testdata)); //nas_itti_ul_data_req(UEid, testdata, sizeof(testdata));
LOG_I(NAS, "[UE %d] Received NAS REMOTE UE REPORT %s: \n", Mod_id, ITTI_MSG_NAME (msg_p)); LOG_I(NAS, "[UE %d] Received NAS REMOTE UE REPORT %s: \n", Mod_id, ITTI_MSG_NAME (msg_p));
/* TODO not processed by NAS currently */ /* TODO not processed by NAS currently */
} }
......
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