Commit in reactos/drivers/lib/oskittcp on MAIN
include/oskittcp.h+8-31.2 -> 1.3
oskittcp/interface.c+10-231.2 -> 1.3
        /sleep.c+12-81.2 -> 1.3
        /tcp_input.c+9-71.2 -> 1.3
        /tcp_usrreq.c-21.1 -> 1.2
        /uipc_socket.c+3-11.2 -> 1.3
        /uipc_socket2.c+21.2 -> 1.3
+44-44
7 modified files
Fixed OskitTCPSend prototype.
sleep: removed blocking.  not needed anymore.
Made socket non-blocking with respect to oskit.
removed unneeded panic in sbflush.
removed unneeded stats keeping.  This info is better kept by tcpip.sys

reactos/drivers/lib/oskittcp/include
oskittcp.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- oskittcp.h	9 Jun 2004 18:11:36 -0000	1.2
+++ oskittcp.h	8 Jul 2004 06:39:29 -0000	1.3
@@ -50,12 +50,12 @@
 #define SEL_ERROR   256
 #define SEL_FINOUT  512
 
-typedef void (*OSKITTCP_SOCKET_STATE)
+typedef int (*OSKITTCP_SOCKET_STATE)
     ( void *ClientData,
       void *WhichSocket,
       void *WhichConnection,
-      OSK_UINT SelFlags,
-      OSK_UINT SocketState );
+      OSK_UINT NewState );
+
 typedef int (*OSKITTCP_SEND_PACKET)
     ( void *ClientData,
       void *WhichSocket,
@@ -86,6 +86,11 @@
 			    OSK_UINT Len,
 			    OSK_UINT *OutLen,
 			    OSK_UINT Flags );
+extern int OskitTCPSend( void *socket, 
+			 OSK_PCHAR Data,
+			 OSK_UINT Len,
+			 OSK_UINT *OutLen,
+			 OSK_UINT Flags );
 #undef errno
 
 #define malloc(x,...) fbsd_malloc(x,__FILE__,__LINE__)

reactos/drivers/lib/oskittcp/oskittcp
interface.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- interface.c	9 Jun 2004 18:11:37 -0000	1.2
+++ interface.c	8 Jul 2004 06:39:30 -0000	1.3
@@ -1,3 +1,4 @@
+
 #include <oskittcp.h>
 #include <oskitdebug.h>
 #include <ntddk.h>
@@ -79,13 +80,13 @@
     int error = socreate(domain, &so, type, proto);
     if( !error ) {
 	so->so_connection = context;
+	so->so_state = SS_NBIO;
 	*aso = so;
     }
     return error;
 }
 
 int OskitTCPRecv( void *connection,
-		  void *Addr,
 		  OSK_PCHAR Data,
 		  OSK_UINT Len,
 		  OSK_UINT *OutLen,
@@ -118,9 +119,6 @@
 	OskitDumpBuffer( m.m_data, uio.uio_resid );
     }
 
-    if( paddr )
-	memcpy( Addr, paddr, min(sizeof(struct sockaddr),paddr->m_len) );
-
     *OutLen = uio.uio_resid;
     return error;
 }
@@ -186,22 +184,6 @@
 	goto done;
     }
 
-    s = splnet();
-
-    while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
-	error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH,
-		       "connect", 0);
-	if (error)
-	    break;
-    }
-
-    if (error == 0) {
-	error = so->so_error;
-	so->so_error = 0;
-    }
-
-    splx(s);
-
 bad:
     so->so_state &= ~SS_ISCONNECTING;
 
@@ -219,12 +201,17 @@
     soclose( so );
 }
 
-DWORD OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len, int flags ) {
-    OskitDumpBuffer( Data, Len );
+int OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len, 
+		  OSK_UINT *OutLen, OSK_UINT flags ) {
     struct mbuf mb;
+    struct uio uio = { 0 };
+    int error = 0;
+    OskitDumpBuffer( Data, Len );
     mb.m_data = Data;
     mb.m_len  = Len;
-    return sosend( socket, NULL, NULL, (struct mbuf *)&mb, NULL, 0 );
+    error = sosend( socket, NULL, &uio, (struct mbuf *)&mb, NULL, 0 );
+    *OutLen = uio.uio_resid;
+    return error;
 }
 
 void *OskitTCPAccept( void *socket, 

reactos/drivers/lib/oskittcp/oskittcp
sleep.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- sleep.c	9 Jun 2004 18:11:37 -0000	1.2
+++ sleep.c	8 Jul 2004 06:39:30 -0000	1.3
@@ -64,25 +64,29 @@
     KEVENT Event;
     PLIST_ENTRY Entry;
     PSLEEPING_THREAD SleepingThread;
+    UINT flags = 0;
 
     OS_DbgPrint
 	(OSK_MID_TRACE,("XXX Bytes to receive: %d\n", so->so_rcv.sb_cc));
 
-    if( so->so_rcv.sb_cc && si )
-	si->si_flags |= SEL_READ;
+    if( so->so_state & SS_ISCONNECTED ) {
+	OS_DbgPrint(OSK_MID_TRACE,("Socket connected!\n"));
+	flags |= SEL_CONNECT;
+    }
+    if( so->so_rcv.sb_cc && si ) {
+	OS_DbgPrint(OSK_MID_TRACE,("Socket readable\n"));
+	flags |= SEL_READ;
+    }
 
     OS_DbgPrint(OSK_MID_TRACE,("Wakeup %x (socket %x, si_flags %x, state %x)!\n",
 			       token, so, si ? si->si_flags : 0,
 			       so->so_state));
 
-    if( OtcpEvent.SocketState ) {
-	OS_DbgPrint(OSK_MID_TRACE,("Calling client's socket state fn\n"));
+    if( OtcpEvent.SocketState ) 
 	OtcpEvent.SocketState( OtcpEvent.ClientData,
 			       so,
-			       so->so_connection,
-			       si ? si->si_flags : 0,
-			       so->so_state );
-    }
+			       so ? so->so_connection : 0,
+			       flags );
 
     ExAcquireFastMutex( &SleepingThreadsLock );
     Entry = SleepingThreadsList.Flink;

