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"
|
|
|
|
|
|
|
|
#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;
|
2017-03-28 07:35:57 +00:00
|
|
|
void *pool;
|
2017-03-27 10:12:45 +00:00
|
|
|
|
|
|
|
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-30 00:06:56 +00:00
|
|
|
c_uint8_t type; /**< GTPv2-C Message Type */
|
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-03-30 12:26:42 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_create(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t org, c_uint32_t xid,
|
2017-04-01 14:28:22 +00:00
|
|
|
c_uint8_t type, c_uint32_t duration, c_uint8_t retry_count);
|
2017-04-01 14:37:27 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_local_create(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type);
|
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_remote_create(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint32_t xid, c_uint8_t type);
|
2017-03-29 02:54:18 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_delete(gtp_xact_t *xact);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-03-30 00:20:40 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_associate(
|
|
|
|
gtp_xact_t *xact1, gtp_xact_t *xact2);
|
|
|
|
CORE_DECLARE(status_t) gtp_xact_deassociate(
|
|
|
|
gtp_xact_t *xact1, gtp_xact_t *xact2);
|
|
|
|
|
2017-03-29 14:19:31 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_find(gtp_node_t *gnode, pkbuf_t *pkbuf);
|
2017-04-01 14:13:15 +00:00
|
|
|
CORE_DECLARE(status_t) gtp_xact_commit(gtp_xact_t *xact, pkbuf_t *pkbuf);
|
|
|
|
CORE_DECLARE(status_t) gtp_xact_timeout(gtp_xact_t *xact);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
2017-03-29 14:19:31 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_recv(gtp_xact_ctx_t *context,
|
|
|
|
net_sock_t *sock, gtp_node_t *gnode, pkbuf_t *pkbuf);
|
2017-03-30 14:27:26 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_associated_send(gtp_xact_ctx_t *context,
|
2017-03-30 13:23:47 +00:00
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf,
|
|
|
|
gtp_xact_t *associated_xact);
|
2017-03-30 00:06:56 +00:00
|
|
|
CORE_DECLARE(gtp_xact_t *) gtp_xact_send(gtp_xact_ctx_t *context,
|
2017-03-29 14:19:31 +00:00
|
|
|
net_sock_t *sock, gtp_node_t *gnode, c_uint8_t type, pkbuf_t *pkbuf);
|
2017-03-26 15:48:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __GTP_XACT_H__ */
|