From: Adam D. <ada...@us...> - 2005-02-27 09:44:42
|
Update of /cvsroot/contiki/contiki/uip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27574 Modified Files: uip.c uip.h tcpip.c Log Message: Added uIP call for polling an application without triggering any timer events. Removed redundant assignments of uip_len and uip_slen. Index: tcpip.c =================================================================== RCS file: /cvsroot/contiki/contiki/uip/tcpip.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcpip.c 22 Feb 2005 22:34:46 -0000 1.5 --- tcpip.c 27 Feb 2005 09:44:33 -0000 1.6 *************** *** 307,311 **** case TCP_POLL: if(data != NULL) { ! uip_periodic_conn(data); if(uip_len > 0) { tcpip_output(); --- 307,311 ---- case TCP_POLL: if(data != NULL) { ! uip_poll_conn(data); if(uip_len > 0) { tcpip_output(); Index: uip.h =================================================================== RCS file: /cvsroot/contiki/contiki/uip/uip.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** uip.h 23 Feb 2005 22:40:40 -0000 1.16 --- uip.h 27 Feb 2005 09:44:33 -0000 1.17 *************** *** 268,272 **** /** ! * Periodic processing for a connection identified by a pointer to its structure. * * Same as uip_periodic() but takes a pointer to the actual uip_conn --- 268,273 ---- /** ! * Perform eriodic processing for a connection identified by a pointer ! * to its structure. * * Same as uip_periodic() but takes a pointer to the actual uip_conn *************** *** 282,285 **** --- 283,301 ---- uip_process(UIP_TIMER); } while (0) + /** + * Reuqest that a particular connection should be polled. + * + * Similar to uip_periodic_conn() but does not perform any timer + * processing. The application is polled for new data. + * + * \param conn A pointer to the uip_conn struct for the connection to + * be processed. + * + * \hideinitializer + */ + #define uip_poll_conn(conn) do { uip_conn = conn; \ + uip_process(UIP_POLL_REQUEST); } while (0) + + #if UIP_UDP /** *************** *** 1207,1220 **** uip_process() is called. It can be called either because we have incoming data that should be processed, or because the periodic ! timer has fired. */ ! ! #define UIP_DATA 1 /* Tells uIP that there is incoming data in ! the uip_buf buffer. The length of the ! data is stored in the global variable ! uip_len. */ ! #define UIP_TIMER 2 /* Tells uIP that the periodic timer has ! fired. */ #if UIP_UDP ! #define UIP_UDP_TIMER 3 #endif /* UIP_UDP */ --- 1223,1239 ---- uip_process() is called. It can be called either because we have incoming data that should be processed, or because the periodic ! timer has fired. These values are never used directly, but only in ! the macrose defined in this file. */ ! ! #define UIP_DATA 1 /* Tells uIP that there is incoming ! data in the uip_buf buffer. The ! length of the data is stored in the ! global variable uip_len. */ ! #define UIP_TIMER 2 /* Tells uIP that the periodic timer ! has fired. */ ! #define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should ! be polled. */ #if UIP_UDP ! #define UIP_UDP_TIMER 4 #endif /* UIP_UDP */ Index: uip.c =================================================================== RCS file: /cvsroot/contiki/contiki/uip/uip.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** uip.c 23 Feb 2005 17:30:27 -0000 1.21 --- uip.c 27 Feb 2005 09:44:33 -0000 1.22 *************** *** 108,114 **** incoming packets. */ #endif /* UIP_CONF_EXTERNAL_BUFFER */ u8_t *uip_appdata; /* The uip_appdata pointer points to application data. */ - u8_t *uip_sappdata; /* The uip_appdata pointer points to the application data which is to --- 108,114 ---- incoming packets. */ #endif /* UIP_CONF_EXTERNAL_BUFFER */ + u8_t *uip_appdata; /* The uip_appdata pointer points to application data. */ u8_t *uip_sappdata; /* The uip_appdata pointer points to the application data which is to *************** *** 121,132 **** #endif /* UIP_URGDATA > 0 */ ! u16_t uip_len, uip_slen; /* The uip_len is either 8 or 16 bits, depending on the maximum packet size. */ ! u8_t uip_flags; /* The uip_flags variable is used for communication between the TCP/IP stack and the application program. */ - struct uip_conn *uip_conn; /* uip_conn always points to the current connection. */ --- 121,132 ---- #endif /* UIP_URGDATA > 0 */ ! u16_t uip_len, uip_slen; ! /* The uip_len is either 8 or 16 bits, depending on the maximum packet size. */ ! u8_t uip_flags; /* The uip_flags variable is used for communication between the TCP/IP stack and the application program. */ struct uip_conn *uip_conn; /* uip_conn always points to the current connection. */ *************** *** 149,152 **** --- 149,153 ---- static u8_t iss[4]; /* The iss variable is used for the TCP initial sequence number. */ + #if UIP_ACTIVE_OPEN static u16_t lastport; /* Keeps track of the last port used for *************** *** 177,180 **** --- 178,182 ---- #define ICMP_ECHO 8 + /* Macros. */ #define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) *************** *** 183,186 **** --- 185,189 ---- #define UDPBUF ((uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN]) + #if UIP_STATISTICS == 1 struct uip_stats uip_stat; *************** *** 505,511 **** uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; ! ! /* Check if we were invoked because of the perodic timer fireing. */ ! if(flag == UIP_TIMER) { #if UIP_REASSEMBLY if(uip_reasstmr != 0) { --- 508,523 ---- uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; ! ! /* Check if we were invoked because of a poll request for a ! particular connection. */ ! if(flag == UIP_POLL_REQUEST) { ! if((uip_connr->tcpstateflags & TS_MASK) == ESTABLISHED && ! !uip_outstanding(uip_connr)) { ! uip_flags = UIP_POLL; ! UIP_APPCALL(); ! goto appsend; ! } ! /* Check if we were invoked because of the perodic timer fireing. */ ! } else if(flag == UIP_TIMER) { #if UIP_REASSEMBLY if(uip_reasstmr != 0) { *************** *** 522,525 **** --- 534,538 ---- } uip_len = 0; + uip_slen = 0; if(uip_connr->tcpstateflags == TIME_WAIT || uip_connr->tcpstateflags == FIN_WAIT_2) { *************** *** 582,587 **** the code for sending out the packet (the apprexmit label). */ - uip_len = 0; - uip_slen = 0; uip_flags = UIP_REXMIT; UIP_APPCALL(); --- 595,598 ---- *************** *** 599,604 **** /* If there was no need for a retransmission, we poll the application for new data. */ - uip_len = 0; - uip_slen = 0; uip_flags = UIP_POLL; UIP_APPCALL(); --- 610,613 ---- |