Adjust thread index type to uint16 for future expansion & Organize stellar directory files

This commit is contained in:
luwenpeng
2024-04-25 16:48:50 +08:00
parent 17ca476c24
commit 611fda598f
22 changed files with 232 additions and 222 deletions

View File

@@ -0,0 +1,51 @@
#ifndef _STELLAR_PRIV_H
#define _STELLAR_PRIV_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "stat.h"
#include "plugin_manager.h"
#include "stellar/stellar.h"
#define STELLAR_LOG_STATE(format, ...) LOG_STATE("stellar", format, ##__VA_ARGS__)
#define STELLAR_LOG_ERROR(format, ...) LOG_ERROR("stellar", format, ##__VA_ARGS__)
#define STELLAR_LOG_DEBUG(format, ...) LOG_DEBUG("stellar", format, ##__VA_ARGS__)
struct stellar_thread
{
pthread_t tid;
uint16_t idx;
uint64_t is_runing;
uint64_t timing_wheel_last_update_ts;
struct ip_reassembly *ip_mgr;
struct session_manager *sess_mgr;
};
struct stellar_runtime
{
uint64_t need_exit;
uint64_t stat_last_output_ts;
struct stellar_stat *stat;
struct packet_io *packet_io;
struct plugin_manager *plug_mgr;
struct stellar_thread threads[MAX_THREAD_NUM];
};
extern struct stellar_runtime *runtime;
extern struct stellar_config *config;
void stellar_set_current_thread_index(uint16_t idx);
int stellar_thread_init(struct stellar_runtime *runtime, struct stellar_config *config);
void stellar_thread_clean(struct stellar_runtime *runtime, struct stellar_config *config);
int stellar_thread_run(struct stellar_runtime *runtime, struct stellar_config *config);
void stellar_thread_join(struct stellar_runtime *runtime, struct stellar_config *config);
#ifdef __cplusplus
}
#endif
#endif