/*
* @fileName remote_server.h
* @author gaoyang
* @date 2025-04-29 09:25
* @description 
*/
#ifndef _REMOTE_SERVER_H
#define _REMOTE_SERVER_H
#include <pthread.h>
#include <stdatomic.h>
#include <stdio.h>

typedef struct channel_t channel_t;

typedef struct tcp_trans_t
{
    channel_t* chan_pr; //
    pthread_t  server_tid;
    atomic_int state;

    char* local_ip;
    int   local_port;
    int   local_type;

    int    mode;
    int    sfd;
    int    epfd;
    int    port;
    time_t timeout;
    time_t last_recv;
    time_t keepalive;
    FILE*  log_fp;
} tcp_trans_t;

int tcp_server_task_start(tcp_trans_t* cfg);
int tcp_server_listen(tcp_trans_t* cfg);
int tcp_server_task_stop(tcp_trans_t* cfg);
int tcp_server_task_destroy(tcp_trans_t* cfg);

#endif
 