Modified: trunk/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h
Modified: trunk/reactos/drivers/lib/oskittcp/include/oskitfreebsd.h
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/defaults.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/in.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/interface.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/ip_output.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/raw_ip.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/route.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/rtsock.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_debug.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_input.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c
Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_socket.c
--- trunk/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h 2005-06-20 13:17:21 UTC (rev 16146)
@@ -129,7 +129,7 @@
int __cdecl vprintf(const char *, va_list);
#define log bsd_log
-static int bsd_log ( int blah, const char* fmt, ... )
+static __inline int bsd_log ( int blah, const char* fmt, ... )
{
va_list arg;
int i;
--- trunk/reactos/drivers/lib/oskittcp/include/oskitfreebsd.h 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/include/oskitfreebsd.h 2005-06-20 13:17:21 UTC (rev 16146)
@@ -1,18 +1,16 @@
#ifndef _OSKITFREEBSD_H
#define _OSKITFREEBSD_H
+#include <ddk/ntddk.h>
+
#ifdef linux
#include <netinet/in.h>
#endif
extern void oskittcp_die(const char *file, int line);
-#ifdef _MSC_VER
-#define DbgPrint printf
-#define DbgVPrint vprintf
-#else//_MSC_VER
#define printf DbgPrint
-#endif//_MSC_VER
+#define vprintf DbgVPrint
#define ovbcopy(x,y,z) bcopy(x,y,z)
void *memset( void *dest, int c, size_t count );
#define bzero(x,y) memset(x,0,y)
@@ -22,14 +20,14 @@
{
va_list arg;
va_start(arg, fmt);
- DbgPrint ( "oskit PANIC: " );
- DbgVPrint ( fmt, arg );
+ printf ( "oskit PANIC: " );
+ vprintf ( fmt, arg );
va_end(arg);
// TODO FIXME - print stack trace...
oskittcp_die("<unknown file>",-1);
}
#else//_MSC_VER
-#define panic(...) do { DbgPrint(__VA_ARGS__); \
+#define panic(...) do { printf(__VA_ARGS__); \
oskittcp_die(__FILE__,__LINE__); } while(0)
#endif//_MSC_VER
#define kmem_malloc(x,y,z) malloc(y)
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/defaults.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/defaults.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -189,27 +189,8 @@
return (error);
}
-/* ---------------------------------------------------------------------- */
-/*
- * normally, this is a builtin function in gcc
- * net/if.c doesn't seem to get it, though
- */
-static int
-memcmp(const void *s1v, const void *s2v, size_t size)
-{
- register const char *s1 = s1v, *s2 = s2v;
- register unsigned int a, b;
-
- while (size-- > 0) {
- if ((a = *s1++) != (b = *s2++))
- return (a-b);
- }
-
- return 0;
-}
-
int bcmp(const void *b1, const void *b2, size_t len)
{
- return memcmp(b1, b2, len);
+ return RtlCompareMemory(b1, b2, len);
}
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/in.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/in.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -56,7 +56,9 @@
* This structure is used to keep track of in_multi chains which belong to
* deleted interface addresses.
*/
+#ifndef __REACTOS__
static LIST_HEAD(in_mk_type, multi_kludge) in_mk; /* XXX BSS initialization */
+#endif
struct multi_kludge {
LIST_ENTRY(multi_kludge) mk_entry;
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -56,6 +56,8 @@
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
+#include <oskittcp.h>
+
struct in_addr zeroin_addr;
int
@@ -89,10 +91,14 @@
struct inpcbhead *head = inp->inp_pcbinfo->listhead;
unsigned short *lastport = &inp->inp_pcbinfo->lastport;
struct sockaddr_in *sin;
+#ifndef __REACTOS__
struct proc *p = curproc; /* XXX */
+#endif
u_short lport = 0;
int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
+#ifndef __REACTOS__
int error;
+#endif
OS_DbgPrint(OSK_MID_TRACE,("Called\n"));
@@ -208,7 +214,9 @@
struct sockaddr_in **plocal_sin;
{
struct in_ifaddr *ia;
+#ifndef __REACTOS__
struct sockaddr_in *ifaddr = 0;
+#endif
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
OS_DbgPrint(OSK_MID_TRACE,("Called\n"));
@@ -339,7 +347,7 @@
/*
* Call inner routine, to assign local interface address.
*/
- if (error = in_pcbladdr(inp, nam, &ifaddr))
+ if ((error = in_pcbladdr(inp, nam, &ifaddr)))
return(error);
if (in_pcblookuphash(inp->inp_pcbinfo, sin->sin_addr, sin->sin_port,
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/interface.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/interface.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -1,5 +1,7 @@
#include <oskittcp.h>
#include <oskitdebug.h>
+#include <net/raw_cb.h>
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
@@ -14,10 +16,6 @@
#include <sys/socketvar.h>
#include <sys/uio.h>
-#ifdef WIN32
-#define snprintf _snprintf
-#endif//WIN32
-
struct linker_set domain_set;
OSKITTCP_EVENT_HANDLERS OtcpEvent = { 0 };
@@ -31,6 +29,10 @@
unsigned volatile ipending;
struct timeval boottime;
+void clock_init();
+int isprint(int c);
+int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
+
void *fbsd_malloc( unsigned int bytes, ... ) {
if( !OtcpEvent.TCPMalloc ) panic("no malloc");
return OtcpEvent.TCPMalloc
@@ -51,8 +53,6 @@
raw_init();
OS_DbgPrint(OSK_MID_TRACE,("Route Init\n"));
route_init();
- OS_DbgPrint(OSK_MID_TRACE,("Init fake freebsd scheduling\n"));
- init_freebsd_sched();
OS_DbgPrint(OSK_MID_TRACE,("Init clock\n"));
clock_init();
OS_DbgPrint(OSK_MID_TRACE,("Init TCP\n"));
@@ -92,7 +92,7 @@
if ( !align )
{
if ( i ) DbgPrint( line );
- snprintf ( line, sizeof(line)-1, "%08x: \n", &Data[i] );
+ _snprintf ( line, sizeof(line)-1, "%08x: \n", &Data[i] );
line[sizeof(line)-1] = '\0';
}
@@ -133,12 +133,10 @@
OSK_UINT Len,
OSK_UINT *OutLen,
OSK_UINT Flags ) {
- char *output_ptr = Data;
struct uio uio = { 0 };
struct iovec iov = { 0 };
int error = 0;
int tcp_flags = 0;
- int tocopy = 0;
*OutLen = 0;
@@ -167,33 +165,11 @@
return error;
}
-static int
-getsockaddr(namp, uaddr, len)
-/* [<][>][^][v][top][bottom][index][help] */
- struct sockaddr **namp;
-caddr_t uaddr;
-size_t len;
-{
- struct sockaddr *sa;
- int error;
-
- if (len > SOCK_MAXADDRLEN)
- return ENAMETOOLONG;
- MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK);
- error = copyin(uaddr, sa, len);
- if (error) {
- FREE(sa, M_SONAME);
- } else {
- *namp = sa;
- }
- return error;
-}
-
int OskitTCPBind( void *socket, void *connection,
void *nam, OSK_UINT namelen ) {
int error = EFAULT;
struct socket *so = socket;
- struct mbuf sabuf = { 0 };
+ struct mbuf sabuf;
struct sockaddr addr;
OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket));
@@ -201,6 +177,7 @@
if( nam )
addr = *((struct sockaddr *)nam);
+ RtlZeroMemory(&sabuf, sizeof(sabuf));
sabuf.m_data = (void *)&addr;
sabuf.m_len = sizeof(addr);
@@ -216,11 +193,8 @@
int OskitTCPConnect( void *socket, void *connection,
void *nam, OSK_UINT namelen ) {
struct socket *so = socket;
- struct connect_args _uap = {
- 0, nam, namelen
- }, *uap = &_uap;
- int error = EFAULT, s;
- struct mbuf sabuf = { 0 };
+ int error = EFAULT;
+ struct mbuf sabuf;
struct sockaddr addr;
OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket));
@@ -236,6 +210,7 @@
if( nam )
addr = *((struct sockaddr *)nam);
+ RtlZeroMemory(&sabuf, sizeof(sabuf));
sabuf.m_data = (void *)&addr;
sabuf.m_len = sizeof(addr);
@@ -264,7 +239,6 @@
}
int OskitTCPShutdown( void *socket, int disconn_type ) {
- struct socket *so = socket;
return soshutdown( socket, disconn_type );
}
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/ip_output.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/ip_output.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -63,8 +63,10 @@
u_short ip_id;
static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *));
+#ifndef __REACTOS__
static void ip_mloopback
__P((struct ifnet *, struct mbuf *, struct sockaddr_in *));
+#endif
/*
* IP output. The packet in mbuf chain m contains a skeletal IP
@@ -81,7 +83,9 @@
struct ip_moptions *imo;
{
register struct ip *ip, *mhip;
+#ifndef __REACTOS__
register struct ifnet *ifp;
+#endif
register struct mbuf *m = m0;
register int hlen = sizeof (struct ip);
int len, off, error = 0;
@@ -340,8 +344,8 @@
m->m_flags &= ~M_BCAST;
#endif
+#ifndef __REACTOS__
sendit:
-#ifndef __REACTOS__
/*
* Check with the firewall...
*/
@@ -382,6 +386,7 @@
*/
if (ip->ip_off & IP_DF) {
error = EMSGSIZE;
+#ifndef __REACTOS__
#if 1
/*
* This case can happen if the user changed the MTU
@@ -396,6 +401,7 @@
ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu;
}
#endif
+#endif
ipstat.ips_cantfrag++;
goto bad;
}
@@ -509,8 +515,9 @@
ipstat.ips_fragmented++;
}
done:
- if (ro == &iproute && (flags & IP_ROUTETOIF) == 0 && ro->ro_rt)
+ if (ro == &iproute && (flags & IP_ROUTETOIF) == 0 && ro->ro_rt) {
RTFREE(ro->ro_rt);
+ }
return (error);
bad:
@@ -773,7 +780,7 @@
struct mbuf **pcbopt;
register struct mbuf *m;
{
- register cnt, optlen;
+ register int cnt, optlen;
register u_char *cp;
u_char opt;
@@ -875,15 +882,19 @@
struct mbuf *m;
{
register int error = 0;
+#ifndef __REACTOS__
u_char loop;
register int i;
struct in_addr addr;
register struct ip_mreq *mreq;
register struct ifnet *ifp;
+#endif
register struct ip_moptions *imo = *imop;
+#ifndef __REACTOS__
struct route ro;
register struct sockaddr_in *dst;
int s;
+#endif
if (imo == NULL) {
/*
@@ -1149,10 +1160,12 @@
register struct ip_moptions *imo;
register struct mbuf **mp;
{
+#ifndef __REACTOS__
u_char *ttl;
u_char *loop;
struct in_addr *addr;
struct in_ifaddr *ia;
+#endif
*mp = m_get(M_WAIT, MT_SOOPTS);
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/raw_ip.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/raw_ip.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -156,7 +156,9 @@
{
register struct ip *ip;
register struct inpcb *inp = sotoinpcb(so);
+#ifndef __REACTOS__
struct mbuf *opts;
+#endif
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
/*
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/route.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/route.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -365,7 +365,9 @@
#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#ifndef __REACTOS__
static int rt_fixdelete(struct radix_node *, void *);
+#endif
static int rt_fixchange(struct radix_node *, void *);
struct rtfc_arg {
@@ -385,7 +387,9 @@
register struct radix_node_head *rnh;
struct ifaddr *ifa;
struct sockaddr *ndst;
+#ifndef __REACTOS__
u_long prflags = 0UL;
+#endif
#define senderr(x) { error = x ; goto bad; }
if ((rnh = rt_tables[dst->sa_family]) == 0)
@@ -561,6 +565,7 @@
* rnh->rnh_walktree_from() above, and those that actually are children of
* the late parent (passed in as VP here) are themselves deleted.
*/
+#ifndef __REACTOS__
static int
rt_fixdelete(struct radix_node *rn, void *vp)
{
@@ -574,6 +579,7 @@
}
return 0;
}
+#endif
/*
* This routine is called from rt_setgate() to do the analogous thing for
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/rtsock.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/rtsock.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -206,8 +206,8 @@
case RTM_LOCK:
if ((rnh = rt_tables[dst->sa_family]) == 0) {
senderr(EAFNOSUPPORT);
- } else if (rt = (struct rtentry *)
- rnh->rnh_lookup(dst, netmask, rnh))
+ } else if ((rt = (struct rtentry *)
+ rnh->rnh_lookup(dst, netmask, rnh)))
rt->rt_refcnt++;
else
senderr(ESRCH);
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_debug.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_debug.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -83,8 +83,10 @@
struct tcpiphdr *ti;
int req;
{
+#ifdef TCPDEBUG
tcp_seq seq, ack;
int len, flags;
+#endif
struct tcp_debug *td = &tcp_debug[tcp_debx++];
if (tcp_debx == TCP_NDEBUG)
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_input.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_input.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -516,7 +516,7 @@
* if the segment has a CC option equal to CCrecv
*/
((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) != (TF_REQ_CC|TF_RCVD_CC) ||
- (to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv) &&
+ ((to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv)) &&
ti->ti_seq == tp->rcv_nxt &&
tiwin && tiwin == tp->snd_wnd &&
tp->snd_nxt == tp->snd_max) {
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/tcp_output.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -780,7 +780,7 @@
tcp_setpersist(tp)
register struct tcpcb *tp;
{
- register t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
+ register int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
if (tp->t_timer[TCPT_REXMT])
panic("tcp_output REXMT");
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -101,7 +101,9 @@
register int ncl;
int nowait;
{
+#ifndef __REACTOS__
static int logged;
+#endif
register caddr_t p;
register int i;
int npg;
@@ -456,7 +458,7 @@
{
register int len = req_len;
register struct mbuf *m;
- register count;
+ register int count;
if ((m = mp) == NULL)
return;
--- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_socket.c 2005-06-20 12:10:46 UTC (rev 16145)
+++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_socket.c 2005-06-20 13:17:21 UTC (rev 16146)
@@ -71,7 +71,9 @@
register int type;
int proto;
{
+#ifndef __REACTOS__
struct proc *p = curproc; /* XXX */
+#endif
register struct protosw *prp;
register struct socket *so;
register int error;
@@ -335,7 +337,9 @@
struct mbuf *control;
int flags;
{
+#ifndef __REACTOS__
struct proc *p = curproc; /* XXX */
+#endif
struct mbuf **mp;
register struct mbuf *m;
register long space, len, resid;