#pragma once

#ifdef __cplusplus
extern "C"
{
#endif

#include "packet_io.h"
#include "ip_reassembly.h"
#include "session_manager.h"

struct schedule_options
{
    // Note: free_expired_session_interval determines the precision of session_manager timeout
    uint64_t free_expired_session_interval;    // range: [1, 60000] (ms)
    uint64_t free_expired_session_batch;       // range: [1, 60000]
    uint64_t force_session_expire_before_exit; // range: [0, 1]

    // Note: free_expired_ip_frag_interval determines the precision of ip_reassembly timeout
    uint64_t free_expired_ip_frag_interval; // range: [1, 60000] (ms)
    uint64_t free_expired_ip_frag_batch;    // range: [1, 60000]

    uint64_t merge_stat_interval;  // range: [1, 60000] (ms)
    uint64_t output_stat_interval; // range: [1, 60000] (ms)

    uint64_t packet_io_yield_interval; // range: [1, 60000] (ms)
};

struct snowflake_options
{
    uint8_t snowflake_base;
    uint8_t snowflake_offset;
};

struct stellar_config
{
    struct packet_io_options pkt_io_opts;
    struct snowflake_options snowflake_opts;
    struct ip_reassembly_options ip_reass_opts;
    struct session_manager_options sess_mgr_opts;
    struct schedule_options sched_opts;
};

int stellar_config_load(struct stellar_config *config, const char *file);
void stellar_config_print(const struct stellar_config *config);

#ifdef __cplusplus
}
#endif
