diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-09-01 13:59:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-09-01 13:59:54 +0000 |
commit | 17edc87d5eadbdcd81add3cd4ff8941fee253e14 (patch) | |
tree | c55719a909501c0098b9f96ec08e40cb2fe97729 /nuttx/include/net/uip/uip-tcp.h | |
parent | 50041ff73393316f3c4da440844279d49136a9a2 (diff) | |
download | px4-nuttx-17edc87d5eadbdcd81add3cd4ff8941fee253e14.tar.gz px4-nuttx-17edc87d5eadbdcd81add3cd4ff8941fee253e14.tar.bz2 px4-nuttx-17edc87d5eadbdcd81add3cd4ff8941fee253e14.zip |
Add uIP support more multi-threaded socket access
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@858 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include/net/uip/uip-tcp.h')
-rw-r--r-- | nuttx/include/net/uip/uip-tcp.h | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/nuttx/include/net/uip/uip-tcp.h b/nuttx/include/net/uip/uip-tcp.h index 789a5b479..0fa12880c 100644 --- a/nuttx/include/net/uip/uip-tcp.h +++ b/nuttx/include/net/uip/uip-tcp.h @@ -95,6 +95,7 @@ */ struct uip_driver_s; /* Forward reference */ +struct uip_callback_s; /* Forward reference */ struct uip_conn { dq_entry_t node; /* Implements a doubly linked list */ @@ -121,9 +122,6 @@ struct uip_conn uint8 timer; /* The retransmission timer (units: half-seconds) */ uint8 nrtx; /* The number of retransmissions for the last * segment sent */ - uint8 data_flags; /* Flags that will be handled by the data_event() - * callback function (see data_event() discussion below). - */ /* Read-ahead buffering */ @@ -131,37 +129,41 @@ struct uip_conn sq_queue_t readahead; #endif - /* Higher level logic can retain application specific information - * in the following: + /* Application callbacks: * - * data_event() is called on all events. Normally, the input flags are - * returned, however, the implemenation may set one of the following: + * Data transfer events are retained in 'list'. Event handlers in 'list' + * are called for events specified in the flags set within struct + * uip_callback_s * - * UIP_CLOSE - Gracefully close the current connection - * UIP_ABORT - Abort (reset) the current connection on an error that - * prevents UIP_CLOSE from working. + * When an callback is executed from 'list', the input flags are normally + * returned, however, the implementation may set one of the following: * - * Or clear the following: + * UIP_CLOSE - Gracefully close the current connection + * UIP_ABORT - Abort (reset) the current connection on an error that + * prevents UIP_CLOSE from working. * - * UIP_NEWDATA - May be cleared to suppress returning the ACK response. - * (dev->d_len should also be set to zero in this case). + * And/Or set/clear the following: * - * - * The provider of the data_event callback must also set data_flags. This - * will inform the uIP layer which flags are and are not handled by the - * callback. - * accept() is called when the TCP logic has created a connection - * connection_event() is called on any of the subset of connection-related events + * UIP_NEWDATA - May be cleared to indicate that the data was consumed + * and that no further process of the new data should be + * attempted. + * UIP_SNDACK - If UIP_NEWDATA is cleared, then UIP_SNDACK may be set + * to indicate that an ACK should be included in the response. + * (In UIP_NEWDATA is cleared bu UIP_SNDACK is not set, then + * dev->d_len should also be cleared). */ - void *data_private; - uint8 (*data_event)(struct uip_driver_s *dev, struct uip_conn *conn, uint8 flags); + struct uip_callback_s *list; + + /* accept() is called when the TCP logic has created a connection */ void *accept_private; int (*accept)(struct uip_conn *listener, struct uip_conn *conn); + /* connection_event() is called on any of the subset of connection-related events */ + void *connection_private; - void (*connection_event)(struct uip_conn *conn, uint8 flags); + void (*connection_event)(struct uip_conn *conn, uint16 flags); }; /* The following structure is used to handle read-ahead buffering for TCP @@ -267,6 +269,11 @@ struct uip_tcpip_hdr extern struct uip_conn *uip_tcpalloc(void); +/* Allocate a new TCP data callback */ + +#define uip_tcpcallbackalloc(conn) uip_callbackalloc(&conn->list) +#define uip_tcpcallbackfree(conn,cb) uip_callbackfree(cb, &conn->list) + /* Free a connection structure that is no longer in use. This should * be done by the implementation of close() */ |