2017-03-26 15:48:33 +00:00
|
|
|
#ifndef __GTP_XACT_H__
|
|
|
|
#define __GTP_XACT_H__
|
|
|
|
|
|
|
|
#include "core_pkbuf.h"
|
|
|
|
#include "core_list.h"
|
|
|
|
#include "core_net.h"
|
|
|
|
#include "core_timer.h"
|
|
|
|
|
|
|
|
#include "gtp_path.h"
|
2017-04-02 11:51:12 +00:00
|
|
|
#include "gtp_tlv.h"
|
2017-03-26 15:48:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2017-03-27 10:12:45 +00:00
|
|
|
/**
|
|
|
|
* Transaction Configuration
|
|
|
|
*/
|
2017-03-28 07:35:57 +00:00
|
|
|
typedef struct _gtp_xact_ctx_t {
|
2017-03-27 10:12:45 +00:00
|
|
|
c_uint32_t g_xact_id;
|
|
|
|
|
|
|
|
tm_service_t *tm_service;
|
|
|
|
c_uintptr_t event;
|
2017-03-28 07:35:57 +00:00
|
|
|
} gtp_xact_ctx_t;
|
2017-03-26 15:48:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Transaction context
|
|
|
|
*/
|
2017-03-29 02:54:18 +00:00
|
|
|
typedef struct _gtp_xact_t {
|
2017-03-26 15:48:33 +00:00
|
|
|
lnode_t node; /**< A node of list */
|
|
|
|
#define GTP_LOCAL_ORIGINATOR 0
|
|
|
|
#define GTP_REMOTE_ORIGINATOR 1
|
|
|
|
c_uint8_t org; /**< Transaction' originator.
|
|
|
|
local or remote */
|
2017-03-30 00:06:56 +00:00
|
|
|
|
|
|
|
c_uint32_t xid; /**< Transaction ID */
|
|
|
|
|
2017-03-27 10:12:45 +00:00
|
|
|
net_sock_t *sock; /**< GTP Socket */
|
|
|
|
gtp_node_t *gnode; /**< Relevant GTP node context */
|
2017-03-30 00:20:40 +00:00
|
|
|
|
2017-03-27 10:12:45 +00:00
|
|
|
pkbuf_t *pkbuf; /**< Relevant GTP node context */
|
2017-03-30 00:20:40 +00:00
|
|
|
|
2017-03-26 15:48:33 +00:00
|
|
|
tm_block_id tm_wait; /**< Timer waiting for next message */
|
2017-04-01 14:28:22 +00:00
|
|
|
c_uint8_t retry_count; /**< Retry count waiting for next message */
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-03-30 00:20:40 +00:00
|
|
|
struct _gtp_xact_t *assoc_xact; /**< Associated transaction */
|
2017-03-29 02:54:18 +00:00
|
|
|
} gtp_xact_t;
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-03-28 07:35:57 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_init(gtp_xact_ctx_t *context,
|
2017-04-01 14:28:22 +00:00
|
|
|
tm_service_t *tm_service, c_uintptr_t event);
|
2017-03-26 15:48:33 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_final(void);
|
|
|
|
|
2017-04-03 13:53:36 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *)gtp_xact_local_create(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode);
|
2017-04-01 14:37:27 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_remote_create(gtp_xact_ctx_t *context,
|
2017-04-03 13:53:36 +00:00
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint32_t sqn);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-04-03 05:18:25 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_commit(
|
2017-04-06 00:57:56 +00:00
|
|
|
gtp_xact_t *xact, c_uint8_t type, pkbuf_t *pkbuf);
|
|
|
|
CORE_DECLARE(status_t) gtp_xact_associated_commit(gtp_xact_t *xact,
|
|
|
|
gtp_xact_t *assoc_xact, c_uint8_t type, pkbuf_t *pkbuf);
|
2017-04-01 14:13:15 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_timeout(gtp_xact_t *xact);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-04-03 13:46:19 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_preprocess(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t *type, pkbuf_t *pkbuf);
|
|
|
|
CORE_DECLARE(status_t) gtp_xact_receive(gtp_xact_t *xact,
|
|
|
|
gtp_message_t *gtp_message, c_uint8_t type, pkbuf_t *pkbuf);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __GTP_XACT_H__ */
|