Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. format binary as ""
  2.  
  3. use32
  4. ; standard header
  5.         db      'MENUET01'      ; signature
  6.         dd      1               ; header version
  7.         dd      start           ; entry point
  8.         dd      i_end           ; initialized size
  9.         dd      mem             ; required memory
  10.         dd      mem             ; stack pointer
  11.         dd      0               ; parameters
  12.         dd      0               ; path
  13.  
  14. ; useful includes
  15. include '../macros.inc'
  16. purge mov,add,sub
  17. include '../proc32.inc'
  18. include '../dll.inc'
  19.  
  20. include '../struct.inc'
  21.  
  22. include 'socket.inc'
  23.  
  24. ; entry point
  25. start:
  26.         mcall   40, 0                   ; we dont want any events
  27. ; load libraries
  28.         stdcall dll.Load, @IMPORT
  29.         test    eax, eax
  30.         jnz     exit
  31. ; initialize console
  32.         push    1
  33.         call    [con_start]
  34.         push    title
  35.         push    -1
  36.         push    -1
  37.         push    -1
  38.         push    -1
  39.         call    [con_init]
  40. ; main loop
  41. main:
  42.         mcall   75, 255, 0, socket_list ; get current socket list
  43.  
  44.         call    [con_cls]
  45.  
  46.         mov     esi, socket_list
  47.   .loop:
  48.         lodsd
  49.         test    eax, eax
  50.         jz      .done
  51.  
  52.         mov     ecx, eax
  53.         mcall   75, 255, , socket_buf
  54.  
  55.         pushd   [socket_buf + SOCKET.state]
  56.         pushd   [socket_buf + SOCKET.PID]
  57.         pushd   [socket_buf + SOCKET.Number]
  58.         push    str_sock
  59.         call    [con_printf]
  60.         add     esp, 4
  61.  
  62.         jmp     .loop
  63.  
  64.   .done:
  65.  
  66.         mcall   23, 50
  67.  
  68.         jmp     main
  69.  
  70.  
  71.         push    0
  72.         call    [con_exit]
  73. exit:
  74.         mcall   -1
  75.  
  76. ; data
  77. title           db 'Socket debugger', 0
  78.  
  79. str_sock        db 'Socket=%d PID=%d state=%d', 10, 0
  80.  
  81. ; import
  82. align 4
  83. @IMPORT:
  84.  
  85. library console, 'console.obj'
  86.  
  87. import  console,        \
  88.         con_start,      'START',        \
  89.         con_init,       'con_init',     \
  90.         con_cls,        'con_cls',      \
  91.         con_exit,       'con_exit',     \
  92.         con_printf,     'con_printf'
  93. i_end:
  94.  
  95. socket_list     rd 4096
  96. socket_buf      rd 4096
  97.  
  98. align   4
  99. rb      4096    ; stack
  100. mem:
  101.