|
TuyaOS
|
Common process - Initialization 更多...


宏定义 | |
| #define | tuya_hal_net_accept(fd, addr, port) tal_net_accept(fd, addr, port) |
| Accept the coming socket connection of the server fd 更多... | |
| #define | tuya_hal_net_addr(ip) tal_net_str2addr(ip) |
| Get ip address by ip string 更多... | |
| #define | tuya_hal_net_addr2str(ipaddr) tal_net_addr2str(ipaddr) |
| Change ip address to string 更多... | |
| #define | tuya_hal_net_bind(fd, addr, port) tal_net_bind(fd, addr, port) |
| Bind to network 更多... | |
| #define | tuya_hal_net_close(fd) tal_net_close(fd) |
| Close file descriptors 更多... | |
| #define | tuya_hal_net_connect(fd, addr, port) tal_net_connect(fd, addr, port) |
| Connect to network 更多... | |
| #define | tuya_hal_net_connect_raw(fd, p_socket, len) tal_net_connect_raw(fd, p_socket, len) |
| Connect to network with raw data 更多... | |
| #define | tuya_hal_net_disable_nagle(fd) tal_net_disable_nagle(fd) |
| Disable nagle option of socket fd 更多... | |
| #define | tuya_hal_net_fd_clear(fd, fds) tal_net_fd_clear(fd, fds) |
| Clear file descriptor from set 更多... | |
| #define | tuya_hal_net_fd_isset(fd, fds) tal_net_fd_isset(fd, fds) |
| Check file descriptor is in set 更多... | |
| #define | tuya_hal_net_fd_set(fd, fds) tal_net_fd_set(fd, fds) |
| Add file descriptor to set 更多... | |
| #define | tuya_hal_net_fd_zero(fds) tal_net_fd_zero(fds) |
| Clear all file descriptor in set 更多... | |
| #define | tuya_hal_net_get_errno() tal_net_get_errno() |
| Get error code of network 更多... | |
| #define | tuya_hal_net_get_nonblock(fd) tal_net_get_nonblock(fd) |
| Get no block file descriptors 更多... | |
| #define | tuya_hal_net_get_socket_ip(fd, addr) tal_net_get_socket_ip(fd, addr) |
| Get ip address by socket fd 更多... | |
| #define | tuya_hal_net_gethostbyname(domain, addr) tal_net_gethostbyname(domain, addr) |
| Get address information by domain 更多... | |
| #define | tuya_hal_net_listen(fd, backlog) tal_net_listen(fd, backlog) |
| Listen to network 更多... | |
| #define | tuya_hal_net_recv(fd, buf, nbytes) tal_net_recv(fd, buf, nbytes) |
| Receive data from network 更多... | |
| #define | tuya_hal_net_recv_nd_size(fd, buf, buf_size, nd_size) tal_net_recv_nd_size(fd, buf, buf_size, nd_size) |
| Receive data from network with need size 更多... | |
| #define | tuya_hal_net_recvfrom(fd, buf, nbytes, addr, port) tal_net_recvfrom(fd, buf, nbytes, addr, port) |
| Receive data from specified server 更多... | |
| #define | tuya_hal_net_select(maxfd, readfds, writefds, errorfds, ms_timeout) tal_net_select(maxfd, readfds, writefds, errorfds, ms_timeout) |
| Get available file descriptors 更多... | |
| #define | tuya_hal_net_send(fd, buf, nbytes) tal_net_send(fd, buf, nbytes) |
| Send data to network 更多... | |
| #define | tuya_hal_net_send_to(fd, buf, nbytes, addr, port) tal_net_send_to(fd, buf, nbytes, addr, port) |
| Send data to specified server 更多... | |
| #define | tuya_hal_net_set_block(fd, block) tal_net_set_block(fd, block) |
| Set block flag for file descriptors 更多... | |
| #define | tuya_hal_net_set_boardcast(fd) tal_net_set_broadcast(fd) |
| Enable broadcast option of socket fd 更多... | |
| #define | tuya_hal_net_set_bufsize(fd, buf_size, type) tal_net_set_bufsize(fd, buf_size, type) |
| Set buffer_size option of socket fd 更多... | |
| #define | tuya_hal_net_set_keepalive(fd, alive, idle, intr, cnt) tal_net_set_keepalive(fd, alive, idle, intr, cnt) |
| Set keepalive option of socket fd to monitor the connection 更多... | |
| #define | tuya_hal_net_set_reuse(fd) tal_net_set_reuse(fd) |
| Enable reuse option of socket fd 更多... | |
| #define | tuya_hal_net_set_timeout(fd, ms_timeout, type) tal_net_set_timeout(fd, ms_timeout, type) |
| Set timeout option of socket fd 更多... | |
| #define | tuya_hal_net_socket_create(type) tal_net_socket_create(type) |
| Create a tcp/udp socket 更多... | |
| #define | tuya_hal_net_str2addr(ip_str) tal_net_str2addr(ip_str) |
| Change ip string to address 更多... | |
| #define | UNW_FD_CLR(n, p) TAL_FD_CLR(n, p) |
| #define | UNW_FD_ISSET(n, p) TAL_FD_ISSET(n,p) |
| #define | UNW_FD_SET(n, p) TAL_FD_SET(n, p) |
| #define | UNW_FD_ZERO(p) TAL_FD_ZERO(p) |
| #define | UNW_SHUT_RD 0 |
| #define | UNW_SHUT_RDWR 2 |
| #define | UNW_SHUT_WR 1 |
类型定义 | |
| typedef TUYA_FD_SET_T | UNW_FD_SET_T |
| typedef TUYA_IP_ADDR_T | UNW_IP_ADDR_T |
| typedef TUYA_PROTOCOL_TYPE_E | UNW_PROTOCOL_TYPE |
| typedef TUYA_TRANS_TYPE_E | UNW_TRANS_TYPE_E |
函数 | |
| int | tuya_hal_net_socket_bind (int fd, const char *ip) |
| Bind to network with specified ip 更多... | |
Common process - Initialization
| #define tuya_hal_net_accept | ( | fd, | |
| addr, | |||
| port | |||
| ) | tal_net_accept(fd, addr, port) |
Accept the coming socket connection of the server fd
| [in] | fd | file descriptor |
| [in] | addr | address information of server |
| [in] | port | port information of server |
| #define tuya_hal_net_addr | ( | ip | ) | tal_net_str2addr(ip) |
Get ip address by ip string
| [in] | ip | ip string |
| #define tuya_hal_net_addr2str | ( | ipaddr | ) | tal_net_addr2str(ipaddr) |
Change ip address to string
| [in] | ipaddr | ip address |
| #define tuya_hal_net_bind | ( | fd, | |
| addr, | |||
| port | |||
| ) | tal_net_bind(fd, addr, port) |
Bind to network
| [in] | fd | file descriptor |
| [in] | addr | address information of server |
| [in] | port | port information of server |
| #define tuya_hal_net_close | ( | fd | ) | tal_net_close(fd) |
Close file descriptors
| [in] | fd | file descriptor |
| #define tuya_hal_net_connect | ( | fd, | |
| addr, | |||
| port | |||
| ) | tal_net_connect(fd, addr, port) |
Connect to network
| [in] | fd | file descriptor |
| [in] | addr | address information of server |
| [in] | port | port information of server |
| #define tuya_hal_net_connect_raw | ( | fd, | |
| p_socket, | |||
| len | |||
| ) | tal_net_connect_raw(fd, p_socket, len) |
Connect to network with raw data
| [in] | fd | file descriptor |
| [in] | p_socket | raw socket data |
| [in] | len | data lenth |
| #define tuya_hal_net_disable_nagle | ( | fd | ) | tal_net_disable_nagle(fd) |
Disable nagle option of socket fd
| [in] | fd | file descriptor |
| #define tuya_hal_net_fd_clear | ( | fd, | |
| fds | |||
| ) | tal_net_fd_clear(fd, fds) |
Clear file descriptor from set
| [in] | fd | file descriptor |
| [in] | fds | set of file descriptor |
| #define tuya_hal_net_fd_isset | ( | fd, | |
| fds | |||
| ) | tal_net_fd_isset(fd, fds) |
Check file descriptor is in set
| [in] | fd | file descriptor |
| [in] | fds | set of file descriptor |
| #define tuya_hal_net_fd_set | ( | fd, | |
| fds | |||
| ) | tal_net_fd_set(fd, fds) |
Add file descriptor to set
| [in] | fd | file descriptor |
| [in] | fds | set of file descriptor |
| #define tuya_hal_net_fd_zero | ( | fds | ) | tal_net_fd_zero(fds) |
Clear all file descriptor in set
| [in] | fds | set of file descriptor |
| #define tuya_hal_net_get_errno | ( | ) | tal_net_get_errno() |
Get error code of network
| void |
| #define tuya_hal_net_get_nonblock | ( | fd | ) | tal_net_get_nonblock(fd) |
Get no block file descriptors
| [in] | fd | file descriptor |
| #define tuya_hal_net_get_socket_ip | ( | fd, | |
| addr | |||
| ) | tal_net_get_socket_ip(fd, addr) |
Get ip address by socket fd
| [in] | fd | file descriptor |
| [out] | addr | ip address |
| #define tuya_hal_net_gethostbyname | ( | domain, | |
| addr | |||
| ) | tal_net_gethostbyname(domain, addr) |
Get address information by domain
| [in] | domain | domain information |
| [in] | addr | address information |
| #define tuya_hal_net_listen | ( | fd, | |
| backlog | |||
| ) | tal_net_listen(fd, backlog) |
Listen to network
| [in] | fd | file descriptor |
| [in] | backlog | max count of backlog connection |
| #define tuya_hal_net_recv | ( | fd, | |
| buf, | |||
| nbytes | |||
| ) | tal_net_recv(fd, buf, nbytes) |
Receive data from network
| [in] | fd | file descriptor |
| [in] | buf | receive data buffer |
| [in] | nbytes | buffer lenth |
| #define tuya_hal_net_recv_nd_size | ( | fd, | |
| buf, | |||
| buf_size, | |||
| nd_size | |||
| ) | tal_net_recv_nd_size(fd, buf, buf_size, nd_size) |
Receive data from network with need size
| [in] | fd | file descriptor |
| [in] | buf | receive data buffer |
| [in] | nbytes | buffer lenth |
| [in] | nd_size | the need size |
| #define tuya_hal_net_recvfrom | ( | fd, | |
| buf, | |||
| nbytes, | |||
| addr, | |||
| port | |||
| ) | tal_net_recvfrom(fd, buf, nbytes, addr, port) |
Receive data from specified server
| [in] | fd | file descriptor |
| [in] | buf | receive data buffer |
| [in] | nbytes | buffer lenth |
| [in] | addr | address information of server |
| [in] | port | port information of server |
| #define tuya_hal_net_select | ( | maxfd, | |
| readfds, | |||
| writefds, | |||
| errorfds, | |||
| ms_timeout | |||
| ) | tal_net_select(maxfd, readfds, writefds, errorfds, ms_timeout) |
Get available file descriptors
| [in] | maxfd | max count of file descriptor |
| [out] | readfds | a set of readalbe file descriptor |
| [out] | writefds | a set of writable file descriptor |
| [out] | errorfds | a set of except file descriptor |
| [in] | ms_timeout | time out |
| #define tuya_hal_net_send | ( | fd, | |
| buf, | |||
| nbytes | |||
| ) | tal_net_send(fd, buf, nbytes) |
Send data to network
| [in] | fd | file descriptor |
| [in] | buf | send data buffer |
| [in] | nbytes | buffer lenth |
| #define tuya_hal_net_send_to | ( | fd, | |
| buf, | |||
| nbytes, | |||
| addr, | |||
| port | |||
| ) | tal_net_send_to(fd, buf, nbytes, addr, port) |
Send data to specified server
| [in] | fd | file descriptor |
| [in] | buf | send data buffer |
| [in] | nbytes | buffer lenth |
| [in] | addr | address information of server |
| [in] | port | port information of server |
| #define tuya_hal_net_set_block | ( | fd, | |
| block | |||
| ) | tal_net_set_block(fd, block) |
Set block flag for file descriptors
| [in] | fd | file descriptor |
| [in] | block | block flag |
| #define tuya_hal_net_set_boardcast | ( | fd | ) | tal_net_set_broadcast(fd) |
Enable broadcast option of socket fd
| [in] | fd | file descriptor |
| #define tuya_hal_net_set_bufsize | ( | fd, | |
| buf_size, | |||
| type | |||
| ) | tal_net_set_bufsize(fd, buf_size, type) |
Set buffer_size option of socket fd
| [in] | fd | file descriptor |
| [in] | buf_size | buffer size in byte |
| [in] | type | transfer type, receive or send |
| #define tuya_hal_net_set_keepalive | ( | fd, | |
| alive, | |||
| idle, | |||
| intr, | |||
| cnt | |||
| ) | tal_net_set_keepalive(fd, alive, idle, intr, cnt) |
Set keepalive option of socket fd to monitor the connection
| [in] | fd | file descriptor |
| [in] | alive | keepalive option, enable or disable option |
| [in] | idle | keep idle option, if the connection has no data exchange with the idle time(in seconds), start probe. |
| [in] | intr | keep interval option, the probe time interval. |
| [in] | cnt | keep count option, probe count. |
| #define tuya_hal_net_set_reuse | ( | fd | ) | tal_net_set_reuse(fd) |
Enable reuse option of socket fd
| [in] | fd | file descriptor |
| #define tuya_hal_net_set_timeout | ( | fd, | |
| ms_timeout, | |||
| type | |||
| ) | tal_net_set_timeout(fd, ms_timeout, type) |
Set timeout option of socket fd
| [in] | fd | file descriptor |
| [in] | ms_timeout | timeout in ms |
| [in] | type | transfer type, receive or send |
| #define tuya_hal_net_socket_create | ( | type | ) | tal_net_socket_create(type) |
Create a tcp/udp socket
| [in] | type | protocol type, tcp or udp |
| #define tuya_hal_net_str2addr | ( | ip_str | ) | tal_net_str2addr(ip_str) |
Change ip string to address
| [in] | ip_str | ip string |
| int tuya_hal_net_socket_bind | ( | int | fd, |
| const char * | ip | ||
| ) |
Bind to network with specified ip
| [in] | fd | file descriptor |
| [in] | ip | ip address |