renamed struct lwip_socket to struct lwip_sock to avoid duplicate names (function lwip_socket)

This commit is contained in:
goldsimon 2010-03-06 10:21:03 +00:00
parent 5d4438e652
commit 957f4d8096

View File

@ -57,7 +57,7 @@
#define NUM_SOCKETS MEMP_NUM_NETCONN #define NUM_SOCKETS MEMP_NUM_NETCONN
/** Contains all internal pointers and states used for a socket */ /** Contains all internal pointers and states used for a socket */
struct lwip_socket { struct lwip_sock {
/** sockets currently are built on netconns, each socket has one netconn */ /** sockets currently are built on netconns, each socket has one netconn */
struct netconn *conn; struct netconn *conn;
/** data that was left from the previous read */ /** data that was left from the previous read */
@ -96,7 +96,7 @@ struct lwip_select_cb {
* functions running in tcpip_thread context (only a void* is allowed) */ * functions running in tcpip_thread context (only a void* is allowed) */
struct lwip_setgetsockopt_data { struct lwip_setgetsockopt_data {
/** socket struct for which to change options */ /** socket struct for which to change options */
struct lwip_socket *sock; struct lwip_sock *sock;
/** socket index for which to change options */ /** socket index for which to change options */
int s; int s;
/** level of the option to process */ /** level of the option to process */
@ -113,7 +113,7 @@ struct lwip_setgetsockopt_data {
}; };
/** The global array of available sockets */ /** The global array of available sockets */
static struct lwip_socket sockets[NUM_SOCKETS]; static struct lwip_sock sockets[NUM_SOCKETS];
/** The global list of tasks waiting for select */ /** The global list of tasks waiting for select */
static struct lwip_select_cb *select_cb_list; static struct lwip_select_cb *select_cb_list;
@ -182,12 +182,12 @@ lwip_socket_init(void)
* Map a externally used socket index to the internal socket representation. * Map a externally used socket index to the internal socket representation.
* *
* @param s externally used socket index * @param s externally used socket index
* @return struct lwip_socket for the socket or NULL if not found * @return struct lwip_sock for the socket or NULL if not found
*/ */
static struct lwip_socket * static struct lwip_sock *
get_socket(int s) get_socket(int s)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
if ((s < 0) || (s >= NUM_SOCKETS)) { if ((s < 0) || (s >= NUM_SOCKETS)) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s)); LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s));
@ -250,7 +250,7 @@ alloc_socket(struct netconn *newconn, int accepted)
* @param sock the socket to free * @param sock the socket to free
*/ */
static void static void
free_socket(struct lwip_socket *sock) free_socket(struct lwip_sock *sock)
{ {
struct netbuf *lastdata; struct netbuf *lastdata;
SYS_ARCH_DECL_PROTECT(lev); SYS_ARCH_DECL_PROTECT(lev);
@ -279,7 +279,7 @@ free_socket(struct lwip_socket *sock)
int int
lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen) lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{ {
struct lwip_socket *sock, *nsock; struct lwip_sock *sock, *nsock;
struct netconn *newconn; struct netconn *newconn;
ip_addr_t naddr; ip_addr_t naddr;
u16_t port; u16_t port;
@ -367,7 +367,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
int int
lwip_bind(int s, const struct sockaddr *name, socklen_t namelen) lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
ip_addr_t local_addr; ip_addr_t local_addr;
u16_t local_port; u16_t local_port;
err_t err; err_t err;
@ -403,7 +403,7 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
int int
lwip_close(int s) lwip_close(int s)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
@ -422,7 +422,7 @@ lwip_close(int s)
int int
lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
err_t err; err_t err;
sock = get_socket(s); sock = get_socket(s);
@ -472,7 +472,7 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
int int
lwip_listen(int s, int backlog) lwip_listen(int s, int backlog)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
err_t err; err_t err;
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog));
@ -500,7 +500,7 @@ int
lwip_recvfrom(int s, void *mem, size_t len, int flags, lwip_recvfrom(int s, void *mem, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen) struct sockaddr *from, socklen_t *fromlen)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
struct netbuf *buf; struct netbuf *buf;
u16_t buflen, copylen; u16_t buflen, copylen;
int off = 0; int off = 0;
@ -681,7 +681,7 @@ lwip_recv(int s, void *mem, size_t len, int flags)
int int
lwip_send(int s, const void *data, size_t size, int flags) lwip_send(int s, const void *data, size_t size, int flags)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
err_t err; err_t err;
u8_t write_flags; u8_t write_flags;
@ -723,7 +723,7 @@ int
lwip_sendto(int s, const void *data, size_t size, int flags, lwip_sendto(int s, const void *data, size_t size, int flags,
const struct sockaddr *to, socklen_t tolen) const struct sockaddr *to, socklen_t tolen)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
ip_addr_t remote_addr; ip_addr_t remote_addr;
err_t err; err_t err;
u16_t short_size; u16_t short_size;
@ -901,7 +901,7 @@ lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset)
{ {
int i, nready = 0; int i, nready = 0;
fd_set lreadset, lwriteset, lexceptset; fd_set lreadset, lwriteset, lexceptset;
struct lwip_socket *p_sock; struct lwip_sock *p_sock;
FD_ZERO(&lreadset); FD_ZERO(&lreadset);
FD_ZERO(&lwriteset); FD_ZERO(&lwriteset);
@ -1112,7 +1112,7 @@ static void
event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
{ {
int s; int s;
struct lwip_socket *sock; struct lwip_sock *sock;
struct lwip_select_cb *scb; struct lwip_select_cb *scb;
LWIP_UNUSED_ARG(len); LWIP_UNUSED_ARG(len);
@ -1220,7 +1220,7 @@ lwip_shutdown(int s, int how)
static int static int
lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local) lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
struct sockaddr_in sin; struct sockaddr_in sin;
ip_addr_t naddr; ip_addr_t naddr;
@ -1266,7 +1266,7 @@ int
lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
{ {
err_t err = ERR_OK; err_t err = ERR_OK;
struct lwip_socket *sock = get_socket(s); struct lwip_sock *sock = get_socket(s);
struct lwip_setgetsockopt_data data; struct lwip_setgetsockopt_data data;
if (!sock) if (!sock)
@ -1450,7 +1450,7 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
static void static void
lwip_getsockopt_internal(void *arg) lwip_getsockopt_internal(void *arg)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
#ifdef LWIP_DEBUG #ifdef LWIP_DEBUG
int s; int s;
#endif /* LWIP_DEBUG */ #endif /* LWIP_DEBUG */
@ -1630,7 +1630,7 @@ lwip_getsockopt_internal(void *arg)
int int
lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
{ {
struct lwip_socket *sock = get_socket(s); struct lwip_sock *sock = get_socket(s);
err_t err = ERR_OK; err_t err = ERR_OK;
struct lwip_setgetsockopt_data data; struct lwip_setgetsockopt_data data;
@ -1825,7 +1825,7 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
static void static void
lwip_setsockopt_internal(void *arg) lwip_setsockopt_internal(void *arg)
{ {
struct lwip_socket *sock; struct lwip_sock *sock;
#ifdef LWIP_DEBUG #ifdef LWIP_DEBUG
int s; int s;
#endif /* LWIP_DEBUG */ #endif /* LWIP_DEBUG */
@ -2008,7 +2008,7 @@ lwip_setsockopt_internal(void *arg)
int int
lwip_ioctl(int s, long cmd, void *argp) lwip_ioctl(int s, long cmd, void *argp)
{ {
struct lwip_socket *sock = get_socket(s); struct lwip_sock *sock = get_socket(s);
u16_t buflen = 0; u16_t buflen = 0;
s16_t recv_avail; s16_t recv_avail;
u8_t val; u8_t val;
@ -2065,7 +2065,7 @@ lwip_ioctl(int s, long cmd, void *argp)
int int
lwip_fcntl(int s, int cmd, int val) lwip_fcntl(int s, int cmd, int val)
{ {
struct lwip_socket *sock = get_socket(s); struct lwip_sock *sock = get_socket(s);
int ret = -1; int ret = -1;
if (!sock || !sock->conn) { if (!sock || !sock->conn) {