This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/src/session/session_private.h

93 lines
1.8 KiB
C
Raw Normal View History

2023-12-11 16:35:26 +08:00
/*
* The current file is private to the plugin, and pulgin can only use session.h
* The current file can only be used by session.cpp/session_pool.cpp/session_table.cpp
*/
#ifndef _SESSION_PRIVATE_H
#define _SESSION_PRIVATE_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "uthash.h"
#include "session.h"
#include "session_address.h"
#define EX_DATA_MAX_COUNT 128
#define SESSION_EVENT_QUEUE_SIZE 256
struct event_queue
{
uint32_t head_idx;
uint32_t tail_idx;
uint32_t events[SESSION_EVENT_QUEUE_SIZE];
};
struct session
{
// session state
enum session_state state;
// session type
enum session_type type;
// session metrics
uint64_t c2s_bytes;
uint64_t s2c_bytes;
uint64_t c2s_packets;
uint64_t s2c_packets;
// session metadata
struct metadata c2s_1st_md;
struct metadata s2c_1st_md;
// session timestamp
uint64_t create_time;
uint64_t last_time;
uint64_t expire_time;
/******************************
* Session Ev Queue Zone
******************************/
struct event_queue events;
/******************************
* Session Ex Data Zone
******************************/
void *ex_data[EX_DATA_MAX_COUNT];
/******************************
* Session Timer Zone
******************************/
// session timer
/******************************
* Session Pool Zone
******************************/
// session pool recycle handle
struct session *next;
/******************************
* Session Table Zone
******************************/
// session table key
uint64_t id;
struct session_address addr;
// session table handle
UT_hash_handle hh1; /* handle for root_id hash table */
UT_hash_handle hh2; /* handle for root_addr hash table */
};
#ifdef __cpluscplus
}
#endif
#endif