Author: cgutman
Date: Sat Oct 31 01:24:38 2009
New Revision: 43861
URL:
http://svn.reactos.org/svn/reactos?rev=43861&view=rev
Log:
- Implement OskitTCPSetSockOpt and OskitTCPGetSockOpt (currently unused)
Modified:
trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h
trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
Modified: trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/inclu…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/include/oskittcp.h [iso-8859-1] Sat Oct 31 01:24:38
2009
@@ -150,6 +150,18 @@
OSK_UINT *RemoteAddress,
OSK_UI16 *RemotePort );
+int OskitTCPGetSockOpt(void *socket,
+ int level,
+ int optname,
+ char *buffer,
+ int *size);
+
+int OskitTCPSetSockOpt(void *socket,
+ int level,
+ int optname,
+ char *buffer,
+ int size);
+
#undef errno
void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... );
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] Sat Oct 31
01:24:38 2009
@@ -428,6 +428,57 @@
/* The buffer Ip is freed by tcp_input */
}
+int OskitTCPSetSockOpt(void *socket,
+ int level,
+ int optname,
+ char *buffer,
+ int size)
+{
+ struct mbuf *m;
+
+ if (size >= MLEN)
+ return OSK_EINVAL;
+
+ m = m_get(M_WAIT, MT_SOOPTS);
+ if (!m)
+ return OSK_ENOMEM;
+
+ m->m_len = size;
+
+ memcpy(m->m_data, buffer, size);
+
+ /* m is freed by sosetopt */
+ return sosetopt(socket, level, optname, m);
+}
+
+int OskitTCPGetSockOpt(void *socket,
+ int level,
+ int optname,
+ char *buffer,
+ int *size)
+{
+ int error, oldsize = *size;
+ struct mbuf *m;
+
+ error = sogetopt(socket, level, optname, &m);
+ if (!error)
+ {
+ *size = m->m_len;
+
+ if (!buffer || oldsize < m->m_len)
+ {
+ m_freem(m);
+ return OSK_EINVAL;
+ }
+
+ memcpy(buffer, m->m_data, m->m_len);
+
+ m_freem(m);
+ }
+
+ return error;
+}
+
int OskitTCPListen( void *socket, int backlog ) {
int error;