kolibrios/kernel/branches/net/applications/socketdbg/socketdbg.asm
hidnplayr 2033224063 Added simple socket debugging tool.
Moved some TCP code to tcp_usreq.inc.

git-svn-id: svn://kolibrios.org@3146 a494cfbc-eb01-0410-851d-a64ba20cac60
2012-12-30 20:31:11 +00:00

101 lines
2.1 KiB
NASM

format binary as ""
use32
; standard header
db 'MENUET01' ; signature
dd 1 ; header version
dd start ; entry point
dd i_end ; initialized size
dd mem ; required memory
dd mem ; stack pointer
dd 0 ; parameters
dd 0 ; path
; useful includes
include '../macros.inc'
purge mov,add,sub
include '../proc32.inc'
include '../dll.inc'
include '../struct.inc'
include 'socket.inc'
; entry point
start:
mcall 40, 0 ; we dont want any events
; load libraries
stdcall dll.Load, @IMPORT
test eax, eax
jnz exit
; initialize console
push 1
call [con_start]
push title
push -1
push -1
push -1
push -1
call [con_init]
; main loop
main:
mcall 75, 255, 0, socket_list ; get current socket list
call [con_cls]
mov esi, socket_list
.loop:
lodsd
test eax, eax
jz .done
mov ecx, eax
mcall 75, 255, , socket_buf
pushd [socket_buf + SOCKET.state]
pushd [socket_buf + SOCKET.PID]
pushd [socket_buf + SOCKET.Number]
push str_sock
call [con_printf]
add esp, 4
jmp .loop
.done:
mcall 23, 50
jmp main
push 0
call [con_exit]
exit:
mcall -1
; data
title db 'Socket debugger', 0
str_sock db 'Socket=%d PID=%d state=%d', 10, 0
; import
align 4
@IMPORT:
library console, 'console.obj'
import console, \
con_start, 'START', \
con_init, 'con_init', \
con_cls, 'con_cls', \
con_exit, 'con_exit', \
con_printf, 'con_printf'
i_end:
socket_list rd 4096
socket_buf rd 4096
align 4
rb 4096 ; stack
mem: