This commit is contained in:
pvvx 2017-04-22 16:44:33 +03:00
parent cf7a2d9683
commit f7b901aa27
76 changed files with 3753 additions and 3990 deletions

View file

@ -41,22 +41,22 @@
#ifdef LWIP_DEBUG
static const char *err_strerr[] = {
"Ok.", /* ERR_OK 0 */
"Out of memory error.", /* ERR_MEM -1 */
"Buffer error.", /* ERR_BUF -2 */
"Timeout.", /* ERR_TIMEOUT -3 */
"Routing problem.", /* ERR_RTE -4 */
"Operation in progress.", /* ERR_INPROGRESS -5 */
"Illegal value.", /* ERR_VAL -6 */
"Operation would block.", /* ERR_WOULDBLOCK -7 */
"Address in use.", /* ERR_USE -8 */
"Already connected.", /* ERR_ISCONN -9 */
"Connection aborted.", /* ERR_ABRT -10 */
"Connection reset.", /* ERR_RST -11 */
"Connection closed.", /* ERR_CLSD -12 */
"Not connected.", /* ERR_CONN -13 */
"Illegal argument.", /* ERR_ARG -14 */
"Low-level netif error.", /* ERR_IF -15 */
"Ok", /* ERR_OK 0 */
"Out of memory error", /* ERR_MEM -1 */
"Buffer error", /* ERR_BUF -2 */
"Timeout", /* ERR_TIMEOUT -3 */
"Routing problem", /* ERR_RTE -4 */
"Operation in progress", /* ERR_INPROGRESS -5 */
"Illegal value", /* ERR_VAL -6 */
"Operation would block", /* ERR_WOULDBLOCK -7 */
"Address in use", /* ERR_USE -8 */
"Already connected", /* ERR_ISCONN -9 */
"Connection aborted", /* ERR_ABRT -10 */
"Connection reset", /* ERR_RST -11 */
"Connection closed", /* ERR_CLSD -12 */
"Not connected", /* ERR_CONN -13 */
"Illegal argument", /* ERR_ARG -14 */
"Low-level netif error", /* ERR_IF -15 */
};
/**

View file

@ -184,7 +184,6 @@ void
lwip_socket_init(void)
{
}
/**
* Map a externally used socket index to the internal socket representation.
*
@ -213,6 +212,14 @@ get_socket(int s)
return sock;
}
/*
* pvvx: errno
*/
int lwip_last_err_socket(int s) {
struct lwip_sock * sc = get_socket(s);
if(sc) return sc->err;
else return EBADF;
}
/**
* Same as get_socket but doesn't set errno
*

View file

@ -342,6 +342,8 @@ int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptse
int lwip_ioctl(int s, long cmd, void *argp);
int lwip_fcntl(int s, int cmd, int val);
int lwip_last_err_socket(int s); // errno
#if LWIP_COMPAT_SOCKETS
#define accept(a,b,c) lwip_accept(a,b,c)
#define bind(a,b,c) lwip_bind(a,b,c)
@ -361,6 +363,7 @@ int lwip_fcntl(int s, int cmd, int val);
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
#if LWIP_POSIX_SOCKETS_IO_NAMES
#define read(a,b,c) lwip_read(a,b,c)
#define write(a,b,c) lwip_write(a,b,c)

View file

@ -163,13 +163,12 @@ PACK_STRUCT_END
# include "arch/epstruct.h"
#endif
LOCAL char toupper(char ch) {
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
}
//#define toupper(CH) \
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
/** NetBIOS decoding name */
LOCAL int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
{
uint8_t i, j;
char c;
@ -218,7 +217,7 @@ static void NBNS_encode(char *dst, char *src, uint8_t type)
#endif
/** NetBIOS Name service recv callback */
LOCAL void NETBIOS_CODE_ATTR
static void NETBIOS_CODE_ATTR
netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
u16_t port) {
LWIP_UNUSED_ARG(arg);
@ -227,7 +226,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
uint32 ip = current_netif->ip_addr.addr;
char *curbiosname = netbios_name[current_netif->num];
if (curbiosname[0] != '\0' && ip != 0
if (curbiosname[0] != '\0' && ip != NULL
/* we only answer if we got a default interface */
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
#if DEBUGSOO > 3
@ -309,7 +308,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
}
}
LOCAL struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
struct udp_pcb *pcb;
for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
if (pcb->local_port == NETBIOS_PORT)

View file

@ -8,7 +8,6 @@
/****************Define if using the polarssl*******************/
#define USING_SSL
/******************Define the function used*********************/
#ifdef USING_SSL
int wss_set_fun_ops(wsclient_context *wsclient);
@ -19,9 +18,6 @@ int ws_set_fun_ops(wsclient_context *wsclient);
#endif
/***************************************************************/
/*************************************************************************************************
** Function Name : create_wsclient
** Description : Creating the websocket client context structure
@ -31,7 +27,7 @@ int ws_set_fun_ops(wsclient_context *wsclient);
** Return : Created: websocket client context structure
** Failed: NULL
**************************************************************************************************/
wsclient_context *create_wsclient(char *url, int port,char *path, char* origin);
wsclient_context *create_wsclient(char *url, int port, char *path, char* origin);
/*************************************************************************************************
** Function Name : ws_connect_url
@ -105,4 +101,4 @@ readyStateValues ws_getReadyState(wsclient_context *wsclient);
**************************************************************************************************/
void ws_close(wsclient_context *wsclient);
#endif
#endif