Updated network programs to use new network function numbers from network.inc

git-svn-id: svn://kolibrios.org@2853 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-07-09 12:45:04 +00:00
parent fd138cc362
commit 08c92f8c50
9 changed files with 1180 additions and 1141 deletions

View File

@ -4,6 +4,8 @@
; hidnplayr@gmail.com
;
format binary as ""
use32
org 0x0
@ -14,40 +16,32 @@ use32
dd IM_END ; size of image
dd (I_END+0x100) ; memory for app
dd (I_END+0x100) ; esp
dd I_PARAM , 0x0 ; I_Param , I_Icon
dd 0x0 , 0x0 ; I_Param , I_Icon
__DEBUG__ equ 1
__DEBUG_LEVEL__ equ 1
include '../macros.inc'
purge mov, add, sub
include '../struct.inc'
include '../network.inc'
include '..\macros.inc'
include '..\debug-fdo.inc'
START:
START: ; start of execution
; TODO: check Parameters
DEBUGF 1, 'Hello!\n'
redraw:
redraw:
mcall 12, 1
mcall 0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc, ,name
mcall 4, 25 shl 16 + 31, 0x80000000, title
mcall 0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc, , str_name
mcall 4, 25 shl 16 + 31, 0x80000000, str_legend
mcall 12, 2
draw_stats:
draw_stats:
mov edx, 50 shl 16 + 50
mov [last],0
mov [last], 0
.loop:
mcall 76, 0x06080003, [last],,,ARP_ENTRY
mcall 76, API_ARP + 3, [last],,, arp_buf
cmp eax, -1
je mainloop
mcall 4, edx, 0x80000000, str_entry
mov edx, ebx
@ -57,53 +51,53 @@ START: ; start of execution
mov edi, 0x00bcbcbc
xor ecx, ecx
mov cl, byte[ARP_ENTRY.IP+0]
mov cl, byte[arp_buf.IP+0]
mcall
mov cl, byte[ARP_ENTRY.IP+1]
mov cl, byte[arp_buf.IP+1]
add edx, 24 shl 16
mcall
mov cl, byte[ARP_ENTRY.IP+2]
mov cl, byte[arp_buf.IP+2]
add edx, 24 shl 16
mcall
mov cl, byte[ARP_ENTRY.IP+3]
mov cl, byte[arp_buf.IP+3]
add edx, 24 shl 16
mcall
mov ebx, 0x00020100
mov cl, byte[ARP_ENTRY.MAC+0]
mov cl, byte[arp_buf.MAC+0]
add edx, 36 shl 16
mcall
mov cl, byte[ARP_ENTRY.MAC+1]
mov cl, byte[arp_buf.MAC+1]
add edx, 18 shl 16
mcall
mov cl, byte[ARP_ENTRY.MAC+2]
mov cl, byte[arp_buf.MAC+2]
add edx, 18 shl 16
mcall
mov cl, byte[ARP_ENTRY.MAC+3]
mov cl, byte[arp_buf.MAC+3]
add edx, 18 shl 16
mcall
mov cl, byte[ARP_ENTRY.MAC+4]
mov cl, byte[arp_buf.MAC+4]
add edx, 18 shl 16
mcall
mov cl, byte[ARP_ENTRY.MAC+5]
mov cl, byte[arp_buf.MAC+5]
add edx, 18 shl 16
mcall
mov ebx, 0x00040000
mov cx, [ARP_ENTRY.Status]
mov cx, [arp_buf.status]
add edx, 30 shl 16
mcall
mov cx, [ARP_ENTRY.TTL]
mov cx, [arp_buf.TTL]
add edx, 60 shl 16
mcall
@ -115,7 +109,8 @@ START: ; start of execution
jmp .loop
mainloop:
mainloop:
mcall 23,50 ; wait for event with timeout (0,5 s)
@ -129,44 +124,32 @@ START: ; start of execution
jmp draw_stats
key:
key:
mcall 2
jmp mainloop
button: ; button
button: ; button
mcall 17 ; get id
cmp ah, 1
je close
je exit
jmp redraw
close:
exit:
mcall -1
; DATA AREA
name db 'ARP manager',0
title db '# IP-address MAC-address Status TTL',0
str_entry db ' . . . - - - - - s',0
last dd 0
ARP_ENTRY:
.IP dd 192 shl 0 + 168 shl 8 + 1 shl 16 + 1 shl 24
.MAC dp 0xdeadbeef1337
.Status dw 0x0300
.TTL dw 37
.size:
include_debug_strings ; ALWAYS present in data section
str_name db 'ARP manager', 0
str_legend db '# IP-address MAC-address Status TTL', 0
str_entry db ' . . . - - - - - s', 0
IM_END:
I_PARAM rb 1024
last dd ?
arp_buf ARP_entry
I_END:

