2 #pragma warning ( disable : 4786 ) 19 unsigned char hwaddr[6] = { 0x08, 0x00, 0x20, 0x0b, 0xb7, 0xbb };
26 #define MAX_DG_SIZE 0x10000 27 #define TI_DbgPrint(x,y) printf y 45 void *WhichConnection,
65 #define STRINGIFY(x) #x 67 char hdr[14] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 static struct ifaddr
a = {
92 nm.sin_addr.s_addr =
inet_addr(
"255.255.255.0" );
115 (
"Called TSLEEP: tok = %x, pri = %d, wmesg = %s, tmio = %x\n",
119 if( SleepingThread ) {
151 Entry = SleepingThreadsList.Flink;
152 while(
Entry != &SleepingThreadsList ) {
180 for(
i = off;
i <
len &&
i < off + 16;
i++ ) {
186 for(
i = off;
i <
len &&
i < off + 16;
i++ ) {
214 if(
bind( asock, (
struct sockaddr *)&addr_from,
sizeof( addr_from ) ) ) {
220 addr_to.sin_addr.s_addr =
inet_addr(
"127.0.0.1");
230 fromsize =
sizeof( addr_from );
231 dgrecv =
recvfrom( asock, datagram,
sizeof(datagram), 0,
232 (
struct sockaddr *)&addr_from, &fromsize );
234 if( datagram[0] ==
'C' && datagram[1] ==
'M' &&
235 datagram[2] ==
'D' && datagram[3] ==
' ' ) {
236 int theport,
bytes, off, bytin;
244 if(
word ==
"socket" ) {
245 cmdin >> faddr >> theport;
256 if( (
err = OskitTCPConnect( conn,
NULL, &nam,
257 sizeof(nam) )) != 0 ) {
260 printf(
"Socket created\n" );
265 if( !conn )
continue;
267 if(
word ==
"recv" ) {
270 if( (
err = OskitTCPRecv( conn, (OSK_PCHAR)datagram,
272 (
unsigned int *)&bytin, 0 )) != 0 ) {
275 for( off = 0; off < bytin; off += 16 ) {
280 }
else if (
word ==
"type" ) {
282 char*
p = &therest[0];
289 if (
c ==
'\r' ||
c ==
'\n' )
break;
295 case 'b':
c =
'\b';
break;
296 case 'n':
c =
'\n';
break;
297 case 'r':
c =
'\r';
break;
298 case 't':
c =
'\t';
break;
299 case 'v':
c =
'\v';
break;
305 if ( (
err = OskitTCPSend ( conn, (OSK_PCHAR)
p,
strlen(
p), (OSK_UINT*)&bytin, 0 ))
309 printf (
"wrote %d bytes\n", bytin );
311 }
else if(
word ==
"send" ) {
313 while( cmdin >>
word ) {
318 if( (
err = OskitTCPSend( conn, (OSK_PCHAR)datagram,
319 off, (OSK_UINT *)&bytin, 0 ))
323 printf(
"wrote %d bytes\n", bytin );
325 }
else if(
word ==
"close" ) {
326 OskitTCPClose( conn );
329 }
else if( dgrecv > 14 ) {
332 if( datagram[12] == 8 && datagram[13] == 6 ) {
336 memcpy( datagram + 32, datagram + 6, 6 );
337 memcpy( datagram, datagram + 6, 6 );
342 memcpy( laddr, datagram + 28, 4 );
343 memcpy( datagram + 28, datagram + 38, 4 );
344 memcpy( datagram + 38, laddr, 4 );
348 err =
sendto( asock, datagram, dgrecv, 0,
358 OskitTCPReceiveDatagram
359 ( (
unsigned char *)datagram + 14,
369 (
struct sockaddr *)&addr_to,
sizeof(addr_to) );
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
struct ifaddr * TCPFindInterface(void *ClientData, OSK_UINT AddrType, OSK_UINT FindType, struct sockaddr *ReqAddr)
void TCPFree(void *ClientData, void *data, OSK_PCHAR File, OSK_UINT Line)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
int TCPSleep(void *ClientData, void *token, int priority, char *msg, int tmio)
ACPI_SIZE strlen(const char *String)
void * TCPMalloc(void *ClientData, OSK_UINT Bytes, OSK_PCHAR File, OSK_UINT Line)
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
_Check_return_ _CRTIMP size_t __cdecl strspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
#define InsertTailList(ListHead, Entry)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
int is_stack_ptr(const void *p)
void display_row(char *data, int off, int len)
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
static unsigned char bytes[4]
#define FD_ISSET(fd, set)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int TCPSocketState(void *ClientData, void *WhichSocket, void *WhichConnection, OSK_UINT NewState)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
#define TI_DbgPrint(x, y)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
WDF_INTERRUPT_PRIORITY priority
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
#define IO_NETWORK_INCREMENT
struct _CONNECTION_ENDPOINT * PCONNECTION_ENDPOINT
int main(int argc, char **argv)
int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len)
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
void TCPWakeup(void *ClientData, void *token)
#define ExAllocatePool(type, size)
#define memcpy(s1, s2, n)
std::list< std::string > output_packets
WDF_CHILD_LIST_ITERATOR iterator
basic_istringstream< char, char_traits< char >, allocator< char > > istringstream
#define KeInitializeEvent(pEvt, foo, foo2)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
OSKITTCP_EVENT_HANDLERS EventHandlers
unsigned long TCP_IPIdentification
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
struct _CONNECTION_ENDPOINT CONNECTION_ENDPOINT
GLboolean GLboolean GLboolean GLboolean a
base of all file and directory entries