open5gs/lib/gtp/gtp_xact.h

73 lines
2.2 KiB
C
Raw Normal View History

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;
c_uint32_t duration;
int retry_count;
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: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-26 15:48:33 +00:00
tm_block_id tm_wait; /**< Timer waiting for next message */
int retry_count; /**< Retry count waiting for next message */
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,
tm_service_t *tm_service, c_uintptr_t event, c_uint32_t duration,
int retry_count);
2017-03-26 15:48:33 +00:00
CORE_DECLARE(status_t) gtp_xact_final(void);
2017-03-29 02:54:18 +00:00
CORE_DECLARE(gtp_xact_t *) gtp_xact_new_local(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-29 02:54:18 +00:00
CORE_DECLARE(gtp_xact_t *) gtp_xact_new_remote(gtp_xact_ctx_t *context,
net_sock_t *sock, gtp_node_t *gnode, pkbuf_t *pkbuf);
CORE_DECLARE(status_t) gtp_xact_delete(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_find(gtp_node_t *gnode, pkbuf_t *pkbuf);
2017-03-29 02:54:18 +00:00
CORE_DECLARE(status_t) gtp_xact_commit(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 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__ */