View File

@ -1,3 +1,6 @@
format binary as ""
use32
org 0x0
; standard header

View File

@ -6,6 +6,8 @@
; By hidnplayr
;
format binary as ""
use32
org 0x0
@ -32,7 +34,7 @@ START:
mcall 40, 0
push exit
push .launch_zeroconf_exit
cmp byte[param], 'A' ; A for All
je Get_PCI_Info
@ -41,6 +43,10 @@ START:
ret
.launch_zeroconf_exit:
mcall 70, zeroconf
mcall -1
.noparams:
call draw_window
@ -494,6 +500,14 @@ hardwareinfo:
.pci_bus db ?
.pci_dev db ?
zeroconf:
dd 7 ; launch app
dd 0 ; no flags
dd 0 ; no parameters
dd 0 ; reserved
dd 0 ; reserved
db "/sys/network/zeroconf", 0
IM_END:

View File

@ -1,9 +1,14 @@
;
; Netstat for KolibriOS v0.1 (still alpha version)
; Netstat for KolibriOS v0.2
;
; 0.1 - 22 sept 2009 - initial release
; 0.2 - 9 july 2012 - converted to new sysfunc numbers
;
; hidnplayr@gmail.com
;
format binary as ""
use32
org 0x0
@ -21,6 +26,7 @@ __DEBUG_LEVEL__ equ 1
include '..\macros.inc'
include '..\debug-fdo.inc'
include '..\network.inc'
START: ; start of execution
; TODO: check Parameters
@ -77,7 +83,7 @@ START: ; start of execution
mov edx, str_queue_out
mcall
mov ebx,1337 shl 16 + 4
mov ebx, API_ETH + 4
mov bh, [device]
mcall 76
push eax
@ -110,7 +116,7 @@ START: ; start of execution
mcall
mov ebx, 0 shl 16 + 8
mov ebx, API_IPv4 + 8
mov bh, [device]
mcall 76
push eax
@ -195,7 +201,7 @@ START: ; start of execution
cmp [mode], 101
jne not_101
mov ebx, 1337 shl 16 + 0
mov ebx, API_ETH
mov bh, [device]
@@:
push ebx
@ -249,7 +255,7 @@ START: ; start of execution
cmp [mode], 102
jne not_102
mov ebx, 0 shl 16
mov ebx, API_IPv4
mov bh, [device]
push ebx
mcall 76
@ -281,7 +287,7 @@ START: ; start of execution
cmp [mode], 103
jne not_103
mov ebx, 0x0608 shl 16 + 0
mov ebx, API_ARP
mov bh, [device]
push ebx
mcall 76
@ -320,7 +326,7 @@ not_103:
cmp [mode], 104
jne not_104
mov ebx, 1 shl 16 + 0
mov ebx, API_ICMP
mov bh, [device]
push ebx
mcall 76
@ -351,7 +357,7 @@ not_104:
cmp [mode], 105
jne not_105
mov ebx, 17 shl 16 + 0
mov ebx, API_UDP
mov bh, [device]
push ebx
mcall 76
@ -382,7 +388,7 @@ not_105:
cmp [mode], 106
jne not_106
mov ebx, 6 shl 16 + 0
mov ebx, API_TCP
mov bh, [device]
push ebx
mcall 76
@ -420,11 +426,11 @@ not_106:
button: ; button
mcall 17 ; get id
cmp ah, 1
je close
je exit
mov [mode], ah
jmp redraw
close:
exit:
mcall -1
@ -494,23 +500,23 @@ draw_ip:
; DATA AREA
name db 'Netstat',0
name db 'Netstat', 0
mode db 101
device db 0
modes db 'Ethernet IPv4 ARP ICMP UDP TCP',0
modes db 'Ethernet IPv4 ARP ICMP UDP TCP', 0
str_packets_tx db 'Packets sent:',0
str_packets_rx db 'Packets received:',0
str_bytes_tx db 'Bytes sent:',0
str_bytes_rx db 'Bytes received:',0
str_MAC db 'MAC address:',0
str_queue_in db 'IN-queue size:',0
str_queue_out db 'OUT-queue size:',0
str_ip db 'IP address:',0
str_dns db 'DNS address:',0
str_subnet db 'Subnet mask:',0
str_gateway db 'Standard gateway:',0
str_arp db 'ARP entrys:',0
str_packets_tx db 'Packets sent:', 0
str_packets_rx db 'Packets received:', 0
str_bytes_tx db 'Bytes sent:', 0
str_bytes_rx db 'Bytes received:', 0
str_MAC db 'MAC address:', 0
str_queue_in db 'IN-queue size:', 0
str_queue_out db 'OUT-queue size:', 0
str_ip db 'IP address:', 0
str_dns db 'DNS address:', 0
str_subnet db 'Subnet mask:', 0
str_gateway db 'Standard gateway:', 0
str_arp db 'ARP entrys:', 0
include_debug_strings ; ALWAYS present in data section

