#ifndef NET_ETH_LINUX_H
#define NET_ETH_LINUX_H
#ifdef LINUX

#include "type.h"
#include "platform.h"
#include "net_interface.h"

#ifdef __cplusplus
extern "C" {
#endif

// UDP
PlatformSocket net_udp_socket_create_linux(void);
bool_xxl net_udp_bind_linux(PlatformSocket sock, uint16_xxl port);
int32_xxl net_udp_sendto_linux(PlatformSocket sock, const char* ip, uint16_xxl port, const uint8_xxl* data, uint32_xxl len);
int32_xxl net_udp_recvfrom_linux(PlatformSocket sock, uint8_xxl* buf, uint32_xxl max_len, char* src_ip, uint16_xxl* src_port, uint32_xxl timeout_ms);

// TCP
PlatformSocket net_tcp_socket_create_linux(void);
bool_xxl net_tcp_connect_linux(PlatformSocket sock, const char* ip, uint16_xxl port);
int32_xxl net_tcp_send_linux(PlatformSocket sock, const uint8_xxl* data, uint32_xxl len);
int32_xxl net_tcp_recv_linux(PlatformSocket sock, uint8_xxl* buf, uint32_xxl max_len, uint32_xxl timeout_ms);

// Common
void net_socket_close_linux(PlatformSocket sock);
NetErr net_eth_linux_init(void);
void eth_set_mqtt_tcp_socket(PlatformSocket tcp_sock);
void eth_socket_set_init(void);
void eth_socket_set_add(int sock);

void eth_socket_set_remove(int sock);

#ifdef __cplusplus
}
#endif
#endif
#endif