reactos/drivers/lib/oskittcp/oskittcp
tcp_input.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- tcp_input.c	9 Jun 2004 18:11:37 -0000	1.2
+++ tcp_input.c	8 Jul 2004 06:39:30 -0000	1.3
@@ -121,10 +121,11 @@
 	 * Find a segment which begins after this one does.
 	 */
 	for (q = tp->seg_next; q != (struct tcpiphdr *)tp;
-	    q = (struct tcpiphdr *)q->ti_next)
-		if (SEQ_GT(q->ti_seq, ti->ti_seq))
-			break;
-
+	     q = (struct tcpiphdr *)q->ti_next) { 
+	    printf("Finding segment: %x\n", q);
+	    if (SEQ_GT(q->ti_seq, ti->ti_seq))
+		break;
+	}
 	/*
 	 * If there is a preceding segment, it may provide some of
 	 * our data already.  If so, drop the data from the incoming
@@ -760,7 +761,7 @@
 			 */
 			tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
 			tcpstat.tcps_connects++;
-			soisconnected(so);
+			//soisconnected(so);
 			tp->t_timer[TCPT_KEEP] = tcp_keepinit;
 			dropsocket = 0;		/* committed to socket */
 			tcpstat.tcps_accepts++;
@@ -853,7 +854,7 @@
 					goto dropwithreset;
 			}
 			tcpstat.tcps_connects++;
-			soisconnected(so);
+			//soisconnected(so);
 			/* Do window scaling on this connection? */
 			if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
 				(TF_RCVD_SCALE|TF_REQ_SCALE)) {
@@ -890,6 +891,7 @@
 				 ("Socket %x entered ESTABLISHED state\n",
 				  so));
 			    tp->t_state = TCPS_ESTABLISHED;
+			    soisconnected(so);
 			    tp->t_timer[TCPT_KEEP] = tcp_keepidle;
 			    socwakeup(so);
 			}
@@ -1220,7 +1222,7 @@
 			goto dropwithreset;
 
 		tcpstat.tcps_connects++;
-		soisconnected(so);
+		//soisconnected(so);
 		/* Do window scaling? */
 		if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
 			(TF_RCVD_SCALE|TF_REQ_SCALE)) {

reactos/drivers/lib/oskittcp/oskittcp
tcp_usrreq.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- tcp_usrreq.c	29 May 2004 00:15:46 -0000	1.1
+++ tcp_usrreq.c	8 Jul 2004 06:39:30 -0000	1.2
@@ -452,7 +452,6 @@
     
     in_pcbrehash(inp);
     
-    
     tp->t_template = tcp_template(tp);
     
     if (tp->t_template == 0) {
@@ -478,7 +477,6 @@
     
     tcp_sendseqinit(tp);
     
-    
     /*
      * Generate a CC value for this connection and
      * check whether CC or CCnew should be used.

reactos/drivers/lib/oskittcp/oskittcp
uipc_socket.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- uipc_socket.c	9 Jun 2004 18:11:37 -0000	1.2
+++ uipc_socket.c	8 Jul 2004 06:39:30 -0000	1.3
@@ -74,6 +74,8 @@
 	register struct socket *so;
 	register int error;
 
+	printf("socreate(%d,%x,%d,%d)\n", dom, aso, type, proto);
+
 	if (proto)
 		prp = pffindproto(dom, proto, type);
 	else
@@ -352,7 +354,7 @@
 	dontroute =
 	    (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 &&
 	    (so->so_proto->pr_flags & PR_ATOMIC);
-	p->p_stats->p_ru.ru_msgsnd++;
+	/* p->p_stats->p_ru.ru_msgsnd++; */
 	if (control)
 		clen = control->m_len;
 #define	snderr(errno)	{ error = errno; splx(s); goto release; }

reactos/drivers/lib/oskittcp/oskittcp
uipc_socket2.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- uipc_socket2.c	9 Jun 2004 18:11:37 -0000	1.2
+++ uipc_socket2.c	8 Jul 2004 06:39:30 -0000	1.3
@@ -742,8 +742,10 @@
 		panic("sbflush");
 	while (sb->sb_mbcnt)
 		sbdrop(sb, (int)sb->sb_cc);
+#if 0
 	if (sb->sb_cc || sb->sb_mb)
 		panic("sbflush 2");
+#endif
 }
 
 /*
CVSspam 0.2.8