blob: 8f90bed05bfca77a2ff8f9ba4464abaebe918d9d [file] [log] [blame]
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include "mbtk_log.h"
#include "mbtk_tcpip.h"
typedef struct {
int fd;
char ser_addr[256];
int ser_port;
char local_addr[256];
int local_port;
bool ack_support;
bool ssl_support;
bool ignore_cert;
uint32 heartbeat_time;
uint32 delay_time;
mbtk_tcpip_read_callback_func read_cb;
uint32 data_traffic_send;
uint32 data_traffic_recv;
} mbtk_tcpip_cli_info_t;
typedef struct {
int fd;
char ser_addr[256];
int ser_port;
int cli_num;
mbtk_tcpip_cli_info_t *cli_list;
} mbtk_tcpip_ser_info_t;
typedef struct {
int link_id;
int link_cid;
bool link_active;
mbtk_tcpip_prot_type_enum prot_type; // TCP/UDP
mbtk_tcpip_type_enum type;
union
{
mbtk_tcpip_cli_info_t cli_info;
mbtk_tcpip_ser_info_t ser_info;
} tcpip_info;
} mbtk_tcpip_link_t;
static mbtk_tcpip_link_t tcpip_link[MBTK_TCPIP_LINK_MAX];
mbtk_tcpip_err_enum mbtk_tcpip_net_open()
{
return MBTK_TCPIP_ERR_SUCCESS;
}
mbtk_tcpip_err_enum mbtk_tcpip_net_close()
{
return MBTK_TCPIP_ERR_SUCCESS;
}
mbtk_tcpip_err_enum mbtk_tcpip_sock_open(const mbtk_tcpip_info_t *tcpip_info)
{
return MBTK_TCPIP_ERR_SUCCESS;
}
mbtk_tcpip_err_enum mbtk_tcpip_sock_close(int link_id)
{
return MBTK_TCPIP_ERR_SUCCESS;
}
int mbtk_tcpip_send(int link_id, const char* data, int data_len, const char* ser_addr, int ser_port)
{
return 0;
}
int mbtk_tcpip_read(int link_id, char* buff, int buff_size)
{
return 0;
}
/*
* Get the data traffic of the specified link.
*/
int mbtk_tcpip_data_traffic_get(int link_id)
{
return 0;
}
/*
* Reset the data traffic of the specified link.
*/
mbtk_tcpip_err_enum mbtk_tcpip_data_traffic_reset(int link_id)
{
return MBTK_TCPIP_ERR_SUCCESS;
}
/*
* Return 0 if disconnected, other for connected.
*/
int mbtk_tcpip_link_state_get(int link_id)
{
return 0;
}