update it

This commit is contained in:
Sukchan Lee 2017-03-30 23:27:26 +09:00
parent edae34950c
commit be32184914
6 changed files with 70 additions and 15 deletions

View File

@ -116,6 +116,10 @@ gtp_xact_t *gtp_xact_create(gtp_xact_ctx_t *context,
list_append(xact->org == GTP_LOCAL_ORIGINATOR ?
xact->gnode->local_list : xact->gnode->remote_list, xact);
d_trace(1, "%s Create : xid = 0x%x, type = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type);
return xact;
out2:
@ -129,6 +133,11 @@ out1:
status_t gtp_xact_delete(gtp_xact_t *xact)
{
d_assert(xact, , "Null param");
d_trace(1, "%s Delete : xid = 0x%x, type = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type);
d_assert(xact->gnode, , "Null param");
d_assert(xact->pkbuf, , "Null param");
@ -185,6 +194,11 @@ status_t gtp_xact_commit(gtp_xact_t *xact)
d_assert(xact, goto out, "Null param");
d_trace(1, "%s Commit : xid = 0x%x, type = %d, "
"retry_count = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type, xact->retry_count);
if (xact->retry_count > 0)
{
if (xact->org == GTP_LOCAL_ORIGINATOR)
@ -275,6 +289,13 @@ gtp_xact_t *gtp_xact_find(gtp_node_t *gnode, pkbuf_t *pkbuf)
xact = list_next(xact);
}
if (xact)
{
d_trace(1, "%s Find : xid = 0x%x, type = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type);
}
return xact;
}
@ -292,7 +313,7 @@ gtp_xact_t *gtp_xact_recv(gtp_xact_ctx_t *context,
h = pkbuf->payload;
d_assert(h, goto out, "Null param");
xact = gtp_xact_find(gnode, pkbuf);
if (!xact)
{
@ -300,6 +321,10 @@ gtp_xact_t *gtp_xact_recv(gtp_xact_ctx_t *context,
GTP_SQN_TO_XID(h->sqn), h->type, pkbuf);
}
d_trace(1, "%s Receive : xid = 0x%x, type = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type);
if (h->teid_presence)
pkbuf_header(pkbuf, -GTPV2C_HEADER_LEN);
else
@ -315,7 +340,7 @@ out:
return NULL;
}
gtp_xact_t *gtp_xact_assoicated_send(gtp_xact_ctx_t *context,
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,
gtp_xact_t *associated_xact)
{
@ -348,6 +373,10 @@ gtp_xact_t *gtp_xact_assoicated_send(gtp_xact_ctx_t *context,
rv = gtp_xact_commit(xact);
d_assert(rv == CORE_OK, return NULL, "Null param");
d_trace(1, "%s Send : xid = 0x%x, type = %d\n",
xact->org == GTP_LOCAL_ORIGINATOR ? "LOCAL " : "REMOTE",
xact->xid, xact->type);
return xact;
out:
@ -358,5 +387,5 @@ out:
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)
{
return gtp_xact_assoicated_send(context, sock, gnode, type, pkbuf, NULL);
return gtp_xact_associated_send(context, sock, gnode, type, pkbuf, NULL);
}

View File

@ -69,7 +69,7 @@ CORE_DECLARE(status_t) gtp_xact_commit(gtp_xact_t *xact);
CORE_DECLARE(gtp_xact_t *) gtp_xact_recv(gtp_xact_ctx_t *context,
net_sock_t *sock, gtp_node_t *gnode, pkbuf_t *pkbuf);
CORE_DECLARE(gtp_xact_t *) gtp_xact_assoicated_send(gtp_xact_ctx_t *context,
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,
gtp_xact_t *associated_xact);
CORE_DECLARE(gtp_xact_t *) gtp_xact_send(gtp_xact_ctx_t *context,

2
main.c
View File

@ -127,6 +127,8 @@ int main(int argc, char *argv[])
}
{
extern int _gtp_xact;
d_trace_level(&_gtp_xact, 100);
#if 0
extern int _mme_sm;
d_trace_level(&_mme_sm, 100);

View File

@ -3,12 +3,19 @@
#include "core_debug.h"
#include "event.h"
#include "sgw_path.h"
#include "s11_handler.h"
void sgw_handle_create_session_request(
gtp_xact_t *xact, gtp_create_session_request_t *req)
{
d_info("sgw_handle_create_session_request");
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");
}

View File

@ -142,16 +142,32 @@ status_t sgw_path_close()
return CORE_OK;
}
status_t sgw_s11_send_to_mme(pkbuf_t *pkbuf)
gtp_xact_t *sgw_s11_send_to_mme(c_uint8_t type, pkbuf_t *pkbuf)
{
d_assert(pkbuf, return CORE_ERROR, "Null param");
return gtp_send(sgw_self()->s11_sock, &sgw_self()->s11_node, pkbuf);
gtp_xact_t *xact;
d_assert(pkbuf, return NULL, "Null param");
xact = gtp_xact_send(&sgw_self()->gtp_xact_ctx, sgw_self()->s11_sock,
&sgw_self()->s11_node, type, pkbuf);
d_assert(xact, return NULL, "Null param");
return xact;
}
status_t sgw_s5c_send_to_pgw(pkbuf_t *pkbuf)
gtp_xact_t *sgw_s5c_send_to_pgw(
c_uint8_t type, pkbuf_t *pkbuf, gtp_xact_t *associated_xact)
{
d_assert(pkbuf, return CORE_ERROR, "Null param");
return gtp_send(sgw_self()->s5c_sock, &sgw_self()->s5c_node, pkbuf);
gtp_xact_t *xact;
d_assert(pkbuf, 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);
d_assert(xact, return NULL, "Null param");
return xact;
}
status_t sgw_s5u_send_to_pgw(pkbuf_t *pkbuf)

View File

@ -1,7 +1,7 @@
#ifndef __SGW_PATH_H__
#define __SGW_PATH_H__
#include "gtp_path.h"
#include "gtp_xact.h"
#ifdef __cplusplus
extern "C" {
@ -10,8 +10,9 @@ extern "C" {
CORE_DECLARE(status_t) sgw_path_open();
CORE_DECLARE(status_t) sgw_path_close();
CORE_DECLARE(status_t) sgw_s11_send_to_mme(pkbuf_t *pkbuf);
CORE_DECLARE(status_t) sgw_s5c_send_to_pgw(pkbuf_t *pkbuf);
CORE_DECLARE(gtp_xact_t *) sgw_s11_send_to_mme(c_uint8_t type, pkbuf_t *pkbuf);
CORE_DECLARE(gtp_xact_t *) sgw_s5c_send_to_pgw(
c_uint8_t type, pkbuf_t *pkbuf, gtp_xact_t *associated_xact);
CORE_DECLARE(status_t) sgw_s5u_send_to_pgw(pkbuf_t *pkbuf);
#ifdef __cplusplus