[6319] | 1 | /** @file wlan_exp_ip_udp_socket_t.h |
---|
| 2 | * @brief Mango wlan_exp IP/UDP Library (Internal Structures / Functions) |
---|
| 3 | * |
---|
| 4 | * @copyright Copyright 2014-2019, Mango Communications. All rights reserved. |
---|
| 5 | * Distributed under the Mango Reference Design license (https://mangocomm.com/802.11/license) |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | /*************************** Constant Definitions ****************************/ |
---|
| 10 | #ifndef WLAN_EXP_IP_UDP_SOCKET_H |
---|
| 11 | #define WLAN_EXP_IP_UDP_SOCKET_H |
---|
| 12 | |
---|
| 13 | #include "wlan_mac_high_sw_config.h" |
---|
| 14 | |
---|
| 15 | #define WLAN_EXP_IP_UDP_NUM_SOCKETS 5 // Number of UDP sockets (global pool) |
---|
| 16 | |
---|
| 17 | // ********************************************************************** |
---|
| 18 | // Mango wlan_exp IP/UDP Library Socket Structures |
---|
| 19 | // |
---|
| 20 | typedef struct __attribute__((__packed__)) wlan_exp_ip_udp_socket_t{ |
---|
| 21 | u32 index; // Index into the array of sockets |
---|
| 22 | u32 state; // SOCKET_CLOSED, SOCKET_ALLOCATED, or SOCKET_OPEN |
---|
| 23 | |
---|
| 24 | // Necessary fields of struct sockaddr_in_t |
---|
| 25 | u16 sin_family; // Family of the socket (only used for data alignment) |
---|
| 26 | u16 sin_port; // Port of the socket |
---|
| 27 | u8 sin_addr[IP_ADDR_LEN]; // IP address of the socket |
---|
| 28 | } wlan_exp_ip_udp_socket_t; |
---|
| 29 | |
---|
| 30 | /*************************** Function Prototypes *****************************/ |
---|
| 31 | |
---|
| 32 | #if WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|
| 33 | void socket_init(); |
---|
| 34 | int socket_find_index_by_port(u16 port); |
---|
| 35 | int socket_alloc(int domain, int type, int protocol); |
---|
| 36 | int socket_bind_eth(int socket_index, u16 port); |
---|
| 37 | sockaddr_in_t socket_get(int socket_index); |
---|
| 38 | void socket_close(int socket_index); |
---|
| 39 | #endif //WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|
| 40 | #endif // WLAN_EXP_IP_UDP_SOCKET_H |
---|