forked from acouzens/open5gs
update it
This commit is contained in:
parent
03f131ac1b
commit
c4aaa33487
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtp_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-04-02 20:45:50.222446 by acetcom
|
||||
* Created on: 2017-04-02 22:30:13.370223 by acetcom
|
||||
* from 29274-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -1909,14 +1909,10 @@ tlv_desc_t tlv_desc_create_session_response =
|
|||
}};
|
||||
|
||||
|
||||
status_t gtp_parse_msg(
|
||||
gtp_message_t *gtp_message, c_uint8_t type, pkbuf_t *pkbuf)
|
||||
status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
|
||||
memset(gtp_message, 0, sizeof(gtp_message_t));
|
||||
|
||||
gtp_message->type = type;
|
||||
switch(gtp_message->type)
|
||||
{
|
||||
case GTP_ECHO_REQUEST_TYPE:
|
||||
|
@ -1936,7 +1932,37 @@ status_t gtp_parse_msg(
|
|||
&tlv_desc_create_session_response, pkbuf, TLV_MODE_T1_L2_I1);
|
||||
break;
|
||||
default:
|
||||
d_warn("Not implmeneted(type:%d)", type);
|
||||
d_warn("Not implmeneted(type:%d)", gtp_message->type);
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
status_t gtp_build_msg(pkbuf_t **pkbuf, gtp_message_t *gtp_message)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
|
||||
switch(gtp_message->type)
|
||||
{
|
||||
case GTP_ECHO_REQUEST_TYPE:
|
||||
rv = tlv_build_msg(pkbuf, &tlv_desc_echo_request,
|
||||
>p_message->echo_request, TLV_MODE_T1_L2_I1);
|
||||
break;
|
||||
case GTP_ECHO_RESPONSE_TYPE:
|
||||
rv = tlv_build_msg(pkbuf, &tlv_desc_echo_response,
|
||||
>p_message->echo_response, TLV_MODE_T1_L2_I1);
|
||||
break;
|
||||
case GTP_CREATE_SESSION_REQUEST_TYPE:
|
||||
rv = tlv_build_msg(pkbuf, &tlv_desc_create_session_request,
|
||||
>p_message->create_session_request, TLV_MODE_T1_L2_I1);
|
||||
break;
|
||||
case GTP_CREATE_SESSION_RESPONSE_TYPE:
|
||||
rv = tlv_build_msg(pkbuf, &tlv_desc_create_session_response,
|
||||
>p_message->create_session_response, TLV_MODE_T1_L2_I1);
|
||||
break;
|
||||
default:
|
||||
d_warn("Not implmeneted(type:%d)", gtp_message->type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/*******************************************************************************
|
||||
* This file had been created by gtp_tlv.py script v0.1.0
|
||||
* Please do not modify this file but regenerate it via script.
|
||||
* Created on: 2017-04-02 20:45:50.211794 by acetcom
|
||||
* Created on: 2017-04-02 22:30:13.359338 by acetcom
|
||||
* from 29274-d80.docx
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -724,7 +724,9 @@ typedef struct _gtp_message_t {
|
|||
} gtp_message_t;
|
||||
|
||||
CORE_DECLARE(status_t) gtp_parse_msg(
|
||||
gtp_message_t *gtp_message, c_uint8_t type, pkbuf_t *pkbuf);
|
||||
gtp_message_t *gtp_message, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(status_t) gtp_build_msg(
|
||||
pkbuf_t **pkbuf, gtp_message_t *gtp_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -194,10 +194,10 @@ status_t gtp_xact_commit(gtp_xact_t *xact, pkbuf_t *pkbuf)
|
|||
{
|
||||
xact->pkbuf = pkbuf;
|
||||
|
||||
d_assert(xact, goto out, "Null param");
|
||||
d_assert(xact->sock, goto out, "Null param");
|
||||
d_assert(xact->gnode, goto out, "Null param");
|
||||
d_assert(xact->pkbuf, goto out, "Null param");
|
||||
d_assert(xact, return CORE_ERROR, "Null param");
|
||||
d_assert(xact->sock, return CORE_ERROR, "Null param");
|
||||
d_assert(xact->gnode, return CORE_ERROR, "Null param");
|
||||
d_assert(xact->pkbuf, return CORE_ERROR, "Null param");
|
||||
|
||||
d_trace(1, "[%d]%s Commit : xid = 0x%x\n",
|
||||
xact->gnode->port,
|
||||
|
@ -205,13 +205,9 @@ status_t gtp_xact_commit(gtp_xact_t *xact, pkbuf_t *pkbuf)
|
|||
xact->xid);
|
||||
|
||||
d_assert(gtp_send(xact->sock, xact->gnode, xact->pkbuf) == CORE_OK,
|
||||
goto out, "gtp_send error");
|
||||
return CORE_ERROR, "gtp_send error");
|
||||
|
||||
return CORE_OK;
|
||||
|
||||
out:
|
||||
pkbuf_free(pkbuf);
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
status_t gtp_xact_timeout(gtp_xact_t *xact)
|
||||
|
@ -343,7 +339,9 @@ gtp_xact_t *gtp_xact_recv(
|
|||
else
|
||||
pkbuf_header(pkbuf, -(GTPV2C_HEADER_LEN-GTPV2C_TEID_LEN));
|
||||
|
||||
d_assert(gtp_parse_msg(gtp_message, h->type, pkbuf) == CORE_OK,
|
||||
memset(gtp_message, 0, sizeof(gtp_message_t));
|
||||
gtp_message->type = h->type;
|
||||
d_assert(gtp_parse_msg(gtp_message, pkbuf) == CORE_OK,
|
||||
goto out, "parse error");
|
||||
|
||||
d_trace(1, "[%d]%s Receive : xid = 0x%x\n",
|
||||
|
@ -359,28 +357,32 @@ out:
|
|||
}
|
||||
|
||||
gtp_xact_t *gtp_xact_associated_send(gtp_xact_ctx_t *context,
|
||||
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf,
|
||||
net_sock_t *sock, gtp_node_t *gnode, gtp_message_t *gtp_message,
|
||||
gtp_xact_t *associated_xact)
|
||||
{
|
||||
status_t rv;
|
||||
gtp_xact_t *xact = NULL;
|
||||
gtpv2c_header_t *h = NULL;
|
||||
pkbuf_t *pkbuf = NULL;
|
||||
|
||||
d_assert(context, goto out, "Null param");
|
||||
d_assert(sock, goto out, "Null param");
|
||||
d_assert(gnode, goto out, "Null param");
|
||||
d_assert(pkbuf, goto out, "Null param");
|
||||
d_assert(context, return NULL, "Null param");
|
||||
d_assert(sock, return NULL, "Null param");
|
||||
d_assert(gnode, return NULL, "Null param");
|
||||
d_assert(gtp_message, return NULL, "Null param");
|
||||
|
||||
xact = gtp_xact_local_create(context, sock, gnode);
|
||||
d_assert(xact, goto out, "Null param");
|
||||
d_assert(xact, return NULL, "Null param");
|
||||
|
||||
rv = gtp_build_msg(&pkbuf, gtp_message);
|
||||
d_assert(rv == CORE_OK, gtp_xact_delete(xact); return NULL, "Null param");
|
||||
|
||||
pkbuf_header(pkbuf, GTPV2C_HEADER_LEN);
|
||||
h = pkbuf->payload;
|
||||
d_assert(h, goto out, "Null param");
|
||||
d_assert(h, gtp_xact_delete(xact); return NULL, "Null param");
|
||||
|
||||
h->version = 2;
|
||||
h->teid_presence = 1;
|
||||
h->type = type;
|
||||
h->type = gtp_message->type;
|
||||
h->length = htons(pkbuf->len - 4);
|
||||
h->sqn = GTP_XID_TO_SQN(xact->xid);
|
||||
|
||||
|
@ -388,7 +390,7 @@ gtp_xact_t *gtp_xact_associated_send(gtp_xact_ctx_t *context,
|
|||
gtp_xact_associate(xact, associated_xact);
|
||||
|
||||
rv = gtp_xact_commit(xact, pkbuf);
|
||||
d_assert(rv == CORE_OK, return NULL, "Null param");
|
||||
d_assert(rv == CORE_OK, gtp_xact_delete(xact); return NULL, "Null param");
|
||||
|
||||
d_trace(1, "[%d]%s Send : xid = 0x%x\n",
|
||||
gnode->port,
|
||||
|
@ -396,14 +398,10 @@ gtp_xact_t *gtp_xact_associated_send(gtp_xact_ctx_t *context,
|
|||
xact->xid);
|
||||
|
||||
return xact;
|
||||
|
||||
out:
|
||||
pkbuf_free(pkbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gtp_xact_t *gtp_xact_send(gtp_xact_ctx_t *context,
|
||||
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf)
|
||||
net_sock_t *sock, gtp_node_t *gnode, gtp_message_t *gtp_message)
|
||||
{
|
||||
return gtp_xact_associated_send(context, sock, gnode, type, pkbuf, NULL);
|
||||
return gtp_xact_associated_send(context, sock, gnode, gtp_message, NULL);
|
||||
}
|
||||
|
|
|
@ -73,10 +73,10 @@ CORE_DECLARE(gtp_xact_t *) gtp_xact_recv(
|
|||
gtp_xact_ctx_t *context, net_sock_t *sock, gtp_node_t *gnode,
|
||||
gtp_message_t *gtp_message, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(gtp_xact_t *) gtp_xact_associated_send(gtp_xact_ctx_t *context,
|
||||
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf,
|
||||
net_sock_t *sock, gtp_node_t *gnode, gtp_message_t *gtp_message,
|
||||
gtp_xact_t *associated_xact);
|
||||
CORE_DECLARE(gtp_xact_t *) gtp_xact_send(gtp_xact_ctx_t *context,
|
||||
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf);
|
||||
net_sock_t *sock, gtp_node_t *gnode, gtp_message_t *gtp_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -463,7 +463,9 @@ f.write(" };\n");
|
|||
f.write("} gtp_message_t;\n\n")
|
||||
|
||||
f.write("""CORE_DECLARE(status_t) gtp_parse_msg(
|
||||
gtp_message_t *gtp_message, c_uint8_t type, pkbuf_t *pkbuf);
|
||||
gtp_message_t *gtp_message, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(status_t) gtp_build_msg(
|
||||
pkbuf_t **pkbuf, gtp_message_t *gtp_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -540,14 +542,10 @@ for (k, v) in sorted_msg_list:
|
|||
f.write("}};\n\n")
|
||||
f.write("\n")
|
||||
|
||||
f.write("""status_t gtp_parse_msg(
|
||||
gtp_message_t *gtp_message, c_uint8_t type, pkbuf_t *pkbuf)
|
||||
f.write("""status_t gtp_parse_msg(gtp_message_t *gtp_message, pkbuf_t *pkbuf)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
|
||||
memset(gtp_message, 0, sizeof(gtp_message_t));
|
||||
|
||||
gtp_message->type = type;
|
||||
switch(gtp_message->type)
|
||||
{
|
||||
""")
|
||||
|
@ -558,7 +556,30 @@ for (k, v) in sorted_msg_list:
|
|||
f.write(" &tlv_desc_%s, pkbuf, TLV_MODE_T1_L2_I1);\n" % v_lower(k))
|
||||
f.write(" break;\n")
|
||||
f.write(""" default:
|
||||
d_warn("Not implmeneted(type:%d)", type);
|
||||
d_warn("Not implmeneted(type:%d)", gtp_message->type);
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
""")
|
||||
|
||||
f.write("""status_t gtp_build_msg(pkbuf_t **pkbuf, gtp_message_t *gtp_message)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
|
||||
switch(gtp_message->type)
|
||||
{
|
||||
""")
|
||||
for (k, v) in sorted_msg_list:
|
||||
if "ies" in msg_list[k]:
|
||||
f.write(" case GTP_%s_TYPE:\n" % v_upper(k))
|
||||
f.write(" rv = tlv_build_msg(pkbuf, &tlv_desc_%s,\n" % v_lower(k))
|
||||
f.write(" >p_message->%s, TLV_MODE_T1_L2_I1);\n" % v_lower(k))
|
||||
f.write(" break;\n")
|
||||
f.write(""" default:
|
||||
d_warn("Not implmeneted(type:%d)", gtp_message->type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
13
main.c
13
main.c
|
@ -7,9 +7,6 @@
|
|||
#include "core_debug.h"
|
||||
#include "core_signal.h"
|
||||
|
||||
/* REMOVE */
|
||||
#include "core_pkbuf.h"
|
||||
|
||||
/* Server */
|
||||
#include "cellwire.h"
|
||||
|
||||
|
@ -51,14 +48,8 @@ static int check_signal(int signum)
|
|||
}
|
||||
case SIGUSR1:
|
||||
{
|
||||
pkbuf_t *pkbuf = NULL;
|
||||
CORE_DECLARE(status_t) s11_build_create_session_req(pkbuf_t **pkbuf, void *ue);
|
||||
CORE_DECLARE(status_t) mme_s11_send_to_sgw(void *sgw, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(void*) mme_ctx_sgw_first(void);
|
||||
|
||||
s11_build_create_session_req(&pkbuf, NULL);
|
||||
d_print_hex(pkbuf->payload, pkbuf->len);
|
||||
mme_s11_send_to_sgw(mme_ctx_sgw_first(), pkbuf);
|
||||
extern void test_send();
|
||||
test_send();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "gtp_types.h"
|
||||
#include "gtp_tlv.h"
|
||||
|
||||
status_t s11_build_create_session_req(pkbuf_t **pkbuf, ue_ctx_t *ue)
|
||||
status_t s11_build_create_session_req(gtp_message_t *gtp_message, ue_ctx_t *ue)
|
||||
{
|
||||
gtp_create_session_request_t req;
|
||||
gtp_create_session_request_t *req = >p_message->create_session_request;
|
||||
gtp_uli_t uli;
|
||||
char uli_buf[GTP_MAX_ULI_LEN];
|
||||
plmn_id_t serving_network;
|
||||
|
@ -23,19 +23,21 @@ status_t s11_build_create_session_req(pkbuf_t **pkbuf, ue_ctx_t *ue)
|
|||
char bearer_qos_buf[GTP_BEARER_QOS_LEN];
|
||||
gtp_ue_timezone_t ue_timezone;
|
||||
|
||||
memset(&req, 0, sizeof(gtp_create_session_request_t));
|
||||
memset(gtp_message, 0, sizeof(gtp_message_t));
|
||||
|
||||
req.imsi.presence = 1;
|
||||
req.imsi.data = (c_uint8_t *)"\x55\x15\x30\x11\x34\x00\x10\xf4";
|
||||
req.imsi.len = 8;
|
||||
gtp_message->type = GTP_CREATE_SESSION_REQUEST_TYPE;
|
||||
|
||||
req.msisdn.presence = 1;
|
||||
req.msisdn.data = (c_uint8_t *)"\x94\x71\x52\x76\x00\x41";
|
||||
req.msisdn.len = 6;
|
||||
req->imsi.presence = 1;
|
||||
req->imsi.data = (c_uint8_t *)"\x55\x15\x30\x11\x34\x00\x10\xf4";
|
||||
req->imsi.len = 8;
|
||||
|
||||
req.me_identity.presence = 1;
|
||||
req.me_identity.data = (c_uint8_t *)"\x53\x61\x20\x00\x91\x78\x84\x00";
|
||||
req.me_identity.len = 8;
|
||||
req->msisdn.presence = 1;
|
||||
req->msisdn.data = (c_uint8_t *)"\x94\x71\x52\x76\x00\x41";
|
||||
req->msisdn.len = 6;
|
||||
|
||||
req->me_identity.presence = 1;
|
||||
req->me_identity.data = (c_uint8_t *)"\x53\x61\x20\x00\x91\x78\x84\x00";
|
||||
req->me_identity.len = 8;
|
||||
|
||||
memset(&uli, 0, sizeof(gtp_uli_t));
|
||||
uli.flags.ecgi = 1;
|
||||
|
@ -44,59 +46,59 @@ status_t s11_build_create_session_req(pkbuf_t **pkbuf, ue_ctx_t *ue)
|
|||
uli.tai.tac = 4130;
|
||||
plmn_id_build(&uli.ecgi.plmn_id, 555, 10, 2);
|
||||
uli.ecgi.eci = 105729;
|
||||
req.user_location_information.presence = 1;
|
||||
gtp_build_uli(&req.user_location_information, &uli,
|
||||
req->user_location_information.presence = 1;
|
||||
gtp_build_uli(&req->user_location_information, &uli,
|
||||
uli_buf, GTP_MAX_ULI_LEN);
|
||||
|
||||
req.serving_network.presence = 1;
|
||||
req.serving_network.data = plmn_id_build(&serving_network, 555, 10, 2);
|
||||
req.serving_network.len = sizeof(serving_network);
|
||||
req->serving_network.presence = 1;
|
||||
req->serving_network.data = plmn_id_build(&serving_network, 555, 10, 2);
|
||||
req->serving_network.len = sizeof(serving_network);
|
||||
|
||||
req.rat_type.presence = 1;
|
||||
req.rat_type.u8 = GTP_RAT_TYPE_EUTRAN;
|
||||
req->rat_type.presence = 1;
|
||||
req->rat_type.u8 = GTP_RAT_TYPE_EUTRAN;
|
||||
|
||||
memset(&s11, 0, sizeof(gtp_f_teid_t));
|
||||
s11.ipv4 = 1;
|
||||
s11.interface_type = GTP_F_TEID_S11_MME_GTP_C;
|
||||
s11.teid = htonl(0x80000084);
|
||||
s11.ipv4_addr = inet_addr("10.50.54.10");
|
||||
req.sender_f_teid_for_control_plane.presence = 1;
|
||||
req.sender_f_teid_for_control_plane.data = &s11;
|
||||
req.sender_f_teid_for_control_plane.len = GTP_F_TEID_IPV4_LEN;
|
||||
req->sender_f_teid_for_control_plane.presence = 1;
|
||||
req->sender_f_teid_for_control_plane.data = &s11;
|
||||
req->sender_f_teid_for_control_plane.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
memset(&s5, 0, sizeof(gtp_f_teid_t));
|
||||
s5.ipv4 = 1;
|
||||
s5.interface_type = GTP_F_TEID_S5_S8_PGW_GTP_C;
|
||||
s5.ipv4_addr = inet_addr("10.50.54.37");
|
||||
req.pgw_s5_s8_address_for_control_plane_or_pmip.presence = 1;
|
||||
req.pgw_s5_s8_address_for_control_plane_or_pmip.data = &s5;
|
||||
req.pgw_s5_s8_address_for_control_plane_or_pmip.len = GTP_F_TEID_IPV4_LEN;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.presence = 1;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.data = &s5;
|
||||
req->pgw_s5_s8_address_for_control_plane_or_pmip.len = GTP_F_TEID_IPV4_LEN;
|
||||
|
||||
req.access_point_name.presence = 1;
|
||||
req.access_point_name.data = "cellwire.com";
|
||||
req.access_point_name.len = strlen(req.access_point_name.data);
|
||||
req->access_point_name.presence = 1;
|
||||
req->access_point_name.data = "cellwire.com";
|
||||
req->access_point_name.len = strlen(req->access_point_name.data);
|
||||
|
||||
req.selection_mode.presence = 1;
|
||||
req.selection_mode.u8 = GTP_SELECTION_MODE_MS_OR_NETWORK_PROVIDED_APN | 0xfc;
|
||||
req->selection_mode.presence = 1;
|
||||
req->selection_mode.u8 = GTP_SELECTION_MODE_MS_OR_NETWORK_PROVIDED_APN | 0xfc;
|
||||
|
||||
req.pdn_type.presence = 1;
|
||||
req.pdn_type.u8 = GTP_PDN_TYPE_IPV4;
|
||||
req->pdn_type.presence = 1;
|
||||
req->pdn_type.u8 = GTP_PDN_TYPE_IPV4;
|
||||
|
||||
memset(&paa, 0, sizeof(gtp_paa_t));
|
||||
paa.pdn_type = GTP_PDN_TYPE_IPV4;
|
||||
req.pdn_address_allocation.presence = 1;
|
||||
req.pdn_address_allocation.data = &paa;
|
||||
req.pdn_address_allocation.len = GTP_PAA_IPV4_LEN;
|
||||
req->pdn_address_allocation.presence = 1;
|
||||
req->pdn_address_allocation.data = &paa;
|
||||
req->pdn_address_allocation.len = GTP_PAA_IPV4_LEN;
|
||||
|
||||
req.maximum_apn_restriction.presence = 1;
|
||||
req.maximum_apn_restriction.u8 = GTP_APN_NO_RESTRICTION;
|
||||
req->maximum_apn_restriction.presence = 1;
|
||||
req->maximum_apn_restriction.u8 = GTP_APN_NO_RESTRICTION;
|
||||
|
||||
memset(&ambr, 0, sizeof(gtp_ambr_t));
|
||||
ambr.uplink = htonl(1000);
|
||||
ambr.downlink = htonl(2000);
|
||||
req.aggregate_maximum_bit_rate.presence = 1;
|
||||
req.aggregate_maximum_bit_rate.data = &ambr;
|
||||
req.aggregate_maximum_bit_rate.len = sizeof(ambr);
|
||||
req->aggregate_maximum_bit_rate.presence = 1;
|
||||
req->aggregate_maximum_bit_rate.data = &ambr;
|
||||
req->aggregate_maximum_bit_rate.len = sizeof(ambr);
|
||||
|
||||
memset(&pco, 0, sizeof(gtp_pco_t));
|
||||
pco.ext = 1;
|
||||
|
@ -110,36 +112,35 @@ status_t s11_build_create_session_req(pkbuf_t **pkbuf, ue_ctx_t *ue)
|
|||
pco.ids[1].length = 0;
|
||||
pco.ids[2].id = GTP_PROTOCOL_OR_CONTAINER_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING;
|
||||
pco.ids[2].length = 0;
|
||||
req.protocol_configuration_options.presence = 1;
|
||||
gtp_build_pco(&req.protocol_configuration_options, &pco,
|
||||
req->protocol_configuration_options.presence = 1;
|
||||
gtp_build_pco(&req->protocol_configuration_options, &pco,
|
||||
pcobuf, GTP_MAX_PCO_LEN);
|
||||
|
||||
req.bearer_contexts_to_be_created.presence = 1;
|
||||
req.bearer_contexts_to_be_created.eps_bearer_id.presence = 1;
|
||||
req.bearer_contexts_to_be_created.eps_bearer_id.u8 = 5;
|
||||
req->bearer_contexts_to_be_created.presence = 1;
|
||||
req->bearer_contexts_to_be_created.eps_bearer_id.presence = 1;
|
||||
req->bearer_contexts_to_be_created.eps_bearer_id.u8 = 5;
|
||||
|
||||
memset(&bearer_qos, 0, sizeof(bearer_qos));
|
||||
bearer_qos.pvi = 1;
|
||||
bearer_qos.pl = 1;
|
||||
bearer_qos.pci = 1;
|
||||
bearer_qos.qci = 5;
|
||||
req.bearer_contexts_to_be_created.bearer_level_qos.presence = 1;
|
||||
gtp_build_bearer_qos(&req.bearer_contexts_to_be_created.bearer_level_qos,
|
||||
req->bearer_contexts_to_be_created.bearer_level_qos.presence = 1;
|
||||
gtp_build_bearer_qos(&req->bearer_contexts_to_be_created.bearer_level_qos,
|
||||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
|
||||
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;
|
||||
req.ue_time_zone.presence = 1;
|
||||
req.ue_time_zone.data = &ue_timezone;
|
||||
req.ue_time_zone.len = sizeof(ue_timezone);
|
||||
req->ue_time_zone.presence = 1;
|
||||
req->ue_time_zone.data = &ue_timezone;
|
||||
req->ue_time_zone.len = sizeof(ue_timezone);
|
||||
|
||||
req.charging_characteristics.presence = 1;
|
||||
req.charging_characteristics.data = (c_uint8_t *)"\x54\x00";
|
||||
req.charging_characteristics.len = 2;
|
||||
req->charging_characteristics.presence = 1;
|
||||
req->charging_characteristics.data = (c_uint8_t *)"\x54\x00";
|
||||
req->charging_characteristics.len = 2;
|
||||
|
||||
return tlv_build_msg(pkbuf, &tlv_desc_create_session_request, &req,
|
||||
TLV_MODE_T1_L2_I1);
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef __S11_BUILD_H__
|
||||
#define __S11_BUILD_H__
|
||||
|
||||
#include "s1ap_message.h"
|
||||
#include "gtp_tlv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(status_t) s11_build_create_session_req(
|
||||
pkbuf_t **pkbuf, ue_ctx_t *ue);
|
||||
gtp_message_t *gtp_message, ue_ctx_t *ue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -80,17 +80,24 @@ status_t mme_s11_close()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
#include "gtp_tlv.h"
|
||||
status_t mme_s11_send_to_sgw(void *sgw, pkbuf_t *pkbuf)
|
||||
status_t mme_s11_send_to_sgw(void *sgw, gtp_message_t *gtp_message)
|
||||
{
|
||||
gtp_xact_t *xact;
|
||||
d_assert(sgw, return CORE_ERROR, "Null param");
|
||||
d_assert(pkbuf, return CORE_ERROR, "Null param");
|
||||
d_assert(gtp_message, return CORE_ERROR, "Null param");
|
||||
|
||||
xact = gtp_xact_send(&mme_self()->gtp_xact_ctx, mme_self()->s11_sock, sgw,
|
||||
GTP_CREATE_SESSION_REQUEST_TYPE, pkbuf);
|
||||
xact->pkbuf = pkbuf;
|
||||
xact = gtp_xact_send(&mme_self()->gtp_xact_ctx, mme_self()->s11_sock,
|
||||
sgw, gtp_message);
|
||||
gtp_xact_delete(xact);
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
#include "s11_build.h"
|
||||
void test_send()
|
||||
{
|
||||
gtp_message_t gtp_message;
|
||||
|
||||
s11_build_create_session_req(>p_message, NULL);
|
||||
mme_s11_send_to_sgw(mme_ctx_sgw_first(), >p_message);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __MME_S11_PATH_H__
|
||||
#define __MME_S11_PATH_H__
|
||||
|
||||
#include "gtp_path.h"
|
||||
#include "gtp_tlv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -10,7 +10,8 @@ extern "C" {
|
|||
CORE_DECLARE(status_t) mme_s11_listen();
|
||||
CORE_DECLARE(status_t) mme_s11_close();
|
||||
|
||||
CORE_DECLARE(status_t) mme_s11_send_to_sgw(void *sgw, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(status_t) mme_s11_send_to_sgw(
|
||||
void *sgw, gtp_message_t *gtp_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -116,14 +116,14 @@ status_t pgw_path_close()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
gtp_xact_t *pgw_s5c_send_to_sgw(c_uint8_t type, pkbuf_t *pkbuf)
|
||||
gtp_xact_t *pgw_s5c_send_to_sgw(gtp_message_t *gtp_message)
|
||||
{
|
||||
gtp_xact_t *xact;
|
||||
|
||||
d_assert(pkbuf, return NULL, "Null param");
|
||||
d_assert(gtp_message, return NULL, "Null param");
|
||||
|
||||
xact = gtp_xact_send(&pgw_self()->gtp_xact_ctx, pgw_self()->s5c_sock,
|
||||
&pgw_self()->s5c_node, type, pkbuf);
|
||||
&pgw_self()->s5c_node, gtp_message);
|
||||
d_assert(xact, return NULL, "Null param");
|
||||
|
||||
return xact;
|
||||
|
|
|
@ -10,7 +10,7 @@ extern "C" {
|
|||
CORE_DECLARE(status_t) pgw_path_open();
|
||||
CORE_DECLARE(status_t) pgw_path_close();
|
||||
|
||||
CORE_DECLARE(gtp_xact_t *) pgw_s5c_send_to_sgw(c_uint8_t type, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(gtp_xact_t *) pgw_s5c_send_to_sgw(gtp_message_t *gtp_messgae);
|
||||
CORE_DECLARE(status_t) pgw_s5u_send_to_sgw(pkbuf_t *pkbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -7,15 +7,8 @@
|
|||
#include "s11_handler.h"
|
||||
|
||||
void sgw_s11_handle_create_session_request(
|
||||
gtp_xact_t *xact, gtp_create_session_request_t *req)
|
||||
gtp_xact_t *xact, gtp_message_t *gtp_message)
|
||||
{
|
||||
status_t rv;
|
||||
pkbuf_t *pkbuf;
|
||||
|
||||
rv = tlv_build_msg(&pkbuf, &tlv_desc_create_session_request, req,
|
||||
TLV_MODE_T1_L2_I1);
|
||||
d_assert(rv == CORE_OK, return, "failed to build GTP TLV");
|
||||
|
||||
d_assert(sgw_s5c_send_to_pgw(GTP_CREATE_SESSION_REQUEST_TYPE, pkbuf, xact),
|
||||
return, "failed to send message");
|
||||
d_assert(sgw_s5c_send_to_pgw(xact, gtp_message), return,
|
||||
"failed to send message");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ extern "C" {
|
|||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(void) sgw_s11_handle_create_session_request(
|
||||
gtp_xact_t *xact, gtp_create_session_request_t *req);
|
||||
gtp_xact_t *xact, gtp_message_t *gtp_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -142,29 +142,29 @@ status_t sgw_path_close()
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
gtp_xact_t *sgw_s11_send_to_mme(c_uint8_t type, pkbuf_t *pkbuf)
|
||||
gtp_xact_t *sgw_s11_send_to_mme(gtp_message_t *gtp_message)
|
||||
{
|
||||
gtp_xact_t *xact;
|
||||
d_assert(pkbuf, return NULL, "Null param");
|
||||
d_assert(gtp_message, return NULL, "Null param");
|
||||
|
||||
xact = gtp_xact_send(&sgw_self()->gtp_xact_ctx, sgw_self()->s11_sock,
|
||||
&sgw_self()->s11_node, type, pkbuf);
|
||||
&sgw_self()->s11_node, gtp_message);
|
||||
d_assert(xact, return NULL, "Null param");
|
||||
|
||||
return xact;
|
||||
}
|
||||
|
||||
gtp_xact_t *sgw_s5c_send_to_pgw(
|
||||
c_uint8_t type, pkbuf_t *pkbuf, gtp_xact_t *associated_xact)
|
||||
gtp_xact_t *associated_xact, gtp_message_t *gtp_message)
|
||||
{
|
||||
gtp_xact_t *xact;
|
||||
|
||||
d_assert(pkbuf, return NULL, "Null param");
|
||||
d_assert(gtp_message, return NULL, "Null param");
|
||||
d_assert(associated_xact, return NULL, "Null param");
|
||||
|
||||
xact = gtp_xact_associated_send(
|
||||
&sgw_self()->gtp_xact_ctx, sgw_self()->s5c_sock,
|
||||
&sgw_self()->s5c_node, type, pkbuf, associated_xact);
|
||||
&sgw_self()->s5c_node, gtp_message, associated_xact);
|
||||
d_assert(xact, return NULL, "Null param");
|
||||
|
||||
return xact;
|
||||
|
|
|
@ -10,9 +10,9 @@ extern "C" {
|
|||
CORE_DECLARE(status_t) sgw_path_open();
|
||||
CORE_DECLARE(status_t) sgw_path_close();
|
||||
|
||||
CORE_DECLARE(gtp_xact_t *) sgw_s11_send_to_mme(c_uint8_t type, pkbuf_t *pkbuf);
|
||||
CORE_DECLARE(gtp_xact_t *) sgw_s11_send_to_mme(gtp_message_t *gtp_message);
|
||||
CORE_DECLARE(gtp_xact_t *) sgw_s5c_send_to_pgw(
|
||||
c_uint8_t type, pkbuf_t *pkbuf, gtp_xact_t *associated_xact);
|
||||
gtp_xact_t *associated_xact, gtp_message_t *gtp_message);
|
||||
CORE_DECLARE(status_t) sgw_s5u_send_to_pgw(pkbuf_t *pkbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -74,8 +74,7 @@ void sgw_state_operational(sgw_sm_t *s, event_t *e)
|
|||
{
|
||||
case GTP_CREATE_SESSION_REQUEST_TYPE:
|
||||
{
|
||||
sgw_s11_handle_create_session_request(
|
||||
xact, >p_message.create_session_request);
|
||||
sgw_s11_handle_create_session_request(xact, >p_message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue