/* * Copyright (c) 2001, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <adam@sics.se> * * $Id: sockets.h 79 2016-01-11 16:21:27Z reddawg $ */ #ifndef __LWIP_SOCKETS_H__ #define __LWIP_SOCKETS_H__ #include <sys/types.h> struct in_addr { uInt32 s_addr; }; struct sockaddr_in { uInt8 sin_len; uInt8 sin_family; uInt16 sin_port; struct in_addr sin_addr; char sin_zero[8]; }; struct sockaddr { uInt8 sa_len; uInt8 sa_family; char sa_data[14]; }; #define SOCK_STREAM 1 #define SOCK_DGRAM 2 #define AF_INET 2 #define PF_INET AF_INET #define IPPROTO_TCP 6 #define IPPROTO_UDP 17 #define INADDR_ANY 0 #define INADDR_BROADCAST 0xffffffff int lwip_accept(int s, struct sockaddr *addr, int *addrlen); int lwip_bind(int s, struct sockaddr *name, int namelen); int lwip_close(int s); int lwip_connect(int s, struct sockaddr *name, int namelen); int lwip_listen(int s, int backlog); int lwip_recv(int s, void *mem, int len, unsigned int flags); int lwip_read(int s, void *mem, int len); int lwip_recvfrom(int s, void *mem, int len, unsigned int flags, struct sockaddr *from, int *fromlen); int lwip_send(int s, void *dataptr, int size, unsigned int flags); int lwip_sendto(int s, void *dataptr, int size, unsigned int flags, struct sockaddr *to, int tolen); int lwip_socket(int domain, int type, int protocol); int lwip_write(int s, void *dataptr, int size); #ifdef LWIP_COMPAT_SOCKETS #define accept(a,b,c) lwip_accept(a,b,c) #define bind(a,b,c) lwip_bind(a,b,c) #define close(s) lwip_close(s) #define connect(a,b,c) lwip_connect(a,b,c) #define listen(a,b) lwip_listen(a,b) #define recv(a,b,c,d) lwip_recv(a,b,c,d) #define read(a,b,c) lwip_read(a,b,c) #define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f) #define send(a,b,c,d) lwip_send(a,b,c,d) #define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f) #define socket(a,b,c) lwip_socket(a,b,c) #define write(a,b,c) lwip_write(a,b,c) #endif /* LWIP_NO_COMPAT_SOCKETS */ #endif /* __LWIP_SOCKETS_H__ */