intermediate

This commit is contained in:
Sukchan Lee 2017-02-13 16:03:12 +09:00
parent 7fc2fa1823
commit ee34fcbb35
7 changed files with 77 additions and 9 deletions

View File

@ -129,9 +129,6 @@ static int s1ap_decode_initiating(s1ap_message *message,
default:
d_error("Unknown procedure ID (%d) for initiating message",
(int)initiating_p->procedureCode);
d_assert(0, return -1,
"Unknown procedure ID (%d) for initiating message",
(int)initiating_p->procedureCode);
break;
}

3
main.c
View File

@ -189,13 +189,14 @@ int main(int argc, char *argv[])
/* Parent */
}
/* FIXME: Pass built symbol table to HypcerCell module. */
{
extern int _mme_sm;
extern int _enb_s1_sm;
extern int _s1ap_path;
d_trace_level(&_mme_sm, 100);
d_trace_level(&_enb_s1_sm, 100);
d_trace_level(&_s1ap_path, 100);
}
signal_init();

View File

@ -74,8 +74,8 @@ void enb_s1_state_operational(enb_s1_sm_t *s, event_t *e)
{
case S1ap_ProcedureCode_id_S1Setup :
{
enb_s1_handle_s1setuprequest(enb, &message);
d_info("s1setuprequest is received");
enb_s1_handle_s1setuprequest(enb, &message);
break;
}
default:
@ -164,7 +164,7 @@ status_t enb_s1_handle_s1setuprequest(enb_ctx_t *enb, s1ap_message *message)
rv = s1ap_conv_uint32_from_enb_id(&enb->id, &ies->global_ENB_ID.eNB_ID);
d_assert(rv == CORE_OK, return rv, "Null param");
d_info("eNB-id[%x] sends S1-Setup-Request from [%s]", enb->id,
d_info("eNB-id[0x%x] sends S1-Setup-Request from [%s]", enb->id,
INET_NTOP(&enb->s1_sock->remote.sin_addr.s_addr, buf));
rv = s1ap_build_setup_rsp(&sendbuf);

View File

@ -7,8 +7,6 @@
extern "C" {
#endif /* __cplusplus */
#define S1AP_SDU_SIZE 2048
CORE_DECLARE(status_t) s1ap_build_setup_rsp(pkbuf_t **pkbuf);
#ifdef __cplusplus

View File

@ -4,8 +4,9 @@
#include "core_debug.h"
#include "core_net.h"
#include "s1ap_codecs.h"
#include "event.h"
#include "s1ap_message.h"
#include "s1ap_path.h"
static int _s1ap_accept_cb(net_sock_t *net_sock, void *data);

54
test/s1ap_enb_message.c Normal file
View File

@ -0,0 +1,54 @@
#define TRACE_MODULE _s1enbmsg
#include "core_debug.h"
#include "core_pkbuf.h"
#include "context.h"
#include "s1ap_message.h"
#include "s1ap_conv.h"
status_t s1ap_build_setup_req(pkbuf_t **pkbuf)
{
int erval = -1;
s1ap_message message;
S1ap_S1SetupRequestIEs_t *ies;
S1ap_PLMNidentity_t *plmnIdentity;
S1ap_SupportedTAs_Item_t *supportedTA;
memset(&message, 0, sizeof(s1ap_message));
ies = &message.msg.s1ap_S1SetupRequestIEs;
ies->global_ENB_ID.eNB_ID.present = S1ap_ENB_ID_PR_macroENB_ID;
s1ap_conv_macro_enb_id_to_bit_string(0x5f123,
&ies->global_ENB_ID.eNB_ID.choice.macroENB_ID);
s1ap_conv_plmn_id_to_tbcd_string(
&mme_self()->plmn_id, &ies->global_ENB_ID.pLMNidentity);
supportedTA = (S1ap_SupportedTAs_Item_t *)
core_calloc(1, sizeof(S1ap_SupportedTAs_Item_t));
s1ap_conv_uint16_to_octet_string(mme_self()->tac, &supportedTA->tAC);
plmnIdentity = (S1ap_PLMNidentity_t *)
core_calloc(1, sizeof(S1ap_PLMNidentity_t));
s1ap_conv_plmn_id_to_tbcd_string(
&mme_self()->plmn_id, plmnIdentity);
ASN_SEQUENCE_ADD(&supportedTA->broadcastPLMNs, plmnIdentity);
ASN_SEQUENCE_ADD(&ies->supportedTAs, supportedTA);
message.direction = S1AP_PDU_PR_initiatingMessage;
message.procedureCode = S1ap_ProcedureCode_id_S1Setup;
erval = s1ap_encode_pdu(pkbuf, &message);
s1ap_free_pdu(&message);
if (erval < 0)
{
d_error("s1ap_encode_error : (%d)", erval);
return CORE_ERROR;
}
return CORE_OK;
}

17
test/s1ap_enb_message.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef _S1AP_ENB_MESSAGE_H__
#define _S1AP_ENB_MESSAGE_H__
#include "s1ap_codecs.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(status_t) s1ap_build_setup_req(pkbuf_t **pkbuf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif