From 0376cddd6d418cdbf65d000c970d9ee1c1810e0e Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Thu, 5 Mar 2020 10:51:32 +0800 Subject: [PATCH] net: move the _SF*/_SS* definitions to net.h Build break caused by 23b8b397999136c61b3c834956ad1da55fb0e072 --- include/nuttx/net/net.h | 26 ++++++++++++++++++++++++++ net/socket/socket.h | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h index afc86c7ad0d..bff4d19a11e 100644 --- a/include/nuttx/net/net.h +++ b/include/nuttx/net/net.h @@ -109,6 +109,32 @@ #define SOCKCAP_NONBLOCKING (1 << 0) /* Bit 0: Socket supports non-blocking * operation. */ +/* Definitions of 8-bit socket flags */ + +#define _SF_CLOEXEC 0x04 /* Bit 2: Close on execute */ +#define _SF_NONBLOCK 0x08 /* Bit 3: Don't block if no data (TCP/READ only) */ +#define _SF_LISTENING 0x10 /* Bit 4: SOCK_STREAM is listening */ +#define _SF_BOUND 0x20 /* Bit 5: SOCK_STREAM is bound to an address */ + /* Bits 6-7: Connection state */ +#define _SF_CONNECTED 0x40 /* Bit 6: SOCK_STREAM/SOCK_DGRAM is connected */ +#define _SF_CLOSED 0x80 /* Bit 7: SOCK_STREAM was gracefully disconnected */ + +/* Connection state encoding: + * + * _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected + * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected + * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected + */ + +/* Macro to manage the socket state and flags */ + +#define _SS_ISCLOEXEC(s) (((s) & _SF_CLOEXEC) != 0) +#define _SS_ISNONBLOCK(s) (((s) & _SF_NONBLOCK) != 0) +#define _SS_ISLISTENING(s) (((s) & _SF_LISTENING) != 0) +#define _SS_ISBOUND(s) (((s) & _SF_BOUND) != 0) +#define _SS_ISCONNECTED(s) (((s) & _SF_CONNECTED) != 0) +#define _SS_ISCLOSED(s) (((s) & _SF_CLOSED) != 0) + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/net/socket/socket.h b/net/socket/socket.h index 5a3cfe3f886..0f809ac9ab9 100644 --- a/net/socket/socket.h +++ b/net/socket/socket.h @@ -55,32 +55,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Definitions of 8-bit socket flags */ - -#define _SF_CLOEXEC 0x04 /* Bit 2: Close on execute */ -#define _SF_NONBLOCK 0x08 /* Bit 3: Don't block if no data (TCP/READ only) */ -#define _SF_LISTENING 0x10 /* Bit 4: SOCK_STREAM is listening */ -#define _SF_BOUND 0x20 /* Bit 5: SOCK_STREAM is bound to an address */ - /* Bits 6-7: Connection state */ -#define _SF_CONNECTED 0x40 /* Bit 6: SOCK_STREAM/SOCK_DGRAM is connected */ -#define _SF_CLOSED 0x80 /* Bit 7: SOCK_STREAM was gracefully disconnected */ - -/* Connection state encoding: - * - * _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected - * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected - * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected - */ - -/* Macro to manage the socket state and flags */ - -#define _SS_ISCLOEXEC(s) (((s) & _SF_CLOEXEC) != 0) -#define _SS_ISNONBLOCK(s) (((s) & _SF_NONBLOCK) != 0) -#define _SS_ISLISTENING(s) (((s) & _SF_LISTENING) != 0) -#define _SS_ISBOUND(s) (((s) & _SF_BOUND) != 0) -#define _SS_ISCONNECTED(s) (((s) & _SF_CONNECTED) != 0) -#define _SS_ISCLOSED(s) (((s) & _SF_CLOSED) != 0) - /* This macro converts a socket option value into a bit setting */ #define _SO_BIT(o) (1 << (o))