Update Stellar export header and add stellar_get_current_thread_index() function
This commit is contained in:
131
include/stellar/session.h
Normal file
131
include/stellar/session.h
Normal file
@@ -0,0 +1,131 @@
|
||||
#ifndef _SESSION_PUB_H
|
||||
#define _SESSION_PUB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "stellar/packet.h"
|
||||
|
||||
enum session_state
|
||||
{
|
||||
SESSION_STATE_INIT = 0,
|
||||
SESSION_STATE_OPENING = 1,
|
||||
SESSION_STATE_ACTIVE = 2,
|
||||
SESSION_STATE_CLOSING = 3,
|
||||
SESSION_STATE_DISCARD = 4,
|
||||
SESSION_STATE_CLOSED = 5,
|
||||
MAX_STATE = 6,
|
||||
};
|
||||
|
||||
enum session_type
|
||||
{
|
||||
SESSION_TYPE_TCP = 0x1,
|
||||
SESSION_TYPE_UDP = 0x2,
|
||||
};
|
||||
|
||||
enum session_direction
|
||||
{
|
||||
SESSION_DIRECTION_NONE = -1,
|
||||
SESSION_DIRECTION_C2S = 0,
|
||||
SESSION_DIRECTION_S2C = 1,
|
||||
MAX_DIRECTION = 2,
|
||||
};
|
||||
|
||||
enum closing_reason
|
||||
{
|
||||
CLOSING_BY_TIMEOUT = 0x1,
|
||||
CLOSING_BY_EVICTED = 0x2,
|
||||
CLOSING_BY_CLIENT_FIN = 0x3,
|
||||
CLOSING_BY_CLIENT_RST = 0x4,
|
||||
CLOSING_BY_SERVER_FIN = 0x5,
|
||||
CLOSING_BY_SERVER_RST = 0x6,
|
||||
};
|
||||
|
||||
enum session_stat
|
||||
{
|
||||
// raw packet
|
||||
STAT_RAW_PKTS_RX,
|
||||
STAT_RAW_BYTES_RX,
|
||||
|
||||
STAT_RAW_PKTS_TX,
|
||||
STAT_RAW_BYTES_TX,
|
||||
|
||||
STAT_RAW_PKTS_DROP,
|
||||
STAT_RAW_BYTES_DROP,
|
||||
|
||||
STAT_DUP_PKTS_BYPASS,
|
||||
STAT_DUP_BYTES_BYPASS,
|
||||
|
||||
// control packet
|
||||
STAT_CTRL_PKTS_RX, // TODO
|
||||
STAT_CTRL_BYTES_RX, // TODO
|
||||
|
||||
STAT_CTRL_PKTS_TX,
|
||||
STAT_CTRL_BYTES_TX,
|
||||
|
||||
STAT_CTRL_PKTS_DROP,
|
||||
STAT_CTRL_BYTES_DROP,
|
||||
|
||||
// TCP segment
|
||||
STAT_TCP_SEGS_RX,
|
||||
STAT_TCP_PLDS_RX,
|
||||
|
||||
STAT_TCP_SEGS_EXPIRED,
|
||||
STAT_TCP_PLDS_EXPIRED,
|
||||
|
||||
STAT_TCP_SEGS_OVERLAP,
|
||||
STAT_TCP_PLDS_OVERLAP,
|
||||
|
||||
STAT_TCP_SEGS_NOSPACE,
|
||||
STAT_TCP_PLDS_NOSPACE,
|
||||
|
||||
STAT_TCP_SEGS_INORDER,
|
||||
STAT_TCP_PLDS_INORDER,
|
||||
|
||||
STAT_TCP_SEGS_REORDERED,
|
||||
STAT_TCP_PLDS_REORDERED,
|
||||
|
||||
STAT_TCP_SEGS_BUFFERED,
|
||||
STAT_TCP_PLDS_BUFFERED,
|
||||
|
||||
STAT_TCP_SEGS_RELEASED,
|
||||
STAT_TCP_PLDS_RELEASED,
|
||||
|
||||
MAX_STAT,
|
||||
};
|
||||
|
||||
enum session_timestamp
|
||||
{
|
||||
SESSION_TIMESTAMP_START,
|
||||
SESSION_TIMESTAMP_LAST,
|
||||
MAX_TIMESTAMP,
|
||||
};
|
||||
|
||||
struct session;
|
||||
|
||||
int session_has_dup_traffic(const struct session *sess);
|
||||
enum session_type session_get_type(const struct session *sess);
|
||||
enum session_state session_get_state(const struct session *sess);
|
||||
enum closing_reason session_get_closing_reason(const struct session *sess);
|
||||
enum session_direction session_get_current_direction(const struct session *sess);
|
||||
const struct packet *session_get_1st_packet(const struct session *sess, enum session_direction dir);
|
||||
|
||||
uint64_t session_get_id(const struct session *sess);
|
||||
uint64_t session_get_timestamp(const struct session *sess, enum session_timestamp type);
|
||||
uint64_t session_get_stat(const struct session *sess, enum session_direction dir, enum session_stat stat);
|
||||
|
||||
const char *session_get_tuple_str(const struct session *sess);
|
||||
const char *session_type_to_str(enum session_type type);
|
||||
const char *session_state_to_str(enum session_state state);
|
||||
const char *session_direction_to_str(enum session_direction dir);
|
||||
const char *closing_reason_to_str(enum closing_reason reason);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user