summaryrefslogtreecommitdiff
path: root/nuttx/net/net_internal.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-07-19 13:50:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-07-19 13:50:08 +0000
commit85f8218d49dfea1bea70633d38cede541143a1df (patch)
tree05dbb3d914eaf7434bd20987200ba57e3aafaa24 /nuttx/net/net_internal.h
parent17553d10657c2a395a2ab1f7d6629453fc5ed342 (diff)
downloadpx4-nuttx-85f8218d49dfea1bea70633d38cede541143a1df.tar.gz
px4-nuttx-85f8218d49dfea1bea70633d38cede541143a1df.tar.bz2
px4-nuttx-85f8218d49dfea1bea70633d38cede541143a1df.zip
Add non-blocking capability for TCP sockets
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1996 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/net_internal.h')
-rw-r--r--nuttx/net/net_internal.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/nuttx/net/net_internal.h b/nuttx/net/net_internal.h
index a403a269f..a4b1fe4dd 100644
--- a/nuttx/net/net_internal.h
+++ b/nuttx/net/net_internal.h
@@ -53,13 +53,14 @@
/* Definitions of 8-bit socket flags */
- /* Bits 0:2 : Socket state */
+ /* Bits 0-2: Socket state */
#define _SF_IDLE 0x00 /* There is no socket activity */
#define _SF_ACCEPT 0x01 /* Socket is waiting to accept a connection */
#define _SF_RECV 0x02 /* Waiting for recv action to complete */
#define _SF_SEND 0x03 /* Waiting for send action to complete */
#define _SF_MASK 0x03 /* Mask to isolate the above actions */
- /* Bits 3:4 : unused */
+ /* Bit 3: unused */
+#define _SF_NONBLOCK 0x10 /* Bit 4: Don't block if no data (TCP/READ only) */
#define _SF_LISTENING 0x20 /* Bit 5: SOCK_STREAM is listening */
#define _SF_BOUND 0x40 /* Bit 6: SOCK_STREAM is bound to an address */
#define _SF_CONNECTED 0x80 /* Bit 7: SOCK_STREAM is connected */
@@ -69,6 +70,8 @@
#define _SS_SETSTATE(s,f) (((s) & ~_SF_MASK) | (f))
#define _SS_GETSTATE(s) ((s) & _SF_MASK)
#define _SS_ISBUSY(s) (_SS_GETSTATE(s) != _SF_IDLE)
+
+#define _SS_ISNONBLOCK(s) (((s) & _SF_NONBLOCK) != 0)
#define _SS_ISLISTENING(s) (((s) & _SF_LISTENING) != 0)
#define _SS_ISBOUND(s) (((s) & _SF_CONNECTED) != 0)
#define _SS_ISCONNECTED(s) (((s) & _SF_CONNECTED) != 0)