/** @file wlan_exp_ip_udp_socket_t.h * @brief Mango wlan_exp IP/UDP Library (Internal Structures / Functions) * * @copyright Copyright 2014-2019, Mango Communications. All rights reserved. * Distributed under the Mango Reference Design license (https://mangocomm.com/802.11/license) */ /*************************** Constant Definitions ****************************/ #ifndef WLAN_EXP_IP_UDP_SOCKET_H #define WLAN_EXP_IP_UDP_SOCKET_H #include "wlan_mac_high_sw_config.h" #define WLAN_EXP_IP_UDP_NUM_SOCKETS 5 // Number of UDP sockets (global pool) // ********************************************************************** // Mango wlan_exp IP/UDP Library Socket Structures // typedef struct __attribute__((__packed__)) wlan_exp_ip_udp_socket_t{ u32 index; // Index into the array of sockets u32 state; // SOCKET_CLOSED, SOCKET_ALLOCATED, or SOCKET_OPEN // Necessary fields of struct sockaddr_in_t u16 sin_family; // Family of the socket (only used for data alignment) u16 sin_port; // Port of the socket u8 sin_addr[IP_ADDR_LEN]; // IP address of the socket } wlan_exp_ip_udp_socket_t; /*************************** Function Prototypes *****************************/ #if WLAN_SW_CONFIG_ENABLE_WLAN_EXP void socket_init(); int socket_find_index_by_port(u16 port); int socket_alloc(int domain, int type, int protocol); int socket_bind_eth(int socket_index, u16 port); sockaddr_in_t socket_get(int socket_index); void socket_close(int socket_index); #endif //WLAN_SW_CONFIG_ENABLE_WLAN_EXP #endif // WLAN_EXP_IP_UDP_SOCKET_H