View File

@ -1,22 +1,22 @@
; Socket types
SOCK_STREAM = 1
SOCK_DGRAM = 2
SOCK_RAW = 3 ; not supported by the kernel
SOCK_RAW = 3
; IP protocols
IPPROTO_IP = 0
IPPROTO_ICMP = 1 ; not supported by the kernel
IPPROTO_ICMP = 1
IPPROTO_TCP = 6
IPPROTO_UDP = 17
; Address families
AF_UNSPEC = 0
AF_UNIX = 1
AF_LOCAL = 1
AF_INET4 = 2 ; IPv4
;AF_INET6 = 28 ; IPv6 (not supported)
;AF_INET6 = 28 ; IPv6 (not supported yet)
PF_UNSPEC = AF_UNSPEC
PF_UNIX = AF_UNIX
PF_LOCAL = AF_LOCAL
PF_INET4 = AF_INET4
;PF_INET6 = AF_INET6
@ -30,6 +30,15 @@ AI_ADDRCONFIG = 0x400
; internal definition
AI_SUPPORTED = 0x40F
; for system function 76
API_ETH = 0 shl 16
API_IPv4 = 1 shl 16
API_ICMP = 2 shl 16
API_UDP = 3 shl 16
API_TCP = 4 shl 16
API_ARP = 5 shl 16
API_PPPOE = 6 shl 16
struct sockaddr_in
sin_family dw ? ; sa_family_t
sin_port dw ? ; in_port_t
@ -69,4 +78,14 @@ connect fix 75, 4
accept fix 75, 5
send fix 75, 6
recv fix 75, 7
setsockopt fix 75, 8
getsockopt fix 75, 9
struct ARP_entry
IP dd ?
MAC dp ?
status dw ?
TTL dw ?
ends

View File

@ -1,3 +1,5 @@
format binary as ""
use32
; standard header
db 'MENUET01' ; signature

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2010. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Synergyc.asm - Synergy client for KolibriOS ;;
@ -12,6 +12,8 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
format binary as ""
use32
org 0x0
@ -19,16 +21,20 @@ use32
dd 1 ; header version
dd start ; entry point
dd i_end ; initialized size
dd mem ; required memory
dd mem ; stack pointer
dd mem+0x1000 ; required memory
dd mem+0x1000 ; stack pointer
dd 0 ; parameters
dd path ; path
__DEBUG__ equ 1 ; enable/disable
__DEBUG_LEVEL__ equ 1 ; 1 = all, 2 = errors
BUFFERSIZE equ 1024
include '../proc32.inc'
include '../macros.inc'
purge mov,add,sub
include '../debug-fdo.inc'
include '../proc32.inc'
include '../dll.inc'
include '../network.inc'
@ -37,11 +43,11 @@ start:
cld
mov edi, path ; Calculate the length of zero-terminated string
xor al , al
xor al, al
mov ecx, 1024
repne scasb
dec edi
mov esi, filename
mov esi, filename ; append the path with '.ini'
movsd
movsb
@ -348,8 +354,8 @@ align 16
@IMPORT:
library console, 'console.obj',\
libini, 'libini.obj',\
network, 'network.obj'
network, 'network.obj',\
libini, 'libini.obj'
import network,\
inet_addr, 'inet_addr'
@ -368,6 +374,8 @@ import libini,\
ini.get_str, 'ini_get_str',\
ini.get_int, 'ini_get_int'
include_debug_strings
align 4
i_end:
socketnum dd ?

View File

@ -1,3 +1,5 @@
format binary as ""
use32
; standard header
db 'MENUET01' ; signature

View File

@ -1,3 +1,5 @@
format binary as ""
use32
; standard header
db 'MENUET01' ; signature