/programs/network/smtps/trunk/smtps.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/smtps/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/smtps/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/remote/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/remote/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/remote/trunk/remote.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/stackcfg/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/stackcfg/trunk/readme.txt |
---|
File deleted |
\ No newline at end of file |
/programs/network/stackcfg/trunk/stackcfg.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/stackcfg/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ethstat/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ethstat/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ethstat/trunk/ethstat.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/arpstat/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/arpstat/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/arpstat/trunk/arpstat.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/browser/build.sh |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/programs/network/browser/browser.asm |
---|
File deleted |
/programs/network/browser/build.bat |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/programs/network/rccc/trunk/rccc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/rccc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rccc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rccs/trunk/rccs.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/rccs/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rccs/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/mp3s/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/mp3s/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/mp3s/trunk/mp3s.asm |
---|
File deleted |
/programs/network/terminal/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/terminal/trunk/terminal.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/terminal/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ym/trunk/ym.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/ym/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ym/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/chess/trunk/chess.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/network/chess/trunk/chess.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/chess/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/chess/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/popc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/popc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/popc/trunk/popc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/local/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/local/trunk/local.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/local/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/VNCclient/logon.inc |
---|
File deleted |
/programs/network/VNCclient/ETH.INC |
---|
File deleted |
/programs/network/VNCclient/thread.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/VNCclient/copyrect.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/VNCclient/fdo.inc |
---|
File deleted |
/programs/network/VNCclient/raw.inc |
---|
File deleted |
/programs/network/VNCclient/VNCclient.asm |
---|
File deleted |
/programs/network/VNCclient/build.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/nntpc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/nntpc/trunk/nntpc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/nntpc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/tftpa/trunk/tftpa.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/tftpa/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/tftpa/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ppp/trunk/ppp.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/ppp/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ppp/trunk/chat.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/ppp/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/downloader/trunk/build.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/downloader/trunk/build.sh |
---|
File deleted |
/programs/network/downloader/trunk/downloader.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/https/trunk/https.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/https/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/https/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/dhcp/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/dhcp/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/dhcp/trunk/dhcp.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/airc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/airc/trunk/eth.inc |
---|
File deleted |
/programs/network/airc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/airc/trunk/airc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/airc/trunk/fdo.inc |
---|
File deleted |
/programs/network/ipc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ipc/trunk/ipc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/ipc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/STDCALL.INC |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/ssi_data.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/comp_data.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/ki.cfg |
---|
File deleted |
/programs/network/icq/trunk/parser.inc |
---|
File deleted |
/programs/network/icq/trunk/ssi.inc |
---|
File deleted |
/programs/network/icq/trunk/editbox.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/comp.inc |
---|
File deleted |
/programs/network/icq/trunk/cmdipc.inc |
---|
File deleted |
/programs/network/icq/trunk/build_ru.bat |
---|
File deleted |
/programs/network/icq/trunk/README.TXT |
---|
File deleted |
/programs/network/icq/trunk/dialogs1.inc |
---|
File deleted |
/programs/network/icq/trunk/config.inc |
---|
File deleted |
/programs/network/icq/trunk/proc32.inc |
---|
File deleted |
/programs/network/icq/trunk/ki.asm |
---|
File deleted |
/programs/network/icq/trunk/icons.inc |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/SSI_INFO.txt |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/lang.inc |
---|
File deleted |
/programs/network/icq/trunk/2000.inc |
---|
File deleted |
/programs/network/icq/trunk/macros.inc |
---|
File deleted |
/programs/network/icq/trunk/struct.inc |
---|
File deleted |
/programs/network/icq/trunk/parser_data.inc |
---|
File deleted |
/programs/network/icq/trunk/editbox.mac |
---|
File deleted |
\ No newline at end of file |
/programs/network/icq/trunk/dos2win.inc |
---|
File deleted |
/programs/network/icq/trunk/st_red.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/network/icq/trunk |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/network/icq |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/network/dnsr/trunk/dnsr.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/dnsr/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/dnsr/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/ftps/trunk/FTPS.ASM |
---|
File deleted |
/programs/network/ftps/trunk/build.bat |
---|
File deleted |
/programs/network/netsendc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/netsendc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/netsendc/trunk/netsendc.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/netsends/trunk/netsends.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/netsends/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/netsends/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/arpcfg/arpcfg.asm |
---|
0,0 → 1,156 |
; |
; ARPmanager for KolibriOS |
; |
; hidnplayr@gmail.com |
; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd IM_END ; size of image |
dd (I_END+0x100) ; memory for app |
dd (I_END+0x100) ; esp |
dd 0x0 , 0x0 ; I_Param , I_Icon |
include '../macros.inc' |
purge mov, add, sub |
include '../struct.inc' |
include '../network.inc' |
START: |
redraw: |
mcall 12, 1 |
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: |
mov edx, 50 shl 16 + 50 |
mov [last], 0 |
.loop: |
mcall 76, API_ARP + 3, [last],,, arp_buf |
cmp eax, -1 |
je mainloop |
mcall 4, edx, 0x80000000, str_entry |
mov edx, ebx |
mov eax, 47 |
mov ebx, 0x00030000 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
xor ecx, ecx |
mov cl, byte[arp_buf.IP+0] |
mcall |
mov cl, byte[arp_buf.IP+1] |
add edx, 24 shl 16 |
mcall |
mov cl, byte[arp_buf.IP+2] |
add edx, 24 shl 16 |
mcall |
mov cl, byte[arp_buf.IP+3] |
add edx, 24 shl 16 |
mcall |
mov ebx, 0x00020100 |
mov cl, byte[arp_buf.MAC+0] |
add edx, 36 shl 16 |
mcall |
mov cl, byte[arp_buf.MAC+1] |
add edx, 18 shl 16 |
mcall |
mov cl, byte[arp_buf.MAC+2] |
add edx, 18 shl 16 |
mcall |
mov cl, byte[arp_buf.MAC+3] |
add edx, 18 shl 16 |
mcall |
mov cl, byte[arp_buf.MAC+4] |
add edx, 18 shl 16 |
mcall |
mov cl, byte[arp_buf.MAC+5] |
add edx, 18 shl 16 |
mcall |
mov ebx, 0x00040000 |
mov cx, [arp_buf.status] |
add edx, 30 shl 16 |
mcall |
mov cx, [arp_buf.TTL] |
add edx, 60 shl 16 |
mcall |
add dx, 20 |
rol edx, 16 |
mov dx, 50 |
rol edx, 16 |
inc [last] |
jmp .loop |
mainloop: |
mcall 23,50 ; wait for event with timeout (0,5 s) |
cmp eax, 1 |
je redraw |
cmp eax, 2 |
je key |
cmp eax, 3 |
je button |
jmp draw_stats |
key: |
mcall 2 |
jmp mainloop |
button: ; button |
mcall 17 ; get id |
cmp ah, 1 |
je exit |
jmp redraw |
exit: |
mcall -1 |
; DATA AREA |
str_name db 'ARP manager', 0 |
str_legend db '# IP-address MAC-address Status TTL', 0 |
str_entry db ' . . . - - - - - s', 0 |
IM_END: |
last dd ? |
arp_buf ARP_entry |
I_END: |
/programs/network/arpcfg |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/config.inc |
---|
0,0 → 1,0 |
__CPU_type fix p5 |
/programs/network/debug-fdo.inc |
---|
0,0 → 1,422 |
; |
; Formatted Debug Output (FDO) |
; Copyright (c) 2005-2006, mike.dld |
; Created: 2005-01-29, Changed: 2006-11-10 |
; |
; For questions and bug reports, mail to mike.dld@gmail.com |
; |
; Available format specifiers are: %s, %d, %u, %x (with partial width support) |
; |
; to be defined: |
; __DEBUG__ equ 1 |
; __DEBUG_LEVEL__ equ 5 |
macro debug_func name { |
if used name |
name@of@func equ name |
} |
macro debug_beginf { |
align 4 |
name@of@func: |
} |
debug_endf fix end if |
macro DEBUGS _sign,[_str] { |
common |
local tp |
tp equ 0 |
match _arg:_num,_str \{ |
DEBUGS_N _sign,_num,_arg |
tp equ 1 |
\} |
match =0 _arg,tp _str \{ |
DEBUGS_N _sign,,_arg |
\} |
} |
macro DEBUGS_N _sign,_num,[_str] { |
common |
pushf |
pushad |
local ..str,..label,is_str |
is_str = 0 |
forward |
if _str eqtype '' |
is_str = 1 |
end if |
common |
if is_str = 1 |
jmp ..label |
..str db _str,0 |
..label: |
add esp,4*8+4 |
mov edx,..str |
sub esp,4*8+4 |
else |
mov edx,_str |
end if |
if ~_num eq |
if _num eqtype eax |
if _num in <eax,ebx,ecx,edx,edi,ebp,esp> |
mov esi,_num |
else if ~_num eq esi |
movzx esi,_num |
end if |
else if _num eqtype 0 |
mov esi,_num |
else |
local tp |
tp equ 0 |
match [_arg],_num \{ |
mov esi,dword[_arg] |
tp equ 1 |
\} |
match =0 =dword[_arg],tp _num \{ |
mov esi,dword[_arg] |
tp equ 1 |
\} |
match =0 =word[_arg],tp _num \{ |
movzx esi,word[_arg] |
tp equ 1 |
\} |
match =0 =byte[_arg],tp _num \{ |
movzx esi,byte[_arg] |
tp equ 1 |
\} |
match =0,tp \{ |
'Error: specified string width is incorrect' |
\} |
end if |
else |
mov esi,0x7FFFFFFF |
end if |
call fdo_debug_outstr |
popad |
popf |
} |
macro DEBUGD _sign,_dec { |
local tp |
tp equ 0 |
match _arg:_num,_dec \{ |
DEBUGD_N _sign,_num,_arg |
tp equ 1 |
\} |
match =0 _arg,tp _dec \{ |
DEBUGD_N _sign,,_arg |
\} |
} |
macro DEBUGD_N _sign,_num,_dec { |
pushf |
pushad |
if (~_num eq) |
if (_dec eqtype eax | _dec eqtype 0) |
'Error: precision allowed only for in-memory variables' |
end if |
if (~_num in <1,2,4>) |
if _sign |
'Error: 1, 2 and 4 are only allowed for precision in %d' |
else |
'Error: 1, 2 and 4 are only allowed for precision in %u' |
end if |
end if |
end if |
if _dec eqtype eax |
if _dec in <ebx,ecx,edx,esi,edi,ebp,esp> |
mov eax,_dec |
else if ~_dec eq eax |
if _sign = 1 |
movsx eax,_dec |
else |
movzx eax,_dec |
end if |
end if |
else if _dec eqtype 0 |
mov eax,_dec |
else |
add esp,4*8+4 |
if _num eq |
mov eax,dword _dec |
else if _num = 1 |
if _sign = 1 |
movsx eax,byte _dec |
else |
movzx eax,byte _dec |
end if |
else if _num = 2 |
if _sign = 1 |
movsx eax,word _dec |
else |
movzx eax,word _dec |
end if |
else |
mov eax,dword _dec |
end if |
sub esp,4*8+4 |
end if |
mov cl,_sign |
call fdo_debug_outdec |
popad |
popf |
} |
macro DEBUGH _sign,_hex { |
local tp |
tp equ 0 |
match _arg:_num,_hex \{ |
DEBUGH_N _sign,_num,_arg |
tp equ 1 |
\} |
match =0 _arg,tp _hex \{ |
DEBUGH_N _sign,,_arg |
\} |
} |
macro DEBUGH_N _sign,_num,_hex { |
pushf |
pushad |
if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>) |
'Error: 1..8 are only allowed for precision in %x' |
end if |
if _hex eqtype eax |
if _hex in <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
if ~_hex eq eax |
mov eax,_hex |
end if |
else if _hex in <ax,bx,cx,dx,si,di,bp,sp> |
if ~_hex eq ax |
movzx eax,_hex |
end if |
shl eax,16 |
if (_num eq) |
mov edx,4 |
end if |
else if _hex in <al,ah,bl,bh,cl,ch,dl,dh> |
if ~_hex eq al |
movzx eax,_hex |
end if |
shl eax,24 |
if (_num eq) |
mov edx,2 |
end if |
end if |
else if _hex eqtype 0 |
mov eax,_hex |
else |
add esp,4*8+4 |
mov eax,dword _hex |
sub esp,4*8+4 |
end if |
if ~_num eq |
mov edx,_num |
else |
mov edx,8 |
end if |
call fdo_debug_outhex |
popad |
popf |
} |
;----------------------------------------------------------------------------- |
debug_func fdo_debug_outchar |
debug_beginf |
pushad |
mov cl,al |
mov ebx,1 |
mov eax,63 |
mcall |
popad |
ret |
debug_endf |
debug_func fdo_debug_outstr |
debug_beginf |
mov eax,63 |
mov ebx,1 |
.l1: dec esi |
js .l2 |
mov cl,[edx] |
or cl,cl |
jz .l2 |
mcall |
inc edx |
jmp .l1 |
.l2: ret |
debug_endf |
debug_func fdo_debug_outdec |
debug_beginf |
or cl,cl |
jz @f |
or eax,eax |
jns @f |
neg eax |
push eax |
mov al,'-' |
call fdo_debug_outchar |
pop eax |
@@: push 10 |
pop ecx |
push -'0' |
.l1: xor edx,edx |
div ecx |
push edx |
test eax,eax |
jnz .l1 |
.l2: pop eax |
add al,'0' |
jz .l3 |
call fdo_debug_outchar |
jmp .l2 |
.l3: ret |
debug_endf |
debug_func fdo_debug_outhex |
__fdo_hexdigits db '0123456789ABCDEF' |
debug_beginf |
mov cl,dl |
neg cl |
add cl,8 |
shl cl,2 |
rol eax,cl |
.l1: rol eax,4 |
push eax |
and eax,0x0000000F |
mov al,[__fdo_hexdigits+eax] |
call fdo_debug_outchar |
pop eax |
dec edx |
jnz .l1 |
ret |
debug_endf |
;----------------------------------------------------------------------------- |
macro DEBUGF _level,_format,[_arg] { |
common |
if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__ |
local ..f1,f2,a1,a2,c1,c2,c3,..lbl |
_debug_str_ equ __debug_str_ # a1 |
a1 = 0 |
c2 = 0 |
c3 = 0 |
f2 = 0 |
repeat ..lbl-..f1 |
virtual at 0 |
db _format,0,0 |
load c1 word from %-1 |
end virtual |
if c1 = '%s' |
virtual at 0 |
db _format,0,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS 0,_debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
DEBUGF_HELPER S,a1,0,_arg |
else if c1 = '%x' |
virtual at 0 |
db _format,0,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS 0,_debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
DEBUGF_HELPER H,a1,0,_arg |
else if c1 = '%d' | c1 = '%u' |
local c4 |
if c1 = '%d' |
c4 = 1 |
else |
c4 = 0 |
end if |
virtual at 0 |
db _format,0,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS 0,_debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
DEBUGF_HELPER D,a1,c4,_arg |
else if c1 = '\n' |
c3 = c3 + 1 |
end if |
end repeat |
virtual at 0 |
db _format,0,0 |
load c1 from f2-c2 |
end virtual |
if (c1<>0)&(f2<>..lbl-..f1-1) |
DEBUGS 0,_debug_str_+f2-c2 |
end if |
virtual at 0 |
..f1 db _format,0 |
..lbl: |
__debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3 |
end virtual |
end if |
} |
macro __include_debug_strings dummy,[_id,_fmt,_len] { |
common |
local c1,a1,a2 |
forward |
if defined _len & ~_len eq |
_id: |
a1 = 0 |
a2 = 0 |
repeat _len |
virtual at 0 |
db _fmt,0,0 |
load c1 word from %+a2-1 |
end virtual |
if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u') |
db 0 |
a2 = a2 + 1 |
else if (c1='\n') |
dw $0A0D |
a1 = a1 + 1 |
a2 = a2 + 1 |
else |
db c1 and 0x0FF |
end if |
end repeat |
db 0 |
end if |
} |
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] { |
common |
local num |
num = 0 |
forward |
if num = _num |
DEBUG#_letter _sign,_arg |
end if |
num = num+1 |
common |
_num = _num+1 |
} |
macro include_debug_strings { |
if __DEBUG__ = 1 |
match dbg_str,__debug_strings \{ |
__include_debug_strings dbg_str |
\} |
end if |
} |
/programs/network/dll.inc |
---|
0,0 → 1,160 |
;----------------------------------------------------------------------------- |
proc mem.Alloc size ;///////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push ebx ecx |
mov eax,[size] |
lea ecx,[eax+4+4095] |
and ecx, not 4095 |
mcall 68,12 |
test eax, eax |
jz @f |
add ecx,-4 |
mov [eax],ecx |
add eax,4 |
@@: |
pop ecx ebx |
ret |
endp |
;----------------------------------------------------------------------------- |
proc mem.ReAlloc mptr,size;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push ebx ecx esi edi eax |
mov eax,[mptr] |
mov ebx,[size] |
or eax,eax |
jz @f |
lea ecx,[ebx+4+4095] |
and ecx,not 4095 |
add ecx,-4 |
cmp ecx,[eax-4] |
je .exit |
@@: mov eax,ebx |
call mem.Alloc |
xchg eax,[esp] |
or eax,eax |
jz .exit |
mov esi,eax |
xchg eax,[esp] |
mov edi,eax |
mov ecx,[esi-4] |
cmp ecx,[edi-4] |
jbe @f |
mov ecx,[edi-4] |
@@: add ecx,3 |
shr ecx,2 |
cld |
rep movsd |
xchg eax,[esp] |
call mem.Free |
.exit: |
pop eax edi esi ecx ebx |
ret |
endp |
;----------------------------------------------------------------------------- |
proc mem.Free mptr ;////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov eax,[mptr] |
or eax,eax |
jz @f |
push ebx ecx |
lea ecx,[eax-4] |
mcall 68,13 |
pop ecx ebx |
@@: ret |
endp |
proc dll.Load, import_table:dword |
mov esi,[import_table] |
.next_lib: mov edx,[esi] |
or edx,edx |
jz .exit |
push esi |
mov esi,[esi+4] |
mov edi,s_libdir.fname |
@@: lodsb |
stosb |
or al,al |
jnz @b |
mcall 68,19,s_libdir |
or eax,eax |
jz .fail |
stdcall dll.Link,eax,edx |
stdcall dll.Init,[eax+4] |
pop esi |
add esi,8 |
jmp .next_lib |
.exit: xor eax,eax |
ret |
.fail: add esp,4 |
xor eax,eax |
inc eax |
ret |
endp |
proc dll.Link, exp:dword,imp:dword |
push eax |
mov esi,[imp] |
test esi,esi |
jz .done |
.next: lodsd |
test eax,eax |
jz .done |
stdcall dll.GetProcAddress,[exp],eax |
or eax,eax |
jz @f |
mov [esi-4],eax |
jmp .next |
@@: mov dword[esp],0 |
.done: pop eax |
ret |
endp |
proc dll.Init, dllentry:dword |
pushad |
mov eax,mem.Alloc |
mov ebx,mem.Free |
mov ecx,mem.ReAlloc |
mov edx,dll.Load |
stdcall [dllentry] |
popad |
ret |
endp |
proc dll.GetProcAddress, exp:dword,sz_name:dword |
mov edx,[exp] |
xor eax,eax |
.next: or edx,edx |
jz .end |
cmp dword[edx],0 |
jz .end |
stdcall strcmp,[edx],[sz_name] |
test eax,eax |
jz .ok |
add edx,8 |
jmp .next |
.ok: mov eax,[edx+4] |
.end: ret |
endp |
proc strcmp, str1:dword,str2:dword |
push esi edi |
mov esi,[str1] |
mov edi,[str2] |
xor eax,eax |
@@: lodsb |
scasb |
jne .fail |
or al,al |
jnz @b |
jmp .ok |
.fail: or eax,-1 |
.ok: pop edi esi |
ret |
endp |
s_libdir: |
db '/sys/lib/' |
.fname rb 32 |
/programs/network/ftpd/commands.inc |
---|
0,0 → 1,1135 |
struct thread_data |
rb 1024 |
stack rb 0 |
home_dir rb 1024 ; home directory in wich the user is locked, asciiz |
work_dir rb 1024 ; working directory, must at all times begin and end with a '/', asciiz |
fpath rb 1024*3 ; file path, combination of home_dir, work_dir and filename |
; Will also be used to temporarily store username |
type db ? ; ASCII/EBDIC/IMAGE/.. |
mode db ? ; active/passive |
socketnum dd ? ; Commands socket |
state dd ? ; disconnected/logging in/logged in/.. |
passivesocknum dd ? ; when in passive mode, this is the listening socket |
datasocketnum dd ? ; socket used for data transfers |
permissions dd ? ; read/write/execute/.... |
buffer_ptr dd ? |
pid dd ? ; Process id of the current thread |
datasock sockaddr_in |
buffer rb BUFFERSIZE |
ends |
;------------------------------------------------ |
; parse_cmd |
; |
; Internal function wich uses the 'commands' |
; table to call an appropriate cmd_xx function. |
; |
; input: esi = ptr to ascii commands |
; ecx = number of bytes input |
; ebp = pointer to thread_data structure |
; |
; output: none |
; |
;------------------------------------------------ |
align 4 |
parse_cmd: ; esi must point to command |
cmp byte [esi], 0x20 ; skip all leading characters |
ja .ok |
inc esi |
dec ecx |
cmp ecx, 3 |
jb .error |
jmp parse_cmd |
.ok: |
cmp byte [esi+3], 0x20 |
ja @f |
mov byte [esi+3], 0 |
@@: |
mov eax, [esi] |
and eax, not 0x20202020 ; convert to upper case |
mov edi, commands ; list of commands to scan |
.scanloop: |
cmp eax, [edi] |
je .got_it |
add edi, 5*4 |
cmp byte [edi], 0 |
jne .scanloop |
.error: |
cmp [ebp + thread_data.state], STATE_ACTIVE |
jb login_first |
sendFTP "500 Unsupported command" |
ret |
.got_it: |
mov eax, [ebp + thread_data.state] |
jmp dword [edi + 4 + eax] |
align 4 |
iglobal |
commands: ; all commands must be in uppercase |
dd 'ABOR', login_first, login_first, login_first, cmdABOR |
; dd 'ACCT', login_first, login_first, login_first, cmd_ACCT |
; dd 'APPE', login_first, login_first, login_first, cmd_APPE |
dd 'CDUP', login_first, login_first, login_first, cmdCDUP |
dd 'CWD', login_first, login_first, login_first, cmdCWD |
dd 'DELE', login_first, login_first, login_first, cmdDELE |
; dd 'HELP', login_first, login_first, login_first, cmd_HELP |
dd 'LIST', login_first, login_first, login_first, cmdLIST |
; dd 'MDTM', login_first, login_first, login_first, cmd_MDTM |
; dd 'MKD', login_first, login_first, login_first, cmd_MKD |
; dd 'MODE', login_first, login_first, login_first, cmd_MODE |
dd 'NLST', login_first, login_first, login_first, cmdNLST |
dd 'NOOP', login_first, login_first, login_first, cmdNOOP |
dd 'PASS', cmdPASS.0, cmdPASS , cmdPASS.2, cmdPASS.3 |
dd 'PASV', login_first, login_first, login_first, cmdPASV |
dd 'PORT', login_first, login_first, login_first, cmdPORT |
dd 'PWD', login_first, login_first, login_first, cmdPWD |
dd 'QUIT', cmdQUIT, cmdQUIT, cmdQUIT, cmdQUIT |
; dd 'REIN', login_first, login_first, login_first, cmd_REIN |
; dd 'REST', login_first, login_first, login_first, cmd_REST |
dd 'RETR', login_first, login_first, login_first, cmdRETR |
; dd 'RMD', login_first, login_first, login_first, cmd_RMD |
; dd 'RNFR', login_first, login_first, login_first, cmd_RNFR |
; dd 'RNTO', login_first, login_first, login_first, cmd_RNTO |
; dd 'SITE', login_first, login_first, login_first, cmd_SITE |
; dd 'SIZE', login_first, login_first, login_first, cmd_SIZE |
; dd 'STAT', login_first, login_first, login_first, cmd_STAT |
dd 'STOR', login_first, login_first, login_first, cmdSTOR |
; dd 'STOU', login_first, login_first, login_first, cmd_STOU |
; dd 'STRU', login_first, login_first, login_first, cmd_STRU |
dd 'SYST', login_first, login_first, login_first, cmdSYST |
dd 'TYPE', login_first, login_first, login_first, cmdTYPE |
dd 'USER', cmdUSER, cmdUSER, cmdUSER, cmdUSER.2 |
db 0 ; end marker |
endg |
align 4 |
login_first: |
sendFTP "530 Please login with USER and PASS" |
ret |
align 4 |
permission_denied: |
sendFTP "550 Permission denied" |
ret |
align 4 |
socketerror: |
invoke con_set_flags, 0x0c |
invoke con_write_asciiz, str_sockerr |
invoke con_set_flags, 0x07 |
sendFTP "425 Can't open data connection" |
ret |
align 4 |
abort_transfer: |
and [ebp + thread_data.permissions], not ABORT |
mov [ebp + thread_data.mode], MODE_NOTREADY |
invoke file.close, ebx |
mcall close, [ebp + thread_data.datasocketnum] |
sendFTP "530 Transfer aborted" |
ret |
align 4 |
ip_to_dword: ; esi = ptr to str, cl = separator ('.', ',') |
call ascii_to_byte |
mov bl, al |
cmp byte [esi], cl |
jne .err |
inc esi |
call ascii_to_byte |
mov bh, al |
cmp byte [esi], cl |
jne .err |
inc esi |
shl ebx, 16 |
call ascii_to_byte |
mov bl, al |
cmp byte [esi], cl |
jne .err |
inc esi |
call ascii_to_byte |
mov bh, al |
ror ebx, 16 |
ret |
.err: |
xor ebx, ebx |
ret |
align 4 ; esi = ptr to str, output in eax |
ascii_to_byte: |
xor eax, eax |
push ebx |
.loop: |
movzx ebx, byte[esi] |
sub bl, '0' |
jb .done |
cmp bl, 9 |
ja .done |
lea eax, [eax*4 + eax] ; |
shl eax, 1 ; eax = eax * 10 |
add eax, ebx |
inc esi |
jmp .loop |
.done: |
pop ebx |
ret |
align 4 |
dword_to_ascii: ; edi = ptr where to write, eax is number |
push edx ebx ecx |
mov ebx, 10 |
xor ecx, ecx |
@@: |
xor edx, edx |
div ebx |
add edx, '0' |
pushw dx |
inc ecx |
test eax, eax |
jnz @r |
@@: |
popw ax |
stosb |
dec ecx |
jnz @r |
pop ecx ebx edx |
ret |
align 4 |
create_path: ; combine home_dir and work_dir strings into fpath |
lea edi, [ebp + thread_data.fpath] |
lea esi, [ebp + thread_data.home_dir] |
mov ecx, 1024 |
.loop1: |
lodsb |
cmp al, 0x20 |
jb .next |
stosb |
loop .loop1 |
.next: |
cmp byte[edi-1], '/' |
jne @f |
dec edi |
@@: |
lea esi, [ebp + thread_data.work_dir] |
mov ecx, 1024 |
.loop2: |
lodsb |
cmp al, 0x20 |
jb .done |
stosb |
loop .loop2 |
.done: |
xor al, al |
stosb |
ret |
align 4 |
nextpasvport: |
inc [pasv_port] |
mov ax, [pasv_port] |
cmp ax, [pasv_start] |
jb .restart |
cmp ax, [pasv_end] |
ja .restart |
ret |
.restart: |
pushw [pasv_start] |
popw [pasv_port] |
ret |
align 4 |
open_datasock: |
cmp [ebp + thread_data.mode], MODE_PASSIVE_OK |
je .start |
; If we are in active mode, it's time to open a data socket.. |
cmp [ebp + thread_data.mode], MODE_ACTIVE |
jne .not_active |
mov ecx, [ebp + thread_data.datasocketnum] |
lea edx, [ebp + thread_data.datasock] |
mov esi, sizeof.thread_data.datasock |
mcall connect |
cmp eax, -1 |
jne .start |
.socketerror: |
add esp, 4 |
jmp socketerror |
; If we are still in passive_wait, it's time we accept an incomming call.. |
.not_active: |
cmp [ebp + thread_data.mode], MODE_PASSIVE_WAIT |
jne .socketerror |
.try_now: |
mov ecx, [ebp + thread_data.passivesocknum] |
lea edx, [ebp + thread_data.datasock] |
mov esi, sizeof.thread_data.datasock |
mcall accept |
cmp eax, -1 |
jne .pasv_ok |
mov [ebp + thread_data.mode], MODE_PASSIVE_FAILED ; assume that we will fail |
mcall 23, 200 |
mcall accept |
cmp eax, -1 |
je .socketerror |
.pasv_ok: |
mov [ebp + thread_data.datasocketnum], eax |
mov [ebp + thread_data.mode], MODE_PASSIVE_OK |
mcall close ; [ebp + thread_data.passivesocknum] |
mov [ebp + thread_data.passivesocknum], -1 |
invoke con_write_asciiz, str_datasock |
.start: |
ret |
;------------------------------------------------ |
; "ABOR" |
; |
; This command aborts the current filetransfer. |
; |
;------------------------------------------------ |
align 4 |
cmdABOR: |
or [ebp + thread_data.permissions], ABORT |
sendFTP "250 Command succesul" |
ret |
;------------------------------------------------ |
; "CDUP" |
; |
; Change the directory to move up one level. |
; |
;------------------------------------------------ |
align 4 |
cmdCDUP: |
test [ebp + thread_data.permissions], PERMISSION_CD |
jz permission_denied |
cmp byte [ebp + thread_data.work_dir+1], 0 ; are we in "/" ? |
je .done ; if so, we cant go up.. |
; find the end of asciiz string work_dir |
mov ecx, 1024 |
xor al, al |
lea edi, [ebp + thread_data.work_dir] |
repne scasb |
; return 2 characters (right before last /) |
sub edi, 3 |
; and now search backwards, for a '/' |
mov al,'/' |
neg ecx |
add ecx, 1024 |
std |
repne scasb |
cld |
; terminate the string here |
mov byte[edi+2], 0 |
.done: |
; Print the new working dir on the console |
lea eax, [ebp + thread_data.work_dir] |
invoke con_write_asciiz, eax |
invoke con_write_asciiz, str_newline |
sendFTP "250 Command succesul" |
ret |
;------------------------------------------------ |
; "CWD" |
; |
; Change Working Directory. |
; |
;------------------------------------------------ |
align 4 |
cmdCWD: |
test [ebp + thread_data.permissions], PERMISSION_CD |
jz permission_denied |
; do we have enough parameters? |
sub ecx, 4 |
jbe .err |
; get ready to copy the path |
add esi, 4 |
mov ecx, 1024 |
lea edi, [ebp + thread_data.work_dir] |
; if received dir starts with '/', we will simply copy it |
; If not, we will append the current path with the received path. |
cmp byte [esi], '/' |
je .copyloop |
; Find the end of work_dir string. |
xor al, al |
.find_zero: |
repne scasb |
dec edi |
; and now append work_dir with received string |
mov ecx, 1024 |
; scan for end byte, or '.' |
.copyloop: |
lodsb |
cmp al, 0x20 |
jb .done |
;;; cmp al, '.' ; '..' means we must go up one dir TODO |
;;; je .up |
stosb |
loop .copyloop |
; now, now make sure it ends with '/', 0 |
.done: |
cmp byte [edi-1], '/' |
je @f |
mov byte [edi], '/' |
inc edi |
@@: |
mov byte [edi], 0 |
; Print the new working dir on the console |
lea eax, [ebp + thread_data.work_dir] |
invoke con_write_asciiz, eax |
invoke con_write_asciiz, str_newline |
sendFTP "250 Command succesful" |
ret |
.err: |
sendFTP "550 Directory does not exist" |
ret |
;------------------------------------------------ |
; "DELE" |
; |
; Delete a file from the server. |
; |
;------------------------------------------------ |
align 4 |
cmdDELE: |
test [ebp + thread_data.permissions], PERMISSION_DELETE |
jz permission_denied |
ret |
;------------------------------------------------ |
; "LIST" |
; |
; List the files in the current working directory. |
; |
;------------------------------------------------ |
align 4 |
cmdLIST: |
test [ebp + thread_data.permissions], PERMISSION_EXEC |
jz permission_denied |
call open_datasock |
; Create fpath from home_dir and work_dir |
call create_path |
lea ebx, [ebp + thread_data.fpath] |
invoke con_write_asciiz, ebx |
invoke con_write_asciiz, str_newline |
; Start the search |
invoke file.find.first, ebx, str_mask, FA_READONLY+FA_FOLDER+FA_ARCHIVED;+FA_NORMAL |
test eax, eax |
jz .nosuchdir |
lea edi, [ebp + thread_data.buffer] |
.parse_file: |
test eax, eax ; did we find a file? |
jz .done |
mov ebx, eax ; yes, save the descripter in ebx |
; first, convert the attributes |
test [ebx + FileInfoA.Attributes], FA_FOLDER |
jnz .folder |
test [ebx + FileInfoA.Attributes], FA_READONLY |
jnz .readonly |
mov eax, '-rw-' |
stosd |
jmp .attr |
.folder: |
mov eax, 'drwx' |
stosd |
jmp .attr |
.readonly: |
mov eax, '-r--' |
stosd |
.attr: |
mov eax, 'rw-r' |
stosd |
mov ax, 'w-' |
stosw |
mov al, ' ' |
stosb |
; now.. |
mov ax, '1 ' |
stosw |
; now write owner, everything is owned by FTP, woohoo! |
mov eax, 'FTP ' |
stosd |
stosd |
; now the filesize in ascii |
mov eax, [ebx + FileInfoA.FileSizeLow] |
call dword_to_ascii |
mov al, ' ' |
stosb |
; then date (month/day/year) |
movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.month] |
cmp eax, 12 |
ja @f |
mov eax, [months - 4 + 4*eax] |
stosd |
@@: |
movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.day] |
call dword_to_ascii |
mov al, ' ' |
stosb |
movzx eax, [ebx + FileInfoA.DateModify + FileDateTime.year] |
call dword_to_ascii |
mov al, ' ' |
stosb |
; and last but not least, filename |
lea esi, [ebx + FileInfoA.FileName] |
mov ecx, 264 |
.nameloop: |
lodsb |
test al, al |
jz .namedone |
stosb |
loop .nameloop |
; insert a cr lf |
.namedone: |
mov ax, 0x0a0d |
stosw |
test [ebp + thread_data.permissions], ABORT ; Did we receive ABOR command from client? |
jnz abort_transfer |
; check next file |
invoke file.find.next, ebx |
jmp .parse_file |
; close file desc |
.done: |
invoke file.find.close, ebx ; ebx is descriptor of last file, eax will be -1 !! |
; append the string with a 0 |
xor al, al |
stosb |
; Warn the client we're about to send the data |
push edi |
sendFTP "150 Here it comes.." |
pop esi |
; and send it to the client |
mov ecx, [ebp + thread_data.datasocketnum] ; socket num |
lea edx, [ebp + thread_data.buffer] ; buffer ptr |
sub esi, edx ; length |
xor edi, edi ; flags |
mcall send |
; close the data socket.. |
mov [ebp + thread_data.mode], MODE_NOTREADY |
mcall close, [ebp + thread_data.datasocketnum] |
sendFTP "226 Transfer OK" |
ret |
.nosuchdir: |
sendFTP "550 Directory does not exist" |
ret |
;------------------------------------------------ |
; "NLST" |
; |
; List the filenames of the files in the current working directory. |
; |
;------------------------------------------------ |
align 4 |
cmdNLST: |
test [ebp + thread_data.permissions], PERMISSION_EXEC |
jz permission_denied |
; TODO: same as list but simpler output format |
ret |
;------------------------------------------------ |
; "NOOP" |
; |
; No operation, just keep the connection alive. |
; |
;------------------------------------------------ |
align 4 |
cmdNOOP: |
sendFTP "200 Command OK" |
ret |
;------------------------------------------------ |
; "PASS" |
; |
; Second phase of login process, client provides password. |
; |
;------------------------------------------------ |
align 4 |
cmdPASS: |
; read the password from users.ini |
lea edi, [ebp + thread_data.buffer + 512] ; temp pass |
lea ebx, [ebp + thread_data.fpath] ; temp username |
invoke ini.get_str, path2, ebx, str_pass, edi, 512, str_infinity |
test eax, eax ; unable to read password? fail! |
jnz .incorrect |
cmp dword [edi], -1 ; no key, section or file found.. fail! |
je .incorrect |
cmp byte [edi], 0 ; zero password? ok! |
je .ok |
add esi, 5 |
sub ecx, 5 |
jbe .incorrect ; no password given? but hey, we need one! fail.. |
; compare with received password |
repe cmpsb |
cmp byte [esi-1], 0x20 ; printeable characters left? |
jae .incorrect |
cmp byte [edi-1], 0 |
jne .incorrect |
.ok: |
invoke ini.get_int, path2, ebx, str_mode, 0 |
mov [ebp + thread_data.permissions], eax |
invoke con_write_asciiz, str_pass_ok |
mov [ebp + thread_data.state], STATE_ACTIVE |
sendFTP "230 You are now logged in" |
ret |
.2: |
.incorrect: |
invoke con_write_asciiz, str_pass_err |
mov [ebp + thread_data.state], STATE_CONNECTED ; reset state |
sendFTP "530 Login incorrect" |
ret |
.0: |
sendFTP "503 Login with USER first" |
ret |
.3: |
sendFTP "230 Already logged in" |
ret |
;------------------------------------------------ |
; "PASV" |
; |
; Initiate a passive dataconnection. |
; |
;------------------------------------------------ |
align 4 |
cmdPASV: |
; cmp [ebp + thread_data.passivesocknum], -1 |
; je @f |
; mcall close, [ebp + thread_data.passivesocknum] ; if there is still a socket open, close it |
; @@: |
; Open a new TCP socket |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
je socketerror |
mov [ebp + thread_data.passivesocknum], eax |
; Bind it to a known local port |
mov [ebp + thread_data.datasock.sin_family], AF_INET4 |
mov [ebp + thread_data.datasock.sin_addr], 0 |
mov ecx, eax ; passivesocketnum |
lea edx, [ebp + thread_data.datasock] |
mov esi, sizeof.thread_data.datasock |
.next_port: ; TODO: break the endless loop |
call nextpasvport |
mov ax, [pasv_port] |
xchg al, ah |
mov [ebp + thread_data.datasock.sin_port], ax |
mcall bind |
cmp eax, -1 |
je .next_port |
; And set it to listen! |
mcall listen, , 1 |
cmp eax, -1 |
je socketerror |
; Tell our thread we are ready to accept incoming calls |
mov [ebp + thread_data.mode], MODE_PASSIVE_WAIT |
; Now tell the client where to connect to in this format: |
; 227 Entering Passive Mode (a1,a2,a3,a4,p1,p2) |
; where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number. |
; '227 (' |
lea edi, [ebp + thread_data.buffer] |
mov eax, '227 ' |
stosd |
mov al, '(' |
stosb |
; ip |
movzx eax, byte [serverip] |
call dword_to_ascii |
mov al, ',' |
stosb |
movzx eax, byte [serverip+1] |
call dword_to_ascii |
mov al, ',' |
stosb |
movzx eax, byte [serverip+2] |
call dword_to_ascii |
mov al, ',' |
stosb |
movzx eax, byte [serverip+3] |
call dword_to_ascii |
mov al, ',' |
stosb |
; port |
movzx eax, byte [ebp + thread_data.datasock.sin_port] |
call dword_to_ascii |
mov al, ',' |
stosb |
movzx eax, byte [ebp + thread_data.datasock.sin_port+1] |
call dword_to_ascii |
; ')', 13, 10, 0 |
mov eax, ')' + 0x000a0d00 |
stosd |
lea esi, [edi - thread_data.buffer] |
sub esi, ebp |
mov ecx, [ebp + thread_data.socketnum] |
lea edx, [ebp + thread_data.buffer] |
xor edi, edi |
mcall send |
ret |
;------------------------------------------------ |
; "PWD" |
; |
; Print the current working directory. |
; |
;------------------------------------------------ |
align 4 |
cmdPWD: |
mov dword [ebp + thread_data.buffer], '257 ' |
mov byte [ebp + thread_data.buffer+4], '"' |
lea edi, [ebp + thread_data.buffer+5] |
lea esi, [ebp + thread_data.work_dir] |
mov ecx, 1024 |
.loop: |
lodsb |
or al, al |
jz .ok |
stosb |
dec ecx |
jnz .loop |
.ok: |
mov dword [edi], '"' + 0x000a0d00 ; '"',13,10,0 |
lea esi, [edi - thread_data.buffer + 4] |
sub esi, ebp |
mov ecx, [ebp + thread_data.socketnum] |
lea edx, [ebp + thread_data.buffer] |
xor edi, edi |
mcall send |
; Print the new working dir on the console |
lea eax, [ebp + thread_data.work_dir] |
invoke con_write_asciiz, eax |
invoke con_write_asciiz, str_newline |
ret |
;------------------------------------------------ |
; "PORT" |
; |
; Initiate an active dataconnection. |
; |
;------------------------------------------------ |
align 4 |
cmdPORT: |
; PORT a1,a2,a3,a4,p1,p2 |
; IP address a1.a2.a3.a4, port p1*256+p2 |
; Convert the IP |
lea esi, [esi+5] |
mov cl, ',' |
call ip_to_dword |
; And put it in datasock |
mov [ebp + thread_data.datasock.sin_addr], ebx |
; Now the same with portnumber |
inc esi |
call ascii_to_byte |
mov byte[ebp + thread_data.datasock.sin_port], al |
inc esi |
call ascii_to_byte |
mov byte[ebp + thread_data.datasock.sin_port+1], al |
; We will open the socket, but do not connect yet! |
mov [ebp + thread_data.datasock.sin_family], AF_INET4 |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
je socketerror |
mov [ebp + thread_data.datasocketnum], eax |
mov [ebp + thread_data.mode], MODE_ACTIVE |
sendFTP "225 Data connection open" |
ret |
;------------------------------------------------ |
; "QUIT" |
; |
; Close the connection with client. |
; |
;------------------------------------------------ |
align 4 |
cmdQUIT: |
sendFTP "221 Bye!" |
mcall close, [ebp + thread_data.datasocketnum] |
mcall close, [ebp + thread_data.socketnum] |
add esp, 4 ; get rid of call return address |
jmp thread_exit ; now close this thread |
;------------------------------------------------ |
; "RETR" |
; |
; Retrieve a file from the ftp server. |
; |
;------------------------------------------------ |
align 4 |
cmdRETR: |
test [ebp + thread_data.permissions], PERMISSION_READ |
jz permission_denied |
cmp ecx, 1024 + 5 |
jae .cannot_open |
sub ecx, 5 |
jb .cannot_open |
call open_datasock |
call create_path |
dec edi |
lea esi, [ebp + thread_data.buffer + 5] |
mov ecx, 1024 |
cmp byte [esi], '/' |
jne .loop |
inc esi |
.loop: |
lodsb |
cmp al, 0x20 |
jl .done |
stosb |
loop .loop |
.done: |
xor al, al |
stosb |
lea ebx, [ebp + thread_data.fpath] |
invoke con_write_asciiz, ebx |
invoke con_write_asciiz, str_newline |
invoke file.open, ebx, O_READ |
test eax, eax |
jz .cannot_open |
push eax |
sendFTP "150 Here it comes.." |
pop ebx |
.read_more: |
test [ebp + thread_data.permissions], ABORT |
jnz abort_transfer |
lea eax, [ebp + thread_data.buffer] ; FIXME: use another buffer!! if we receive something on control connection now, we screw up! |
invoke file.read, ebx, eax, BUFFERSIZE |
cmp eax, -1 |
je .cannot_open ; FIXME: this is not the correct error |
invoke con_write_asciiz, str2 |
push eax ebx |
mov esi, eax |
mov ecx, [ebp + thread_data.datasocketnum] |
lea edx, [ebp + thread_data.buffer] |
xor edi, edi |
mcall send |
pop ebx ecx |
cmp eax, -1 |
je socketerror ; FIXME: not the correct error |
; cmp eax, ecx |
; jne not_all_byes_sent ; TODO |
cmp ecx, BUFFERSIZE |
je .read_more |
invoke file.close, ebx |
invoke con_write_asciiz, str2b |
mov [ebp + thread_data.mode], MODE_NOTREADY |
mcall close, [ebp + thread_data.datasocketnum] |
sendFTP "226 Transfer OK, closing connection" |
ret |
.cannot_open: |
invoke con_set_flags, 0x0c |
invoke con_write_asciiz, str_notfound |
invoke con_set_flags, 0x07 |
sendFTP "550 No such file" |
ret |
;------------------------------------------------ |
; "STOR" |
; |
; Store a file on the server. |
; |
;------------------------------------------------ |
align 4 |
cmdSTOR: |
test [ebp + thread_data.permissions], PERMISSION_WRITE |
jz permission_denied |
;;;; |
test [ebp + thread_data.permissions], ABORT |
jnz abort_transfer |
;;;; |
ret |
;------------------------------------------------ |
; "SYST" |
; |
; Send information about the system. |
; |
;------------------------------------------------ |
align 4 |
cmdSYST: |
sendFTP "215 UNIX type: L8" |
ret |
;------------------------------------------------ |
; "TYPE" |
; |
; Choose the file transfer type. |
; |
;------------------------------------------------ |
align 4 |
cmdTYPE: |
cmp ecx, 6 |
jb parse_cmd.error |
mov al, byte[esi+5] |
and al, not 0x20 |
cmp al, 'A' |
je .ascii |
cmp al, 'E' |
je .ebdic |
cmp al, 'I' |
je .image |
cmp al, 'L' |
je .local |
jmp parse_cmd.error |
.ascii: |
mov [ebp + thread_data.type], TYPE_ASCII |
jmp .subtype |
.ebdic: |
mov [ebp + thread_data.type], TYPE_EBDIC |
.subtype: |
cmp ecx, 8 |
jb .non_print |
mov al, byte[esi+7] |
and al, not 0x20 |
cmp al, 'N' |
je .non_print |
cmp al, 'T' |
je .telnet |
cmp al, 'C' |
je .asacc |
cmp al, 0x20 |
jb .non_print |
jmp parse_cmd.error |
.non_print: |
or [ebp + thread_data.type], TYPE_NP |
jmp .ok |
.telnet: |
or [ebp + thread_data.type], TYPE_TELNET |
jmp .ok |
.asacc: |
or [ebp + thread_data.type], TYPE_ASA |
jmp .ok |
.image: |
mov [ebp + thread_data.type], TYPE_IMAGE |
jmp .ok |
.local: |
cmp ecx, 8 |
jb parse_cmd.error |
mov al, byte[esi+7] |
sub al, '0' |
jb parse_cmd.error ; FIXME: this is not the correct errormessage |
cmp al, 9 |
ja parse_cmd.error ; FIXME |
or al, TYPE_LOCAL |
mov [ebp + thread_data.type], al |
.ok: |
sendFTP "200 Command ok" |
ret |
;------------------------------------------------ |
; "USER" |
; |
; Login to the server, step one of two. ;;; TODO: prevent buffer overflow! |
; |
;------------------------------------------------ |
align 4 |
cmdUSER: |
lea esi, [esi + 5] |
lea edi, [ebp + thread_data.fpath] ; temp buffer for username |
.loop: |
lodsb |
stosb |
cmp al, 0x20 |
jae .loop |
mov byte [edi-1], 0 |
lea esi, [ebp + thread_data.fpath] |
lea eax, [ebp + thread_data.home_dir] |
invoke ini.get_str, path2, esi, str_home, eax, 1024, str_infinity |
cmp eax, -1 |
je .login_fail |
cmp dword [esi], -1 |
je .login_fail |
mov word [ebp + thread_data.work_dir], "/" ; "/", 0 |
invoke con_write_asciiz, str_logged_in |
mov [ebp + thread_data.state], STATE_LOGIN |
.sendstr: |
sendFTP "331 Please specify the password" |
ret |
.login_fail: |
invoke con_write_asciiz, str_pass_err |
mov [ebp + thread_data.state], STATE_LOGIN_FAIL |
jmp .sendstr |
align 4 |
.2: |
sendFTP "530 Can't change to another user" |
ret |
/programs/network/ftpd/ftpd.asm |
---|
0,0 → 1,455 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ftpd.asm - FTP Daemon for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
DEBUG = 0 ; if set to one, program will run in a single thread |
BUFFERSIZE = 8192 |
; using multiple's of 4 |
STATE_CONNECTED = 0*4 |
STATE_LOGIN = 1*4 |
STATE_LOGIN_FAIL = 2*4 ; When an invalid username was given |
STATE_ACTIVE = 3*4 |
TYPE_UNDEF = 0 |
TYPE_ASCII = 00000100b |
TYPE_EBDIC = 00001000b |
; subtypes for ascii & ebdic (np = default) |
TYPE_NP = 00000001b ; non printable |
TYPE_TELNET = 00000010b |
TYPE_ASA = 00000011b |
TYPE_IMAGE = 01000000b ; binary data |
TYPE_LOCAL = 10000000b ; bits per byte must be specified |
; lower 4 bits will hold this value |
MODE_NOTREADY = 0 |
MODE_ACTIVE = 1 |
MODE_PASSIVE_WAIT = 2 |
MODE_PASSIVE_OK = 3 |
MODE_PASSIVE_FAILED = 4 |
PERMISSION_EXEC = 1b ; LIST |
PERMISSION_READ = 10b |
PERMISSION_WRITE = 100b |
PERMISSION_DELETE = 1000b |
PERMISSION_CD = 10000b ; Change Directory |
ABORT = 1 shl 31 |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; signature |
dd 1 ; header version |
dd start ; entry point |
dd i_end ; initialized size |
dd mem+0x1000 ; required memory |
dd mem+0x1000 ; stack pointer |
dd params ; parameters |
dd path ; path |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../struct.inc' |
include '../libio.inc' |
include '../network.inc' |
macro sendFTP str { |
local string, length |
xor edi, edi |
mcall send, [ebp + thread_data.socketnum], string, length |
iglobal |
string db str, 13, 10 |
length = $ - string |
\} |
} |
include 'commands.inc' |
start: |
mcall 68, 11 ; init heap |
mcall 40, 1 shl 7 ; we only want network events |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; find path to main settings file (ftpd.ini) |
mov edi, path ; Calculate the length of zero-terminated string |
xor al, al |
mov ecx, 1024 |
repne scasb |
dec edi |
mov esi, str_ini ; append it with '.ini', 0 |
movsd |
movsb |
; now create the second path (users.ini) |
std |
mov al, '/' |
repne scasb |
lea ecx, [edi - path + 2] |
cld |
mov esi, path |
mov edi, path2 |
rep movsb |
mov esi, str_users |
movsd |
movsd |
movsw |
; initialize console |
invoke con_start, 1 |
invoke con_init, -1, -1, -1, -1, title |
; get settings from ini |
invoke ini.get_str, path, str_ftpd, str_ip, ini_buf, 16, 0 |
mov esi, ini_buf |
mov cl, '.' |
call ip_to_dword |
mov [serverip], ebx |
invoke ini.get_int, path, str_ftpd, str_port, 21 |
xchg al, ah |
mov [sockaddr1.port], ax |
xchg al, ah |
invoke con_printf, str1, eax |
add esp, 8 |
; open listening socket |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
je sock_err |
mov [socketnum], eax |
invoke con_write_asciiz, str2 |
; mcall setsockopt, [socketnum], SOL_SOCKET, SO_REUSEADDR, &yes, |
; cmp eax, -1 |
; je opt_err |
mcall bind, [socketnum], sockaddr1, sockaddr1.length |
cmp eax, -1 |
je bind_err |
invoke con_write_asciiz, str2 |
invoke ini.get_int, path, str_ftpd, str_conn, 1 ; Backlog (max connections) |
mov edx, eax |
invoke con_write_asciiz, str2 |
mcall listen, [socketnum] |
cmp eax, -1 |
je listen_err |
invoke con_write_asciiz, str2b |
invoke ini.get_int, path, str_pasv, str_start, 2000 |
mov [pasv_start], ax |
invoke ini.get_int, path, str_pasv, str_end, 5000 |
mov [pasv_end], ax |
mov [alive], 1 |
mainloop: |
mcall 23, 100 ; Wait here for incoming connections on the base socket (socketnum) |
; One second timeout, we will use this to check if console is still working |
test eax, eax ; network event? |
jz .checkconsole |
if DEBUG |
jmp threadstart |
else |
mcall 51, 1, threadstart, 0 ; Start a new thread for every incoming connection |
; NOTE: upon initialisation of the thread, stack will not be available! |
end if |
jmp mainloop |
.checkconsole: |
invoke con_get_flags ; Is console still running? |
test eax, 0x0200 |
jz mainloop |
mcall close, [socketnum] ; kill the listening socket |
mov [alive], 0 |
mcall -1 ; and exit |
diff16 "threadstart", 0, $ |
threadstart: |
;;; mcall 68, 11 ; init heap |
mcall 68, 12, sizeof.thread_data ; allocate the thread data struct |
test eax, eax |
je exit |
lea esp, [eax + thread_data.stack] ; init stack |
mov ebp, eax |
mcall 40, 1 shl 7 ; we only want network events for this thread |
lea ebx, [ebp + thread_data.buffer] ; get information about the current process |
or ecx, -1 |
mcall 9 |
mov eax, dword [ebp + thread_data.buffer + 30] ; PID is at offset 30 |
mov [ebp + thread_data.pid], eax |
invoke con_set_flags, 0x03 |
invoke con_printf, str8, [ebp + thread_data.pid] ; print on the console that we have created the new thread successfully |
add esp, 8 ; balance stack |
invoke con_set_flags, 0x07 |
mcall accept, [socketnum], sockaddr1, sockaddr1.length ; time to accept the awaiting connection.. |
cmp eax, -1 |
je thread_exit |
mov [ebp + thread_data.socketnum], eax |
if DEBUG |
mcall close, [socketnum] ; close the listening socket |
end if |
mov [ebp + thread_data.state], STATE_CONNECTED |
mov [ebp + thread_data.permissions], 0 |
mov [ebp + thread_data.mode], MODE_NOTREADY |
lea eax, [ebp + thread_data.buffer] |
mov [ebp + thread_data.buffer_ptr], eax |
mov [ebp + thread_data.passivesocknum], -1 |
sendFTP "220 Welcome to KolibriOS FTP daemon" |
diff16 "threadloop", 0, $ |
threadloop: |
; Check if our socket is still connected |
mcall send, [ebp + thread_data.socketnum], 0, 0 ; Try to send zero bytes, if socket is closed, this will return -1 |
cmp eax, -1 |
je thread_exit |
cmp [alive], 0 ; Did main thread take a run for it? |
je thread_exit |
mcall 10 ; Wait for network event |
cmp [ebp + thread_data.mode], MODE_PASSIVE_WAIT |
jne .not_passive |
mov ecx, [ebp + thread_data.passivesocknum] |
lea edx, [ebp + thread_data.datasock] |
mov esi, sizeof.thread_data.datasock |
mcall accept |
cmp eax, -1 |
je .not_passive |
mov [ebp + thread_data.datasocketnum], eax |
mov [ebp + thread_data.mode], MODE_PASSIVE_OK |
mcall close ; [ebp + thread_data.passivesocknum] |
mov [ebp + thread_data.passivesocknum], -1 |
invoke con_write_asciiz, str_datasock |
.not_passive: |
mov ecx, [ebp + thread_data.socketnum] |
mov edx, [ebp + thread_data.buffer_ptr] |
mov esi, sizeof.thread_data.buffer ;;; FIXME |
mcall recv |
inc eax ; error? (-1) |
jz threadloop |
dec eax ; 0 bytes read? |
jz threadloop |
mov edi, [ebp + thread_data.buffer_ptr] |
add [ebp + thread_data.buffer_ptr], eax |
; Check if we received a newline character, if not, wait for more data |
mov ecx, eax |
mov al, 13 |
repne scasb |
jne threadloop |
; We got a command! |
mov byte [edi + 1], 0 ; append string with zero byte |
lea esi, [ebp + thread_data.buffer] |
mov ecx, [ebp + thread_data.buffer_ptr] |
sub ecx, esi |
mov [ebp + thread_data.buffer_ptr], esi ; reset buffer ptr |
invoke con_set_flags, 0x02 ; print received data to console (in green color) |
invoke con_write_asciiz, str_newline |
invoke con_write_asciiz, esi |
invoke con_set_flags, 0x07 |
push threadloop |
jmp parse_cmd |
listen_err: |
invoke con_set_flags, 0x0c ; print errors in red |
invoke con_write_asciiz, str3 |
jmp done |
bind_err: |
invoke con_set_flags, 0x0c ; print errors in red |
invoke con_write_asciiz, str4 |
jmp done |
sock_err: |
invoke con_set_flags, 0x0c ; print errors in red |
invoke con_write_asciiz, str6 |
jmp done |
done: |
invoke con_exit, 0 |
exit: |
mcall -1 |
thread_exit: |
invoke con_set_flags, 0x03 ; print thread info in blue |
invoke con_printf, str_bye, [ebp + thread_data.pid] ; print on the console that we are about to kill the thread |
add esp, 8 ; balance stack |
mcall 68, 13, ebp ; free the memory |
mcall -1 ; and kill the thread |
; initialized data |
title db 'KolibriOS FTP daemon 0.1', 0 |
str1 db 'Starting FTP daemon on port %u.', 0 |
str2 db '.', 0 |
str2b db ' OK!',10,0 |
str3 db 'Listen error',10,0 |
str4 db 10,'ERROR: local port is already in use.',10,0 |
;str5 db 'Setsockopt error.',10,10,0 |
str6 db 'ERROR: Could not open socket.',10,0 |
str7 db 'Got data!',10,10,0 |
str8 db 10,'Thread %d created',10,0 |
str_bye db 10,'Thread %d killed',10,0 |
str_logged_in db 'Login ok',10,0 |
str_pass_ok db 'Password ok',10,0 |
str_pass_err db 'Password/Username incorrect',10,0 |
str_pwd db 'Current directory is "%s"\n',0 |
str_err2 db 'ERROR: cannot open the directory.',10,0 |
str_datasock db 'Passive data socket connected.',10,0 |
str_notfound db 'ERROR: file not found.',10,0 |
str_sockerr db 'ERROR: socket error.',10,0 |
str_newline db 10, 0 |
str_mask db '*', 0 |
str_infinity db 0xff, 0xff, 0xff, 0xff, 0 |
months dd 'Jan ' |
dd 'Feb ' |
dd 'Mar ' |
dd 'Apr ' |
dd 'May ' |
dd 'Jun ' |
dd 'Jul ' |
dd 'Aug ' |
dd 'Sep ' |
dd 'Oct ' |
dd 'Nov ' |
dd 'Dec ' |
str_users db 'users' |
str_ini db '.ini', 0 |
str_port db 'port', 0 |
str_ftpd db 'ftpd', 0 |
str_conn db 'conn', 0 |
str_ip db 'ip', 0 |
str_pass db 'pass', 0 |
str_home db 'home', 0 |
str_mode db 'mode', 0 |
str_pasv db 'pasv', 0 |
str_start db 'start', 0 |
str_end db 'end', 0 |
sockaddr1: |
dw AF_INET4 |
.port dw 0 |
.ip dd 0 |
rb 10 |
.length = $ - sockaddr1 |
; import |
align 4 |
@IMPORT: |
diff16 "import", 0, $ |
library console, 'console.obj',\ |
libini, 'libini.obj', \ |
libio, 'libio.obj' |
import console,\ |
con_start, 'START',\ |
con_init, 'con_init',\ |
con_write_asciiz, 'con_write_asciiz',\ |
con_exit, 'con_exit',\ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_printf, 'con_printf',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos',\ |
con_set_flags, 'con_set_flags',\ |
con_get_flags, 'con_get_flags' |
import libini,\ |
ini.get_str, 'ini_get_str',\ |
ini.get_int, 'ini_get_int' |
import libio,\ |
file.size, 'file_size',\ |
file.open, 'file_open',\ |
file.read, 'file_read',\ |
file.close, 'file_close',\ |
file.find.first, 'file_find_first',\ |
file.find.next, 'file_find_next',\ |
file.find.close, 'file_find_close' |
IncludeIGlobals |
i_end: |
diff16 "i_end", 0, $ |
; uninitialised data |
socketnum dd ? |
path rb 1024 |
path2 rb 1024 |
params rb 1024 |
serverip dd ? |
pasv_start dw ? |
pasv_end dw ? |
pasv_port dw ? |
ini_buf rb 3*4+3+1 |
alive db ? |
mem: |
/programs/network/ftpd/ftpd.ini |
---|
0,0 → 1,8 |
[ftpd] |
port=21 |
conn=10 |
ip=127.0.0.1 |
[pasv] |
start=2000 |
end=5000 |
/programs/network/ftpd/users.ini |
---|
0,0 → 1,20 |
; Access modes |
; |
; List = 1 |
; Read = 2 |
; Write = 4 |
; Delete = 8 |
; Change directory = 16 |
[anonymous] |
; leavy pass empty to disable it |
pass= |
home=/rd/1/ |
mode=3 |
[test] |
pass=1234 |
home=/rd/1/ |
mode=31 |
/programs/network/ftpd |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/icmp/icmp.inc |
---|
0,0 → 1,77 |
; ICMP types & codes |
ICMP_ECHOREPLY equ 0 ; echo reply message |
ICMP_UNREACH equ 3 |
ICMP_UNREACH_NET equ 0 ; bad net |
ICMP_UNREACH_HOST equ 1 ; bad host |
ICMP_UNREACH_PROTOCOL equ 2 ; bad protocol |
ICMP_UNREACH_PORT equ 3 ; bad port |
ICMP_UNREACH_NEEDFRAG equ 4 ; IP_DF caused drop |
ICMP_UNREACH_SRCFAIL equ 5 ; src route failed |
ICMP_UNREACH_NET_UNKNOWN equ 6 ; unknown net |
ICMP_UNREACH_HOST_UNKNOWN equ 7 ; unknown host |
ICMP_UNREACH_ISOLATED equ 8 ; src host isolated |
ICMP_UNREACH_NET_PROHIB equ 9 ; prohibited access |
ICMP_UNREACH_HOST_PROHIB equ 10 ; ditto |
ICMP_UNREACH_TOSNET equ 11 ; bad tos for net |
ICMP_UNREACH_TOSHOST equ 12 ; bad tos for host |
ICMP_UNREACH_FILTER_PROHIB equ 13 ; admin prohib |
ICMP_UNREACH_HOST_PRECEDENCE equ 14 ; host prec vio. |
ICMP_UNREACH_PRECEDENCE_CUTOFF equ 15 ; prec cutoff |
ICMP_SOURCEQUENCH equ 4 ; Packet lost, slow down |
ICMP_REDIRECT equ 5 ; shorter route, codes: |
ICMP_REDIRECT_NET equ 0 ; for network |
ICMP_REDIRECT_HOST equ 1 ; for host |
ICMP_REDIRECT_TOSNET equ 2 ; for tos and net |
ICMP_REDIRECT_TOSHOST equ 3 ; for tos and host |
ICMP_ALTHOSTADDR equ 6 ; alternate host address |
ICMP_ECHO equ 8 ; echo service |
ICMP_ROUTERADVERT equ 9 ; router advertisement |
ICMP_ROUTERADVERT_NORMAL equ 0 ; normal advertisement |
ICMP_ROUTERADVERT_NOROUTE_COMMON equ 16 ; selective routing |
ICMP_ROUTERSOLICIT equ 10 ; router solicitation |
ICMP_TIMXCEED equ 11 ; time exceeded, code: |
ICMP_TIMXCEED_INTRANS equ 0 ; ttl==0 in transit |
ICMP_TIMXCEED_REASS equ 1 ; ttl==0 in reass |
ICMP_PARAMPROB equ 12 ; ip header bad |
ICMP_PARAMPROB_ERRATPTR equ 0 ; error at param ptr |
ICMP_PARAMPROB_OPTABSENT equ 1 ; req. opt. absent |
ICMP_PARAMPROB_LENGTH equ 2 ; bad length |
ICMP_TSTAMP equ 13 ; timestamp request |
ICMP_TSTAMPREPLY equ 14 ; timestamp reply |
ICMP_IREQ equ 15 ; information request |
ICMP_IREQREPLY equ 16 ; information reply |
ICMP_MASKREQ equ 17 ; address mask request |
ICMP_MASKREPLY equ 18 ; address mask reply |
ICMP_TRACEROUTE equ 30 ; traceroute |
ICMP_DATACONVERR equ 31 ; data conversion error |
ICMP_MOBILE_REDIRECT equ 32 ; mobile host redirect |
ICMP_IPV6_WHEREAREYOU equ 33 ; IPv6 where-are-you |
ICMP_IPV6_IAMHERE equ 34 ; IPv6 i-am-here |
ICMP_MOBILE_REGREQUEST equ 35 ; mobile registration req |
ICMP_MOBILE_REGREPLY equ 36 ; mobile registreation reply |
ICMP_SKIP equ 39 ; SKIP |
ICMP_PHOTURIS equ 40 ; Photuris |
ICMP_PHOTURIS_UNKNOWN_INDEX equ 1 ; unknown sec index |
ICMP_PHOTURIS_AUTH_FAILED equ 2 ; auth failed |
ICMP_PHOTURIS_DECRYPT_FAILED equ 3 ; decrypt failed |
virtual at 0 |
ICMP_Packet: |
.Type db ? |
.Code db ? |
.Checksum dw ? |
.Identifier dw ? |
.SequenceNumber dw ? |
.Data: |
end virtual |
/programs/network/icmp/ping.asm |
---|
0,0 → 1,256 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ping.asm - ICMP echo client for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
use32 |
org 0x0 |
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 s ; parameters |
dd 0 ; path |
BUFFERSIZE equ 1500 |
; useful includes |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../network.inc' |
include 'icmp.inc' |
start: |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; initialize console |
push 1 |
call [con_start] |
push title |
push 25 |
push 80 |
push 25 |
push 80 |
call [con_init] |
; main loop |
cmp byte[s], 0 |
jne resolve |
main: |
; write prompt |
push str2 |
call [con_write_asciiz] |
; read string |
mov esi, s |
push 256 |
push esi |
call [con_gets] |
; check for exit |
test eax, eax |
jz done |
cmp byte [esi], 10 |
jz done |
; delete terminating '\n' |
push esi |
@@: |
lodsb |
test al, al |
jnz @b |
mov byte [esi-2], al |
pop esi |
resolve: |
; resolve name |
push esp ; reserve stack place |
push esp ; fourth parameter |
push 0 ; third parameter |
push 0 ; second parameter |
push s ; first parameter |
call [getaddrinfo] |
pop esi |
; test for error |
test eax, eax |
jnz fail |
; convert IP address to decimal notation |
mov eax, [esi+addrinfo.ai_addr] |
mov eax, [eax+sockaddr_in.sin_addr] |
mov [sockaddr1.ip], eax |
push eax |
call [inet_ntoa] |
; write result |
mov [ip_ptr], eax |
push eax |
; free allocated memory |
push esi |
call [freeaddrinfo] |
push str4 |
call [con_write_asciiz] |
mcall socket, AF_INET4, SOCK_RAW, IPPROTO_ICMP |
cmp eax, -1 |
jz fail2 |
mov [socketnum], eax |
mcall connect, [socketnum], sockaddr1, 18 |
mcall 40, 1 shl 7 ; + 7 |
; call [con_cls] |
mov [count], 4 |
mainloop: |
push str3 |
call [con_write_asciiz] |
push [ip_ptr] |
call [con_write_asciiz] |
mcall 26,9 |
mov [time_reference], eax |
mcall send, [socketnum], icmp_packet, icmp_packet.length, 0 |
mcall 23, 300 ; 3 seconds time-out |
mcall 26,9 |
neg [time_reference] |
add [time_reference], eax |
mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
cmp eax, -1 |
je .no_response |
; validate the packet |
lea esi, [buffer_ptr + ICMP_Packet.Data] |
mov edi, icmp_packet.data |
mov ecx, 32/4 |
repe cmpsd |
jne .miscomp |
push [time_reference] |
push str7 |
call [con_printf] |
jmp continue |
.miscomp: |
sub edi, icmp_packet.data |
push edi |
push str9 |
call [con_printf] |
jmp continue |
.no_response: |
push str8 |
call [con_write_asciiz] |
continue: |
dec [count] |
jz done |
mcall 5, 100 ; wait a second |
inc [icmp_packet.id] |
jmp mainloop |
done: |
push str10 |
call [con_write_asciiz] |
call [con_getch2] |
push 1 |
call [con_exit] |
exit: |
mcall -1 |
fail: |
push str5 |
call [con_write_asciiz] |
jmp done |
fail2: |
push str6 |
call [con_write_asciiz] |
jmp done |
; data |
title db 'ICMP - echo client',0 |
str2 db '> ',0 |
str3 db 'Ping to ',0 |
str4 db 10,0 |
str5 db 'Name resolution failed.',10,0 |
str6 db 'Could not open socket',10,0 |
str7 db ' time= %u0ms',10,0 |
str8 db ' timeout!',10,0 |
str9 db ' miscompare at offset %u',10,0 |
str10 db 10,'Press any key to exit',0 |
sockaddr1: |
dw AF_INET4 |
.port dw 0 |
.ip dd 0 |
rb 10 |
time_reference dd ? |
ip_ptr dd ? |
count dd ? |
; import |
align 4 |
@IMPORT: |
library network, 'network.obj', console, 'console.obj' |
import network, \ |
getaddrinfo, 'getaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
inet_ntoa, 'inet_ntoa' |
import console, \ |
con_start, 'START', \ |
con_init, 'con_init', \ |
con_write_asciiz, 'con_write_asciiz', \ |
con_printf, 'con_printf', \ |
con_exit, 'con_exit', \ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos' |
socketnum dd ? |
icmp_packet: db 8 ; type |
db 0 ; code |
dw 0 ; |
.id dw 0x0000 ; identifier |
.seq dw 0x0001 ; sequence number |
.data db 'abcdefghijklmnopqrstuvwxyz012345678' |
.length = $ - icmp_packet |
I_END: |
buffer_ptr rb BUFFERSIZE |
s rb 1024 |
rb 4096 ; stack |
mem: |
/programs/network/icmp |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/ircc/encodings.inc |
---|
0,0 → 1,317 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
get_next_byte: |
; Load next byte from the packet, translating to cp866 if necessary |
; At input esi = pointer to data, edx = limit of data |
; Output is either (translated) byte in al with CF set or CF cleared. |
mov eax, [encoding] |
jmp [get_byte_table+eax*4] |
get_byte_cp866: |
cmp esi, edx |
jae .nothing |
lodsb |
.nothing: |
ret |
get_byte_cp1251: |
cmp esi, edx |
jae .nothing |
lodsb |
cmp al, 0x80 |
jb @f |
and eax, 0x7F |
mov al, [cp1251_table+eax] |
@@: |
stc |
.nothing: |
ret |
get_byte_utf8: |
; UTF8 decoding is slightly complicated. |
; One character can occupy one or more bytes. |
; The boundary in packets theoretically can be anywhere in data, |
; so this procedure keeps internal state between calls and handles |
; one byte at a time, looping until character is read or packet is over. |
; Globally, there are two distinct tasks: decode byte sequence to unicode char |
; and convert this unicode char to our base encoding (that is cp866). |
; 1. Check that there are data. |
cmp esi, edx |
jae .nothing |
; 2. Load byte. |
lodsb |
movzx ecx, al |
; 3. Bytes in an UTF8 sequence can be of any of three types. |
; If most significant bit is cleared, sequence is one byte and usual ASCII char. |
; First byte of a sequence must be 11xxxxxx, other bytes are 10yyyyyy. |
and al, 0xC0 |
jns .single_byte |
jp .first_byte |
; 4. This byte is not first in UTF8 sequence. |
; 4a. Check that the sequence was started. If no, it is invalid byte |
; and we simply ignore it. |
cmp [utf8_bytes_rest], 0 |
jz get_byte_utf8 |
; 4b. Otherwise, it is really next byte and it gives some more bits of char. |
mov eax, [utf8_char] |
shl eax, 6 |
lea eax, [eax+ecx-0x80] |
; 4c. Decrement number of bytes rest in the sequence. |
; If it goes to zero, character is read, so return it. |
dec [utf8_bytes_rest] |
jz .got_char |
mov [utf8_char], eax |
jmp get_byte_utf8 |
; 5. If the byte is first in UTF8 sequence, calculate the number of leading 1s |
; - it equals total number of bytes in the sequence; some other bits rest for |
; leading bits in the character. |
.first_byte: |
mov eax, -1 |
@@: |
inc eax |
add cl, cl |
js @b |
mov [utf8_bytes_rest], eax |
xchg eax, ecx |
inc ecx |
shr al, cl |
mov [utf8_char], eax |
jmp get_byte_utf8 |
; 6. If the byte is ASCII char, it is the character. |
.single_byte: |
xchg eax, ecx |
.got_char: |
; We got the character, now abandon a possible sequence in progress. |
and [utf8_bytes_rest], 0 |
; Now second task. The unicode character is in eax, and now we shall convert it |
; to cp866. |
cmp eax, 0x80 |
jb .done |
; 0x410-0x43F -> 0x80-0xAF, 0x440-0x44F -> 0xE0-0xEF, 0x401 -> 0xF0, 0x451 -> 0xF1 |
cmp eax, 0x401 |
jz .YO |
cmp eax, 0x451 |
jz .yo |
cmp eax, 0x410 |
jb .unrecognized |
cmp eax, 0x440 |
jb .part1 |
cmp eax, 0x450 |
jae .unrecognized |
sub al, (0x40-0xE0) and 0xFF |
ret |
.part1: |
sub al, 0x10-0x80 |
.nothing: |
.done: |
ret |
.unrecognized: |
mov al, '?' |
stc |
ret |
.YO: |
mov al, 0xF0 |
stc |
ret |
.yo: |
mov al, 0xF1 |
stc |
ret |
print_character: |
pusha |
cmp bl, 13 ; line beginning |
jne nobol |
mov ecx, [pos] |
inc ecx |
boll1: |
dec ecx |
mov eax, ecx |
xor edx, edx |
mov ebx, [textbox_width] |
div ebx |
test edx, edx |
jnz boll1 |
mov [pos], ecx |
jmp newdata |
nobol: |
cmp bl, 10 ; line down |
jne nolf |
addx1: |
inc [pos] |
mov eax, [pos] |
xor edx, edx |
mov ecx, [textbox_width] |
div ecx |
test edx, edx |
jnz addx1 |
mov eax, [pos] |
jmp cm1 |
nolf: |
no_lf_ret: |
cmp bl, 15 ; character |
jbe newdata |
mov eax, [irc_data] |
shl eax, 8 |
mov al, bl |
mov [irc_data], eax |
mov eax, [pos] |
;---- draw data |
pusha |
and ebx, 0xff |
add eax, [text_start] |
mov [eax], bl |
popa |
;---- draw data |
mov eax, [pos] |
inc eax |
cm1: |
mov ebx, [scroll+4] |
imul ebx, [textbox_width] |
cmp eax, ebx |
jb noeaxz |
mov esi, [text_start] |
add esi, [textbox_width] |
mov edi, [text_start] |
mov ecx, ebx |
rep movsb |
mov esi, [text_start] |
mov ecx, [textbox_width] |
imul ecx, 61 |
add esi, ecx |
mov edi, [text_start] |
mov ecx, [textbox_width] |
imul ecx, 60 |
add edi, ecx |
mov ecx, ebx |
rep movsb |
mov eax, ebx |
sub eax, [textbox_width] |
noeaxz: |
mov [pos], eax |
newdata: |
mov eax, [window_print] |
or [eax + window.flags], FLAG_UPDATED |
popa |
ret |
recode_to_cp866: |
rep movsb |
ret |
recode_to_cp1251: |
xor eax, eax |
jecxz .nothing |
.loop: |
lodsb |
cmp al,0x80 |
jb @f |
mov al, [cp866_table-0x80+eax] |
@@: stosb |
loop .loop |
.nothing: |
ret |
recode_to_utf8: |
jecxz .nothing |
.loop: |
lodsb |
cmp al, 0x80 |
jb .single_byte |
and eax, 0x7F |
mov ax, [utf8_table+eax*2] |
stosw |
loop .loop |
ret |
.single_byte: |
stosb |
loop .loop |
.nothing: |
ret |
recode: |
mov eax, [encoding] |
jmp [recode_proc+eax*4] |
encoding dd UTF8 |
recode_proc dd recode_to_cp866, recode_to_cp1251, recode_to_utf8 |
get_byte_table dd get_byte_cp866, get_byte_cp1251, get_byte_utf8 |
cp1251_table: |
db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; 8 |
db '?','?','?','?','?',$F9,'?','?' , '?','?','?','?','?','?','?','?' ; 9 |
db '?',$F6,$F7,'?',$FD,'?','?','?' , $F0,'?',$F2,'?','?','?','?',$F4 ; A |
db $F8,'?','?','?','?','?','?',$FA , $F1,$FC,$F3,'?','?','?','?',$F5 ; B |
db $80,$81,$82,$83,$84,$85,$86,$87 , $88,$89,$8A,$8B,$8C,$8D,$8E,$8F ; C |
db $90,$91,$92,$93,$94,$95,$96,$97 , $98,$99,$9A,$9B,$9C,$9D,$9E,$9F ; D |
db $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7 , $A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF ; E |
db $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF ; F |
; 0 1 2 3 4 5 6 7 8 9 A B C D E F |
utf8_table: |
times 80h dw 0x98C3 ; default placeholder |
; 0x80-0xAF -> 0x90D0-0xBFD0 |
repeat 0x30 |
store byte 0xD0 at utf8_table+2*(%-1) |
store byte 0x90+%-1 at utf8_table+2*%-1 |
end repeat |
; 0xE0-0xEF -> 0x80D1-0x8FD1 |
repeat 0x10 |
store byte 0xD1 at utf8_table+2*(0xE0-0x80+%-1) |
store byte 0x80+%-1 at utf8_table+2*(0xE0-0x80+%)-1 |
end repeat |
; 0xF0 -> 0x81D0, 0xF1 -> 0x91D1 |
store dword 0x91D181D0 at utf8_table+2*(0xF0-0x80) |
cp866_table: |
db $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7 , $C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF ; 8 |
db $D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7 , $D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF ; 9 |
db $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF ; A |
db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; B |
db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; C |
db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; D |
db $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7 , $F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF ; E |
db $A8,$B8,$AA,$BA,$AF,$BF,$A1,$A2 , $B0,$95,$B7,'?',$B9,$A4,'?','?' ; F |
; 0 1 2 3 4 5 6 7 8 9 A B C D E F |
/programs/network/ircc/gui.inc |
---|
0,0 → 1,316 |
draw_window: |
pusha |
mcall 9, thread_info, -1 ; get current window size |
mov eax, dword[thread_info+42] ; window xsize |
mov ebx, dword[thread_info+46] ; ysize |
mov edx, dword[thread_info+62] ; work area xsize |
mov esi, dword[thread_info+66] ; ysize |
sub eax, edx |
sub ebx, esi |
cmp edx, WIN_MIN_X |
jae .x_ok |
mov edx, WIN_MIN_X |
.x_ok: |
mov [xsize], edx |
add edx, eax |
cmp esi, WIN_MIN_Y |
jae .y_ok |
mov esi, WIN_MIN_Y |
.y_ok: |
mov [ysize], esi |
add esi, ebx |
mcall 67, -1, -1 ; set the new sizes |
mcall 12, 1 |
xor eax, eax ; draw window |
mov ebx, WIN_MIN_X |
mov ecx, WIN_MIN_Y |
mov edx, [colors.work] |
add edx, 0x33000000 |
mov edi, str_programname |
mcall |
mcall 12, 2 ;; when do we actually need this?? |
mov ebx, [xsize] |
mov ecx, [ysize] |
sub cx, 15 ;;;; |
push cx |
shl ecx, 16 |
pop cx |
mov edx, [colors.work_graph] |
mcall 38 ; draw line |
mov ecx, TOP_Y SHL 16 + TOP_Y |
mcall |
mov edi, [window_open] |
cmp [edi + window.type], WINDOWTYPE_CHANNEL |
jne .not_channel |
; draw a vertical separator line |
mov ebx, [xsize] |
sub ebx, USERLIST_X + SCROLLBAR_WIDTH + 3 |
push bx |
shl ebx, 16 |
pop bx |
mov ecx, [ysize] |
add ecx, TOP_Y SHL 16 -(15) ;;;; |
mcall |
call redraw_channel_list |
.not_channel: |
mov edx, [edi + window.data_ptr] |
add edx, window_data.text |
call draw_channel_text |
; editbox |
mov eax, [ysize] |
sub eax, 12 ;;;;;; |
mov [edit1.top], eax |
mov eax, [xsize] |
mov [edit1.width], eax |
push dword edit1 |
call [edit_box_draw] |
; tabs |
call draw_windownames |
popa |
ret |
redraw_channel_list: |
; First, calculate scrollbar |
mov ebx, [window_open] |
mov eax, [ebx + window.users] ; number of users in the open window |
mov [scroll1.max_area], eax |
mov eax, [ysize] |
sub eax, TOP_Y + 15 ;;;; |
push eax |
mov [scroll1.y_size], ax |
mov eax, [xsize] |
sub eax, SCROLLBAR_WIDTH |
mov [scroll1.x_pos], ax |
pop eax ; scrollbar height |
xor edx, edx |
mov ecx, 10 |
div ecx |
mov [scroll1.cur_area], eax |
; Do we need a scrollbar? |
cmp eax, [scroll1.max_area] |
jae .noscroll |
; Is the current position greater then the max position? |
cmp eax, [scroll1.position] |
ja @f |
mov [scroll1.position], eax |
@@: |
; OK, draw the scrollbar |
mov [scroll1.all_redraw], 1 |
push dword scroll1 |
call [scrollbar_v_draw] |
jmp print_channel_list |
.noscroll: |
mov [scroll1.position], 0 |
print_channel_list: |
pusha |
; Now, draw the usernames themselves |
; first, draw an invisible button |
mov ebx, [xsize] |
sub ebx, USERLIST_X + SCROLLBAR_WIDTH |
shl ebx, 16 |
push ebx |
mov bx, USERLIST_X |
mov ecx, [ysize] |
add ecx, TEXT_Y shl 16 - (TEXT_Y + 15) ;;;;; + 10??? |
push ecx ebx |
mov edx, 50 + 1 shl 29 + 1 shl 30 |
mcall 8 |
; now draw rectangle to clear the names |
pop ebx ecx |
mov edx, [colors.work] |
mcall 13 |
; now draw the names according with scrollbar position and window size |
mov eax, [scroll1.position] |
xor edx, edx |
mov ecx, MAX_NICK_LEN |
mul ecx |
mov edx, eax |
mov eax, [window_open] |
mov ebp, [eax + window.selected] |
add edx, [eax + window.data_ptr] |
sub ebp, [scroll1.position] |
add edx, window_data.names |
pop ebx |
mov bx, TEXT_Y |
mov ecx, [colors.work_text] |
or ecx, 0x80000000 ; ASCIIZ string |
mov eax, 4 ; draw text |
mov edi, [ysize] ; Calculate how many names will fit on screen |
sub edi, TEXT_Y + 15 ;+ 10 ;;;;; |
.loop: |
cmp byte[edx], 0 ; end of list? |
je .done |
dec ebp ; is this name selected? |
jnz .nothighlight |
; yes, highlight it |
pusha |
mov cx, bx |
mov bx, USERLIST_X |
shl ecx, 16 |
mov cx, 10 - 1 |
mov edx, 0x00000055 ; blue! |
mcall 13 |
popa |
mov ecx, 0x8000ffff ; cyan! |
mcall |
mov ecx, [colors.work_text] |
or ecx, 0x80000000 ; ASCIIZ string |
jmp .next |
.nothighlight: |
mcall |
.next: |
add edx, MAX_NICK_LEN ; next name |
add ebx, 10 ; height distance between lines |
sub edi, 10 |
ja .loop |
.done: |
popa |
ret |
draw_channel_text: |
pusha |
mov eax, 4 ; draw text |
mov ebx, TEXT_X shl 16 + TEXT_Y |
mov ecx, 12 ; 12 lines max ? |
mov esi, [textbox_width] |
.dct: |
pusha |
mov cx, bx |
shl ecx, 16 |
mov cx, 9 ; character height |
mov eax, 13 ; draw rectangle |
mov ebx, TEXT_X shl 16 |
mov bx, word[textbox_width] |
imul bx, 6 ; character width |
mov edx, [colors.work] |
mcall |
popa |
push ecx |
mov ecx, [colors.work_text] |
cmp word[edx], '* ' |
jne .no_red |
mov ecx, 0x00aa0000 |
jmp .draw |
.no_red: |
cmp word[edx], '**' |
jne .no_light_blue |
cmp byte[edx+2], '*' |
jne .no_light_blue |
mov ecx, 0x000000aa |
jmp .draw |
.no_light_blue: |
cmp byte[edx], '#' |
jne .no_blue |
mov ecx, 0x0000aa00 |
; jmp .draw |
.no_blue: |
.draw: |
mcall |
add edx, [textbox_width] |
add ebx, 10 ; height distance between lines |
pop ecx |
loop .dct |
popa |
ret |
draw_windownames: |
mov eax, 8 |
mov ebx, 5 shl 16 + 120 |
mov ecx, 12 shl 16 + 12 |
mov edx, WINDOW_BTN_START |
mov edi, windows |
.more_btn: |
mov esi, [colors.work_button] |
cmp [window_open], edi |
jne @f |
not esi |
and esi, 0x00ffffff |
@@: |
mcall |
inc edx |
add ebx, 125 shl 16 |
add edi, sizeof.window |
cmp [edi + window.data_ptr], 0 |
jne .more_btn |
mov eax, 4 |
mov ebx, 10 shl 16 + 15 |
mov ecx, [colors.work_button_text] |
or ecx, 0x80000000 ; ASCIIZ string |
lea edx, [windows + window.name] |
mov esi, MAX_WINDOWS |
.more: |
mcall |
add edx, sizeof.window |
cmp byte[edx], 0 |
je .enough |
add ebx, 125 shl 16 |
dec esi |
jnz .more |
.enough: |
ret |
/programs/network/ircc/ircc.asm |
---|
0,0 → 1,476 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; IRC client for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org, ;; |
;; text encoder/decoder by Clevermouse. ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
version equ '0.1' |
; connection status |
STATUS_DISCONNECTED = 0 |
STATUS_RESOLVING = 1 |
STATUS_CONNECTING = 2 |
STATUS_CONNECTED = 3 |
; window flags |
FLAG_UPDATED = 1 shl 0 |
FLAG_CLOSE = 1 shl 1 |
FLAG_RECEIVING_NAMES = 1 shl 2 |
; window types |
WINDOWTYPE_SERVER = 0 |
WINDOWTYPE_CHANNEL = 1 |
WINDOWTYPE_CHAT = 2 |
WINDOWTYPE_LIST = 3 |
WINDOWTYPE_DCC = 4 |
; supported encodings |
CP866 = 0 |
CP1251 = 1 |
UTF8 = 2 |
; settings |
USERCMD_MAX_SIZE = 400 |
WIN_MIN_X = 600 |
WIN_MIN_Y = 165 |
TEXT_X = 5 |
TEXT_Y = 30 |
TOP_Y = 25 |
MAX_WINDOWS = 20 |
MAX_USERS = 4096 |
MAX_NICK_LEN = 32 |
MAX_REAL_LEN = 32 ; realname |
MAX_SERVER_NAME = 256 |
MAX_CHANNEL_LEN = 40 |
MAX_CHANNELS = 37 |
MAX_COMMAND_LEN = 512 |
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp |
MAX_WINDOWNAME_LEN = 256 |
WINDOW_BTN_START = 100 |
SCROLLBAR_WIDTH = 12 |
USERLIST_X = 98 |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 1 ; header version |
dd START ; program start |
dd I_END ; program image size |
dd IM_END+2048 ; required amount of memory |
dd IM_END+2048 |
dd param |
dd path |
include "../macros.inc" |
include "../proc32.inc" |
include "../dll.inc" |
include "../network.inc" |
include "../struct.inc" |
include '../../../../../programs/develop/libraries/box_lib/trunk/box_lib.mac' |
struct window |
data_ptr dd ? ; zero if not used |
flags db ? |
type db ? |
name rb MAX_WINDOWNAME_LEN |
users dd ? |
users_scroll dd ? |
selected dd ? ; selected user, 0 if none selected |
ends |
struct window_data |
text rb 120*60 |
title rb 256 |
names rb MAX_NICK_LEN * MAX_USERS |
usertext rb 256 |
usertextlen dd ? |
ends |
include "encodings.inc" |
include "window.inc" ; also contains text print routines |
include "serverparser.inc" |
include "userparser.inc" |
include "socket.inc" |
include "gui.inc" |
include "users.inc" |
START: |
mcall 68, 11 ; init heap so we can allocate memory dynamically |
; wanted events |
mcall 40, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK + EVM_MOUSE |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; find path to main settings file (ircc.ini) |
mov edi, path ; Calculate the length of zero-terminated string |
xor al, al |
mov ecx, 1024 |
repne scasb |
dec edi |
mov eax, '.ini' |
stosd |
xor al, al |
stosb |
; Fill the window buffer with zeros |
mov edi, windows |
mov ecx, (sizeof.window*MAX_WINDOWS+3)/4 |
xor eax, eax |
rep stosd |
; clear command area too |
mov edi, servercommand |
mov ecx, 600/4 |
rep stosd |
; allocate window data block |
call window_create |
mov ebx, windows |
mov [ebx + window.data_ptr], eax |
mov [ebx + window.flags], 0 |
mov [ebx + window.type], WINDOWTYPE_SERVER |
add eax, window_data.text |
mov [text_start], eax |
call window_refresh |
; get system colors |
mcall 48, 3, colors, 40 |
; set edit box and scrollbar colors |
mov eax, [colors.work] |
mov [scroll1.bg_color], eax |
mov eax, [colors.work_button] |
mov [scroll1.front_color], eax |
mov eax, [colors.work_text] |
mov [scroll1.line_color], eax |
; get settings from ini |
invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick |
invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real |
; Welcome user |
mov esi, str_welcome |
call print_text2 |
call draw_window ;;; FIXME (gui is not correctly drawn first time) |
redraw: |
call draw_window |
still: |
; wait here for event |
mcall 10 |
dec eax |
jz redraw |
dec eax |
jz main_window_key |
dec eax |
jz button |
cmp al, 3 |
je mouse |
call process_network_event |
mov edx, [window_open] |
test [edx + window.flags], FLAG_UPDATED |
jz .no_update |
and [edx + window.flags], not FLAG_UPDATED |
mov edx, [edx + window.data_ptr] |
add edx, window_data.text |
call draw_channel_text |
.no_update: |
call print_channel_list |
jmp still |
button: |
mcall 17 ; get id |
shr eax, 8 |
cmp ax, 1 ; close program |
je exit |
cmp ax, 50 |
jne @f |
mcall 37, 1 ; Get mouse position |
sub ax, TEXT_Y |
mov bl, 10 |
div bl |
and eax, 0x000000ff |
inc eax |
add eax, [scroll1.position] |
mov ebx, [window_open] |
mov [ebx + window.selected], eax |
call print_channel_list |
jmp still |
@@: |
sub ax, WINDOW_BTN_START |
jb exit |
cmp ax, MAX_WINDOWS |
ja exit |
mov dx, sizeof.window |
mul dx |
shl edx, 16 |
mov dx, ax |
add edx, windows |
cmp [edx + window.data_ptr], 0 |
je exit |
mov [window_open], edx |
call window_refresh |
call draw_window |
jmp still |
exit: |
mcall -1 |
main_window_key: |
mcall 2 |
push dword edit1 |
call [edit_box_key] |
cmp ah, 13 ; enter |
jne no_send2 |
call user_parser |
mov [edit1.size], 0 |
mov [edit1.pos], 0 |
push dword edit1 |
call [edit_box_draw] |
mov edx, [window_open] |
mov edx, [edx + window.data_ptr] |
add edx, window_data.text |
call draw_channel_text |
jmp still |
no_send2: |
jmp still |
mouse: |
push dword edit1 |
call [edit_box_mouse] |
; TODO: check if scrollbar is active |
push [scroll1.position] |
push dword scroll1 |
call [scrollbar_v_mouse] |
pop eax |
cmp eax, [scroll1.position] ; did the scrollbar move? |
je @f |
call print_channel_list |
@@: |
jmp still |
; DATA AREA |
encoding_text: |
db 'CP866 ' |
db 'CP1251' |
db 'UTF-8 ' |
encoding_text_len = 6 |
action_header db '*** ', 0 |
action_header_short db '* ', 0 |
ctcp_header db '-> [',0 |
ctcp_version db '] VERSION',10,0 |
ctcp_ping db '] PING',10,0 |
ctcp_time db '] TIME',10,0 |
has_left_channel db ' has left ', 0 |
joins_channel db ' has joined ', 0 |
is_now_known_as db ' is now known as ', 0 |
has_quit_irc db ' has quit IRC', 10, 0 |
sets_mode db ' sets mode ', 0 |
kicked db ' is kicked from ', 0 |
str_talking db 'Now talking in ',0 |
str_topic db 'Topic is ',0 |
str_setby db 'Set by ',0 |
str_version db 'VERSION ' |
str_programname db 'KolibriOS IRC client ', version, 0 |
str_user db 'user', 0 |
str_nick db 'nick', 0 |
str_real db 'realname', 0 |
str_email db 'email', 0 |
default_nick db 'kolibri_user', 0 |
default_real db 'Kolibri User', 0 |
str_welcome db 10 |
db ' ______________________ __ __ __',10 |
db '| \______ \_ ___ \ ____ | | |__| ____ _____/ |_',10 |
db '| || _/ \ \/ _/ ___\| | | |/ __ \ / \ __\',10 |
db '| || | \ \____ \ \___| |_| \ ___/| | \ |',10 |
db '|___||____|_ /\______ / \___ >____/__|\___ >___| /__|',10 |
db ' \/ \/ \/ \/ \/',10 |
db 10 |
db 'Welcome to IRC client ',version,' for KolibriOS',10 |
db 10 |
db 'Type /help for help',10,0 |
str_nickchange db 'Nickname is now ',0 |
str_realchange db 'Real name is now ',0 |
str_dotnewline db '.',10, 0 |
str_newline db 10, 0 |
str_connecting db 10,'* Connecting to ',0 |
str_help db 10,'following commands are available:',10 |
db 10 |
db '/nick <nick> : change nickname to <nick>',10 |
db '/real <real name> : change real name to <real name>',10 |
db '/server <address> : connect to server <address>',10 |
db '/code <code> : change codepage to cp866, cp1251, or utf8',10,0 |
str_1 db ' -',0 |
str_2 db '- ',0 |
str_sockerr db 'Socket Error',10,0 |
str_dnserr db 'Unable to resolve hostname.',10,0 |
str_refused db 'Connection refused',10,0 |
sockaddr1: |
dw AF_INET4 |
.port dw 0x0b1a ; 6667 |
.ip dd 0 |
rb 10 |
status dd STATUS_DISCONNECTED |
text_start dd ? ; pointer to current textbox data |
irc_data dd 0x0 ; encoder |
textbox_width dd 80 ; in characters, not pixels ;) |
pos dd 66 * 11 ; encoder |
window_open dd windows |
window_print dd windows |
scroll dd 1 |
dd 12 |
align 4 |
@IMPORT: |
library network, 'network.obj',\ |
libini, 'libini.obj',\ |
boxlib, 'box_lib.obj' |
import network,\ |
getaddrinfo, 'getaddrinfo',\ |
freeaddrinfo, 'freeaddrinfo',\ |
inet_ntoa, 'inet_ntoa' |
import libini,\ |
ini.get_str, 'ini_get_str',\ |
ini.get_int, 'ini_get_int' |
import boxlib,\ |
edit_box_draw ,'edit_box' ,\ |
edit_box_key ,'edit_box_key' ,\ |
edit_box_mouse ,'edit_box_mouse' ,\ |
scrollbar_v_draw ,'scrollbar_v_draw' ,\ |
scrollbar_v_mouse,'scrollbar_v_mouse' |
usercommand db '/server chat.freenode.net', 0 |
rb MAX_COMMAND_LEN |
I_END: |
; width, left, top |
edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25 |
; xsize, xpos, ysize, ypos, max, cur, pos, bgcol, frcol, linecol |
scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
scroll2 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
main_PID dd ? ; identifier of main thread |
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence |
utf8_char dd ? ; first bits of current UTF8 character |
gai_reqdata rb 32 ; buffer for getaddrinfo_start/process |
ip_list dd ? ; will be filled as pointer to addrinfo list |
packetbuf rb 1024 ; buffer for packets to server |
path rb 1024 |
param rb 1024 |
socketnum dd ? |
servercommand rb 600 |
thread_info rb 1024 |
xsize dd ? |
ysize dd ? |
colors system_colors |
irc_server_name rb MAX_SERVER_NAME |
user_nick rb MAX_NICK_LEN |
user_real_name rb MAX_REAL_LEN |
windows rb MAX_WINDOWS*sizeof.window |
mouse_dd dd ? |
IM_END: |
/programs/network/ircc/ircc.ini |
---|
0,0 → 1,8 |
[user] |
nick = kolibri_user |
realname = tetten |
[colors] |
action1 = 0x000000aa |
action2 = 0x0000aa00 |
action3 = 0x00aa0000 |
/programs/network/ircc/serverparser.inc |
---|
0,0 → 1,928 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
server_parser: |
mov esi, servercommand |
cmp byte [esi], ':' |
jne .parse |
.spaceloop: |
lodsb |
test al, al |
jz .fail |
cmp al, ' ' |
jne .spaceloop |
.parse: |
mov eax, [esi] |
or eax, 0x20202020 |
mov edi, server_commands |
mov ecx, server_commands.number |
.loop: |
scasd |
je .got_cmd |
add edi, 4 |
dec ecx |
jnz .loop |
.fail: |
ret |
.got_cmd: |
jmp dword[edi] |
server_commands: |
dd '322 ', cmd_322 ; RPL_LIST |
dd '323 ', cmd_323 ; RPL_LISTEND |
dd '328 ', cmd_328 |
dd '332 ', cmd_topic |
dd '333 ', cmd_333 ; nickname and time of topic |
dd '353 ', cmd_353 ; name reply |
dd '366 ', cmd_366 ; end of names list |
dd '372 ', cmd_372 ; motd |
dd '375 ', cmd_375 ; start of motd |
dd '376 ', cmd_376 ; end of motd |
dd '421 ', cmd_421 ; unknown command |
dd 'join', cmd_join |
dd 'kick', cmd_kick |
dd 'mode', cmd_mode |
dd 'nick', cmd_nick |
dd 'part', cmd_part |
dd 'ping', cmd_ping |
dd 'priv', cmd_privmsg |
dd 'quit', cmd_quit |
dd 'noti', cmd_notice |
.number = ($ - server_commands) / 8 |
align 4 |
compare_to_nick: |
push esi |
mov ecx, MAX_NICK_LEN |
mov esi, user_nick |
.loop: |
lodsb |
cmp al, ' ' |
jbe .done |
cmp al, 'a' |
jb .ok |
cmp al, 'z' |
ja .ok |
sub al, 0x20 |
.ok: |
mov bl, byte[edi] |
cmp bl, 'a' |
jb .ok2 |
cmp bl, 'z' |
ja .ok2 |
sub bl, 0x20 |
.ok2: |
cmp bl, al |
jne .not_equal |
inc edi |
dec ecx |
jnz .loop |
.done: |
xor eax, eax |
pop esi |
ret |
.not_equal: |
or eax, -1 |
pop esi |
ret |
align 4 |
skip_nick: |
; First: skip the NICK (maybe we should verify it?) |
.nick: |
lodsb |
cmp al, ' ' |
je .skip |
cmp al, ':' |
je .skip |
jmp .nick |
; skip all leading spaces and semicolons |
.skip: |
lodsb |
cmp al, ' ' |
je .skip |
cmp al, ':' |
je .skip |
dec esi |
ret |
align 4 |
find_window: ; esi is ptr to windowname |
push esi |
mov edi, esi |
call compare_to_nick |
jne .nochat |
mov esi, servercommand+1 |
.nochat: |
; now search for window in list |
mov ebx, windows |
mov [window_print], ebx ; set first window (server window) as default output window |
.scanloop: |
cmp [ebx + window.data_ptr], 0 |
je .create_it |
push esi |
lea edi, [ebx + window.name] |
mov ecx, MAX_WINDOWNAME_LEN |
repe cmpsb |
pop esi |
cmp byte[edi-1], 0 |
je .got_it |
add ebx, sizeof.window |
; TODO: check buffer limits ? |
jmp .scanloop |
; create channel window - search for empty slot |
.create_it: |
mov ebx, windows |
mov ecx, MAX_WINDOWS |
.scanloop2: |
cmp [ebx + window.data_ptr], 0 |
je .free_found |
add ebx, sizeof.window |
dec ecx |
jnz .scanloop2 |
; Error: no more available windows! |
jmp .just_skip |
.free_found: |
push ebx |
call window_create |
pop ebx |
test eax, eax |
jz .just_skip |
mov [ebx + window.data_ptr], eax |
mov [ebx + window.type], WINDOWTYPE_CHAT |
mov [ebx + window.flags], 0 |
call window_set_name |
mov [window_open], ebx |
mov [window_print], ebx |
call window_refresh |
call draw_windownames |
jmp .just_skip |
; found it! |
.got_it: |
mov [window_print], ebx |
call window_refresh |
.just_skip: |
pop esi |
.skip1: |
; skip text |
lodsb |
test al, al |
jz .quit |
cmp al, ' ' |
jne .skip1 |
dec esi |
; now skip trailing spaces and semicolons |
.skip2: |
lodsb |
test al, al |
jz .quit |
cmp al, ' ' |
je .skip2 |
cmp al, ':' |
je .skip2 |
dec esi |
.quit: |
ret |
cmd_328: |
cmd_421: |
cmd_372: |
cmd_375: |
cmd_376: |
add esi, 4 |
jmp cmd_notice.loop |
cmd_notice: |
cmp byte[servercommand], ':' |
jne .gogogo |
mov byte [esi-1], 0 |
push esi |
mov esi, str_1 |
call print_text2 |
mov esi, servercommand+1 |
call print_text2 |
mov esi, str_2 |
call print_text2 |
pop esi |
.gogogo: |
add esi, 6 |
.loop: |
inc esi |
cmp byte [esi], 0 |
je .fail |
cmp byte [esi], ' ' |
jne .loop |
.loop2: |
inc esi |
cmp byte [esi], 0 |
je .fail |
cmp byte [esi], ' ' |
je .loop2 |
cmp byte [esi], ':' |
je .loop2 |
call print_text2 |
mov esi, str_newline |
call print_text2 |
.fail: |
ret |
cmd_ping: |
; Just change PING to PONG |
mov dword[esi], 'PONG' |
; Find the end of the command |
lea edi, [esi + 5] |
xor al, al |
repne scasb |
; Now send it back |
mov edx, esi |
mov esi, edi |
mov word [esi], 0x0d0a |
inc esi |
inc esi |
sub esi, edx |
mcall send, [socketnum], , , 0 |
ret |
cmd_privmsg: |
add esi, 8 ; skip 'PRIVMSG ' |
call find_window ; esi now points to end of destination name |
cmp byte[esi], 1 |
je cmd_ctcp |
cmp dword[esi], 'ACTI' ; Action? |
je .action |
; nope, just plain old privmsg |
if TIMESTAMP |
call print_timestamp |
end if |
push esi |
mov bl, '<' |
call print_character |
mov eax, servercommand+1 |
mov dl, '!' |
call print_text |
mov bl, '>' |
call print_character |
mov bl, ' ' |
call print_character |
pop esi |
call print_text2 |
mov bl, 10 |
call print_character |
.fail: |
ret |
.action: |
add esi, 8 |
push esi |
if TIMESTAMP |
call print_timestamp |
end if |
mov esi, action_header_short |
call print_text2 |
mov eax, servercommand+1 |
mov dl, ' ' |
call print_text |
mov bl, ' ' |
call print_character |
pop esi |
call print_text2 |
mov bl, 10 |
call print_character |
ret |
cmd_ctcp: |
inc esi |
cmp dword[esi], 'VERS' |
je .version |
cmp dword[esi], 'TIME' |
je .time |
cmp dword[esi], 'PING' |
je .ping |
ret |
.time: |
mov byte [esi+4], ' ' |
lea edi, [esi+5] |
; TODO: add system date (fn 29) in human readable format |
mcall 3 ; get system time |
mov ecx, 3 |
.timeloop: |
mov bl, al |
shr al, 4 |
add al, '0' |
stosb |
mov al, bl |
and al, 0x0f |
add al, '0' |
stosb |
dec ecx |
jz .timedone |
mov al, ':' |
stosb |
shr eax, 8 |
jmp .timeloop |
.timedone: |
xor al, al |
stosb |
call ctcp_reply |
if TIMESTAMP |
call print_timestamp |
end if |
mov esi, ctcp_header |
call print_text2 |
mov esi, servercommand+1 |
call print_text2 |
mov esi, ctcp_time |
call print_text2 |
ret |
.version: |
mov esi, str_version |
call ctcp_reply |
if TIMESTAMP |
call print_timestamp |
end if |
mov esi, ctcp_header |
call print_text2 |
mov esi, servercommand+1 |
call print_text2 |
mov esi, ctcp_version |
call print_text2 |
ret |
.ping: |
call ctcp_reply |
if TIMESTAMP |
call print_timestamp |
end if |
mov esi, ctcp_header |
call print_text2 |
mov esi, servercommand+1 |
call print_text2 |
mov esi, ctcp_ping |
call print_text2 |
ret |
ctcp_reply: |
push esi |
mov dword [usercommand], 'NOTI' |
mov dword [usercommand+4], 'CE ' |
mov esi, servercommand+1 |
mov edi, usercommand+7 |
.nickloop: |
lodsb |
cmp al, '!' |
je .done |
cmp al, ' ' |
je .done |
test al, al |
je .fail |
stosb |
jmp .nickloop |
.done: |
mov byte [esi-1], 0 |
mov ax, ' :' |
stosw |
mov al, 1 |
stosb |
pop esi |
.replyloop: |
lodsb |
cmp al, 1 |
jbe .done2 |
stosb |
jmp .replyloop |
.done2: |
mov al, 1 |
stosb |
mov ax, 0x0a0d |
stosw |
lea esi, [edi - usercommand] |
mcall send, [socketnum], usercommand, , 0 |
.fail: |
ret |
cmd_part: |
add esi, 5 ; skip 'PART ' |
push esi |
call skip_nick |
call find_window |
pop esi |
; Is it me who parted? |
mov edi, servercommand+1 |
call compare_to_nick |
jne .dont_close |
; yes, close the window |
mov edi, [window_print] |
mov [edi + window.flags], FLAG_UPDATED + FLAG_CLOSE |
ret |
; somebody else parted, just print message |
.dont_close: |
push esi |
mov esi, action_header |
call print_text2 |
mov eax, servercommand+1 |
mov dl, '!' |
mov cl, ' ' |
call print_text |
mov esi, has_left_channel |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
mov ebx, [window_print] |
mov esi, servercommand+1 |
call user_remove |
ret |
cmd_join: |
add esi, 5 ; skip 'JOIN ' |
; compare nick: did we join a channel? |
mov edi, servercommand+1 |
call compare_to_nick |
jne .no_new_window |
; create channel window - search for empty slot |
mov ebx, windows |
mov ecx, MAX_WINDOWS |
.loop: |
cmp [ebx + window.data_ptr], 0 |
je .free_found |
add ebx, sizeof.window |
dec ecx |
jnz .loop |
; Error: no more available windows!! ;;;;; TODO |
.fail: |
ret |
.free_found: |
push ebx |
call window_create |
pop ebx |
test eax, eax |
jz .fail |
mov [ebx + window.data_ptr], eax |
mov [ebx + window.type], WINDOWTYPE_CHANNEL |
mov [ebx + window.flags], 0 |
call window_set_name |
mov [window_open], ebx |
mov [window_print], ebx |
call window_refresh |
push esi |
mov esi, action_header |
call print_text2 |
mov esi, str_talking |
call print_text2 |
pop eax |
mov dl, ' ' |
call print_text |
mov esi, str_dotnewline |
call print_text2 |
call draw_window |
ret |
.no_new_window: |
push esi |
call find_window |
mov esi, action_header |
call print_text2 |
mov eax, servercommand+1 |
mov dl, '!' |
call print_text |
mov esi, joins_channel |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
mov ebx, [window_print] |
mov esi, servercommand+1 |
call user_add |
ret |
cmd_nick: |
; NOTE: This command applies to a user, and thus has no specific channel |
add esi, 5 ; skip 'NICK ' |
cmp byte[esi], ':' ; TODO: skip all spaces and semicolons? |
jne @f |
inc esi |
@@: |
; Change the nick in the current userlist. TODO: check other channels too! |
push esi |
mov ebx, [window_print] |
mov esi, servercommand+1 |
call user_remove |
mov esi, [esp] |
call user_add |
call redraw_channel_list |
; Is it me who changed nick? |
mov edi, servercommand+1 |
call compare_to_nick |
pop esi |
jne .not_me |
mov ecx, MAX_NICK_LEN-1 |
push esi |
.copyloop: |
lodsb |
test al, al |
jz .copydone |
cmp al, ' ' |
je .copydone |
stosb |
dec ecx |
jnz .copyloop |
.copydone: |
xor al, al |
stosb |
pop esi |
.not_me: |
; Now print a message on the current channel |
push esi |
mov esi, action_header_short |
call print_text2 |
mov eax, servercommand+1 |
mov dl, '!' |
call print_text |
mov esi, is_now_known_as |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
ret |
cmd_kick: |
add esi, 5 ; skip 'KICK ' |
; Is it me who got kicked? |
mov edi, servercommand+1 |
call compare_to_nick |
jne .not_me |
; TODO: mark channel as disconnected |
.not_me: |
; find the channel user has been kicked from |
push esi |
call skip_nick |
call find_window |
mov esi, action_header_short |
call print_text2 |
mov eax, servercommand+1 |
mov dl, '!' |
call print_text |
mov esi, kicked |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
mov ebx, [window_print] |
mov esi, servercommand+1 |
call user_remove |
ret |
cmd_quit: |
; NOTE: This command applies to a user, and thus has no specific channel |
mov esi, action_header |
call print_text2 |
mov eax, servercommand+1 |
mov dl, '!' |
call print_text |
mov esi, has_quit_irc |
call print_text2 |
; TODO: check other channels on same server too! |
mov ebx, [window_print] |
mov esi, servercommand+1 |
call user_remove |
ret |
cmd_mode: |
add esi, 5 ; skip 'MODE ' |
push esi |
mov esi, action_header_short |
call print_text2 |
mov eax, servercommand+1 |
mov dl, ' ' |
call print_text |
mov esi, sets_mode |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
;;; TODO: change username if needed |
ret |
cmd_353: ; channel usernames reply |
add esi, 4 ; skip '353 ' |
call skip_nick |
inc esi ; channel type '*', '=' or '@' |
inc esi ; ' ' |
call find_window |
; now find window ptr and check if this is the first 353 message |
mov ebx, [window_print] |
test [ebx + window.flags], FLAG_RECEIVING_NAMES |
jnz .add |
or [ebx + window.flags], FLAG_RECEIVING_NAMES |
; mov [ebx + window.users], 0 |
; TODO: remove all users? |
.add: |
push esi |
call user_add |
pop esi |
.namesloop: |
lodsb |
test al, al |
jz .done |
cmp al, ' ' ; names list is separated with spaces |
jne .namesloop |
jmp .add |
.done: |
call redraw_channel_list |
ret |
cmd_366: ; channel usernames end |
add esi, 4 ; skip '366 ' |
call skip_nick |
call find_window |
mov ebx, [window_print] |
and [ebx + window.flags], not FLAG_RECEIVING_NAMES |
ret |
cmd_topic: |
add esi, 4 ; skip '332 ' |
call skip_nick |
call find_window |
push esi |
mov esi, action_header |
call print_text2 |
mov esi, str_topic |
call print_text2 |
pop esi |
call print_text2 |
mov esi, str_newline |
call print_text2 |
ret |
cmd_333: |
add esi, 4 ; skip '333 ' |
call skip_nick ;;;; |
call find_window |
; mov ecx, 2 ; number of spaces to find ;;; CHECKME |
; .loop: |
; lodsb |
; test al, al |
; je .fail |
; cmp al, ' ' |
; jne .loop |
; dec ecx |
; jnz .loop ; find some more spaces |
push esi |
mov esi, action_header |
call print_text2 |
mov esi, str_setby |
call print_text2 |
; pop esi |
; call print_text2 |
pop eax |
mov dl, '!' |
call print_text |
mov esi, str_newline |
call print_text2 |
.fail: |
ret |
cmd_322: |
add esi, 4 |
call skip_nick |
call print_text2 |
mov esi, str_newline |
call print_text2 |
ret |
cmd_323: |
ret |
/programs/network/ircc/socket.inc |
---|
0,0 → 1,242 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
socket_connect: |
; cmp [status], STATUS_CONNECTED ; TODO |
; je disconnect |
; ignore if status is not "disconnected" |
cmp [status], STATUS_DISCONNECTED |
jne .nothing |
mov esi, str_connecting |
call print_text2 |
mov esi, irc_server_name |
call print_text2 |
mov esi, str_dotnewline |
call print_text2 |
; update status |
inc [status] ; was STATUS_DISCONNECTED, now STATUS_RESOLVING |
; resolve name |
push esp ; reserve stack place |
push esp ; fourth parameter |
push 0 ; third parameter |
push 0 ; second parameter |
push irc_server_name |
call [getaddrinfo] |
pop esi |
; test for error |
test eax, eax |
jnz .fail_dns |
; fill in ip in sockstruct |
mov eax, [esi + addrinfo.ai_addr] |
mov eax, [eax + sockaddr_in.sin_addr] |
mov [sockaddr1.ip], eax |
; free allocated memory |
push esi |
call [freeaddrinfo] |
; update status |
inc [status] |
; connect |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
jz .fail |
mov [socketnum], eax |
mcall connect, [socketnum], sockaddr1, 18 |
cmp eax, -1 |
jz .fail_refused |
.nothing: |
ret |
.fail: |
mov [status], STATUS_DISCONNECTED |
mov esi, str_sockerr |
call print_text2 |
ret |
.fail_dns: |
mov [status], STATUS_DISCONNECTED |
mov esi, str_dnserr |
call print_text2 |
ret |
.fail_refused: |
mov [status], STATUS_DISCONNECTED |
mov esi, str_refused |
call print_text2 |
ret |
socket_write_userinfo: |
; create packet in packetbuf |
mov edi, packetbuf |
mov eax, 'NICK' |
stosd |
mov al, ' ' |
stosb |
mov esi, user_nick |
mov ecx, MAX_NICK_LEN |
.loop: |
lodsb |
test al, al |
jz .done |
stosb |
dec ecx |
jnz .loop |
.done: |
mov ax, 0x0d0a |
stosw |
mov eax, 'USER' |
stosd |
mov al, ' ' |
stosb |
mov esi, user_nick |
mov ecx, MAX_NICK_LEN |
.loop2: |
lodsb |
test al, al |
jz .done2 |
stosb |
dec ecx |
jnz .loop2 |
.done2: |
mov eax, ' 8 *' |
stosd |
mov ax, ' :' |
stosw |
mov al, ' ' |
stosb |
mov esi, user_real_name |
mov ecx, MAX_REAL_LEN |
.loop3: |
lodsb |
test al, al |
jz .done3 |
stosb |
dec ecx |
jnz .loop3 |
.done3: |
mov ax, 0x0d0a |
stosw |
lea esi, [edi - packetbuf] |
mcall send, [socketnum], packetbuf, , 0 |
ret |
process_network_event: |
; values for status: 0, 1, 2, 3 |
mov eax, [status] |
dec eax |
; 0 = STATUS_DISCONNECTED - do nothing |
; (ignore network events if we are disconnected from network) |
js .nothing |
; 1 = STATUS_RESOLVING |
jz .nothing |
; 2 = STATUS_CONNECTING |
dec eax |
jz .connecting |
; 3 = STATUS_CONNECTED |
jmp .connected |
.nothing: |
ret |
.connecting: |
call socket_write_userinfo |
; The connection has been established, change status from "connecting" to "connected". |
inc [status] |
.connected: |
call read_incoming_data |
ret |
disconnect: |
cmp [status], STATUS_DISCONNECTED |
je .nothing |
mcall close, [socketnum] |
mov [status], STATUS_DISCONNECTED |
.nothing: |
ret |
read_incoming_data: |
pusha |
; TODO: read more data if we receive one full packet |
.nextpacket: |
mcall recv, [socketnum], packetbuf, 1024 ; read a packet |
inc eax ; check if we got one |
jz .done |
dec eax |
jz .done |
; ok we have data, now feed it to the recoder |
lea edx, [packetbuf + eax] ; edx = end pointer |
mov esi, packetbuf ; esi = start pointer |
.nextcommand: |
mov edi, servercommand |
.byteloop: |
call get_next_byte ; reads byte from [esi] to al |
jnc .nextpacket ; if CF is set, we need more data |
cmp al, 10 |
je .got_command |
cmp al, 13 |
je .got_command |
stosb |
jmp .byteloop |
; we have a command, call the serverparser |
.got_command: |
mov byte[edi], 0 ; mark the end of the command |
push esi edx |
call server_parser |
pop edx esi |
jmp .nextcommand |
.done: |
popa |
ret |
/programs/network/ircc/userparser.inc |
---|
0,0 → 1,318 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
user_parser: |
mov eax, [edit1.size] |
mov word [usercommand + eax], 0x0a0d ; terminate the line |
cmp byte[usercommand], '/' ; is it a server command ? |
je server_command |
; Ignore data commands when not connected. |
cmp [status], STATUS_CONNECTED |
jne sdts_ret |
; Ok, we said something, print it to our textbox |
; TODO: dont send if it's a server window? |
push [window_open] ; print to the current window |
pop [window_print] |
call window_refresh |
if TIMESTAMP |
call print_timestamp |
end if |
mov bl, '<' |
call print_character |
mov esi, user_nick |
call print_text2 |
mov bl,'>' |
call print_character |
mov bl,' ' |
call print_character |
mov eax, [edit1.size] |
mov byte[usercommand + eax],0 |
mov esi, usercommand |
call print_text2 |
mov bl, 10 |
call print_character |
; and now send it to the server |
mov dword[packetbuf], 'priv' |
mov dword[packetbuf+4], 'msg ' |
mov esi, [window_open] |
add esi, window.name |
mov edi, packetbuf+8 |
mov ecx, MAX_WINDOWNAME_LEN |
.loop: |
lodsb |
test al, al |
jz .done |
stosb |
dec ecx |
jnz .loop |
.done: |
mov ax, ' :' |
stosw |
mov esi, usercommand |
mov ecx, [edit1.size] |
inc ecx |
call recode |
mov al, 10 |
stosb |
lea esi, [edi - packetbuf] |
mcall send, [socketnum], packetbuf, , 0 |
sdts_ret: |
ret |
user_commands: |
dd 'nick', cmd_usr_nick |
dd 'real', cmd_usr_real |
dd 'serv', cmd_usr_server |
dd 'help', cmd_usr_help |
dd 'code', cmd_usr_code |
; TODO: All other commands require a connection to the server. |
dd 'quer', cmd_usr_quer |
dd 'quit', cmd_usr_quit |
.number = ($ - user_commands) / 8 |
server_command: |
mov eax, dword[usercommand+1] |
or eax, 0x20202020 |
mov edi, user_commands |
mov ecx, user_commands.number |
.loop: |
scasd |
je .got_cmd |
add edi, 4 |
dec ecx |
jnz .loop |
jmp cmd_usr_send ; If none of the previous commands, just send to server |
.got_cmd: |
jmp dword[edi] |
cmd_usr_quit: |
cmp [edit1.size], 5 |
je .ok |
jb cmd_usr_send |
cmp byte[usercommand+5], ' ' |
jne cmd_usr_send |
.ok: |
call cmd_usr_send |
mcall close, [socketnum] |
mov ecx, MAX_WINDOWS |
mov edi, windows |
.loop: |
mov [edi + window.flags], FLAG_CLOSE |
add edi, sizeof.window |
dec ecx |
jnz .loop |
ret |
cmd_usr_nick: |
cmp [edit1.size], 5 |
je .justprint |
cmp byte[usercommand+5], ' ' |
jne cmd_usr_send |
mov ecx, MAX_NICK_LEN |
mov esi, usercommand+6 |
mov edi, user_nick |
.loop: |
lodsb |
cmp al, 13 |
je .done |
stosb |
dec ecx |
jnz .loop |
.done: |
xor al, al |
stosb |
cmp [socketnum], 0 |
je .justprint |
lea esi, [edi - usercommand] |
mcall send, [socketnum], usercommand+1, , 0 |
.justprint: |
mov esi, str_nickchange |
call print_text2 |
mov esi, user_nick |
call print_text2 |
mov esi, str_dotnewline |
call print_text2 |
ret |
cmd_usr_real: |
cmp byte[usercommand+5], ' ' |
jne cmd_usr_send |
mov ecx, MAX_REAL_LEN |
mov esi, usercommand+6 |
mov edi, user_real_name |
.loop: |
lodsb |
cmp al, 13 |
je .done |
stosb |
dec ecx |
jnz .loop |
.done: |
xor al, al |
stosb |
mov esi, str_realchange |
call print_text2 |
mov esi, user_real_name |
call print_text2 |
mov esi, str_dotnewline |
call print_text2 |
ret |
cmd_usr_server: |
mov eax, dword[usercommand+5] ; check for 'er ', we only checked 'serv' |
or eax, 0x00002020 |
and eax, 0x00ffffff |
cmp eax, 'er ' |
jne cmd_usr_send |
mov ecx, [edit1.size] ; ok now set the address |
sub ecx, 8 |
mov esi, usercommand+8 |
push esi |
mov edi, irc_server_name |
rep movsb |
xor al, al |
stosb |
pop esi |
; set it also in window name |
mov ebx, [window_print] |
call window_set_name |
; now connect |
call socket_connect |
ret |
cmd_usr_quer: |
mov ecx, MAX_WINDOWS |
mov ebx, windows |
.loop: |
cmp [ebx + window.data_ptr], 0 |
je .found |
add ebx, sizeof.window |
dec ecx |
jnz .loop |
; error: no available channels ! FIXME |
ret |
.found: |
call window_create |
test eax, eax |
jz .error |
mov [ebx + window.data_ptr], eax |
mov esi, usercommand+7 |
call window_set_name |
mov [ebx + window.type], WINDOWTYPE_CHAT |
mov [ebx + window.flags], 0 |
.error: |
ret |
cmd_usr_help: |
mov esi, str_help |
call print_text2 |
ret |
cmd_usr_code: |
; TODO |
ret |
cmd_usr_send: |
mov esi, usercommand+1 |
mov ecx, [edit1.size] |
inc ecx |
mov edi, packetbuf |
call recode |
lea esi, [edi - packetbuf] |
mcall send, [socketnum], packetbuf, , 0 |
ret |
/programs/network/ircc/users.inc |
---|
0,0 → 1,164 |
; esi is ptr to nick |
; ebx is ptr to window |
align 4 |
user_add: |
cmp [ebx + window.users], MAX_USERS |
jae fail |
mov edi, [ebx + window.data_ptr] |
add edi, window_data.names |
mov ebp, [ebx + window.users] |
inc ebp ; CHECKME |
push esi edi |
.restart: |
mov ecx, MAX_NICK_LEN |
.loop1: |
lodsb |
cmp al, '@' |
jne @f |
mov al, ' ' ; give @ highest priority |
@@: |
cmp al, 'A' |
jb @f |
cmp al, 'Z' |
ja @f |
add al, 'a' - 'A' ; convert to lowercase |
@@: |
dec ecx |
jz .got_it |
.loop2: |
mov dl, [edi] |
cmp dl, 0 |
je .got_it |
cmp dl, '@' |
jne @f |
mov dl, ' ' ; give @ highest priority |
@@: |
cmp dl, 'A' |
jb @f |
cmp dl, 'Z' |
ja @f |
add dl, 'a' - 'A' ; convert to lowercase |
@@: |
cmp al, dl |
jb .got_it |
je .check_next |
pop edi esi |
add edi, MAX_NICK_LEN |
push esi edi |
dec ebp |
jnz .restart |
.check_next: |
inc edi |
jmp .loop1 |
.got_it: |
pop edi esi |
; OK, insert it here.. |
; mov all trailing usernames by MAX_NICK_LEN bytes |
push esi edi |
mov esi, [ebx + window.data_ptr] |
add esi, window_data.names + MAX_NICK_LEN * (MAX_USERS - 1) |
mov ecx, esi |
sub ecx, edi |
add ecx, MAX_NICK_LEN |
shr ecx, 2 |
lea edi, [esi + MAX_NICK_LEN] |
std |
rep movsd |
cld |
pop edi esi |
; Now insert our new username |
mov ecx, MAX_NICK_LEN-1 |
.fill: |
lodsb |
cmp al, ' ' |
je .done |
cmp al, '!' |
je .done |
stosb |
loop .fill |
.done: |
xor al, al |
stosb |
inc [ebx + window.users] |
ret |
; esi is ptr to nick |
; ebx is ptr to window |
align 4 |
user_remove: |
call user_find |
jz fail |
lea esi, [edi + MAX_NICK_LEN] |
mov ecx, [ebx + window.data_ptr] |
add ecx, window_data.names + MAX_NICK_LEN * MAX_USERS |
sub ecx, esi |
shr ecx, 2 |
rep movsd |
dec [ebx + window.users] |
xor eax, eax |
ret |
; IN: |
; esi is ptr to nick |
; ebx is ptr to window |
; OUT: |
; edi is ptr to nick in userlist |
align 4 |
user_find: |
mov eax, [ebx + window.users] |
test eax, eax |
jz fail |
mov edi, [ebx + window.data_ptr] |
add edi, window_data.names |
.loop: |
push esi edi |
mov ecx, MAX_NICK_LEN |
repe cmpsb |
cmp byte[edi-1], 0 |
je .got_it |
; TODO: check byte[esi] too! |
pop edi esi |
add edi, MAX_NICK_LEN |
dec eax |
jnz .loop |
jmp fail |
.got_it: |
pop edi esi |
test edi, edi ; to clear zero flag |
ret |
fail: |
xor edi, edi |
ret |
/programs/network/ircc/window.inc |
---|
0,0 → 1,167 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
window_create: |
; allocate the window data block |
mcall 68, 12, sizeof.window_data |
test eax, eax |
jz .fail |
; fill it with all zeros |
push eax |
mov edi, eax |
mov ecx, (sizeof.window_data+3)/4 |
xor eax, eax |
rep stosd |
pop eax |
.fail: |
ret |
window_set_name: ; esi = ptr to name, ebx = window ptr |
pusha |
; Skip heading spaces |
.spaceloop: |
cmp byte[esi], ' ' |
jne .done |
inc esi |
jmp .spaceloop |
.done: |
; Now copy it |
lea edi, [ebx + window.name] |
mov ecx, MAX_WINDOWNAME_LEN |
.loop: |
lodsb |
cmp al, 0x21 |
jbe .addzero |
stosb |
dec ecx |
jnz .loop |
.addzero: |
xor al, al |
stosb |
call draw_windownames ; redraw it |
popa |
ret |
window_refresh: |
; set the correct buffer pointers ; FIXME: what is it good for? |
mov eax, [textbox_width] ; |
imul eax, 11 ; |
mov [pos], eax ; |
mov eax, [window_print] |
mov eax, [eax + window.data_ptr] |
add eax, window_data.text |
mov [text_start], eax |
ret |
window_updated: |
mov edi, [window_print] |
test [edi + window.flags], FLAG_UPDATED |
jnz .skip |
or [edi + window.flags], FLAG_UPDATED |
; now play a sound :) |
.skip: |
ret |
print_text: ; eax = start ptr |
; dl = end char |
pusha |
ptr2: |
mov bl, [eax] |
cmp bl, dl |
je ptr_ret |
cmp bl, 0 |
je ptr_ret |
call print_character |
inc eax |
jmp ptr2 |
ptr_ret: |
popa |
ret |
print_text2: ; esi = ptr to ASCIIZ string |
pusha |
.loop: |
lodsb |
test al, al |
jz .done |
mov bl, al |
call print_character |
jmp .loop |
.done: |
popa |
ret |
if TIMESTAMP |
print_timestamp: |
pusha |
mcall 3 ; get system time |
mov bl, '[' |
call print_character |
mov ecx, TIMESTAMP |
.loop: |
mov bl, al |
shr bl, 4 |
add bl, '0' |
call print_character |
mov bl, al |
and bl, 0x0f |
add bl, '0' |
call print_character |
dec ecx |
jz .done |
mov bl, ':' |
call print_character |
shr eax, 8 |
jmp .loop |
.done: |
mov bl, ']' |
call print_character |
mov bl, ' ' |
call print_character |
popa |
ret |
end if |
/programs/network/ircc |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/libio.inc |
---|
0,0 → 1,113 |
;;================================================================================================;; |
;;//// libio.inc //// (c) mike.dld, 2007-2008 ////////////////////////////////////////////////////;; |
;;================================================================================================;; |
;; ;; |
;; This file is part of Common development libraries (Libs-Dev). ;; |
;; ;; |
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;; |
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;; |
;; of the License, or (at your option) any later version. ;; |
;; ;; |
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;; |
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; |
;; Lesser General Public License for more details. ;; |
;; ;; |
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev. ;; |
;; If not, see <http://www.gnu.org/licenses/>. ;; |
;; ;; |
;;================================================================================================;; |
O_BINARY = 00000000b |
O_READ = 00000001b |
O_WRITE = 00000010b |
O_CREATE = 00000100b |
O_SHARE = 00001000b |
O_TEXT = 00010000b |
SEEK_SET = 0 |
SEEK_CUR = 1 |
SEEK_END = 2 |
struct FileDateTime |
union |
time dd ? |
struct |
sec db ? |
min db ? |
hour db ? |
ends |
ends |
union |
date dd ? |
struct |
day db ? |
month db ? |
year dw ? |
ends |
ends |
ends |
struct FileInfoBlock |
Function dd ? |
Position dd ? |
Flags dd ? |
Count dd ? |
Buffer dd ? |
db ? |
FileName dd ? |
ends |
struct FileInfoHeader |
Version dd ? |
FilesRead dd ? |
FilesCount dd ? |
rd 5 |
ends |
struct FileInfoA |
Attributes dd ? |
Flags dd ? |
DateCreate FileDateTime |
DateAccess FileDateTime |
DateModify FileDateTime |
union |
FileSize dq ? |
struct |
FileSizeLow dd ? |
FileSizeHigh dd ? |
ends |
ends |
FileName rb 264 |
ends |
struct FileInfoW |
Attributes dd ? |
Flags dd ? |
DateCreate FileDateTime |
DateAccess FileDateTime |
DateModify FileDateTime |
union |
FileSize dq ? |
struct |
FileSizeLow dd ? |
FileSizeHigh dd ? |
ends |
ends |
FileName rw 264 |
ends |
virtual at 0 |
FileInfo FileInfoA |
FileInfo fix FileInfoA |
sizeof.FileInfo fix sizeof.FileInfoA |
end virtual |
FA_READONLY = 00000001b |
FA_HIDDEN = 00000010b |
FA_SYSTEM = 00000100b |
FA_LABEL = 00001000b |
FA_FOLDER = 00010000b |
FA_ARCHIVED = 00100000b |
FA_NORMAL = 01000000b |
FA_ANY = 01111111b |
/programs/network/macros.inc |
---|
0,0 → 1,588 |
@^ fix macro comment { |
^@ fix } |
; ------------------------- |
macro library [lname,fname] |
{ |
forward |
dd __#lname#_library_table__,__#lname#_library_name__ |
common |
dd 0 |
forward |
align 4 |
__#lname#_library_name__ db fname,0 |
} |
macro import lname,[name,sname] |
{ |
common |
align 4 |
__#lname#_library_table__: |
forward |
if used name |
name dd __#name#_import_name__ |
end if |
common |
dd 0 |
forward |
if used name |
align 4 |
__#name#_import_name__ db sname,0 |
end if |
} |
macro export [name,sname] |
{ |
forward |
dd __#name#_export_name__,name |
common |
dd 0 |
forward |
align 4 |
__#name#_export_name__ db sname,0 |
} |
; ------------------------- |
macro m2m dest,src { |
push src |
pop dest |
} |
macro iglobal { |
IGlobals equ IGlobals, |
macro __IGlobalBlock { } |
macro uglobal { |
UGlobals equ UGlobals, |
macro __UGlobalBlock { } |
endg fix } ; Use endg for ending iglobal and uglobal blocks. |
macro IncludeIGlobals{ |
macro IGlobals dummy,[n] \{ __IGlobalBlock |
purge __IGlobalBlock \} |
match I, IGlobals \{ I \} } |
macro IncludeUGlobals{ |
macro UGlobals dummy,[n] \{ |
\common |
\local begin, size |
begin = $ |
virtual at $ |
\forward |
__UGlobalBlock |
purge __UGlobalBlock |
\common |
size = $ - begin |
end virtual |
rb size |
\} |
match U, UGlobals \{ U \} } |
uglobal |
endg |
iglobal |
endg |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
IncludeIGlobals |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
IncludeUGlobals |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; macro for defining multiline text data |
struc mls [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring ; mod |
ssize = $ |
end virtual |
db ssize |
db sstring |
common |
db -1 ; mod |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
name db data |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
forward |
if lang eq lng |
db data |
end if |
common |
.size = $-name |
end if |
} |
macro szc name,elsz,[data] { ; from MFAR [mike.dld] |
common |
local s,m |
m = 0 |
if used name |
label name |
forward |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
common |
.size = $-name |
.maxl = m |
end if |
} |
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] |
common |
local s,m,c |
m = 0 |
c = 0 |
if used name |
label name |
forward |
if lang eq lng |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
c = c+1 |
end if |
common |
.size = $-name |
.maxl = m |
.count = c |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
include 'config.inc' |
;__CPU_type equ p5 |
SYSENTER_VAR equ 0 |
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls |
local ..ret_point |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
if __CPU_type eq p5 |
int 0x40 |
else |
if __CPU_type eq p6 |
push ebp |
mov ebp, esp |
push ..ret_point ; it may be 2 or 5 byte |
sysenter |
..ret_point: |
pop edx |
pop ecx |
else |
if __CPU_type eq k6 |
push ecx |
syscall |
pop ecx |
else |
display 'ERROR : unknown CPU type (set to p5)', 10, 13 |
__CPU_type equ p5 |
int 0x40 |
end if |
end if |
end if |
} |
; ------------------------- |
macro header a,[b] { |
common |
use32 |
org 0 |
db 'MENUET',a |
forward |
if b eq |
dd 0 |
else |
dd b |
end if } |
macro section name { align 16 |
label name } |
macro func name { |
if ~used name |
display 'FUNC NOT USED: ',`name,13,10 |
else |
align 4 |
name: |
;diff16 `name,0,name |
;pushad |
;pushfd |
;dps `name |
;newline |
;mcall 5,1 |
;popfd |
;popad |
} |
macro endf { end if } |
macro diff16 title,l1,l2 |
{ |
local s,d |
s = l2-l1 |
display title,': 0x' |
repeat 8 |
d = '0' + s shr ((8-%) shl 2) and $0F |
if d > '9' |
d = d + 'A'-'9'-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
macro diff10 title,l1,l2 |
{ |
local s,d,z,m |
s = l2-l1 |
z = 0 |
m = 1000000000 |
display title,': ' |
repeat 10 |
d = '0' + s / m |
s = s - (s/m)*m |
m = m / 10 |
if d <> '0' |
z = 1 |
end if |
if z <> 0 |
display d |
end if |
end repeat |
display 13,10 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro RGB [a] { |
common |
match (r=,g=,b),a \{ |
\dd ((r) shl 16) or ((g) shl 8) or (b) |
\} |
} |
struc POINT _t,_dx,_dy { |
.x _t _dx |
.y _t _dy |
} |
; structure definition helper |
include 'struct.inc' |
struct RECT |
left dd ? |
top dd ? |
right dd ? |
bottom dd ? |
ends |
struct BOX |
left dd ? |
top dd ? |
width dd ? |
height dd ? |
ends |
; structures used in MeOS |
struct process_information |
cpu_usage dd ? ; +0 |
window_stack_position dw ? ; +4 |
window_stack_value dw ? ; +6 |
dw ? ; +8 |
process_name rb 12 ; +10 |
memory_start dd ? ; +22 |
used_memory dd ? ; +26 |
PID dd ? ; +30 |
box BOX ; +34 |
slot_state dw ? ; +50 |
dw ? ; +52 |
client_box BOX ; +54 |
wnd_state db ? ; +70 |
rb (1024-71) |
ends |
struct system_colors |
frame dd ? |
grab dd ? |
grab_button dd ? |
grab_button_text dd ? |
grab_text dd ? |
work dd ? |
work_button dd ? |
work_button_text dd ? |
work_text dd ? |
work_graph dd ? |
ends |
struct FILEDATE |
Second db ? |
Minute db ? |
Hour db ? |
db ? |
Day db ? |
Month db ? |
Year dw ? |
ends |
struct FILEINFO |
Attributes dd ? |
IsUnicode db ? |
db 3 dup(?) |
DateCreate FILEDATE |
DateAccess FILEDATE |
DateModify FILEDATE |
Size dq ? |
ends |
if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 |
cmove fix cmovz |
macro cmovz reg1, reg2 { |
local .jumpaddr |
jnz .jumpaddr |
mov reg1, reg2 |
.jumpaddr: |
} |
cmovne fix cmovnz |
macro cmovnz reg1, reg2 { |
local .jumpaddr |
jz .jumpaddr |
mov reg1, reg2 |
.jumpaddr: |
} |
macro cmovg reg1, reg2 { |
local .jumpaddr |
jle .jumpaddr |
mov reg1, reg2 |
.jumpaddr: |
} |
macro cmovl reg1, reg2 { |
local .jumpaddr |
jge .jumpaddr |
mov reg1, reg2 |
.jumpaddr: |
} |
end if |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
EVM_DEBUG = 100000000b |
EVM_STACK2 = 1000000000b |
/programs/network/netcfg/drivers.inc |
---|
0,0 → 1,198 |
driverlist: |
db 'RTL8139',0 |
dd 0x813910ec |
dd 0x813810ec |
dd 0x12111113 |
dd 0x13601500 |
dd 0x13604033 |
dd 0x13001186 |
dd 0x13401186 |
dd 0xab0613d1 |
dd 0xa1171259 |
dd 0xa11e1259 |
dd 0xab0614ea |
dd 0xab0714ea |
dd 0x123411db |
dd 0x91301432 |
dd 0x101202ac |
dd 0x0106018a |
dd 0x1211126c |
dd 0x81391743 |
dd 0x8139021b |
dd 0x0 ; end |
db 'RTL8029',0 |
dd 0x802910ec |
dd 0x0 |
db 'I8255X',0 |
dd 0x12098086 |
dd 0x10298086 |
dd 0x12298086 |
dd 0x10308086 |
dd 0x24498086 |
dd 0x0 |
db 'RTL8169',0 |
dd 0x816810ec |
dd 0x816910ec |
dd 0x011616ec |
dd 0x43001186 |
dd 0x813610ec |
dd 0x0 |
db '3C59X',0 |
dd 0x590010b7 |
dd 0x592010b7 |
dd 0x597010b7 |
dd 0x595010b7 |
dd 0x595110b7 |
dd 0x595210b7 |
dd 0x900010b7 |
dd 0x900110b7 |
dd 0x900410b7 |
dd 0x900510b7 |
dd 0x900610b7 |
dd 0x900A10b7 |
dd 0x905010b7 |
dd 0x905110b7 |
dd 0x905510b7 |
dd 0x905810b7 |
dd 0x905A10b7 |
dd 0x920010b7 |
dd 0x980010b7 |
dd 0x980510b7 |
dd 0x764610b7 |
dd 0x505510b7 |
dd 0x605510b7 |
dd 0x605610b7 |
dd 0x5b5710b7 |
dd 0x505710b7 |
dd 0x515710b7 |
dd 0x525710b7 |
dd 0x656010b7 |
dd 0x656210b7 |
dd 0x656410b7 |
dd 0x450010b7 |
dd 0x0 |
db 'SIS900',0 |
dd 0x09001039 |
dd 0x70161039 |
dd 0x0 |
db 'PCNET32',0 |
dd 0x20001022 |
dd 0x26251022 |
dd 0x20011022 |
dd 0x0 |
db 'FORCEDETH',0 |
dd 0x006610de |
dd 0x01c310de |
dd 0x00D610de |
dd 0x008610de |
dd 0x008c10de |
dd 0x00e610de |
dd 0x00df10de |
dd 0x005610de |
dd 0x005710de |
dd 0x003710de |
dd 0x003810de |
dd 0x026810de |
dd 0x026910de |
dd 0x037210de |
dd 0x037310de |
dd 0x03e510de |
dd 0x03e610de |
dd 0x03ee10de |
dd 0x03ef10de |
dd 0x045010de |
dd 0x045110de |
dd 0x045210de |
dd 0x045310de |
dd 0x054c10de |
dd 0x054d10de |
dd 0x054e10de |
dd 0x054f10de |
dd 0x07dc10de |
dd 0x07dd10de |
dd 0x07de10de |
dd 0x07df10de |
dd 0x076010de |
dd 0x076110de |
dd 0x076210de |
dd 0x076310de |
dd 0x0ab010de |
dd 0x0ab110de |
dd 0x0ab210de |
dd 0x0ab310de |
dd 0x0d7d10de |
dd 0x0 |
db 'MTD80X',0 |
dd 0x08031516 |
dd 0x08001516 |
dd 0x08911516 |
dd 0x0 |
db 'dec21x4x',0 |
dd 0x00091011 |
dd 0x00191011 |
dd 0x09851317 |
dd 0x0 |
db 'R6040',0 |
dd 0x604017F3 |
dd 0x0 |
db 'i8254x',0 |
dd 0x10008086 ; 82542 (Fiber) |
dd 0x10018086 ; 82543GC (Fiber) |
dd 0x10048086 ; 82543GC (Copper) |
dd 0x10088086 ; 82544EI (Copper) |
dd 0x10098086 ; 82544EI (Fiber) |
dd 0x100A8086 ; 82540EM |
dd 0x100C8086 ; 82544GC (Copper) |
dd 0x100D8086 ; 82544GC (LOM) |
dd 0x100E8086 ; 82540EM |
dd 0x100F8086 ; 82545EM (Copper) |
dd 0x10108086 ; 82546EB (Copper) |
dd 0x10118086 ; 82545EM (Fiber) |
dd 0x10128086 ; 82546EB (Fiber) |
dd 0x10138086 ; 82541EI |
dd 0x10148086 ; 82541ER |
dd 0x10158086 ; 82540EM (LOM) |
dd 0x10168086 ; 82540EP (Mobile) |
dd 0x10178086 ; 82540EP |
dd 0x10188086 ; 82541EI |
dd 0x10198086 ; 82547EI |
dd 0x101a8086 ; 82547EI (Mobile) |
dd 0x101d8086 ; 82546EB |
dd 0x101e8086 ; 82540EP (Mobile) |
dd 0x10268086 ; 82545GM |
dd 0x10278086 ; 82545GM |
dd 0x10288086 ; 82545GM |
dd 0x105b8086 ; 82546GB (Copper) |
dd 0x10758086 ; 82547GI |
dd 0x10768086 ; 82541GI |
dd 0x10778086 ; 82541GI |
dd 0x10788086 ; 82541ER |
dd 0x10798086 ; 82546GB |
dd 0x107a8086 ; 82546GB |
dd 0x107b8086 ; 82546GB |
dd 0x107c8086 ; 82541PI |
dd 0x10b58086 ; 82546GB (Copper) |
dd 0x11078086 ; 82544EI |
dd 0x11128086 ; 82544GC |
dd 0x0 |
db 'RHINE', 0 ; VIA Rhine |
dd 0x30431106 |
dd 0x61001106 |
dd 0x30651106 |
dd 0x31061106 |
dd 0x30531106 |
dd 0x0 |
dd 0x0 ; driverlist end |
/programs/network/netcfg/netcfg.asm |
---|
0,0 → 1,548 |
; |
; Netcfg v1.02 |
; |
; Application to load network drivers in KolibriOS |
; |
; By hidnplayr |
; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd IM_END ; size of image |
dd (I_END+0x100) ; memory for app |
dd (I_END+0x100) ; esp |
dd param, 0x0 ; I_Param , I_Icon |
type_ethernet equ 1 |
include '../macros.inc' |
START: |
; first, check boot parameters |
cmp byte[param], 0 |
je .noparams |
mcall 40, 0 |
push .exit |
cmp byte[param], 'A' ; A for All |
je Get_PCI_Info |
cmp byte[param], 'F' ; F for First |
je Get_PCI_Info |
ret |
.exit: |
mcall -1 |
.noparams: |
call draw_window |
still: |
mcall 10 ; wait here for event |
dec eax ; redraw request ? |
jz red |
dec eax ; key in buffer ? |
jz key |
dec eax ; button in buffer ? |
jz button |
jmp still |
red: ; redraw |
mcall 9, Proc_Info, -1 ; window redraw requested so get new window coordinates and size |
mov eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure |
mov [Form + 2], ax ; x start position |
mov eax, [Proc_Info.box.top]; |
mov [Form + 6], ax ; ystart position |
mov eax, [Proc_Info.box.width] ; |
mov [Form], ax ; window width |
mov eax, [Proc_Info.box.height] ; |
mov [Form + 4] ,ax ; window height |
call draw_window ; go redraw window now |
jmp still |
key: ; key |
mcall 2 ; just read it and ignore |
jmp still |
button: ; button |
mcall 17 ; get id |
cmp ah, 1 ; button id = 1 ? |
jne @f |
exit: mcall -1 ; close this program |
@@: |
cmp eax,0x0000ff00 |
jg load_drv |
cmp ah, 4 |
je hook |
cmp ah, 5 |
je reset |
cmp ah, 6 |
je unload |
jmp still |
load_drv: |
shr eax, 16 |
mov word [selected], ax |
mov bl , 6 ; get a dword |
mov bh , ah ; bus |
mov ch , al ; dev |
mov cl , 0 ; offset to device/vendor id |
mcall 62 ; get ID's |
mov word [PCI_Vendor], ax |
shr eax, 16 |
mov word [PCI_Device], ax |
call get_drv_ptr |
mov ecx, eax |
mcall 68, 16 |
mov [IOCTL.handle], eax |
call draw_window |
cmp [IOCTL.handle], 0 |
jne still |
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , load_error |
jmp still |
hook: |
mov ax , [selected] |
test ax , ax |
jz still |
mov [hardwareinfo.pci_dev], al |
mov [hardwareinfo.pci_bus], ah |
mov [IOCTL.io_code], 1 ; SRV_HOOK |
mov [IOCTL.inp_size], 3 |
mov [IOCTL.input], hardwareinfo |
mov [IOCTL.out_size], 0 |
mov [IOCTL.output], 0 |
mcall 68, 17, IOCTL |
mov byte[drivernumber], al |
jmp still |
reset: |
movzx ebx, byte[drivernumber] |
mcall 74,,2 |
jmp still |
unload: |
movzx ebx, byte[drivernumber] |
mcall 74,,3 |
jmp still |
draw_window: |
mcall 12, 1 ; start of draw |
mcall 0, dword [Form], dword [Form + 4], 0x13ffffff, 0x805080d0, title |
call Get_PCI_Info ; get pci version and last bus, scan for and draw each pci device |
cmp edx, 20 shl 16 + 110 |
je .nonefound |
mcall 4, 20 shl 16 + 100, 1 shl 31 + 0x00000000 , caption |
cmp [selected], 0 |
jz .done |
cmp [IOCTL.handle] ,0 |
jz .done |
mcall 8, 18 shl 16 + 100, 35 shl 16 + 18, 4, 0x00007f00 |
mcall ,, 55 shl 16 + 18, 5, 0x0000007f |
mcall ,, 75 shl 16 + 18, 6, 0x007f0000 |
mcall 4, 33 shl 16 + 42, 1 shl 31 + 0x00ffffff , btn_start |
mcall , 33 shl 16 + 62, , btn_reset |
mcall , 36 shl 16 + 82, , btn_stop |
jmp .done |
.nonefound: |
mcall 4, 20 shl 16 + 30, 1 shl 31 + 0x00ff0000 , nonefound |
.done: |
mcall 12, 2 ; end of draw |
ret |
;------------------------------------------------------------------ |
;* Gets the PCI Version and Last Bus |
Get_PCI_Info: |
mcall 62, 0 |
mov word [PCI_Version], ax |
mcall 62, 1 |
mov byte [PCI_LastBus], al |
;---------------------------------------------------------- |
;* Get all devices on PCI Bus |
mov edx, 20 shl 16 + 110 ; set start write position |
cmp al , 0xff ; 0xFF means no pci bus found |
jne Pci_Exists ; |
ret ; if no bus then leave |
Pci_Exists: |
mov byte [V_Bus], 0 ; reset varibles |
mov byte [V_Dev], 0 ; |
Start_Enum: |
mov bl , 6 ; get a dword |
mov bh , byte [V_Bus] ; bus of pci device |
mov ch , byte [V_Dev] ; device number/function |
mov cl , 0 ; offset to device/vendor id |
mcall 62 ; get ID's |
cmp ax, 0 ; Vendor ID should not be 0 or 0xFFFF |
je nextDev ; check next device if nothing exists here |
cmp ax, 0xffff ; |
je nextDev ; |
mov word [PCI_Vendor], ax ; There is a device here, save the ID's |
shr eax, 16 ; |
mov word [PCI_Device], ax ; |
mov bl , 4 ; Read config byte |
mov bh , byte [V_Bus] ; Bus # |
mov ch , byte [V_Dev] ; Device # on bus |
mov cl , 0x08 ; Register to read (Get Revision) |
mcall 62 ; Read it |
mov byte [PCI_Rev], al ; Save it |
mov cl , 0x0b ; Register to read (Get class) |
mcall 62 ; Read it |
mov byte [PCI_Class], al ; Save it |
mov cl , 0x0a ; Register to read (Get Subclass) |
mcall 62 ; Read it |
mov byte [PCI_SubClass], al ; Save it |
mov cl , 0x09 ; Register to read (Get Interface) |
mcall 62 ; Read it |
mov [PCI_Interface], al ; Save it |
mov cl , 0x3c ; Register to read (Get IRQ) |
@@: mcall 62 ; Read it |
mov [PCI_IRQ], al ; Save it |
; cmp byte [PCI_Class], 0 ; device from before class codes |
; je @f |
cmp byte [PCI_Class], 2 ; network controller |
jne nextDev |
; @@: |
cmp byte[param], 0 |
jne load_and_start |
mov cl, 0x0e |
mcall 62 |
push eax |
call Print_New_Device ; print device info to screen |
pop eax |
test al, al |
js nextDev |
nextdev2: |
test byte [V_Dev], 7 |
jnz nextDev |
or byte [V_Dev], 7 |
nextDev: |
inc [V_Dev] ; lower 3 bits are the function number |
jnz Start_Enum ; jump until we reach zero |
mov byte [V_Dev], 0 ; reset device number |
inc byte [V_Bus] ; next bus |
mov al , byte [PCI_LastBus] ; get last bus |
cmp byte [V_Bus], al ; was it last bus |
jbe Start_Enum ; if not jump to keep searching |
ret |
load_and_start: |
call get_drv_ptr |
cmp eax, lbl_none |
je .next |
mov ecx, eax |
mcall 68, 16 |
test eax, eax |
jz .next |
mov [IOCTL.handle], eax |
mov al, [V_Dev] |
mov [hardwareinfo.pci_dev], al |
mov al, [V_Bus] |
mov [hardwareinfo.pci_bus], al |
mov [IOCTL.io_code], 1 ; SRV_HOOK |
mov [IOCTL.inp_size], 3 |
mov [IOCTL.input], hardwareinfo |
mov [IOCTL.out_size], 0 |
mov [IOCTL.output], 0 |
mcall 68, 17, IOCTL |
.next: |
cmp byte[param], 'A' |
je nextdev2 |
jmp exit |
;------------------------------------------------------------------ |
;* Print device info to screen |
Print_New_Device: |
push edx ; Magic ! (to print a button...) |
mov ebx, 18 shl 16 |
mov bx , [Form] |
sub bx , 36 |
mov cx , dx |
dec cx |
shl ecx, 16 |
add ecx, 9 |
movzx edx, byte [V_Bus] |
shl dx , 8 |
mov dl , byte [V_Dev] |
mov esi, 0x0000c0ff ; color: yellow if selected, blue otherwise |
cmp word [selected], dx |
jne @f |
mov esi, 0x00c0c000 |
@@: |
shl edx, 8 |
or dl , 0xff |
mcall 8 |
pop edx |
xor esi, esi ; Color of text |
movzx ecx, word [PCI_Vendor] ; number to be written |
mcall 47, 0x00040100 ; Write Vendor ID |
add edx, (4*6+18) shl 16 |
movzx ecx, word [PCI_Device] ; get Vendor ID |
mcall ; Draw Vendor ID to Window |
add edx, (4*6+18) shl 16 |
movzx ecx, byte [V_Bus] ; get bus number |
mcall ,0x00020100 ; draw bus number to screen |
add edx, (2*6+18) shl 16 |
movzx ecx, byte [V_Dev] ; get device number |
shr ecx, 3 ; device number is bits 3-7 |
mcall ; Draw device Number To Window |
add edx, (2*6+18) shl 16 |
movzx ecx, byte [PCI_Rev] ; get revision number |
mcall ; Draw Revision to screen |
add edx, (2*6+18) shl 16 |
movzx ecx, [PCI_IRQ] |
cmp cl , 0x0f ; IRQ must be between 0 and 15 |
ja @f |
mcall |
@@: |
; |
;Write Names |
movzx ebx, dx ; Set y position |
or ebx, 230 shl 16 ; set Xposition |
;------------------------------------------------------------------ |
; Prints the Vendor's Name based on Vendor ID |
;------------------------------------------------------------------ |
mov edx, VendorsTab |
mov cx , word[PCI_Vendor] |
.fn: mov ax , [edx] |
add edx, 6 |
test ax , ax |
jz .find |
cmp ax , cx |
jne .fn |
.find: mov edx, [edx - 4] |
mcall 4,, 0x80000000 ; lets print the vendor Name |
;------------------------------------------------------------------ |
; Get description based on Class/Subclass |
;------------------------------------------------------------------ |
mov eax, dword [PCI_Class] |
and eax, 0xffffff |
xor edx, edx |
xor esi, esi |
.fnc: inc esi |
mov ecx, [Classes + esi * 8 - 8] |
cmp cx , 0xffff |
je .endfc |
cmp cx , ax |
jne .fnc |
test ecx, 0xff000000 |
jz @f |
mov edx, [Classes + esi * 8 - 4] |
jmp .fnc |
@@: cmp eax, ecx |
jne .fnc |
xor edx, edx |
.endfc: test edx, edx |
jnz @f |
mov edx, [Classes + esi * 8 - 4] |
@@: |
add ebx, 288 shl 16 |
mcall 4,, 0x80000000,, 32 ; draw the text |
movzx edx, bx ; get y coordinate |
add edx, 0x0014000A ; add 10 to y coordinate and set x coordinate to 20 |
;------------------------------------------------------------------ |
; Print Driver Name |
;------------------------------------------------------------------ |
push edx |
add ebx, 120 shl 16 |
push ebx |
call get_drv_ptr |
mov edx, eax |
pop ebx |
mcall 4,,0x80000000 ; lets print the vendor Name |
pop edx |
ret |
get_drv_ptr: |
mov eax, driverlist ; eax will be the pointer to latest driver title |
mov ebx, driverlist ; ebx is the current pointer |
mov ecx, dword[PCI_Vendor] ; the device/vendor id of we want to find |
driverloop: |
inc ebx |
cmp byte[ebx],0 |
jne driverloop |
inc ebx ; the device/vendor id list for the driver eax is pointing to starts here. |
deviceloop: |
cmp dword[ebx],0 |
je nextdriver |
cmp dword[ebx],ecx |
je driverfound |
add ebx,4 |
jmp deviceloop |
nextdriver: |
add ebx,4 |
cmp dword[ebx],0 |
je nodriver |
mov eax,ebx |
jmp driverloop |
nodriver: |
mov eax, lbl_none ; lets print the vendor Name |
ret |
driverfound: |
ret |
include 'vendors.inc' |
include 'drivers.inc' |
;------------------------------------------------------------------ |
; DATA AREA |
DATA |
Form: dw 800 ; window width (no more, special for 800x600) |
dw 100 ; window x start |
dw 220 ; window height |
dw 100 ; window y start |
title db 'Network Driver Control Center', 0 |
caption db 'Vendor Device Bus Dev Rev IRQ Company Description DRIVER',0 |
nonefound db 'No compatible devices were found!',0 |
btn_start db 'Start device',0 |
btn_reset db 'Reset device',0 |
btn_stop db 'Stop device',0 |
lbl_none db 'none',0 |
load_error db 'Could not load driver!',0 |
hardwareinfo: |
.type db 1 ; pci |
.pci_bus db ? |
.pci_dev db ? |
IM_END: |
;------------------------------------------------------------------ |
; UNINITIALIZED DATA AREA |
IOCTL: |
.handle dd ? |
.io_code dd ? |
.input dd ? |
.inp_size dd ? |
.output dd ? |
.out_size dd ? |
drivernumber db ? |
MAC dp ? |
type db ? |
selected dw ? |
V_Bus db ? |
V_Dev db ? |
PCI_Version dw ? |
PCI_LastBus db ? |
PCI_Vendor dw ? |
PCI_Device dw ? |
PCI_Bus db ? |
PCI_Dev db ? |
PCI_Rev db ? |
; don`t change order!!! |
PCI_Class db ? |
PCI_SubClass db ? |
PCI_Interface db ? |
PCI_IRQ db ? |
Proc_Info process_information |
param rb 1024 |
I_END: |
/programs/network/netcfg/vendors.inc |
---|
0,0 → 1,1072 |
; AUTHOR: Victor Alberto Gil Hancco Laquita <vhanla@gmail.com> |
; This list might content mistakes, plz report it |
; There are 865 Lists of Vendors' Names |
; Date: 8/14/2005 |
; |
; maybe this list is outdated... |
; (the source was from 2004 list) |
; changed 11/05/2006: + 3 vendors and no more label 'PREVIOUSVERSIONLIST' |
; so the total quantity of vendors is 875 now (changes by Sergey Kuzmin) |
; changed 16/08/2006: + 122 vendors |
; so the total quantity of vendors is 987 now (changes by Sergey Kuzmin) |
; changed ??/04/2007: |
; size optimezed |
; total quantity of vendors is 997 now (changes by Mihailov Ilia) |
macro VendorID a,b { ; by mike.dld |
dw a |
dd _vtmp#a |
\iglobal |
_vtmp#a db b |
db 0 |
\};endg |
} |
macro ClassID a,b,c,d { |
db a |
db b |
local tt |
if c eq |
db 0 |
db 1 |
tt = 'x' |
else |
db c |
db 0 |
tt = c |
end if |
dd _ctmp#a#b#tt |
\iglobal |
_ctmp#a#b#tt db d |
db 0 |
\};endg |
} |
;-------------------------------------- |
VendorsTab: |
VendorID 0x0033, 'PARADYNE CORP.' |
VendorID 0x003D, 'Lockheed Martin Corp' |
VendorID 0x0100, 'NCIPHER CORP. LTD' |
VendorID 0x0675, 'DYNALINK' |
VendorID 0x0571, 'BERKOM' |
VendorID 0x0A89, 'BREA TECHNOLOGIES INC' |
VendorID 0x0E11, 'COMPAQ COMPUTER CORP.' |
VendorID 0x1000, 'SYMBIOS LOGIC INC/LSI Logic' |
VendorID 0x1001, 'KOLTER ELECTRONIC' |
VendorID 0x1002, 'ATI TECHNOLOGIES INC' |
VendorID 0x1003, 'ULSI' |
VendorID 0x1004, 'VLSI TECHNOLOGY INC' |
VendorID 0x1005, 'ADL' |
VendorID 0x100B, 'NATIONAL SEMICONDUCTOR CORPORATION' |
VendorID 0x100C, 'Tseng Labs' |
VendorID 0x100E, 'Weitek' |
VendorID 0x1010, 'VIDEO LOGIC LTD' |
VendorID 0x1011, 'Digital Equipment Corporation' |
VendorID 0x1013, 'Cirrus Logic' |
VendorID 0x1014, 'IBM' |
VendorID 0x1017, 'Spea Software AG' |
VendorID 0x1018, 'UNISYS CORPORATION' |
VendorID 0x1019, 'ELITEGROUP COMPUTER SYS' |
VendorID 0x101A, 'NCR Corporation' |
VendorID 0x101E, 'AMERICAN MEGATRENDS' |
VendorID 0x1020, 'HITACHI COMPUTER PRODUCTS' |
VendorID 0x1021, 'OKI ELECTRIC INDUSTRY CO. LTD.' |
VendorID 0x1022, 'Advanced Micro Devices' |
VendorID 0x1023, 'TRIDENT MICROSYSTEMS' |
VendorID 0x1025, 'Acer Incorporated' |
VendorID 0x1028, 'DELL COMPUTER CORPORATION' |
VendorID 0x102A, 'LSI LOGIC CORPORATION' |
VendorID 0x102B, 'MATROX GRAPHICS' |
VendorID 0x102C, 'Asiliant (Chips And Technologies)' |
VendorID 0x102D, 'Wyse Technologies' |
VendorID 0x102F, 'TOSHIBA AMERICA' |
VendorID 0x1031, 'miro Computer Products AG' |
VendorID 0x1033, 'NEC CORPORATION' |
VendorID 0x1036, 'Future Domain' |
VendorID 0x1038, 'AMP' |
VendorID 0x1039, 'SILICON INTEGRATED SYSTEMS' |
VendorID 0x103C, 'Hewlett-Packard Company' |
VendorID 0x103F, 'SYNOPSYS/LOGIC MODELING GROUP' |
VendorID 0x1042, 'Micron Electronics' |
VendorID 0x1043, 'ASUSTEK COMPUTER' |
VendorID 0x1044, 'DISTRIBUTED PROCESSING TECHNOLOGY' |
VendorID 0x1045, 'OPTI INC.' |
VendorID 0x1048, 'ELSA AG' |
VendorID 0x1049, 'FOUNTAIN TECHNOLOGIES' |
VendorID 0x104A, 'STMicroelectronics' |
VendorID 0x104B, 'BusLogic' |
VendorID 0x104C, 'TEXAS INSTRUMENTS' |
VendorID 0x104D, 'SONY CORPORATION' |
VendorID 0x104E, 'Oak Technology' |
VendorID 0x104F, 'Co-Time Computer Ltd.' |
VendorID 0x1050, 'WINBOND ELECTRONICS CORP' |
VendorID 0x1051, 'Anigma Corp.' |
VendorID 0x1054, 'HITACHI' |
VendorID 0x1055, 'Standard Microsystems Corp.' |
VendorID 0x1057, 'Motorola' |
VendorID 0x1058, 'ETRI' |
VendorID 0x1059, 'TEKNOR INDUSTRIAL COMPUTERS INC' |
VendorID 0x105A, 'PROMISE TECHNOLOGY' |
VendorID 0x105B, 'FOXCONN INTERNATIONAL INC' |
VendorID 0x105D, 'NUMBER 9 VISUAL TECHNOLOGY' |
VendorID 0x105F, 'INFOTRONIC AMERICA INC' |
VendorID 0x1060, 'United Microelectronics' |
VendorID 0x1061, '8x8 Inc.' |
VendorID 0x1063, 'OCEAN MANUFACTURING LTD' |
VendorID 0x1064, 'ALCATEL' |
VendorID 0x1065, 'Texas Microsystems' |
VendorID 0x1066, 'Picopower Technology' |
VendorID 0x1067, 'MITSUBISHI ELECTRIC AMERICA' |
VendorID 0x1068, 'DIVERSIFIED TECHNOLOGY' |
VendorID 0x1069, 'MYLEX CORPORATION' |
VendorID 0x106B, 'APPLE COMPUTER INC.' |
VendorID 0x106C, 'Hyundai Electronics America' |
VendorID 0x106D, 'SEQUENT COMPUTER SYSTEMS' |
VendorID 0x1070, 'DAEWOO TELECOM LTD' |
VendorID 0x1071, 'MITAC' |
VendorID 0x1073, 'YAMAHA CORPORATION' |
VendorID 0x1074, 'Nexgen Microsystems' |
VendorID 0x1076, 'Chaintech Comp.' |
VendorID 0x1077, 'QLOGIC Corporation' |
VendorID 0x1078, 'Cyrix Corporation' |
VendorID 0x1079, 'I-BUS' |
VendorID 0x107B, 'GATEWAY 2000' |
VendorID 0x107D, 'Leadtek Research' |
VendorID 0x107E, 'INTERPHASE CORPORATION' |
VendorID 0x107F, 'Data Technology Corporation' |
VendorID 0x1080, 'Cypress Semiconductor' |
VendorID 0x1081, 'Radius Inc.' |
VendorID 0x1083, 'Forex Computer Corporation' |
VendorID 0x1085, 'Tulip Computers International BV' |
VendorID 0x1087, 'Cache Computer' |
VendorID 0x108A, 'SBS Operations' |
VendorID 0x108D, 'OLICOM' |
VendorID 0x108E, 'Sun Microsystems' |
VendorID 0x1091, 'Intergraph Corporation' |
VendorID 0x1092, 'Diamond Computer Systems' |
VendorID 0x1093, 'National Instruments' |
VendorID 0x1095, 'SILICON IMAGE (WAS CMD TECHNOLOGY INC)' |
VendorID 0x1096, 'ALACRON' |
VendorID 0x1097, 'APPIAN Graphics/ETMA' |
VendorID 0x1098, 'Quantum Designs Ltd.' |
VendorID 0x109A, 'PACKARD BELL NEC' |
VendorID 0x109E, 'BROOKTREE CORPORATION' |
VendorID 0x109F, 'TRIGEM COMPUTER INC.' |
VendorID 0x10A0, 'MEIDENSHA CORPORATION' |
VendorID 0x10A2, 'QUANTUM EFFECT DESIGN' |
VendorID 0x10A4, 'Globe Manufacturing Sales' |
VendorID 0x10A8, 'Sierra Semiconductor' |
VendorID 0x10A9, 'SILICON GRAPHICS' |
VendorID 0x10AC, 'HONEYWELL IAC' |
VendorID 0x10AD, 'Winbond Systems Labs' |
VendorID 0x10AF, 'MICRO COMPUTER SYSTEMS INC' |
VendorID 0x10B5, 'PLX TECHNOLOGY.' |
VendorID 0x10B6, 'MADGE NETWORKS' |
VendorID 0x10B7, '3COM Corp, Networking Division' |
VendorID 0x10B8, 'Standard Microsystems Corporation' |
VendorID 0x10B9, 'ACER LABS Incorp.' |
VendorID 0x10BA, 'MITSUBISHI ELECTRIC CORP.' |
VendorID 0x10BD, 'Surecom Technology' |
VendorID 0x10C2, 'AUSPEX SYSTEMS INC.' |
VendorID 0x10C3, 'Samsung Semiconductors' |
VendorID 0x10C4, 'Award Software International Inc.' |
VendorID 0x10C8, 'NEOMAGIC CORPORATION' |
VendorID 0x10CA, 'FUJITSU MICROELECTRONIC' |
VendorID 0x10CB, 'OMRON CORPORATION' |
VendorID 0x10CD, 'ADVANCED SYSTEM PRODUCTS' |
VendorID 0x10CF, 'FUJITSU LIMITED' |
VendorID 0x10D1, 'FUTUREPLUS SYSTEMS CORP.' |
VendorID 0x10D2, 'MOLEX INCORPORATED' |
VendorID 0x10D9, 'Macronix International Co. Ltd.' |
VendorID 0x10DB, 'ROHM LSI SYSTEMS' |
VendorID 0x10DC, 'CERN-European Lab. for Particle Physics' |
VendorID 0x10DD, 'EVANS & SUTHERLAND' |
VendorID 0x10DE, 'NVIDIA CORPORATION' |
VendorID 0x10DF, 'EMULEX CORPORATION' |
VendorID 0x10E1, 'TEKRAM TECHNOLOGY CO.LTD.' |
VendorID 0x10E3, 'TUNDRA SEMICONDUCTOR CORP' |
VendorID 0x10E5, 'MICRO INDUSTRIES CORPORATION' |
VendorID 0x10E8, 'Applied Micro Circuits Corp.' |
VendorID 0x10EA, 'Tvia, Inc.' |
VendorID 0x10EB, 'Artist Graphics' |
VendorID 0x10EC, 'REALTEK SEMICONDUCTOR CORP.' |
VendorID 0x10ED, 'Ascii Corporation' |
VendorID 0x10EE, 'XILINX' |
VendorID 0x10EF, 'Racore Computer Products' |
VendorID 0x10F0, 'Curtiss-Wright Controls Embedded Computing' |
VendorID 0x10F1, 'TYAN COMPUTER' |
VendorID 0x10F4, 'S-Mos Systems' |
VendorID 0x10F5, 'NKK CORPORATION' |
VendorID 0x10F6, 'Creative Electronic Systems SA' |
VendorID 0x10FA, 'Truevision' |
VendorID 0x10FB, 'Thesys Microelectronics' |
VendorID 0x10FC, 'I-O DATA DEVICE' |
VendorID 0x10FE, 'FAST MULTIMEDIA AG' |
VendorID 0x1101, 'INITIO CORPORATION' |
VendorID 0x1102, 'Creative Labs' |
VendorID 0x1105, 'SIGMA DESIGNS' |
VendorID 0x1106, 'VIA TECHNOLOGIES' |
VendorID 0x1107, 'ASCEND COMMUNICATIONS/Stratus Computer' |
VendorID 0x1108, 'Proteon Inc.' |
VendorID 0x1109, 'Adaptec/Cogent Data Technologies Inc' |
VendorID 0x110A, 'SIEMENS PC SYSTEME GMBH' |
VendorID 0x110B, 'Chromatic Research Inc' |
VendorID 0x1111, 'SANTA CRUZ OPERATION' |
VendorID 0x1112, 'Osicom Technologies Inc.' |
VendorID 0x1113, 'ACCTON TECHNOLOGY' |
VendorID 0x1114, 'Atmel Corp.' |
VendorID 0x1116, 'Media 100, Inc.' |
VendorID 0x1117, 'Datacube Inc.' |
VendorID 0x1118, 'FCI ELECTRONICS' |
VendorID 0x1119, 'ICP-VORTEX COMPUTERSYSTEM GMBH' |
VendorID 0x111A, 'EFFICIENT NETWORKS' |
VendorID 0x111C, 'Tricord Systems Inc.' |
VendorID 0x111D, 'INTEGRATED DEVICE TECH' |
VendorID 0x111F, 'Precision Digital Images' |
VendorID 0x1120, 'EMC CORPORATION' |
VendorID 0x1127, 'FORE SYSTEMS INC' |
VendorID 0x112A, 'HERMES ELECTRONICS COMPANY' |
VendorID 0x112E, 'Infomedia' |
VendorID 0x112F, 'IMAGING TECHNOLOGY' |
VendorID 0x1131, 'PHILIPS SEMICONDUCTORS' |
VendorID 0x1132, 'MITEL CORP' |
VendorID 0x1133, 'Eicon Networks Corporation' |
VendorID 0x1134, 'MERCURY COMPUTER SYSTEMS' |
VendorID 0x1135, 'FUJI XEROX CO LTD' |
VendorID 0x1136, 'MOMENTUM DATA SYSTEMS' |
VendorID 0x1137, 'CISCO SYSTEMS INC' |
VendorID 0x1138, 'ZIATECH CORPORATION' |
VendorID 0x113C, 'CYCLONE MICROSYSTEMS.' |
VendorID 0x113E, 'SANYO ELECTRIC CO-Information Systems Division' |
VendorID 0x113F, 'Equinox Systems' |
VendorID 0x1141, 'CREST MICROSYSTEM INC.' |
VendorID 0x1142, 'Alliance Semiconductor CA - USA' |
VendorID 0x1144, 'Cincinnati Milacron' |
VendorID 0x1145, 'WORKBIT CORPORATION' |
VendorID 0x1146, 'FORCE COMPUTERS GMBH' |
VendorID 0x1147, 'Interface Corp' |
VendorID 0x1148, 'SYSKONNECT/Marvell' |
VendorID 0x114A, 'VMIC' |
VendorID 0x114C, 'ANNABOOKS' |
VendorID 0x114F, 'DIGI INTERNATIONAL' |
VendorID 0x1154, 'MELCO INC' |
VendorID 0x1155, 'Pine Technology Ltd' |
VendorID 0x1158, 'Voarx R&D Inc' |
VendorID 0x1159, 'Mutech' |
VendorID 0x115C, 'PHOTRON LTD.' |
VendorID 0x115D, 'XIRCOM' |
VendorID 0x1161, 'PFU LIMITED' |
VendorID 0x1163, 'RENDITION' |
VendorID 0x1165, 'Imagraph Corporation' |
VendorID 0x1166, 'Reliance Computer Corp./ServerWorks' |
VendorID 0x1169, 'Centre f/Dev. of Adv. Computing' |
VendorID 0x116A, 'Polaris Communications' |
VendorID 0x116E, 'ELECTRONICS FOR IMAGING' |
VendorID 0x1170, 'INVENTEC CORPORATION' |
VendorID 0x1171, 'BLUE WAVE SYSTEMS' |
VendorID 0x1172, 'ALTERA CORPORATION' |
VendorID 0x1176, 'SBE' |
VendorID 0x1178, 'Alfa Inc' |
VendorID 0x1179, 'TOSHIBA AMERICA INFO SYSTEMS' |
VendorID 0x117B, 'GCE-8320B' |
VendorID 0x117E, 'T/R Systems' |
VendorID 0x1180, 'RICOH CO LTD' |
VendorID 0x1185, 'Dataworld' |
VendorID 0x1186, 'D-LINK SYSTEM INC' |
VendorID 0x1187, 'ADVANCED TECHNOLOGY LABORATORIES' |
VendorID 0x1189, 'MATSUSHITA ELECTIC INDUSTRIAL CO LTD' |
VendorID 0x118B, 'PLATYPUS TECHNOLOGY PTY LTD' |
VendorID 0x118C, 'Corollary Inc' |
VendorID 0x118D, 'BitFlow Inc' |
VendorID 0x118E, 'Hermstedt AG' |
VendorID 0x1190, 'Tripace' |
VendorID 0x1191, 'ACARD TECHNOLOGY' |
VendorID 0x1193, 'ZeitNet' |
VendorID 0x1195, 'RATOC SYSTEMS INC' |
VendorID 0x1197, 'Gage Applied Technologies' |
VendorID 0x1199, 'Attachmate Corp.' |
VendorID 0x119A, 'MINDSHARE.' |
VendorID 0x119B, 'Omega Micro Inc.' |
VendorID 0x119D, 'BUG.' |
VendorID 0x119E, 'FUJITSU MICROELECTRONICS LTD.' |
VendorID 0x119F, 'BULL HN INFORMATION SYSTEMS' |
VendorID 0x11A1, 'HAMAMATSU PHOTONICS K.K.' |
VendorID 0x11A8, 'Systech Corp.' |
VendorID 0x11A9, 'InnoSys Inc.' |
VendorID 0x11AA, 'ACTEL' |
VendorID 0x11AB, 'GALILEO TECHNOLOGY LTD/Marvell Semiconductor, Inc.' |
VendorID 0x11AD, 'LITE-ON COMMUNICATIONS INC' |
VendorID 0x11AE, 'SCITEX CORPORATION' |
VendorID 0x11AF, 'AVID TECHNOLOGY INC' |
VendorID 0x11B0, 'V3 SEMICONDUCTOR INC./Quicklogic Corp' |
VendorID 0x11B2, 'EASTMAN KODAK' |
VendorID 0x11B3, 'BARR SYSTEMS INC.' |
VendorID 0x11B5, 'Radstone Technology Ltd.' |
VendorID 0x11B8, 'Xpoint Technologies Inc' |
VendorID 0x11B9, 'Pathlight Technology Inc.' |
VendorID 0x11BC, 'Network Peripherals Inc' |
VendorID 0x11BD, 'Pinnacle Systems Inc.' |
VendorID 0x11BF, 'ASTRODESIGN' |
VendorID 0x11C1, 'AGERE/LUCENT' |
VendorID 0x11C6, 'DAINIPPON SCREEN MFG. CO. LTD' |
VendorID 0x11C8, 'DOLPHIN INTERCONNECT SOLUTIONS AS' |
VendorID 0x11C9, 'MAGMA' |
VendorID 0x11CA, 'LSI SYSTEMS' |
VendorID 0x11CB, 'SPECIALIX INTERNATIONAL LTD' |
VendorID 0x11CE, 'NETACCESS/Primary Rate Inc' |
VendorID 0x11D0, 'LOCKHEED MARTIN-Electronics & Communications' |
VendorID 0x11D1, 'AuraVision Corporation' |
VendorID 0x11D2, 'INTERCOM INC.' |
VendorID 0x11D4, 'Analog Devices, Inc.' |
VendorID 0x11D5, 'IKON CORPORATION/Tahoma Technology' |
VendorID 0x11D9, 'TOSHIBA TEC CORPORATION' |
VendorID 0x11DA, 'NOVELL' |
VendorID 0x11DB, 'Sega Enterprises Ltd' |
VendorID 0x11DE, 'Zoran Corporation' |
VendorID 0x11DF, 'NEW WAVE PDG' |
VendorID 0x11E3, 'QUICKLOGIC CORPORATION' |
VendorID 0x11EC, 'CORECO INC' |
VendorID 0x11EE, 'DOME IMAGING SYSTEMS INC' |
VendorID 0x11F0, 'Compu-Shack GmbH' |
VendorID 0x11F4, 'Kinetic Systems Corporation' |
VendorID 0x11F6, 'Powermatic Data Systems Ltd' |
VendorID 0x11F8, 'PMC-SIERRA INC' |
VendorID 0x11FE, 'Comtrol Corp' |
VendorID 0x1202, 'Network General Corp' |
VendorID 0x1203, 'AGFA CORPORATION' |
VendorID 0x1206, 'AMDAHL CORPORATION' |
VendorID 0x1208, 'Parsytec GmbH' |
VendorID 0x1209, 'Sci Systems Inc' |
VendorID 0x120E, 'Cyclades Corporation' |
VendorID 0x120F, 'ESSENTIAL COMMUNICATIONS' |
VendorID 0x1214, 'PERFORMANCE TECHNOLOGIES.' |
VendorID 0x1216, 'PURUP-EskoFot A/S' |
VendorID 0x1217, 'O2MICRO.' |
VendorID 0x121A, '3DFX INTERACTIVE' |
VendorID 0x121B, 'VIRATA LTD' |
VendorID 0x1220, 'Ariel Corporation' |
VendorID 0x1221, 'CONTEC CO. LTD' |
VendorID 0x1223, 'ARTESYN COMMUNICATIONS PRODUCTS INC' |
VendorID 0x1224, 'Interactive Images' |
VendorID 0x1227, 'TECH-SOURCE' |
VendorID 0x122C, 'SICAN GMBH' |
VendorID 0x122D, 'Aztech System Ltd' |
VendorID 0x1232, 'MARCONI COMMUNICATIONS LTD' |
VendorID 0x1236, 'Sigma Designs, Inc' |
VendorID 0x124C, 'Solitron Technologies Inc.' |
VendorID 0x124D, 'Stallion Technologies' |
VendorID 0x124F, 'Infortrend Technology Inc' |
VendorID 0x1256, 'Perceptive Solutions Inc.' |
VendorID 0x1258, 'Gilbarco Inc.' |
VendorID 0x125B, 'Asix Electronics Corp.' |
VendorID 0x1266, 'Microdyne Corp.' |
VendorID 0x1267, 'S.A. Telecommunications' |
VendorID 0x1361, 'SOLITON SYSTEMS K.K.' |
VendorID 0x123C, 'CENTURY SYSTEMS.' |
VendorID 0x123D, 'Engineering Design Team Inc.' |
VendorID 0x123F, 'C-CUBE MICROSYSTEMS' |
VendorID 0x1242, 'JAYCOR NETWORKS INC./JNI Corporation' |
VendorID 0x1244, 'AVM AUDIOVISUELLES MKTG & COMPUTER SYSTEM GMBH' |
VendorID 0x124B, 'SBS TECHNOLOGIES' |
VendorID 0x1250, 'Hitachi Microcomputer System Ltd.' |
VendorID 0x1253, 'GUZIK TECHNICAL ENTERPRISES' |
VendorID 0x1255, 'OPTIBASE LTD' |
VendorID 0x1259, 'ALLIED TELESYN INTERNATIONAL' |
VendorID 0x125C, 'AURORA TECHNOLOGIES.' |
VendorID 0x125D, 'ESS TECHNOLOGY, INC.' |
VendorID 0x125F, 'CONCURRENT TECHNOLOGIES' |
VendorID 0x1260, 'INTERSIL CORP' |
VendorID 0x1261, 'MATSUSHITA-KOTOBUKI ELECTRONICS' |
VendorID 0x1264, 'AVAL NAGASAKI CORPORATION' |
VendorID 0x1268, 'TEKTRONIX' |
VendorID 0x126C, 'Nortel Networks Corp.' |
VendorID 0x126D, 'SPLASH TECHNOLOGY.' |
VendorID 0x126E, 'SUMITOMO METAL INDUSTRIES' |
VendorID 0x126F, 'SILICON MOTION.' |
VendorID 0x1270, 'OLYMPUS OPTICAL CO. LTD.' |
VendorID 0x1274, 'Creative Labs (was Ensoniq, Malvern)' |
VendorID 0x1275, 'NETWORK APPLIANCE CORPORATION' |
VendorID 0x1278, 'Transtech Parallel Systems' |
VendorID 0x1279, 'TRANSMETA CORPORATION' |
VendorID 0x127A, 'CONEXANT, ROCKWELL' |
VendorID 0x127D, 'VELA RESEARCH LP' |
VendorID 0x127F, 'FUJIFILM' |
VendorID 0x1281, 'YOKOGAWA ELECTRIC CORPORATION' |
VendorID 0x1283, 'Integrated Technology Express Inc.' |
VendorID 0x1286, 'MAZET GMBH' |
VendorID 0x128B, 'TRANSWITCH CORPORATION' |
VendorID 0x128D, 'G2 Networks Inc.' |
VendorID 0x128F, 'TATENO DENNOU.' |
VendorID 0x1290, 'TOSHIBA PERSONAL COMPUTER SYSTEM CORP.' |
VendorID 0x1291, 'NCS COMPUTER ITALIA SRL' |
VendorID 0x1292, 'TRITECH MICROELECTRONICS INC' |
VendorID 0x1297, 'SHUTTLE COMPUTER' |
VendorID 0x1299, 'KNOWLEDGE TECHNOLOGY LAB.' |
VendorID 0x129A, 'VMETRO Inc.' |
VendorID 0x129E, 'VICTOR COMPANY OF JAPAN' |
VendorID 0x12A0, 'ALLEN- BRADLEY COMPANY' |
VendorID 0x12A3, 'Lucent Technologies AMR' |
VendorID 0x12A7, 'AMO GMBH' |
VendorID 0x12A9, 'XIOTECH CORPORATION' |
VendorID 0x12AB, 'YUAN YUAN ENTERPRISE CO. LTD.' |
VendorID 0x12AE, 'Alteon Networks Inc.' |
VendorID 0x12B6, 'NATURAL MICROSYSTEMS' |
VendorID 0x12B7, 'COGNEX MODULAR VISION SYSTEMS DIV.-ACUMEN INC.' |
VendorID 0x12B9, '3Com Corp, Modem Division' |
VendorID 0x12BC, 'ARRAY MICROSYSTEMS' |
VendorID 0x12BE, 'ANCHOR CHIPS INC.' |
VendorID 0x12BF, 'Fujifilm Microdevices' |
VendorID 0x12C0, 'INFIMED' |
VendorID 0x12C3, 'Holtek Microelectronics Inc.' |
VendorID 0x12C4, 'Connect Tech Inc' |
VendorID 0x12C6, 'Mitan Corporation' |
VendorID 0x12C7, 'Dialogic Corp' |
VendorID 0x12CA, 'Integrated Computing Engines' |
VendorID 0x12CD, 'Aims Lab' |
VendorID 0x12D2, 'NVIDIA (WAS: STB,SGS THOMPSON)' |
VendorID 0x12D3, 'GE VINGMED ULTRASOUND AS' |
VendorID 0x12D4, 'COMVERSE NETWORKS SYSTEM & Ulticom, Inc.' |
VendorID 0x12D5, 'Equator Technologies' |
VendorID 0x12D6, 'Analogic Corp' |
VendorID 0x12D8, 'PERICOM SEMICONDUCTOR' |
VendorID 0x12D9, 'Aculab PLC' |
VendorID 0x12DA, 'True Time Inc.' |
VendorID 0x12DE, 'Rainbow Technologies' |
VendorID 0x12DF, 'SBS Technologies Inc' |
VendorID 0x12E0, 'Chase Research PLC' |
VendorID 0x12E2, 'Datum Inc. Bancomm-Timing Division' |
VendorID 0x12E4, 'Brooktrout Technology Inc' |
VendorID 0x12E7, 'Sebring Systems' |
VendorID 0x12EA, 'Real Vision' |
VendorID 0x12EB, 'Aureal Semiconductor' |
VendorID 0x12EC, '3A' |
VendorID 0x12F0, 'PENTEK' |
VendorID 0x12F7, 'COGNEX INC.' |
VendorID 0x12FB, 'Spectrum Signal Processing' |
VendorID 0x12FC, 'CAPITAL EQUIPMENT CORP' |
VendorID 0x12FE, 'ESD Electronic System Design GmbH' |
VendorID 0x1304, 'Juniper Networks Inc.' |
VendorID 0x1307, 'Computer Boards' |
VendorID 0x1308, 'LEVEL ONE COMMUNICATIONS/Jato Technologies Inc.' |
VendorID 0x130A, 'Mitsubishi Electric MicroComputer' |
VendorID 0x130B, 'Colorgraphic Communications Corp' |
VendorID 0x130F, 'Advanet Inc' |
VendorID 0x1310, 'GESPAC' |
VendorID 0x1313, 'YASKAWA ELECTRIC CO.' |
VendorID 0x1316, 'TERADYNE INC.' |
VendorID 0x1317, 'ADMTEK INC' |
VendorID 0x1318, 'Packet Engines Inc.' |
VendorID 0x1319, 'ForteMedia' |
VendorID 0x131F, 'SIIG Inc' |
VendorID 0x1325, 'SALIX TECHNOLOGIES INC' |
VendorID 0x1326, 'SeaChange International' |
VendorID 0x1331, 'RadiSys Corp.' |
VendorID 0x133D, 'PRISA NETWORKS' |
VendorID 0x133F, 'SCM MICROSYSTEMS' |
VendorID 0x1342, 'PROMAX SYSTEMS INC' |
VendorID 0x1344, 'MICRON TECHNOLOGY INC' |
VendorID 0x134A, 'Domex' |
VendorID 0x134B, 'ARK RESEARCH CORP.' |
VendorID 0x134C, 'CHORI JOHO SYSTEM CO. LTD' |
VendorID 0x134D, 'PC-TEL INC' |
VendorID 0x135A, 'BRAIN BOXES LIMITED' |
VendorID 0x135C, 'QUATECH INC' |
VendorID 0x135E, 'SEALEVEL SYSTEMS INC' |
VendorID 0x135F, 'I-DATA INTERNATIONAL A-S' |
VendorID 0x1360, 'MEINBERG FUNKUHREN' |
VendorID 0x1363, 'PHOENIX TECHNOLOGIES LTD' |
VendorID 0x1365, 'HYPERCOPE' |
VendorID 0x1367, 'HITACHI ZOSEN CORPORATION' |
VendorID 0x1368, 'SKYWARE CORPORATION' |
VendorID 0x1369, 'DIGIGRAM' |
VendorID 0x136B, 'KAWASAKI STEEL CORPORATION' |
VendorID 0x136C, 'ADTEK SYSTEM SCIENCE CO LTD' |
VendorID 0x1375, 'BOEING-SUNNYVALE' |
VendorID 0x1376, 'LAN Media Corporation' |
VendorID 0x1377, 'ELECTRONIC EQUIPMENT PRODUCTION & DISTRIBUTION' |
VendorID 0x137A, 'MARK OF THE UNICORN INC' |
VendorID 0x137B, 'PPT VISION' |
VendorID 0x137C, 'IWATSU ELECTRIC CO LTD' |
VendorID 0x137D, 'DYNACHIP CORPORATION' |
VendorID 0x1380, 'SANRITZ AUTOMATION CO LTC' |
VendorID 0x1381, 'BRAINS CO. LTD' |
VendorID 0x1383, 'CONTROLNET INC' |
VendorID 0x1384, 'STELLAR SEMICONDUCTOR INC' |
VendorID 0x1385, 'NETGEAR' |
VendorID 0x1387, 'SYSTRAN CORP' |
VendorID 0x1388, 'HITACHI INFORMATION TECHNOLOGY CO LTD' |
VendorID 0x1389, 'APPLICOM INTERNATIONAL' |
VendorID 0x138A, 'SITERA' |
VendorID 0x138B, 'TOKIMEC INC' |
VendorID 0x138E, 'BASLER GMBH' |
VendorID 0x138F, 'PATAPSCO DESIGNS INC' |
VendorID 0x1393, 'MOXA TECHNOLOGIES CO LTD' |
VendorID 0x1394, 'LEVEL ONE COMMUNICATIONS' |
VendorID 0x1395, 'AMBICOM INC' |
VendorID 0x1396, 'CIPHER SYSTEMS INC' |
VendorID 0x1397, 'COLOGNE CHIP DESIGNS GMBH' |
VendorID 0x1398, 'CLARION CO. LTD' |
VendorID 0x1399, 'RIOS SYSTEMS CO LTD' |
VendorID 0x139A, 'ALACRITECH INC' |
VendorID 0x139C, 'QUANTUM 3D INC' |
VendorID 0x139D, 'XSTREAMS PLC/ EPL LIMITED' |
VendorID 0x139E, 'ECHOSTAR DATA NETWORKS' |
VendorID 0x139F, 'AETHRA S.R.L.' |
VendorID 0x13A0, 'CRYSTAL GROUP INC' |
VendorID 0x13A1, 'KAWASAKI HEAVY INDUSTRIES LTD' |
VendorID 0x13A2, 'OSITECH COMMUNICATIONS INC' |
VendorID 0x13A4, 'RASCOM INC' |
VendorID 0x13A7, 'TELES AG' |
VendorID 0x13A8, 'EXAR CORP.' |
VendorID 0x13A9, 'SIEMENS MEDICAL SYSTEMS' |
VendorID 0x13AA, 'NORTEL NETWORKS-BWA DIVISION' |
VendorID 0x13AF, 'T.SQWARE' |
VendorID 0x13B1, 'TAMURA CORPORATION' |
VendorID 0x13B4, 'WELLBEAN CO INC' |
VendorID 0x13B5, 'ARM Ltd' |
VendorID 0x13B6, 'DLoG GMBH' |
VendorID 0x13B8, 'NOKIA TELECOMMUNICATIONS OY' |
VendorID 0x13BD, 'SHARP CORPORATION' |
VendorID 0x13BF, 'SHAREWAVE INC' |
VendorID 0x13C0, 'Microgate Corp.' |
VendorID 0x13C1, '3ware Inc.' |
VendorID 0x13C2, 'TECHNOTREND SYSTEMTECHNIK GMBH' |
VendorID 0x13C3, 'JANZ COMPUTER AG' |
VendorID 0x13C6, 'CONDOR ENGINEERING INC' |
VendorID 0x13C7, 'BLUE CHIP TECHNOLOGY LTD' |
VendorID 0x13CA, 'IOMEGA CORPORATION' |
VendorID 0x13CC, 'METHEUS CORPORATION' |
VendorID 0x13CF, 'STUDIO AUDIO & VIDEO LTD' |
VendorID 0x13D0, 'B2C2' |
VendorID 0x13D1, 'ABOCOM SYSTEMS' |
VendorID 0x13D2, 'SHARK MULTIMEDIA INC' |
VendorID 0x13D3, 'IMC NETWORKS' |
VendorID 0x13D4, 'GRAPHICS MICROSYSTEMS INC' |
VendorID 0x13D6, 'K.I. TECHNOLOGY CO LTD' |
VendorID 0x13D7, 'TOSHIBA ENGINEERING CORPORATION' |
VendorID 0x13D8, 'PHOBOS CORPORATION' |
VendorID 0x13D9, 'APEX INC' |
VendorID 0x13DC, 'NETBOOST CORPORATION' |
VendorID 0x13DE, 'ABB ROBOTICS PRODUCTS' |
VendorID 0x13DF, 'E-TECH INC' |
VendorID 0x13E0, 'GVC CORPORATION' |
VendorID 0x13E3, 'NEST INC' |
VendorID 0x13E4, 'CALCULEX INC' |
VendorID 0x13E5, 'TELESOFT DESIGN LTD' |
VendorID 0x13E9, 'INTRASERVER TECHNOLOGY INC' |
VendorID 0x13EA, 'DALLAS SEMICONDUCTOR' |
VendorID 0x13F0, 'SUNDANCE TECHNOLOGY INC' |
VendorID 0x13F1, 'OCE-TECHNOLOGIES B.V.' |
VendorID 0x13F2, 'FORD MICROELECTRONICS INC' |
VendorID 0x13F4, 'TROIKA NETWORKS INC' |
VendorID 0x13F6, 'C-MEDIA ELECTRONICS INC' |
VendorID 0x13F9, 'NTT ADVANCED TECHNOLOGY CORP.' |
VendorID 0x13FB, 'AYDIN CORP' |
VendorID 0x13FD, 'MICRO SCIENCE INC' |
VendorID 0x1400, 'ARTX INC' |
VendorID 0x1402, 'Meilhaus Electronic GmbH Germany' |
VendorID 0x1404, 'FUNDAMENTAL SOFTWARE INC' |
VendorID 0x1406, 'OCE PRINTING SYSTEMS GmbH' |
VendorID 0x1407, 'LAVA COMPUTER MFG INC' |
VendorID 0x1408, 'ALOKA CO. LTD' |
VendorID 0x140A, 'DSP RESEARCH INC' |
VendorID 0x140B, 'RAMIX INC' |
VendorID 0x140D, 'MATSUSHITA ELECTRIC WORKS LTD' |
VendorID 0x1412, 'ICEnsemble' |
VendorID 0x1413, 'ADDONICS' |
VendorID 0x1415, 'OXFORD SEMICONDUCTOR LTD' |
VendorID 0x1418, 'KYUSHU ELECTRONICS SYSTEMS INC' |
VendorID 0x1419, 'EXCEL SWITCHING CORP' |
VendorID 0x141B, 'ZOOM TELEPHONICS INC' |
VendorID 0x141E, 'FANUC LTD' |
VendorID 0x1420, 'PSION DACOM PLC' |
VendorID 0x1428, 'EDEC CO LTD' |
VendorID 0x1429, 'UNEX TECHNOLOGY CORP' |
VendorID 0x142A, 'KINGMAX TECHNOLOGY INC' |
VendorID 0x142B, 'RADIOLAN' |
VendorID 0x142C, 'MINTON OPTIC INDUSTRY CO LTD' |
VendorID 0x142D, 'PIXSTREAM INC' |
VendorID 0x1430, 'ITT AEROSPACE/COMMUNICATIONS DIVISION' |
VendorID 0x1433, 'ELTEC ELEKTRONIK GMBH' |
VendorID 0x1436, 'CIS TECHNOLOGY INC' |
VendorID 0x1437, 'NISSIN INC CO' |
VendorID 0x1438, 'ATMEL-DREAM' |
VendorID 0x143F, 'LIGHTWELL CO LTD-ZAX DIVISION' |
VendorID 0x1441, 'AGIE SA' |
VendorID 0x1445, 'LOGICAL CO LTD' |
VendorID 0x1446, 'GRAPHIN CO. LTD' |
VendorID 0x1447, 'AIM GMBH' |
VendorID 0x144A, 'ADLINK Technology Inc' |
VendorID 0x144B, 'LORONIX INFORMATION SYSTEMS INC' |
VendorID 0x144D, 'SAMSUNG ELECTRONICS CO LTD' |
VendorID 0x1450, 'OCTAVE COMMUNICATIONS IND.' |
VendorID 0x1451, 'SP3D CHIP DESIGN GMBH' |
VendorID 0x1453, 'MYCOM INC' |
VendorID 0x1455, 'LOGIC PLUS PLUS INC' |
VendorID 0x1458, 'GIGA-BYTE TECHNOLOGY' |
VendorID 0x145C, 'CRYPTEK' |
VendorID 0x145F, 'BALDOR ELECTRIC COMPANY' |
VendorID 0x1460, 'DYNARC INC' |
VendorID 0x1461, 'AVERMEDIA Tech.' |
VendorID 0x1462, 'MICRO-STAR INTERNATIONAL CO LTD' |
VendorID 0x1463, 'FAST CORPORATION' |
VendorID 0x1464, 'INTERACTIVE CIRCUITS & SYSTEMS LTD' |
VendorID 0x1465, 'GN NETTEST TELECOM DIV.' |
VendorID 0x1468, 'AMBIT MICROSYSTEMS CORP.' |
VendorID 0x1469, 'CLEVELAND MOTION CONTROLS' |
VendorID 0x146C, 'RUBY TECH CORP.' |
VendorID 0x146D, 'TACHYON' |
VendorID 0x146E, 'WILLIAMS ELECTRONICS GAMES.' |
VendorID 0x1471, 'INTEGRATED TELECOM EXPRESS INC' |
VendorID 0x1473, 'ZAPEX TECHNOLOGIES INC' |
VendorID 0x1474, 'DOUG CARSON & ASSOCIATES' |
VendorID 0x1477, 'NET INSIGHT' |
VendorID 0x1478, 'DIATREND CORPORATION' |
VendorID 0x147B, 'ABIT Computer' |
VendorID 0x147F, 'NIHON UNISYS' |
VendorID 0x1482, 'ISYTEC-Integrierte Systemtechnik Gmbh' |
VendorID 0x1483, 'LABWAY COPORATION' |
VendorID 0x1485, 'ERMA-ELECTRONIC GMBH' |
VendorID 0x1489, 'KYE SYSTEMS CORPORATION' |
VendorID 0x148A, 'OPTO 22' |
VendorID 0x148B, 'INNOMEDIALOGIC INC.' |
VendorID 0x148E, 'OSI PLUS CORPORATION' |
VendorID 0x148F, 'PLANT EQUIPMENT.' |
VendorID 0x1490, 'TC LABS PTY LTD.' |
VendorID 0x1493, 'MAKER COMMUNICATIONS' |
VendorID 0x1495, 'TOKAI COMMUNICATIONS INDUSTRY CO. LTD' |
VendorID 0x1496, 'JOYTECH COMPUTER CO. LTD.' |
VendorID 0x1497, 'SMA REGELSYSTEME GMBH' |
VendorID 0x1499, 'EMTEC CO. LTD' |
VendorID 0x149A, 'ANDOR TECHNOLOGY LTD' |
VendorID 0x149B, 'SEIKO INSTRUMENTS INC' |
VendorID 0x149C, 'OVISLINK CORP.' |
VendorID 0x149D, 'NEWTEK INC' |
VendorID 0x149E, 'MAPLETREE NETWORKS INC.' |
VendorID 0x149F, 'LECTRON CO LTD' |
VendorID 0x14A0, 'SOFTING GMBH' |
VendorID 0x14A1, 'SYSTEMBASE CO LTD' |
VendorID 0x14A2, 'MILLENNIUM ENGINEERING INC' |
VendorID 0x14A3, 'MAVERICK NETWORKS' |
VendorID 0x14A4, 'GVC/BCM ADVANCED RESEARCH' |
VendorID 0x14A5, 'XIONICS DOCUMENT TECHNOLOGIES INC.' |
VendorID 0x14A6, 'INOVA COMPUTERS GMBH & CO KG' |
VendorID 0x14A8, 'FEATRON TECHNOLOGIES CORPORATION' |
VendorID 0x14A9, 'HIVERTEC INC.' |
VendorID 0x14AB, 'MENTOR GRAPHICS CORP.' |
VendorID 0x14AC, 'NOVAWEB TECHNOLOGIES INC' |
VendorID 0x14AD, 'TIME SPACE RADIO AB' |
VendorID 0x14AE, 'CTI PET Systems' |
VendorID 0x14AF, 'GUILLEMOT CORPORATION' |
VendorID 0x14B0, 'BST COMMUNICATION TECHNOLOGY LTD' |
VendorID 0x14B1, 'NEXTCOM K.K.' |
VendorID 0x14B2, 'ENNOVATE NETWORKS INC' |
VendorID 0x14B3, 'XPEED INC.' |
VendorID 0x14B4, 'PHILIPS BUSINESS ELECTRONICS B.V.' |
VendorID 0x14B5, 'CREAMWARE GMBH' |
VendorID 0x14B6, 'QUANTUM DATA CORP.' |
VendorID 0x14B7, 'PROXIM INC' |
VendorID 0x14B8, 'TECHSOFT TECHNOLOGY CO LTD' |
VendorID 0x14B9, 'AIRONET WIRELESS COMMUNICATIONS' |
VendorID 0x14BA, 'INTERNIX INC.' |
VendorID 0x14BB, 'SEMTECH CORPORATION' |
VendorID 0x14BC, 'GLOBESPAN SEMICONDUCTOR INC.' |
VendorID 0x14BD, 'CARDIO CONTROL N.V.' |
VendorID 0x14BE, 'L3 COMMUNICATIONS' |
VendorID 0x14BF, 'SPIDER COMMUNICATIONS INC.' |
VendorID 0x14C0, 'COMPAL ELECTRONICS INC' |
VendorID 0x14C1, 'MYRICOM INC.' |
VendorID 0x14C2, 'DTK COMPUTER' |
VendorID 0x14C3, 'MEDIATEK CORP.' |
VendorID 0x14C4, 'IWASAKI INFORMATION SYSTEMS CO LTD' |
VendorID 0x14C5, 'ABB AUTOMATION PRODUCTS' |
VendorID 0x14C6, 'DATA RACE INC' |
VendorID 0x14C7, 'MODULAR TECHNOLOY HOLDINGS LTD' |
VendorID 0x14C8, 'TURBOCOMM TECH. INC.' |
VendorID 0x14C9, 'ODIN TELESYSTEMS INC' |
VendorID 0x14CA, 'PE LOGIC CORP.' |
VendorID 0x14CB, 'Billionton Systems Inc./Cadmus Micro Inc.' |
VendorID 0x14CC, 'NAKAYO TELECOMMUNICATIONS INC' |
VendorID 0x14CD, 'UNIVERSAL SCIENTIFIC IND' |
VendorID 0x14CE, 'WHISTLE COMMUNICATIONS' |
VendorID 0x14CF, 'TEK MICROSYSTEMS INC.' |
VendorID 0x14D0, 'ERICSSON AXE R & D' |
VendorID 0x14D1, 'COMPUTER HI-TECH CO LTD' |
VendorID 0x14D2, 'TITAN ELECTRONICS INC' |
VendorID 0x14D3, 'CIRTECH (UK) LTD' |
VendorID 0x14D4, 'PANACOM TECHNOLOGY CORP' |
VendorID 0x14D5, 'NITSUKO CORPORATION' |
VendorID 0x14D6, 'ACCUSYS' |
VendorID 0x14D7, 'HIRAKAWA HEWTECH CORP' |
VendorID 0x14D8, 'HOPF ELEKTRONIK GMBH' |
VendorID 0x14D9, 'ALPHA PROCESSOR INC' |
VendorID 0x14DA, 'NATIONAL AEROSPACE LABORATORIES' |
VendorID 0x14DB, 'AVLAB TECHNOLOGY INC' |
VendorID 0x14DC, 'AMPLICON LIVELINE LTD' |
VendorID 0x14DD, 'IMODL INC.' |
VendorID 0x14DE, 'APPLIED INTEGRATION CORPORATION' |
VendorID 0x14DF, 'BASIS COMMUNICATIONS CORP' |
VendorID 0x14E1, 'INVERTEX' |
VendorID 0x14E2, 'INFOLIBRIA' |
VendorID 0x14E3, 'AMTELCO' |
VendorID 0x14E4, 'BROADCOM CORPORATION' |
VendorID 0x14E5, 'PIXELFUSION LTD' |
VendorID 0x14E6, 'SHINING TECHNOLOGY INC' |
VendorID 0x14E7, '3CX' |
VendorID 0x14E8, 'RAYCER INC' |
VendorID 0x14E9, 'GARNETS SYSTEM CO LTD' |
VendorID 0x14EA, 'PLANEX COMMUNICATIONS INC' |
VendorID 0x14EB, 'SEIKO EPSON CORPORATION' |
VendorID 0x14EC, 'ACQIRIS' |
VendorID 0x14ED, 'DATAKINETICS LTD' |
VendorID 0x14EE, 'MASPRO KENKOH CORP' |
VendorID 0x14EF, 'CARRY COMPUTER ENG. CO LTD' |
VendorID 0x14F0, 'CANON RESEACH CENTRE FRANCE' |
VendorID 0x14F1, 'Conexant Systems, Inc' |
VendorID 0x14F2, 'Mobility Electronics, Inc.' |
VendorID 0x14F3, 'BROADLOGIC' |
VendorID 0x14F4, 'TOKYO ELECTRONIC INDUSTRY CO LTD' |
VendorID 0x14F5, 'SOPAC LTD' |
VendorID 0x14F6, 'COYOTE TECHNOLOGIES LLC' |
VendorID 0x14F7, 'WOLF TECHNOLOGY INC' |
VendorID 0x14F8, 'AUDIOCODES INC' |
VendorID 0x14F9, 'AG COMMUNICATIONS' |
VendorID 0x14FA, 'WAVETEK WANDEL & GOLTERMANN' |
VendorID 0x14FB, 'TRANSAS MARINE (UK) LTD' |
VendorID 0x14FC, 'QUADRICS SUPERCOMPUTERS WORLD' |
VendorID 0x14FD, 'JAPAN COMPUTER INDUSTRY INC.' |
VendorID 0x14FE, 'ARCHTEK TELECOM CORP.' |
VendorID 0x14FF, 'TWINHEAD INTERNATIONAL CORP' |
VendorID 0x1500, 'LANTECH COMPUTER COMPANY' |
VendorID 0x1501, 'BANKSOFT CANADA LTD' |
VendorID 0x1502, 'MITSUBISHI ELECTRIC LOGISTICS SUPPORT CO' |
VendorID 0x1503, 'KAWASAKI LSI USA INC' |
VendorID 0x1504, 'KAISER ELECTRONICS' |
VendorID 0x1505, 'ITA INGENIEURBURO FUR TESTAUFGABEN GMBH' |
VendorID 0x1506, 'CHAMELEON SYSTEMS INC' |
VendorID 0x1507, 'HTEC LTD' |
VendorID 0x1508, 'HONDA CONNECTORS/MHOTRONICS INC' |
VendorID 0x1509, 'FIRST INTERNATIONAL COMPUTER INC' |
VendorID 0x150A, 'FORVUS RESEARCH INC' |
VendorID 0x150B, 'YAMASHITA SYSTEMS CORP' |
VendorID 0x150C, 'KYOPAL CO LTD' |
VendorID 0x150D, 'WARPSPPED INC' |
VendorID 0x150E, 'C-PORT CORPORATION' |
VendorID 0x150F, 'INTEC GMBH' |
VendorID 0x1510, 'BEHAVIOR TECH COMPUTER CORP' |
VendorID 0x1511, 'CENTILLIUM TECHNOLOGY CORP' |
VendorID 0x1512, 'ROSUN TECHNOLOGIES INC' |
VendorID 0x1513, 'RAYCHEM' |
VendorID 0x1514, 'TFL LAN INC' |
VendorID 0x1515, 'ICS ADVENT' |
VendorID 0x1516, 'MYSON TECHNOLOGY INC' |
VendorID 0x1517, 'ECHOTEK CORPORATION' |
VendorID 0x1518, 'PEP MODULAR COMPUTERS GMBH' |
VendorID 0x1519, 'TELEFON AKTIEBOLAGET LM Ericsson' |
VendorID 0x151A, 'GLOBETEK INC' |
VendorID 0x151B, 'COMBOX LTD' |
VendorID 0x151C, 'DIGITAL AUDIO LABS INC' |
VendorID 0x151D, 'FUJITSU COMPUTER PRODUCTS OF AMERICA' |
VendorID 0x151E, 'MATRIX CORP.' |
VendorID 0x151F, 'TOPIC SEMICONDUCTOR CORP' |
VendorID 0x1520, 'CHAPLET SYSTEM INC' |
VendorID 0x1521, 'BELL CORPORATION' |
VendorID 0x1522, 'MAINPINE LIMITED' |
VendorID 0x1523, 'MUSIC SEMICONDUCTORS' |
VendorID 0x1524, 'ENE TECHNOLOGY INC' |
VendorID 0x1525, 'IMPACT TECHNOLOGIES' |
VendorID 0x1526, 'ISS' |
VendorID 0x1527, 'SOLECTRON' |
VendorID 0x1528, 'ACKSYS' |
VendorID 0x1529, 'AMERICAN MICROSYSTEMS INC' |
VendorID 0x152A, 'QUICKTURN DESIGN SYSTEMS' |
VendorID 0x152B, 'FLYTECH TECHNOLOGY CO LTD' |
VendorID 0x152C, 'MACRAIGOR SYSTEMS LLC' |
VendorID 0x152D, 'QUANTA COMPUTER INC' |
VendorID 0x152E, 'MELEC INC' |
VendorID 0x152F, 'PHILIPS-CRYPTO' |
VendorID 0x1530, 'ACQIS TECHNOLOGY' |
VendorID 0x1531, 'CHRYON CORP.' |
VendorID 0x1532, 'ECHELON CORPORATION' |
VendorID 0x1533, 'BALTIMORE' |
VendorID 0x1534, 'ROAD CORPORATION' |
VendorID 0x1535, 'EVERGREEN TECHNOLOGIES INC' |
VendorID 0x1537, 'DATALEX COMMUNCATIONS' |
VendorID 0x1538, 'ARALION INC.' |
VendorID 0x1539, 'ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A.' |
VendorID 0x153A, 'ONO SOKKI' |
VendorID 0x153B, 'TERRATEC ELECTRONIC GMBH' |
VendorID 0x153C, 'ANTAL ELECTRONIC' |
VendorID 0x153D, 'FILANET CORPORATION' |
VendorID 0x153E, 'TECHWELL INC' |
VendorID 0x153F, 'MIPS DENMARK' |
VendorID 0x1540, 'PROVIDEO MULTIMEDIA CO LTD' |
VendorID 0x1541, 'TELOSITY INC.' |
VendorID 0x1542, 'VIVID TECHNOLOGY INC' |
VendorID 0x1543, 'SILICON LABORATORIES' |
VendorID 0x1544, 'DCM DATA SYSTEMS' |
VendorID 0x1545, 'VISIONTEK' |
VendorID 0x1546, 'IOI TECHNOLOGY CORP.' |
VendorID 0x1547, 'MITUTOYO CORPORATION' |
VendorID 0x1548, 'JET PROPULSION LABORATORY' |
VendorID 0x1549, 'INTERCONNECT SYSTEMS SOLUTIONS' |
VendorID 0x154A, 'MAX TECHNOLOGIES INC.' |
VendorID 0x154B, 'COMPUTEX CO LTD' |
VendorID 0x154C, 'VISUAL TECHNOLOGY INC.' |
VendorID 0x154D, 'PAN INTERNATIONAL INDUSTRIAL CORP' |
VendorID 0x154E, 'SERVOTEST LTD' |
VendorID 0x154F, 'STRATABEAM TECHNOLOGY' |
VendorID 0x1550, 'OPEN NETWORK CO LTD' |
VendorID 0x1551, 'SMART ELECTRONIC DEVELOPMENT GMBH' |
VendorID 0x1552, 'RACAL AIRTECH LTD' |
VendorID 0x1553, 'CHICONY ELECTRONICS CO LTD' |
VendorID 0x1554, 'PROLINK MICROSYSTEMS CORP.' |
VendorID 0x1555, 'GESYTEC GMBH' |
VendorID 0x1556, 'PLD APPLICATIONS' |
VendorID 0x1557, 'MEDIASTAR CO. LTD' |
VendorID 0x1558, 'CLEVO/KAPOK COMPUTER' |
VendorID 0x1559, 'SI LOGIC LTD' |
VendorID 0x155A, 'INNOMEDIA INC' |
VendorID 0x155B, 'PROTAC INTERNATIONAL CORP' |
VendorID 0x155C, 'CEMAX-ICON INC' |
VendorID 0x155D, 'MAC SYSTEM CO LTD' |
VendorID 0x155E, 'LP ELEKTRONIK GMBH/KUKA Controls GmbH' |
VendorID 0x155F, 'PERLE SYSTEMS LIMITED' |
VendorID 0x1560, 'TERAYON COMMUNICATIONS SYSTEMS' |
VendorID 0x1561, 'VIEWGRAPHICS INC' |
VendorID 0x1562, 'Symbol Technologies, Inc.' |
VendorID 0x1563, 'A-TREND' |
VendorID 0x1564, 'YAMAKATSU ELECTRONICS INDUSTRY CO LTD' |
VendorID 0x1565, 'BIOSTAR MICROTECH INT CORP' |
VendorID 0x1566, 'ARDENT TECHNOLOGIES INC' |
VendorID 0x1567, 'JUNGSOFT' |
VendorID 0x1568, 'DDK ELECTRONICS INC' |
VendorID 0x1569, 'PALIT MICROSYSTEMS INC' |
VendorID 0x156A, 'AVTEC SYSTEMS' |
VendorID 0x156B, '2WIRE' |
VendorID 0x156C, 'VIDAC ELECTRONICS GMBH' |
VendorID 0x156D, 'ALPHA-TOP CORP' |
VendorID 0x156E, 'ALFA INC' |
VendorID 0x156F, 'M-SYSTEMS FLASH DISK PIONEERS LTD' |
VendorID 0x1570, 'LECROY CORPORATION' |
VendorID 0x1571, 'CONTEMPORARY CONTROLS' |
VendorID 0x1572, 'OTIS ELEVATOR COMPANY' |
VendorID 0x1573, 'LATTICE-VANTIS' |
VendorID 0x1574, 'FAIRCHILD SEMICONDUCTOR' |
VendorID 0x1575, 'VOLTAIRE ADVANCED DATA SECURITY LTD' |
VendorID 0x1576, 'VIEWCAST COM' |
VendorID 0x1578, 'HITT' |
VendorID 0x1579, 'DUAL TECHNOLOGY CORPORATION' |
VendorID 0x157A, 'JAPAN ELECRONICS IND. INC' |
VendorID 0x157B, 'STAR MULTIMEDIA CORP.' |
VendorID 0x157C, 'EUROSOFT (UK) LTD' |
VendorID 0x157D, 'GEMFLEX NETWORKS' |
VendorID 0x157E, 'TRANSITION NETWORKS' |
VendorID 0x157F, 'PX INSTRUMENTS TECHNOLOGY LTD' |
VendorID 0x1580, 'PRIMEX AEROSPACE CO.' |
VendorID 0x1581, 'SEH COMPUTERTECHNIK GMBH' |
VendorID 0x1582, 'CYTEC CORPORATION' |
VendorID 0x1583, 'INET TECHNOLOGIES INC' |
VendorID 0x1584, 'UNIWILL COMPUTER CORP' |
VendorID 0x1585, 'LOGITRON' |
VendorID 0x1586, 'LANCAST INC' |
VendorID 0x1587, 'KONICA CORPORATION' |
VendorID 0x1588, 'SOLIDUM SYSTEMS CORP' |
VendorID 0x1589, 'ATLANTEK MICROSYSTEMS PTY LTD' |
VendorID 0x158A, 'DIGALOG SYSTEMS INC' |
VendorID 0x158B, 'ALLIED DATA TECHNOLOGIES' |
VendorID 0x158C, 'HITACHI SEMICONDUCTOR & DEVICES SALES CO LTD' |
VendorID 0x158D, 'POINT MULTIMEDIA SYSTEMS' |
VendorID 0x158E, 'LARA TECHNOLOGY INC' |
VendorID 0x158F, 'DITECT COOP' |
VendorID 0x1590, '3PARDATA' |
VendorID 0x1591, 'ARN' |
VendorID 0x1592, 'SYBA TECH LIMITED' |
VendorID 0x1593, 'BOPS INC' |
VendorID 0x1594, 'NETGAME LTD' |
VendorID 0x1595, 'DIVA SYSTEMS CORP.' |
VendorID 0x1596, 'FOLSOM RESEARCH INC' |
VendorID 0x1597, 'MEMEC DESIGN SERVICES' |
VendorID 0x1598, 'GRANITE MICROSYSTEMS' |
VendorID 0x1599, 'DELTA ELECTRONICS INC' |
VendorID 0x159A, 'GENERAL INSTRUMENT' |
VendorID 0x159B, 'FARADAY TECHNOLOGY CORP' |
VendorID 0x159C, 'STRATUS COMPUTER SYSTEMS' |
VendorID 0x159D, 'NINGBO HARRISON ELECTRONICS CO LTD' |
VendorID 0x159E, 'A-MAX TECHNOLOGY' |
VendorID 0x159F, 'GALEA NETWORK SECURITY' |
VendorID 0x15A0, 'COMPUMASTER SRL' |
VendorID 0x15A1, 'GEOCAST NETWORK SYSTEMS INC' |
VendorID 0x15A2, 'CATALYST ENTERPRISES INC' |
VendorID 0x15A3, 'ITALTEL' |
VendorID 0x15A4, 'X-NET OY' |
VendorID 0x15A5, 'TOYOTA MACS INC' |
VendorID 0x15A6, 'SUNLIGHT ULTRASOUND TECHNOLOGIES LTD' |
VendorID 0x15A7, 'SSE TELECOM INC' |
VendorID 0x15A8, 'SHANGHAI COMMUNICATIONS TECHNOLOGIES CENTER' |
VendorID 0x15AA, 'MORETON BAY' |
VendorID 0x15AB, 'BLUESTEEL NETWORKS INC' |
VendorID 0x15AC, 'NORTH ATLANTIC INSTRUMENTS' |
VendorID 0x15AD, 'VMware Inc.' |
VendorID 0x15AE, 'AMERSHAM PHARMACIA BIOTECH' |
VendorID 0x15B0, 'ZOLTRIX INTERNATIONAL LIMITED' |
VendorID 0x15B1, 'SOURCE TECHNOLOGY INC' |
VendorID 0x15B2, 'MOSAID TECHNOLOGIES INC.' |
VendorID 0x15B3, 'MELLANOX TECHNOLOGY' |
VendorID 0x15B4, 'CCI/TRIAD' |
VendorID 0x15B5, 'CIMETRICS INC' |
VendorID 0x15B6, 'TEXAS MEMORY SYSTEMS INC' |
VendorID 0x15B7, 'SANDISK CORP.' |
VendorID 0x15B8, 'ADDI-DATA GMBH' |
VendorID 0x15B9, 'MAESTRO DIGITAL COMMUNICATIONS' |
VendorID 0x15BA, 'IMPACCT TECHNOLOGY CORP' |
VendorID 0x15BB, 'PORTWELL INC' |
VendorID 0x15BC, 'AGILENT TECHNOLOGIES' |
VendorID 0x15BD, 'DFI INC.' |
VendorID 0x15BE, 'SOLA ELECTRONICS' |
VendorID 0x15BF, 'HIGH TECH COMPUTER CORP (HTC)' |
VendorID 0x15C0, 'BVM LIMITED' |
VendorID 0x15C1, 'QUANTEL' |
VendorID 0x15C2, 'NEWER TECHNOLOGY INC' |
VendorID 0x15C3, 'TAIWAN MYCOMP CO LTD' |
VendorID 0x15C4, 'EVSX' |
VendorID 0x15C5, 'PROCOMP INFORMATICS LTD' |
VendorID 0x15C6, 'TECHNICAL UNIVERSITY OF BUDAPEST' |
VendorID 0x15C7, 'TATEYAMA SYSTEM LABORATORY CO LTD' |
VendorID 0x15C8, 'PENTA MEDIA CO. LTD' |
VendorID 0x15C9, 'SEROME TECHNOLOGY INC' |
VendorID 0x15CA, 'BITBOYS OY' |
VendorID 0x15CB, 'AG ELECTRONICS LTD' |
VendorID 0x15CC, 'HOTRAIL INC.' |
VendorID 0x15CD, 'DREAMTECH CO LTD' |
VendorID 0x15CE, 'GENRAD INC.' |
VendorID 0x15CF, 'HILSCHER GMBH' |
VendorID 0x15D1, 'INFINEON TECHNOLOGIES AG' |
VendorID 0x15D2, 'FIC (FIRST INTERNATIONAL COMPUTER INC)' |
VendorID 0x15D3, 'NDS TECHNOLOGIES ISRAEL LTD' |
VendorID 0x15D4, 'IWILL CORPORATION' |
VendorID 0x15D5, 'TATUNG CO.' |
VendorID 0x15D6, 'ENTRIDIA CORPORATION' |
VendorID 0x15D7, 'Rockwell-Collins Inc' |
VendorID 0x15D8, 'CYBERNETICS TECHNOLOGY CO LTD' |
VendorID 0x15D9, 'SUPER MICRO COMPUTER INC' |
VendorID 0x15DA, 'CYBERFIRM INC.' |
VendorID 0x15DB, 'APPLIED COMPUTING SYSTEMS INC.' |
VendorID 0x15DC, 'LITRONIC INC' |
VendorID 0x15DD, 'SIGMATEL INC.' |
VendorID 0x15DE, 'MALLEABLE TECHNOLOGIES INC' |
VendorID 0x15DF, 'INFINILINK CORP.' |
VendorID 0x15E0, 'CACHEFLOW INC' |
VendorID 0x15E1, 'VOICE TECHNOLOGIES GROUP INC' |
VendorID 0x15E2, 'QUICKNET TECHNOLOGIES INC' |
VendorID 0x15E3, 'NETWORTH TECHNOLOGIES INC' |
VendorID 0x15E4, 'VSN SYSTEMEN BV' |
VendorID 0x15E5, 'VALLEY TECHNOLOGIES INC' |
VendorID 0x15E6, 'AGERE INC.' |
VendorID 0x15E7, 'GET ENGINEERING CORP.' |
VendorID 0x15E8, 'NATIONAL DATACOMM CORP.' |
VendorID 0x15E9, 'PACIFIC DIGITAL CORP.' |
VendorID 0x15EA, 'TOKYO DENSHI SEKEI K.K.' |
VendorID 0x15EB, 'DRSEARCH GMBH' |
VendorID 0x15EC, 'BECKHOFF GMBH' |
VendorID 0x15ED, 'MACROLINK INC' |
VendorID 0x15EE, 'IN WIN DEVELOPMENT INC.' |
VendorID 0x15EF, 'INTELLIGENT PARADIGM INC' |
VendorID 0x15F0, 'B-TREE SYSTEMS INC' |
VendorID 0x15F1, 'TIMES N SYSTEMS INC' |
VendorID 0x15F2, 'DIAGNOSTIC INSTRUMENTS INC' |
VendorID 0x15F3, 'DIGITMEDIA CORP.' |
VendorID 0x15F4, 'VALUESOFT' |
VendorID 0x15F5, 'POWER MICRO RESEARCH' |
VendorID 0x15F6, 'EXTREME PACKET DEVICE INC' |
VendorID 0x15F7, 'BANCTEC' |
VendorID 0x15F8, 'KOGA ELECTRONICS CO' |
VendorID 0x15F9, 'ZENITH ELECTRONICS CORPORATION' |
VendorID 0x15FA, 'J P AXZAM CORPORATION' |
VendorID 0x15FB, 'ZILOG INC.' |
VendorID 0x15FC, 'TECHSAN ELECTRONICS CO LTD' |
VendorID 0x15FD, 'N-CUBED.NET' |
VendorID 0x15FE, 'KINPO ELECTRONICS INC' |
VendorID 0x15FF, 'FASTPOINT TECHNOLOGIES INC.' |
VendorID 0x1600, 'NORTHROP GRUMMAN-CANADA LTD' |
VendorID 0x1601, 'TENTA TECHNOLOGY' |
VendorID 0x1602, 'PROSYS-TEC INC.' |
VendorID 0x1603, 'NOKIA WIRELESS BUSINESS COMMUNICATIONS' |
VendorID 0x1604, 'CENTRAL SYSTEM RESEARCH CO LTD' |
VendorID 0x1605, 'PAIRGAIN TECHNOLOGIES' |
VendorID 0x1606, 'EUROPOP AG' |
VendorID 0x1607, 'LAVA SEMICONDUCTOR MANUFACTURING INC.' |
VendorID 0x1608, 'AUTOMATED WAGERING INTERNATIONAL' |
VendorID 0x1609, 'SCIEMETRIC INSTRUMENTS INC' |
VendorID 0x166D, 'Broadcom -SiByte' |
VendorID 0x168C, 'Atheros Communications Inc.' |
VendorID 0x1695, 'EPOX Computer Co' |
VendorID 0x17F2, 'ALBATRON Corp.' |
VendorID 0x1813, 'AMBIENT TECHNOLOGIES INC' |
VendorID 0x1849, 'ASROCK Inc' |
VendorID 0x1B13, 'Jaton Corp' |
VendorID 0x2001, 'TEMPORAL RESEARCH LTD' |
VendorID 0x270F, 'CHAINTECH COMPUTER CO. LTD' |
VendorID 0x3388, 'HINT CORP' |
VendorID 0x3411, 'QUANTUM DESIGNS (H.K.) INC.' |
VendorID 0x4005, 'AVANCE LOGIC INC' |
VendorID 0x4033, 'DELTA NETWORKS INC' |
VendorID 0x416C, 'ALADDIN KNOWLEDGE SYSTEMS' |
VendorID 0x4444, 'CONEXANT (WAS ICOMPRESION INC.)' |
VendorID 0x4943, 'GROWTH NETWORKS' |
VendorID 0x4CA1, 'SEANIX TECHNOLOGY INC' |
VendorID 0x4D51, 'MEDIAQ INC.' |
VendorID 0x4D54, 'MICROTECHNICA CO LTD' |
VendorID 0x5136, 'S S TECHNOLOGIES' |
VendorID 0x5333, 'S3 Graphics Co., Ltd.' |
VendorID 0x544C, 'TERALOGIC INC' |
VendorID 0x5555, 'GENROCO INC' |
VendorID 0x6409, 'LOGITEC CORP.' |
VendorID 0x6666, 'DECISION COMPUTER INTERNATIONAL CO.' |
VendorID 0x8086, 'Intel Corp.' |
VendorID 0x8888, 'SILICON MAGIC CORP.' |
VendorID 0x8E0E, 'COMPUTONE CORPORATION' |
VendorID 0x9004, 'Adaptec Inc' |
VendorID 0x919A, 'GIGAPIXEL CORP' |
VendorID 0x9412, 'HOLTEK' |
VendorID 0x9699, 'OMNI MEDIA TECHNOLOGY INC.' |
VendorID 0x9710, 'NetMos' |
VendorID 0xA0A0, 'AOPEN INC.' |
VendorID 0xA259, 'HEWLETT PACKARD' |
VendorID 0xAC1E, 'DIGITAL RECEIVER TECHNOLOGY INC' |
VendorID 0xC0DE, 'MOTOROLA' |
VendorID 0xC0FE, 'MOTION ENGINEERING.' |
VendorID 0xCA50, 'VARIAN AUSTRIALIA PTY LTD' |
VendorID 0xCAFE, 'CHRYSALIS-ITS' |
VendorID 0xCCCC, 'CATAPULT COMMUNICATIONS' |
VendorID 0xD4D4, 'DY4 Systems Inc/Curtiss-Wright Controls Embed. Com' |
VendorID 0xE159, 'TigerJet' |
VendorID 0xE4BF, 'EKF ELEKTRONIK GMBH' |
VendorID 0xEA01, 'EAGLE TECHNOLOGY' |
VendorID 0xFA57, 'FAST SEARCH & TRANSFER ASA' |
VendorID 0xFEDA, 'EPIGRAM INC' |
VendorID 0, 'Unknown' ; <- terminator |
;-------------------------------------- |
Classes: |
; Class, Subclass, [Interface], Name |
ClassID 2, 0, , 'Ethernet' |
ClassID 2, 1, , 'Token Ring' |
ClassID 2, 2, , 'FDDI' |
ClassID 2, 3, , 'ATM' |
ClassID 2, 4, , 'ISDN' |
ClassID 2, 5, , 'WorldFip' |
ClassID 2, 6, , 'PICMG 2.14' |
ClassID 2, 0x80, , 'misc' |
ClassID 0x0d, 0x20, , 'Wlan (802.11a)' |
ClassID 0x0d, 0x21, , 'Wlan (802.11b)' |
ClassID 0xff, 0xff, , 'Unknown' ; <- terminator |
/programs/network/netcfg |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/netstat/netstat.asm |
---|
0,0 → 1,614 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; netstat.asm - Network Status Tool for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd (I_END+0x100) ; memory for app |
dd (I_END+0x100) ; esp |
dd I_PARAM , 0x0 ; I_Param , I_Icon |
include '..\macros.inc' |
include '..\network.inc' |
START: |
mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK2 |
redraw: |
mcall 12, 1 |
mcall 0, 100 shl 16 + 600, 100 shl 16 + 240, 0x34bcbcbc, , name ; draw window |
call draw_interfaces |
mov edx, 101 |
mov esi, 0x00aaaaff |
mov edi, 0x00aaffff |
cmp dl, [mode] |
cmove esi, edi |
mcall 8, 25 shl 16 + 65, 25 shl 16 + 20 |
.morebuttons: |
inc edx |
add ebx, 75 shl 16 |
mov esi, 0x00aaaaff |
cmp dl, [mode] |
cmove esi, edi |
mcall |
cmp edx, 105 |
jle .morebuttons |
mcall 4, 28 shl 16 + 31, 0x80000000, modes |
cmp [mode], 101 |
jne .no_eth |
mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx |
add ebx, 18 |
mov edx, str_packets_rx |
mcall |
add ebx, 18 |
mov edx, str_bytes_tx |
mcall |
add ebx, 18 |
mov edx, str_bytes_rx |
mcall |
add ebx, 18 |
mov edx, str_MAC |
mcall |
add ebx, 18 |
mov edx, str_link |
mcall |
mov ebx, API_ETH + 4 |
mov bh, [device] |
mcall 76 |
push eax |
push bx |
mov edx, 135 shl 16 + 75 + 4*18 |
call draw_mac |
jmp end_of_draw |
.no_eth: |
cmp [mode], 102 |
jne .no_ip |
mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx |
add ebx, 18 |
mov edx, str_packets_rx |
mcall |
add ebx, 18 |
mov edx, str_ip |
mcall |
add ebx, 18 |
mov edx, str_dns |
mcall |
add ebx, 18 |
mov edx, str_subnet |
mcall |
add ebx, 18 |
mov edx, str_gateway |
mcall |
mov ebx, API_IPv4 + 8 |
mov bh, [device] |
mcall 76 |
push eax |
dec bl |
dec bl |
mcall 76 |
push eax |
dec bl |
dec bl |
mcall 76 |
push eax |
dec bl |
dec bl |
mcall 76 |
push eax |
mov edx, 135 shl 16 + 75 + 2*18 |
call draw_ip |
add edx, 18 |
call draw_ip |
add edx, 18 |
call draw_ip |
add edx, 18 |
call draw_ip |
jmp end_of_draw |
.no_ip: |
cmp [mode], 103 |
jne .no_arp |
mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx |
add ebx, 18 |
mov edx, str_packets_rx |
mcall |
add ebx, 18 |
mov edx, str_arp |
mcall |
add ebx, 18 |
mov edx, str_conflicts |
mcall |
jmp end_of_draw |
.no_arp: |
mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx |
add ebx, 18 |
mov edx, str_packets_rx |
mcall |
cmp [mode], 106 |
jne end_of_draw |
add ebx, 18 |
mov edx, str_missed |
mcall |
add ebx, 18 |
mov edx, str_dumped |
mcall |
end_of_draw: |
mcall 12, 2 |
draw_stats: |
cmp [mode], 101 |
jne not_101 |
mov ebx, API_ETH |
mov bh, [device] |
@@: |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
cmp bl, 3 |
jbe @r |
inc bl |
mcall 76 |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 5*18 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18*2 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_101: |
cmp [mode], 102 |
jne not_102 |
mov ebx, API_IPv4 |
mov bh, [device] |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 18 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_102: |
cmp [mode], 103 |
jne not_103 |
mov ebx, API_ARP |
mov bh, [device] |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov bl, 7 |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 3*18 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_103: |
cmp [mode], 104 |
jne not_104 |
mov ebx, API_ICMP |
mov bh, [device] |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 18 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_104: |
cmp [mode], 105 |
jne not_105 |
mov ebx, API_UDP |
mov bh, [device] |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 18 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_105: |
cmp [mode], 106 |
jne not_106 |
mov ebx, API_TCP |
mov bh, [device] |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
inc bl |
push ebx |
mcall 76 |
pop ebx |
push eax |
mov ebx, 0x000a0000 |
pop ecx |
mov edx, 135 shl 16 + 75 + 18*3 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mcall 47 |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
sub edx, 18 |
pop ecx |
mcall |
jmp mainloop |
not_106: |
mainloop: |
mcall 23, 50 ; wait for event with timeout (0,5 s) |
cmp eax, 1 |
je redraw |
cmp eax, 3 |
je button |
cmp eax, 11 |
je redraw |
jmp draw_stats |
button: ; button |
mcall 17 ; get id |
cmp ah, 1 |
je exit |
cmp ah, 0 |
je .interface |
mov [mode], ah |
jmp redraw |
.interface: |
shr eax, 16 |
mov [device], al |
jmp redraw |
exit: |
mcall -1 |
draw_mac: |
mov eax, 47 |
mov ebx, 0x00020100 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
mov cl, [esp+4] |
mcall |
mov cl, [esp+4+1] |
add edx, 15 shl 16 |
mcall |
mov cl, [esp+4+2] |
add edx, 15 shl 16 |
mcall |
mov cl, [esp+4+3] |
add edx, 15 shl 16 |
mcall |
mov cl, [esp+4+4] |
add edx, 15 shl 16 |
mcall |
mov cl, [esp+4+5] |
add edx, 15 shl 16 |
mcall |
sub edx, 5*15 shl 16 |
ret 6 |
draw_ip: |
mov eax, 47 |
mov ebx, 0x00030000 |
mov esi, 0x40000000 |
mov edi, 0x00bcbcbc |
xor ecx, ecx |
mov cl, [esp+4] |
mcall |
mov cl, [esp+4+1] |
add edx, 30 shl 16 |
mcall |
mov cl, [esp+4+2] |
add edx, 30 shl 16 |
mcall |
mov cl, [esp+4+3] |
add edx, 30 shl 16 |
mcall |
sub edx, 3*30 shl 16 |
ret 4 |
draw_interfaces: |
mov [.btnpos], 8 shl 16 + 20 |
mov [.txtpos], 490 shl 16 + 15 |
mcall 74, -1 ; get number of active network devices |
mov ecx, eax |
xor ebx, ebx ; get device type |
.loop: |
mcall 74 |
cmp eax, 1 ; ethernet? |
je .hit |
inc bh |
jb .loop ; tried all 256? |
ret |
.hit: |
push ecx ebx |
movzx edx, bh |
shl edx, 8 |
mov esi, 0x00aaaaff |
cmp bh, [device] |
cmove esi, 0x00aaffff |
mcall 8, 485 shl 16 + 100, [.btnpos] |
mov ebx, [esp] |
inc bl |
mov ecx, namebuf |
mov edx, namebuf |
mcall 74 ; get device name |
cmp eax, -1 |
jne @f |
mov edx, str_unknown |
@@: |
mcall 4, [.txtpos], 0x80000000 ; print the name |
pop ebx ecx |
inc bh |
add [.btnpos], 25 shl 16 |
add [.txtpos], 25 |
dec ecx |
jnz .loop |
ret |
.btnpos dd ? |
.txtpos dd ? |
; DATA AREA |
name db 'Netstat', 0 |
mode db 101 |
device db 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_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_conflicts db 'ARP conflicts:', 0 |
str_unknown db 'unknown', 0 |
str_missed db 'Packets missed:',0 |
str_dumped db 'Packets dumped:',0 |
str_link db 'Link state:',0 |
namebuf rb 64 |
I_PARAM rb 1024 |
I_END: |
/programs/network/netstat |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/network.inc |
---|
0,0 → 1,94 |
; Socket types |
SOCK_STREAM = 1 |
SOCK_DGRAM = 2 |
SOCK_RAW = 3 |
; Socket options |
SO_NONBLOCK = 1 shl 31 |
; IP protocols |
IPPROTO_IP = 0 |
IPPROTO_ICMP = 1 |
IPPROTO_TCP = 6 |
IPPROTO_UDP = 17 |
; Address families |
AF_UNSPEC = 0 |
AF_LOCAL = 1 |
AF_INET4 = 2 ; IPv4 |
AF_INET6 = 28 ; IPv6 (not supported yet) |
PF_UNSPEC = AF_UNSPEC |
PF_LOCAL = AF_LOCAL |
PF_INET4 = AF_INET4 |
PF_INET6 = AF_INET6 |
; Flags for addrinfo |
AI_PASSIVE = 1 |
AI_CANONNAME = 2 |
AI_NUMERICHOST = 4 |
AI_NUMERICSERV = 8 |
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 |
sin_addr dd ? ; struct in_addr |
sin_zero rb 8 ; zero |
ends |
struct addrinfo |
ai_flags dd ? ; bitmask of AI_* |
ai_family dd ? ; PF_* |
ai_socktype dd ? ; SOCK_* |
ai_protocol dd ? ; 0 or IPPROTO_* |
ai_addrlen dd ? ; length of ai_addr |
ai_canonname dd ? ; char* |
ai_addr dd ? ; struct sockaddr* |
ai_next dd ? ; struct addrinfo* |
ends |
EAI_ADDRFAMILY = 1 |
EAI_AGAIN = 2 |
EAI_BADFLAGS = 3 |
EAI_FAIL = 4 |
EAI_FAMILY = 5 |
EAI_MEMORY = 6 |
EAI_NONAME = 8 |
EAI_SERVICE = 9 |
EAI_SOCKTYPE = 10 |
EAI_BADHINTS = 12 |
EAI_PROTOCOL = 13 |
EAI_OVERFLOW = 14 |
socket fix 75, 0 |
close fix 75, 1 |
bind fix 75, 2 |
listen fix 75, 3 |
connect fix 75, 4 |
accept fix 75, 5 |
send fix 75, 6 |
recv fix 75, 7 |
setsockopt fix 75, 8 |
getsockopt fix 75, 9 |
socketpair fix 75, 10 |
struct ARP_entry |
IP dd ? |
MAC dp ? |
status dw ? |
TTL dw ? |
ends |
/programs/network/nslookup/nslookup.asm |
---|
0,0 → 1,136 |
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 '../network.inc' |
; entry point |
start: |
; 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: |
; write prompt |
push str1 |
call [con_write_asciiz] |
; read string |
mov esi, s |
push 256 |
push esi |
call [con_gets] |
; check for exit |
test eax, eax |
jz done |
cmp byte [esi], 10 |
jz done |
; delete terminating '\n' |
push esi |
@@: |
lodsb |
test al, al |
jnz @b |
mov byte [esi-2], al |
pop esi |
; resolve name |
push esp ; reserve stack place |
push esp ; fourth parameter |
push 0 ; third parameter |
push 0 ; second parameter |
push esi ; first parameter |
call [getaddrinfo] |
pop esi |
; test for error |
test eax, eax |
jnz fail |
; write results |
push str2 |
call [con_write_asciiz] |
mov edi, esi |
addrloop: |
; before all subsequent addresses print comma |
cmp edi, esi |
jz @f |
push str3 |
call [con_write_asciiz] |
@@: |
; convert IP address to decimal notation |
mov eax, [edi+addrinfo.ai_addr] |
pushd [eax+sockaddr_in.sin_addr] |
call [inet_ntoa] |
; write result |
push eax |
call [con_write_asciiz] |
; advance to next item |
mov edi, [edi+addrinfo.ai_next] |
test edi, edi |
jnz addrloop |
; free allocated memory |
push esi |
call [freeaddrinfo] |
; write newline and continue main loop |
push str4 |
@@: |
call [con_write_asciiz] |
jmp main |
fail: |
push str5 |
jmp @b |
done: |
push 1 |
call [con_exit] |
exit: |
mcall -1 |
; data |
title db 'Names resolver',0 |
str1 db 'Host name to resolve: ',0 |
str2 db 'IP address(es): ',0 |
str3 db ', ',0 |
str4 db 10,0 |
str5 db 'Name resolution failed.',10,0 |
; import |
align 4 |
@IMPORT: |
library network, 'network.obj', console, 'console.obj' |
import network, \ |
getaddrinfo, 'getaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
inet_ntoa, 'inet_ntoa' |
import console, \ |
con_start, 'START', \ |
con_init, 'con_init', \ |
con_write_asciiz, 'con_write_asciiz', \ |
con_exit, 'con_exit', \ |
con_gets, 'con_gets' |
i_end: |
s rb 256 |
align 4 |
rb 4096 ; stack |
mem: |
/programs/network/nslookup |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/pppoe/pppoe.asm |
---|
0,0 → 1,362 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2012. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; pppoe.asm - PPPoE dialer for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
use32 |
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 |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../network.inc' |
include '../struct.inc' |
; Ethernet protocol numbers |
ETHER_PPP_DISCOVERY = 0x6388 |
ETHER_PPP_SESSION = 0x6488 |
; PPP protocol numbers |
PPP_LCP = 0x21c0 ; Link Configure Protocol |
PPP_CBCP = 0x29c0 ; CallBack Control Protocol |
PPP_PAP = 0x23c0 ; Password Authenication Protocol packet |
PPP_CHAP = 0x23c2 ; Challenge Handshake Authentication Protocol |
PPP_IPCP = 0x2180 ; Internet Protocol Configure Protocol (maybe this should be in kernel?) |
PPP_CCP = 0xfd80 ; Compression Configure Protocol |
; PPP Active Discovery... |
PPPoE_PADI = 0x09 ; .. Initiation |
PPPoE_PADO = 0x07 ; .. Offer |
PPPoE_PADR = 0x19 ; .. Request |
PPPoE_PADS = 0x65 ; .. Session-confirmation |
PPPoE_PADT = 0xa7 ; .. Terminate |
TAG_EOL = 0x0000 |
TAG_SERVICE_NAME= 0x0101 |
TAG_AC_NAME = 0x0201 |
TAG_HOST_UNIQ = 0x0301 |
TAG_AC_COOKIE = 0x0401 |
LCP_config_request = 1 |
LCP_config_ack = 2 |
LCP_config_nak = 3 |
LCP_config_reject = 4 |
LCP_terminate_request = 5 |
LCP_terminate_ack = 6 |
LCP_code_reject = 7 |
LCP_protocol_reject = 8 |
LCP_echo_request = 9 |
LCP_echo_reply = 10 |
LCP_discard_request = 11 |
struct ETH_frame |
DestMac dp ? |
SrcMac dp ? |
Type dw ? |
ends |
struct PPPoE_frame ETH_frame |
VersionAndType db ? |
Code db ? |
SessionID dw ? |
Length dw ? ; Length of payload, does NOT include the length PPPoE header. |
Payload rb 0 |
ends |
struct PPP_frame PPPoE_frame |
Protocol dw ? |
ends |
struct LCP_frame PPP_frame |
LCP_Code db ? |
LCP_Identifier db ? |
LCP_Length dw ? |
LCP_Data rb 0 |
ends |
; entry point |
start: |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; initialize console |
push 1 |
call [con_start] |
push title |
push 25 |
push 80 |
push 25 |
push 80 |
call [con_init] |
main: |
mcall 40, 1 shl 7 |
call [con_cls] |
; Welcome user |
push str1 |
call [con_write_asciiz] |
mcall socket, 777, 3, 666 |
mov [socketnum], eax |
mcall send, [socketnum], PADI, PADI.length, 0 |
mainloop: |
mcall 10 |
call [con_get_flags] |
test eax, 0x200 ; con window closed? |
jnz close_conn |
mcall recv, [socketnum], buffer, 4096 |
cmp eax, sizeof.PPPoE_frame |
jb mainloop |
cmp word [buffer + ETH_frame.Type], ETHER_PPP_SESSION |
je SESSION_input |
cmp word [buffer + ETH_frame.Type], ETHER_PPP_DISCOVERY |
jne mainloop |
cmp [buffer + PPPoE_frame.Code], PPPoE_PADO |
je pado |
cmp [buffer + PPPoE_frame.Code], PPPoE_PADS |
je pads |
cmp [buffer + PPPoE_frame.Code], PPPoE_PADT |
je padt |
jmp mainloop |
pado: |
push str2 |
call [con_write_asciiz] |
lea esi, [buffer + ETH_frame.SrcMac] ; source mac -> dest mac |
lea edi, [buffer + ETH_frame.DestMac] |
movsw |
movsd |
mov byte [buffer + PPPoE_frame.Code], PPPoE_PADR ; change packet type to PADR |
mov al, byte [buffer + PPPoE_frame.Length + 1] ; get packet size |
mov ah, byte [buffer + PPPoE_frame.Length + 0] |
movzx esi, ax |
add esi, sizeof.PPPoE_frame |
mcall send, [socketnum], buffer, , 0 ; now send it! |
jmp mainloop |
pads: |
push str3 |
call [con_write_asciiz] |
mov edx, dword [buffer + ETH_frame.SrcMac] ; source mac -> dest mac |
mov si, word [buffer + ETH_frame.SrcMac + 4] |
mov dword [PADT.mac], edx |
mov word [PADT.mac + 4], si |
mov cx, word [buffer + PPPoE_frame.SessionID] ; and Session ID |
mov [PADT.sid], cx |
mcall 76, API_PPPOE + 0 ; Start PPPoE session |
jmp mainloop |
padt: |
push str4 |
call [con_write_asciiz] |
mcall 76, API_PPPOE + 1 ; Stop PPPoE session |
exit: |
mcall close, [socketnum] |
mcall -1 |
close_conn: |
mcall send, [socketnum], PADT, PADT.length, 0 |
jmp exit |
SESSION_input: |
mov ax, word[buffer + PPP_frame.Protocol] |
cmp ax, PPP_LCP |
je LCP_input |
cmp ax, PPP_CBCP |
je CBCP_input |
cmp ax, PPP_PAP |
je PAP_input |
cmp ax, PPP_CHAP |
je CHAP_input |
cmp ax, PPP_IPCP |
je IPCP_input |
cmp ax, PPP_CCP |
je CCP_input |
jmp mainloop |
LCP_input: |
stdcall con_write_asciiz, str_lcp |
cmp [buffer + LCP_frame.LCP_Code], LCP_echo_request |
je .echo |
.dump: |
jmp mainloop |
.echo: |
mov [buffer + LCP_frame.LCP_Code], LCP_echo_reply |
lea esi, [buffer + ETH_frame.SrcMac] ; source mac -> dest mac |
lea edi, [buffer + ETH_frame.DestMac] |
movsw |
movsd |
mov esi, eax |
mcall send, [socketnum], buffer, , 0 ; now send it back! |
jmp mainloop |
CBCP_input: |
stdcall con_write_asciiz, str_cbcp |
jmp mainloop |
PAP_input: |
stdcall con_write_asciiz, str_pap |
jmp mainloop |
CHAP_input: |
stdcall con_write_asciiz, str_chap |
jmp mainloop |
IPCP_input: |
stdcall con_write_asciiz, str_ipcp |
jmp mainloop |
CCP_input: |
stdcall con_write_asciiz, str_ccp |
jmp mainloop |
; data |
title db 'PPPoE',0 |
str1 db 'Sending PADI',13,10,0 |
str2 db 'Got PADO',13,10,'Sending PADR',13,10,0 |
str3 db 'Got PADS',13,10,'starting PPPoE session',13,10,0 |
str4 db 'Got PADT - connection terminated by Access Concentrator',13,10,0 |
str_lcp db 'Got LCP packet',13,10,0 |
str_cbcp db 'got CBCP packet',13,10,0 |
str_pap db 'got PAP packet',13,10,0 |
str_chap db 'got CHAP packet',13,10,0 |
str_ipcp db 'got IPCP packet',13,10,0 |
str_ccp db 'got CCP packet',13,10,0 |
PADI: |
dp 0xffffffffffff ; dest mac: broadcast |
dp 0 ; source mac (overwritten by kernel) |
dw ETHER_PPP_DISCOVERY ; type |
db 0x11 ; Version and Type |
db PPPoE_PADI ; Code |
dw 0 ; session ID |
dw 20 shl 8 ; Payload Length |
dw TAG_SERVICE_NAME ; tag |
dw 0x0000 ; length |
dw TAG_HOST_UNIQ ; tag |
dw 0x0c00 ; length = 12 bytes |
dd 0xdead ; some random id |
dd 0xbeef |
dd 0x1337 |
.length = $ - PADI |
PADT: |
.mac dp 0 ; Dest mac, to be filled in |
dp 0 ; source mac (overwritten by kernel) |
dw ETHER_PPP_DISCOVERY ; Type |
db 0x11 ; Version and Type |
db PPPoE_PADT ; Code: terminate connection |
.sid dw 0 ; session id, to be filled in |
dw 0 ; PAyload length = 0 |
.length = $ - PADT |
; import |
align 4 |
@IMPORT: |
library console, 'console.obj' |
import console, \ |
con_start, 'START', \ |
con_init, 'con_init', \ |
con_write_asciiz, 'con_write_asciiz', \ |
con_exit, 'con_exit', \ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos',\ |
con_write_string, 'con_write_string',\ |
con_get_flags, 'con_get_flags' |
i_end: |
socketnum dd ? |
buffer rb 4096 |
rb 4096 ; stack |
mem: |
/programs/network/pppoe |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/proc32.inc |
---|
0,0 → 1,270 |
; Macroinstructions for defining and calling procedures |
macro stdcall proc,[arg] ; directly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call proc } |
macro invoke proc,[arg] ; indirectly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call [proc] } |
macro ccall proc,[arg] ; directly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call proc |
if size@ccall |
add esp,size@ccall |
end if } |
macro cinvoke proc,[arg] ; indirectly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call [proc] |
if size@ccall |
add esp,size@ccall |
end if } |
macro proc [args] ; define procedure |
{ common |
match name params, args> |
\{ define@proc name,<params \} } |
prologue@proc equ prologuedef |
macro prologuedef procname,flag,parmbytes,localbytes,reglist |
{ if parmbytes | localbytes |
push ebp |
mov ebp,esp |
if localbytes |
sub esp,localbytes |
end if |
end if |
irps reg, reglist \{ push reg \} } |
epilogue@proc equ epiloguedef |
macro epiloguedef procname,flag,parmbytes,localbytes,reglist |
{ irps reg, reglist \{ reverse pop reg \} |
if parmbytes | localbytes |
leave |
end if |
if flag and 10000b |
retn |
else |
retn parmbytes |
end if } |
macro define@proc name,statement |
{ local params,flag,regs,parmbytes,localbytes,current |
if used name |
name: |
match =stdcall args, statement \{ params equ args |
flag = 11b \} |
match =stdcall, statement \{ params equ |
flag = 11b \} |
match =c args, statement \{ params equ args |
flag = 10001b \} |
match =c, statement \{ params equ |
flag = 10001b \} |
match =params, params \{ params equ statement |
flag = 0 \} |
virtual at ebp+8 |
match =uses reglist=,args, params \{ regs equ reglist |
params equ args \} |
match =regs =uses reglist, regs params \{ regs equ reglist |
params equ \} |
match =regs, regs \{ regs equ \} |
match =,args, params \{ defargs@proc args \} |
match =args@proc args, args@proc params \{ defargs@proc args \} |
parmbytes = $ - (ebp+8) |
end virtual |
name # % = parmbytes/4 |
all@vars equ |
current = 0 |
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} |
macro locals |
\{ virtual at ebp-localbytes+current |
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\} |
struc db [val] \\{ \common deflocal@proc .,db,val \\} |
struc du [val] \\{ \common deflocal@proc .,du,val \\} |
struc dw [val] \\{ \common deflocal@proc .,dw,val \\} |
struc dp [val] \\{ \common deflocal@proc .,dp,val \\} |
struc dd [val] \\{ \common deflocal@proc .,dd,val \\} |
struc dt [val] \\{ \common deflocal@proc .,dt,val \\} |
struc dq [val] \\{ \common deflocal@proc .,dq,val \\} |
struc rb cnt \\{ deflocal@proc .,rb cnt, \\} |
struc rw cnt \\{ deflocal@proc .,rw cnt, \\} |
struc rp cnt \\{ deflocal@proc .,rp cnt, \\} |
struc rd cnt \\{ deflocal@proc .,rd cnt, \\} |
struc rt cnt \\{ deflocal@proc .,rt cnt, \\} |
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} |
macro endl |
\{ purge label |
restruc db,du,dw,dp,dd,dt,dq |
restruc rb,rw,rp,rd,rt,rq |
current = $-(ebp-localbytes) |
end virtual \} |
macro ret operand |
\{ match any, operand \\{ retn operand \\} |
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> |
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} |
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 |
end if \} } |
macro defargs@proc [arg] |
{ common |
if ~ arg eq |
forward |
local ..arg,current@arg |
match argname:type, arg |
\{ current@arg equ argname |
label ..arg type |
argname equ ..arg |
if dqword eq type |
dd ?,?,?,? |
else if tbyte eq type |
dd ?,?,? |
else if qword eq type | pword eq type |
dd ?,? |
else |
dd ? |
end if \} |
match =current@arg,current@arg |
\{ current@arg equ arg |
arg equ ..arg |
..arg dd ? \} |
common |
args@proc equ current@arg |
forward |
restore current@arg |
common |
end if } |
macro deflocal@proc name,def,[val] |
{ common |
match vars, all@vars \{ all@vars equ all@vars, \} |
all@vars equ all@vars name |
forward |
local ..var,..tmp |
match =label,def \{ ..tmp equ \} |
match tmp,..tmp \{ ..var def val \} |
match ,..tmp \{ label ..var val \} |
match =?, val \{ ..tmp equ \} |
match any =dup (=?), val \{ ..tmp equ \} |
match tmp : value, ..tmp : val |
\{ tmp: end virtual |
initlocal@proc ..var,def value |
virtual at tmp\} |
common |
match first rest, ..var, \{ name equ first \} } |
macro initlocal@proc name,def |
{ virtual at name |
def |
size@initlocal = $ - name |
end virtual |
position@initlocal = 0 |
while size@initlocal > position@initlocal |
virtual at name |
def |
if size@initlocal - position@initlocal < 2 |
current@initlocal = 1 |
load byte@initlocal byte from name+position@initlocal |
else if size@initlocal - position@initlocal < 4 |
current@initlocal = 2 |
load word@initlocal word from name+position@initlocal |
else |
current@initlocal = 4 |
load dword@initlocal dword from name+position@initlocal |
end if |
end virtual |
if current@initlocal = 1 |
mov byte [name+position@initlocal],byte@initlocal |
else if current@initlocal = 2 |
mov word [name+position@initlocal],word@initlocal |
else |
mov dword [name+position@initlocal],dword@initlocal |
end if |
position@initlocal = position@initlocal + current@initlocal |
end while } |
macro endp |
{ purge ret,locals,endl |
finish@proc |
purge finish@proc |
restore regs@proc |
match all,args@proc \{ restore all \} |
restore args@proc |
match all,all@vars \{ restore all \} } |
macro local [var] |
{ common |
locals |
forward done@local equ |
match varname[count]:vartype, var |
\{ match =BYTE, vartype \\{ varname rb count |
restore done@local \\} |
match =WORD, vartype \\{ varname rw count |
restore done@local \\} |
match =DWORD, vartype \\{ varname rd count |
restore done@local \\} |
match =PWORD, vartype \\{ varname rp count |
restore done@local \\} |
match =QWORD, vartype \\{ varname rq count |
restore done@local \\} |
match =TBYTE, vartype \\{ varname rt count |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
rq count+count |
restore done@local \\} |
match , done@local \\{ virtual |
varname vartype |
end virtual |
rb count*sizeof.\#vartype |
restore done@local \\} \} |
match :varname:vartype, done@local:var |
\{ match =BYTE, vartype \\{ varname db ? |
restore done@local \\} |
match =WORD, vartype \\{ varname dw ? |
restore done@local \\} |
match =DWORD, vartype \\{ varname dd ? |
restore done@local \\} |
match =PWORD, vartype \\{ varname dp ? |
restore done@local \\} |
match =QWORD, vartype \\{ varname dq ? |
restore done@local \\} |
match =TBYTE, vartype \\{ varname dt ? |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
dq ?,? |
restore done@local \\} |
match , done@local \\{ varname vartype |
restore done@local \\} \} |
match ,done@local |
\{ var |
restore done@local \} |
common |
endl } |
/programs/network/socketdbg/socket.inc |
---|
0,0 → 1,164 |
struct LHEAD |
next dd ? ;next object in list |
prev dd ? ;prev object in list |
ends |
struct MUTEX |
lhead LHEAD |
count dd ? |
ends |
struct SOCKET |
NextPtr dd ? ; pointer to next socket in list |
PrevPtr dd ? ; pointer to previous socket in list |
Number dd ? ; socket number |
mutex MUTEX |
PID dd ? ; application process id |
Domain dd ? ; INET/UNIX/.. |
Type dd ? ; RAW/STREAM/DGRAP |
Protocol dd ? ; ICMP/IPv4/ARP/TCP/UDP |
errorcode dd ? |
device dd ? |
options dd ? |
state dd ? |
backlog dw ? ; how many incomming connections that can be queued |
snd_proc dd ? |
rcv_proc dd ? |
ends |
struct IP_SOCKET SOCKET |
LocalIP rd 4 ; network byte order |
RemoteIP rd 4 ; network byte order |
ends |
struct TCP_SOCKET IP_SOCKET |
LocalPort dw ? ; network byte order |
RemotePort dw ? ; network byte order |
t_state dd ? ; TCB state |
t_rxtshift db ? |
rb 3 ; align |
t_rxtcur dd ? |
t_dupacks dd ? |
t_maxseg dd ? |
t_force dd ? |
t_flags dd ? |
;--------------- |
; RFC783 page 21 |
; send sequence |
SND_UNA dd ? ; sequence number of unack'ed sent Packets |
SND_NXT dd ? ; next send sequence number to use |
SND_UP dd ? ; urgent pointer |
SND_WL1 dd ? ; window minus one |
SND_WL2 dd ? ; |
ISS dd ? ; initial send sequence number |
SND_WND dd ? ; send window |
; receive sequence |
RCV_WND dd ? ; receive window |
RCV_NXT dd ? ; next receive sequence number to use |
RCV_UP dd ? ; urgent pointer |
IRS dd ? ; initial receive sequence number |
;--------------------- |
; Additional variables |
; receive variables |
RCV_ADV dd ? |
; retransmit variables |
SND_MAX dd ? |
; congestion control |
SND_CWND dd ? |
SND_SSTHRESH dd ? |
;---------------------- |
; Transmit timing stuff |
t_idle dd ? |
t_rtt dd ? |
t_rtseq dd ? |
t_srtt dd ? |
t_rttvar dd ? |
t_rttmin dd ? |
max_sndwnd dd ? |
;----------------- |
; Out-of-band data |
t_oobflags dd ? |
t_iobc dd ? |
t_softerror dd ? |
;--------- |
; RFC 1323 ; the order of next 4 elements may not change |
SND_SCALE db ? |
RCV_SCALE db ? |
requested_s_scale db ? |
request_r_scale db ? |
ts_recent dd ? ; a copy of the most-recent valid timestamp from the other end |
ts_recent_age dd ? |
last_ack_sent dd ? |
;------- |
; Timers |
timer_retransmission dd ? ; rexmt |
timer_persist dd ? |
timer_keepalive dd ? ; keepalive/syn timeout |
timer_timed_wait dd ? ; also used as 2msl timer |
; extra |
ts_ecr dd ? ; timestamp echo reply |
ts_val dd ? |
temp_bits db ? |
ends |
struct UDP_SOCKET IP_SOCKET |
LocalPort dw ? ; network byte order |
RemotePort dw ? ; network byte order |
firstpacket db ? |
ends |
struct ICMP_SOCKET IP_SOCKET |
Identifier dw ? |
ends |
struct RING_BUFFER |
start_ptr dd ? ; Pointer to start of buffer |
end_ptr dd ? ; pointer to end of buffer |
read_ptr dd ? ; Read pointer |
write_ptr dd ? ; Write pointer |
size dd ? ; Number of bytes buffered |
ends |
struct STREAM_SOCKET TCP_SOCKET |
rcv RING_BUFFER |
snd RING_BUFFER |
ends |
/programs/network/socketdbg/socketdbg.asm |
---|
0,0 → 1,100 |
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: |
/programs/network/socketdbg |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/struct.inc |
---|
0,0 → 1,240 |
; Macroinstructions for defining data structures |
macro struct name |
{ virtual at 0 |
fields@struct equ name |
match child parent, name \{ fields@struct equ child,fields@\#parent \} |
sub@struct equ |
struc db [val] \{ \common define field@struct .,db,<val> |
fields@struct equ fields@struct,field@struct \} |
struc dw [val] \{ \common define field@struct .,dw,<val> |
fields@struct equ fields@struct,field@struct \} |
struc du [val] \{ \common define field@struct .,du,<val> |
fields@struct equ fields@struct,field@struct \} |
struc dd [val] \{ \common define field@struct .,dd,<val> |
fields@struct equ fields@struct,field@struct \} |
struc dp [val] \{ \common define field@struct .,dp,<val> |
fields@struct equ fields@struct,field@struct \} |
struc dq [val] \{ \common define field@struct .,dq,<val> |
fields@struct equ fields@struct,field@struct \} |
struc dt [val] \{ \common define field@struct .,dt,<val> |
fields@struct equ fields@struct,field@struct \} |
struc rb count \{ define field@struct .,db,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
struc rw count \{ define field@struct .,dw,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
struc rd count \{ define field@struct .,dd,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
struc rp count \{ define field@struct .,dp,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
struc rq count \{ define field@struct .,dq,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
struc rt count \{ define field@struct .,dt,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro db [val] \{ \common \local anonymous |
define field@struct anonymous,db,<val> |
fields@struct equ fields@struct,field@struct \} |
macro dw [val] \{ \common \local anonymous |
define field@struct anonymous,dw,<val> |
fields@struct equ fields@struct,field@struct \} |
macro du [val] \{ \common \local anonymous |
define field@struct anonymous,du,<val> |
fields@struct equ fields@struct,field@struct \} |
macro dd [val] \{ \common \local anonymous |
define field@struct anonymous,dd,<val> |
fields@struct equ fields@struct,field@struct \} |
macro dp [val] \{ \common \local anonymous |
define field@struct anonymous,dp,<val> |
fields@struct equ fields@struct,field@struct \} |
macro dq [val] \{ \common \local anonymous |
define field@struct anonymous,dq,<val> |
fields@struct equ fields@struct,field@struct \} |
macro dt [val] \{ \common \local anonymous |
define field@struct anonymous,dt,<val> |
fields@struct equ fields@struct,field@struct \} |
macro rb count \{ \local anonymous |
define field@struct anonymous,db,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro rw count \{ \local anonymous |
define field@struct anonymous,dw,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro rd count \{ \local anonymous |
define field@struct anonymous,dd,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro rp count \{ \local anonymous |
define field@struct anonymous,dp,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro rq count \{ \local anonymous |
define field@struct anonymous,dq,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro rt count \{ \local anonymous |
define field@struct anonymous,dt,count dup (?) |
fields@struct equ fields@struct,field@struct \} |
macro union \{ fields@struct equ fields@struct,,union,< |
sub@struct equ union \} |
macro struct \{ fields@struct equ fields@struct,,substruct,< |
sub@struct equ substruct \} } |
macro ends |
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt |
restruc rb,rw,rd,rp,rq,rt |
purge db,dw,du,dd,dp,dq,dt |
purge rb,rw,rd,rp,rq,rt |
purge union,struct |
match name tail,fields@struct, \\{ if $ |
display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah |
err |
end if \\} |
match name=,fields,fields@struct \\{ fields@struct equ |
make@struct name,fields |
define fields@\\#name fields \\} |
end virtual \} |
match any, sub@struct \{ fields@struct equ fields@struct> \} |
restore sub@struct } |
macro make@struct name,[field,type,def] |
{ common |
local define |
define equ name |
forward |
local sub |
match , field \{ make@substruct type,name,sub def |
define equ define,.,sub, \} |
match any, field \{ define equ define,.#field,type,<def> \} |
common |
match fields, define \{ define@struct fields \} } |
macro define@struct name,[field,type,def] |
{ common |
virtual |
db `name |
load initial@struct byte from 0 |
if initial@struct = '.' |
display 'Error: name of structure should not begin with a dot.',0Dh,0Ah |
err |
end if |
end virtual |
local list |
list equ |
forward |
if ~ field eq . |
name#field type def |
sizeof.#name#field = $ - name#field |
else |
label name#.#type |
rb sizeof.#type |
end if |
local value |
match any, list \{ list equ list, \} |
list equ list <value> |
common |
sizeof.#name = $ |
restruc name |
match values, list \{ |
struc name value \\{ \\local \\..base |
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\} |
match , fields@struct \\\{ label \\..base |
forward |
match , value \\\\{ field type def \\\\} |
match any, value \\\\{ field type value |
if ~ field eq . |
rb sizeof.#name#field - ($-field) |
end if \\\\} |
common label . at \\..base \\\} |
\\} |
macro name value \\{ |
match any, fields@struct \\\{ \\\local anonymous |
fields@struct equ fields@struct,anonymous,name,<values> \\\} |
match , fields@struct \\\{ |
forward |
match , value \\\\{ type def \\\\} |
match any, value \\\\{ \\\\local ..field |
..field = $ |
type value |
if ~ field eq . |
rb sizeof.#name#field - ($-..field) |
end if \\\\} |
common \\\} \\} \} } |
macro enable@substruct |
{ macro make@substruct substruct,parent,name,[field,type,def] |
\{ \common |
\local define |
define equ parent,name |
\forward |
\local sub |
match , field \\{ match any, type \\\{ enable@substruct |
make@substruct type,parent,sub def |
purge make@substruct |
define equ define,.,sub, \\\} \\} |
match any, field \\{ define equ define,.\#field,type,<def> \\} |
\common |
match fields, define \\{ define@\#substruct fields \\} \} } |
enable@substruct |
macro define@union parent,name,[field,type,def] |
{ common |
virtual at parent#.#name |
forward |
if ~ field eq . |
virtual at parent#.#name |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
end virtual |
if sizeof.#parent#field > $ - parent#.#name |
rb sizeof.#parent#field - ($ - parent#.#name) |
end if |
else |
virtual at parent#.#name |
label parent#.#type |
type def |
end virtual |
label name#.#type at parent#.#name |
if sizeof.#type > $ - parent#.#name |
rb sizeof.#type - ($ - parent#.#name) |
end if |
end if |
common |
sizeof.#name = $ - parent#.#name |
end virtual |
struc name [value] \{ \common |
label .\#name |
last@union equ |
forward |
match any, last@union \\{ virtual at .\#name |
field type def |
end virtual \\} |
match , last@union \\{ match , value \\\{ field type def \\\} |
match any, value \\\{ field type value \\\} \\} |
last@union equ field |
common rb sizeof.#name - ($ - .\#name) \} |
macro name [value] \{ \common \local ..anonymous |
..anonymous name value \} } |
macro define@substruct parent,name,[field,type,def] |
{ common |
virtual at parent#.#name |
forward |
if ~ field eq . |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
else |
label parent#.#type |
rb sizeof.#type |
end if |
common |
sizeof.#name = $ - parent#.#name |
end virtual |
struc name value \{ |
label .\#name |
forward |
match , value \\{ field type def \\} |
match any, value \\{ field type value |
if ~ field eq . |
rb sizeof.#parent#field - ($-field) |
end if \\} |
common \} |
macro name value \{ \local ..anonymous |
..anonymous name \} } |
/programs/network/synergyc/synergyc.asm |
---|
0,0 → 1,384 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; Synergyc.asm - Synergy client for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; signature |
dd 1 ; header version |
dd start ; entry point |
dd i_end ; initialized size |
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 |
DEFAULTPORT equ 24800 |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../network.inc' |
start: |
cld |
mov edi, path ; Calculate the length of zero-terminated string |
xor al, al |
mov ecx, 1024 |
repne scasb |
dec edi |
mov esi, filename ; append the path with '.ini' |
movsd |
movsb |
mcall 68, 11 |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
push 1 |
call [con_start] |
push title |
push 25 |
push 80 |
push 25 |
push 80 |
call [con_init] |
push path |
call [con_write_asciiz] |
push newline |
call [con_write_asciiz] |
push newline |
call [con_write_asciiz] |
invoke ini.get_str, path, str_remote, str_ip, buffer_ptr, 16, 0 |
test eax, eax |
jnz error |
invoke ini.get_int, path, str_remote, str_port, DEFAULTPORT |
xchg al, ah |
mov [sockaddr1.port], ax |
push str1 |
call [con_write_asciiz] |
push buffer_ptr |
call [con_write_asciiz] |
push newline |
call [con_write_asciiz] |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
je error |
mov [socketnum], eax |
push buffer_ptr ; hostname |
call [inet_addr] |
cmp eax, -1 |
je error |
mov [sockaddr1.ip], eax |
mcall connect, [socketnum], sockaddr1, 18 |
push str7 |
call [con_write_asciiz] |
mcall 40, 1 shl 7; + 7 |
login: |
call wait_for_data |
push buffer_ptr + 4 |
call [con_write_asciiz] |
cmp dword [buffer_ptr], 11 shl 24 |
jne login |
cmp dword [buffer_ptr + 4], 'Syne' |
jne login |
cmp word [buffer_ptr + 8], 'rg' |
jne login |
cmp byte [buffer_ptr + 10], 'y' |
jne login |
push str2 |
call [con_write_asciiz] |
lea edi, [buffer_ptr + 11 + 4 + 4] |
invoke ini.get_str, path, str_local, str_name, edi, 255, 0 |
xor al , al |
mov ecx, 256 |
repne scasb |
sub edi, buffer_ptr + 1 + 4 |
mov esi, edi |
bswap edi |
mov dword [buffer_ptr], edi |
mov edi, esi |
sub edi, 11 + 4 |
bswap edi |
mov dword [buffer_ptr + 11 + 4], edi |
add esi, 4 |
mcall send, [socketnum], buffer_ptr, , 0 |
mainloop: |
call wait_for_data |
mov edi, buffer_ptr |
.command: |
push eax edi |
cmp dword [edi + 4], 'QINF' ; query screen info |
je .qinf |
cmp dword [edi + 4], 'CALV' ; alive ? |
je .calv |
cmp dword [edi + 4], 'CINN' ; mouse moved into screen |
je .cinn |
cmp dword [edi + 4], 'DCLP' ; Clipboard event |
je .dclp |
cmp dword [edi + 4], 'DMMV' ; Mouse moved |
je .dmmv |
cmp dword [edi + 4], 'COUT' ; leave screen |
je .cout |
cmp dword [edi + 4], 'DMDN' ; mouse button down |
je .dmdn |
cmp dword [edi + 4], 'DMUP' ; mouse button released |
je .dmup |
cmp dword [edi + 4], 'CNOP' ; no operation |
je .next |
cmp dword [edi + 4], 'CIAK' ; resolution changed? |
je .ciak |
push str3 |
call [con_write_asciiz] |
mov byte[edi+8],0 |
add edi, 4 |
push edi |
call [con_write_asciiz] |
push newline |
call [con_write_asciiz] |
.next: |
pop edi eax |
mov ecx, dword [edi] |
bswap ecx |
add ecx, 4 |
sub eax, ecx |
jle mainloop |
add edi, ecx |
jmp .command |
.qinf: |
mcall 14 ; get screen info |
add eax, 0x00010001 |
bswap eax |
mov dword [screeninfo.size], eax |
mcall send, [socketnum], screeninfo, screeninfo.length, 0 ; send client name |
jmp .next |
.calv: |
mcall send, [socketnum], calv, calv.length, 0 ; looks like ping-pong event |
jmp .next |
.cinn: |
mov edx, [edi + 8] |
bswap edx |
mcall 18, 19, 4 |
; ignore sequence number and modify key mask for now |
push str6 |
call [con_write_asciiz] |
jmp .next |
.dclp: |
jmp .next |
.dmmv: |
mov edx, [edi + 8] |
bswap edx |
mcall 18, 19, 4 |
mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
push str4 |
call [con_write_asciiz] |
jmp .next |
.cout: |
jmp .next |
.dmdn: |
movzx eax, byte [edi + 8] |
or [mousestate], eax |
mcall 18, 19, 5, [mousestate] |
mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
push str5 |
call [con_write_asciiz] |
jmp .next |
.dmup: |
movzx eax, byte [edi + 8] |
not eax |
and [mousestate], eax |
mcall 18, 19, 5, [mousestate] |
mcall send, [socketnum], cnop, cnop.length, 0 ; reply with NOP |
push str5 |
call [con_write_asciiz] |
jmp .next |
.ciak: |
jmp .next |
error: |
push str_err |
call [con_write_asciiz] |
call [con_gets] |
push 1 |
call [con_exit] |
mcall close, [socketnum] |
exit: |
mcall -1 |
wait_for_data: |
mcall 10 ; wait for data |
mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
cmp eax, -1 |
je wait_for_data |
cmp eax, 8 |
jl wait_for_data |
ret |
; data |
title db 'Synergy client',0 |
str1 db 'Connecting to: ',0 |
str7 db 'Connected!',13,10,0 |
str2 db 13,10,'Handshake received',13,10,0 |
str3 db 'Unsupported command: ',0 |
newline db 13,10,0 |
str4 db 'mouse moved',13,10,0 |
str5 db 'mouse buttons changed',13,10,0 |
str6 db 'Enter screen',13,10,0 |
str_err db 'Error occured !',13,10,'Press any key to quit',0 |
screeninfo: |
dd (screeninfo.length - 4) shl 24 |
db 'DINF' |
dw 0 ; coordinate of leftmost pixel |
dw 0 ; coordiante of topmost pixel |
.size: |
dw 0 ; width |
dw 0 ; height |
dw 0 ; size of warp zone |
dw 0xb88b ; x position of the mouse on the secondary screen (no idea what it means) |
dw 0xbcfb ; y position of the mouse on the secondary screen |
.length = $ - screeninfo |
calv: |
dd (4) shl 24 |
db 'CALV' |
.length = $ - calv + 8 ; also send cnop |
cnop: |
dd (4) shl 24 |
db 'CNOP' |
.length = $ - cnop |
mousestate dd 0 |
sockaddr1: |
dw AF_INET4 |
.port dw 0 |
.ip dd 192 + 168 shl 8 + 1 shl 16 + 115 shl 24 |
rb 10 |
filename db '.ini', 0 |
str_local db 'local', 0 |
str_name db 'name', 0 |
str_remote db 'remote', 0 |
str_port db 'port', 0 |
str_ip db 'ip', 0 |
; import |
align 16 |
@IMPORT: |
library console, 'console.obj',\ |
network, 'network.obj',\ |
libini, 'libini.obj' |
import network,\ |
inet_addr, 'inet_addr' |
import console, \ |
con_start, 'START',\ |
con_init, 'con_init',\ |
con_write_asciiz, 'con_write_asciiz',\ |
con_exit, 'con_exit',\ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos' |
import libini,\ |
ini.get_str, 'ini_get_str',\ |
ini.get_int, 'ini_get_int' |
align 4 |
i_end: |
socketnum dd ? |
buffer_ptr rb BUFFERSIZE |
path rb 4096 ; stack |
mem: |
/programs/network/synergyc/synergyc.ini |
---|
0,0 → 1,6 |
[local] |
name = karaboeia |
[remote] |
ip = 192.168.1.115 |
port = 24800 |
/programs/network/synergyc |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/tcpserv/tcpserv.asm |
---|
0,0 → 1,168 |
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 |
BUFFERSIZE equ 1500 |
; useful includes |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../network.inc' |
; entry point |
start: |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; initialize console |
push 1 |
call [con_start] |
push title |
push 25 |
push 80 |
push 25 |
push 80 |
call [con_init] |
mcall 40, 1 shl 7 ; we only want network events |
push str1 |
call [con_write_asciiz] |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
je sock_err |
mov [socketnum], eax |
;; mcall setsockopt, [socketnum], SOL_SOCKET, SO_REUSEADDR, &yes, |
;; cmp eax, -1 |
;; je opt_err |
mcall bind, [socketnum], sockaddr1, sockaddr1.length |
cmp eax, -1 |
je bind_err |
mcall listen, [socketnum], 10 ; Backlog = 10 |
cmp eax, -1 |
je listen_err |
push str2 |
call [con_write_asciiz] |
mcall 10 |
mcall accept, [socketnum], sockaddr1, sockaddr1.length |
cmp eax, -1 |
je acpt_err |
mov [socketnum2], eax |
;; mcall close, [socketnum] |
mcall send, [socketnum2], hello, hello.length |
.loop: |
mcall 10 |
mcall recv, [socketnum2], buffer, buffer.length |
cmp eax, -1 |
je .loop |
mov byte [buffer + eax], 0 |
push buffer |
call [con_write_asciiz] |
jmp .loop |
acpt_err: |
push str8 |
call [con_write_asciiz] |
jmp done |
listen_err: |
push str3 |
call [con_write_asciiz] |
jmp done |
bind_err: |
push str4 |
call [con_write_asciiz] |
jmp done |
sock_err: |
push str6 |
call [con_write_asciiz] |
jmp done |
done: |
call [con_getch2] |
push 1 |
call [con_exit] |
exit: |
mcall -1 |
; data |
title db 'TCP stream server - test',0 |
str1 db 'Opening socket',10, 0 |
str2 db 'Listening for incoming connections...',10,0 |
str3 db 'Listen error',10,10,0 |
str4 db 'Bind error',10,10,0 |
str5 db 'Setsockopt error.',10,10,0 |
str6 db 'Could not open socket',10,10,0 |
str7 db 'Got data!',10,10,0 |
str8 db 'Error accepting connection',10,10,0 |
hello db 'Hello world!',0 |
.length = $ - hello |
sockaddr1: |
dw AF_INET4 |
.port dw 0x1700 ; 23 |
.ip dd 0 |
rb 10 |
.length = $ - sockaddr1 |
; import |
align 4 |
@IMPORT: |
library console, 'console.obj' |
import console, \ |
con_start, 'START', \ |
con_init, 'con_init', \ |
con_write_asciiz, 'con_write_asciiz', \ |
con_exit, 'con_exit', \ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_printf, 'con_printf',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos' |
i_end: |
socketnum dd ? |
socketnum2 dd ? |
buffer rb BUFFERSIZE |
.length = BUFFERSIZE |
align 4 |
rb 4096 ; stack |
mem: |
/programs/network/tcpserv |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/telnet/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/telnet/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/telnet/trunk/telnet.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/telnet/telnet.asm |
---|
0,0 → 1,305 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; telnet.asm - Telnet client for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
__DEBUG__ equ 0 |
__DEBUG_LEVEL__ equ 1 |
BUFFERSIZE equ 4096 |
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 s ; parameters |
dd 0 ; path |
include '../macros.inc' |
purge mov,add,sub |
include '../proc32.inc' |
include '../dll.inc' |
include '../debug-fdo.inc' |
include '../network.inc' |
; entry point |
start: |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; initialize console |
push 1 |
call [con_start] |
push title |
push 25 |
push 80 |
push 25 |
push 80 |
call [con_init] |
; Check for parameters |
cmp byte [s], 0 |
jne resolve |
main: |
call [con_cls] |
; Welcome user |
push str1 |
call [con_write_asciiz] |
; write prompt |
push str2 |
call [con_write_asciiz] |
; read string |
mov esi, s |
push 256 |
push esi |
call [con_gets] |
; check for exit |
test eax, eax |
jz done |
cmp byte [esi], 10 |
jz done |
resolve: |
; delete terminating '\n' |
mov esi, s |
@@: |
lodsb |
cmp al, 0x20 |
ja @r |
mov byte [esi-1], 0 |
call [con_cls] |
push str3 |
call [con_write_asciiz] |
push s |
call [con_write_asciiz] |
; resolve name |
push esp ; reserve stack place |
push esp ; fourth parameter |
push 0 ; third parameter |
push 0 ; second parameter |
push s ; first parameter |
call [getaddrinfo] |
pop esi |
; test for error |
test eax, eax |
jnz fail |
; write results |
push str8 |
call [con_write_asciiz] |
; mov edi, esi |
; convert IP address to decimal notation |
mov eax, [esi+addrinfo.ai_addr] |
mov eax, [eax+sockaddr_in.sin_addr] |
mov [sockaddr1.ip], eax |
push eax |
call [inet_ntoa] |
; write result |
push eax |
call [con_write_asciiz] |
; free allocated memory |
push esi |
call [freeaddrinfo] |
push str9 |
call [con_write_asciiz] |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
cmp eax, -1 |
jz fail2 |
mov [socketnum], eax |
mcall connect, [socketnum], sockaddr1, 18 |
mcall 40, 1 shl 7 ; + 7 |
call [con_cls] |
mcall 18, 7 |
push eax |
mcall 51, 1, thread, mem - 2048 |
pop ecx |
mcall 18, 3 |
mainloop: |
DEBUGF 1, 'TELNET: Waiting for events\n' |
mcall 10 |
DEBUGF 1, 'TELNET: EVENT %x !\n', eax |
call [con_get_flags] |
test eax, 0x200 ; con window closed? |
jnz exit |
mcall recv, [socketnum], buffer_ptr, BUFFERSIZE, 0 |
cmp eax, -1 |
je mainloop |
DEBUGF 1, 'TELNET: got %u bytes of data !\n', eax |
mov esi, buffer_ptr |
lea edi, [esi + eax] |
mov byte [edi], 0 |
.scan_cmd: |
cmp byte [esi], 0xff ; Interpret As Command |
jne .no_cmd |
; TODO: parse options, for now, we will reply with 'WONT' to everything |
mov byte [esi + 1], 252 ; WONT |
add esi, 3 ; a command is always 3 bytes |
jmp .scan_cmd |
.no_cmd: |
cmp esi, buffer_ptr |
je .print_loop |
DEBUGF 1, 'TELNET: sending data\n' |
push esi edi |
sub esi, buffer_ptr |
mcall send, [socketnum], buffer_ptr, , 0 |
pop edi esi |
.print_loop: |
DEBUGF 1, 'TELNET: printloop\n' |
cmp esi, edi |
jae mainloop |
cmp byte [esi], 0x1b ; escape character |
jne .print_byte |
inc esi |
cmp word [esi], 0x485b ; move cursor to beginning |
jne @f |
inc esi |
inc esi |
DEBUGF 1, 'TELNET: resetting cursor \n' |
push 0 |
push 0 |
call [con_set_cursor_pos] |
jmp .print_loop |
@@: |
inc esi |
inc esi |
jmp .print_loop |
.print_byte: |
push dword 1 |
push esi ; next string to print |
inc esi |
call [con_write_string] |
jmp .print_loop |
fail2: |
push str6 |
call [con_write_asciiz] |
jmp fail.wait |
fail: |
push str5 |
call [con_write_asciiz] |
.wait: |
push str10 |
call [con_write_asciiz] |
call [con_getch2] |
jmp main |
done: |
push 1 |
call [con_exit] |
exit: |
mcall close, [socketnum] |
mcall -1 |
thread: |
mcall 40, 0 |
.loop: |
call [con_getch2] |
mov byte [send_data], al |
mcall send, [socketnum], send_data, 1 |
call [con_get_flags] |
test eax, 0x200 ; con window closed? |
jz .loop |
mcall -1 |
; data |
title db 'Telnet',0 |
str1 db 'Telnet for KolibriOS v0.11',10,10,'Please enter URL of telnet server (for example: towel.blinkenlights.nl)',10,10,0 |
str2 db '> ',0 |
str3 db 'Connecting to: ',0 |
str4 db 10,0 |
str5 db 10,'Name resolution failed.',10,0 |
str6 db 10,'Could not open socket.',10,0 |
str8 db ' (',0 |
str9 db ')',10,0 |
str10 db 'Push any key to continue.',0 |
sockaddr1: |
dw AF_INET4 |
.port dw 0x1700 ; 23 |
.ip dd 0 |
rb 10 |
include_debug_strings ; ALWAYS present in data section |
; import |
align 4 |
@IMPORT: |
library network, 'network.obj', console, 'console.obj' |
import network, \ |
getaddrinfo, 'getaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
inet_ntoa, 'inet_ntoa' |
import console, \ |
con_start, 'START', \ |
con_init, 'con_init', \ |
con_write_asciiz, 'con_write_asciiz', \ |
con_exit, 'con_exit', \ |
con_gets, 'con_gets',\ |
con_cls, 'con_cls',\ |
con_getch2, 'con_getch2',\ |
con_set_cursor_pos, 'con_set_cursor_pos',\ |
con_write_string, 'con_write_string',\ |
con_get_flags, 'con_get_flags' |
i_end: |
socketnum dd ? |
buffer_ptr rb BUFFERSIZE+1 |
send_data rb 100 |
s rb 1024 |
rb 4096 ; stack |
mem: |
/programs/network/tftpc/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/tftpc/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/tftpc/trunk/tftpc.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/tftpc/tftpc.asm |
---|
0,0 → 1,566 |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x1 |
dd START |
dd I_END |
dd IM_END |
dd IM_END |
dd 0, 0 |
include '../proc32.inc' |
include '../macros.inc' |
include '../libio.inc' |
include '../dll.inc' |
include '../../../../../programs/develop/libraries/box_lib/trunk/box_lib.mac' |
include '../network.inc' |
filebuffer_size equ 4*4096 ; 16kb (dont try to change it yet..) |
TIMEOUT equ 100 |
buffer_len equ 1500 |
AF_INET4 equ 2 |
IP_PROTO_UDP equ 17 |
opcode_rrq equ 1 |
opcode_wrq equ 2 |
opcode_data equ 3 |
opcode_ack equ 4 |
opcode_error equ 5 |
; read/write request packet |
; |
; 2 bytes string 1 byte string 1 byte |
; ------------------------------------------------ |
; | Opcode | Filename | 0 | Mode | 0 | |
; ------------------------------------------------ |
; data packet |
; |
; 2 bytes 2 bytes n bytes |
; ---------------------------------- |
; | Opcode | Block # | Data | |
; ---------------------------------- |
; acknowledgement packet |
; |
; 2 bytes 2 bytes |
; --------------------- |
; | Opcode | Block # | |
; --------------------- |
; error packet |
; |
; 2 bytes 2 bytes string 1 byte |
; ---------------------------------------- |
; | Opcode | ErrorCode | ErrMsg | 0 | |
; ---------------------------------------- |
START: |
mcall 68, 11 |
stdcall dll.Load, @IMPORT |
or eax, eax |
jnz exit |
stop_transfer: |
mcall 40, 00100111b |
red_win: |
call draw_window |
align 4 |
still: |
mcall 10 |
dec eax |
jz red_win |
dec eax |
jz key |
dec eax |
jz button |
push dword edit1 |
call [edit_box_mouse] |
push dword edit2 |
call [edit_box_mouse] |
push dword edit3 |
call [edit_box_mouse] |
push dword edit4 |
call [edit_box_mouse] |
push dword Option_boxs1 |
call [option_box_mouse] |
push dword Option_boxs2 |
call [option_box_mouse] |
jmp still |
button: |
mcall 17 |
cmp ah,0x10 |
je start_transfer |
test ah , ah |
jz still |
exit: mcall -1 |
key: |
mcall 2 |
push dword edit1 |
call [edit_box_key] |
push dword edit2 |
call [edit_box_key] |
push dword edit3 |
call [edit_box_key] |
push dword edit4 |
call [edit_box_key] |
jmp still |
align 4 |
draw_window: |
mcall 12,1 |
mcall 0, (50*65536+400), (30*65536+180), 0x34AABBCC, 0x085080DD, str_title |
mcall 4, 35*65536+10, 0x80000000, str_server |
mov ebx, 5*65536+30 |
mov edx, str_source |
mcall |
mov ebx, 11*65536+50 |
mov edx, str_destination |
mcall |
mov ebx, 47*65536+72 |
mov edx, str_mode |
mcall |
mov ebx, 160*65536+72 |
mov edx, str_method |
mcall |
mov ebx, 270*65536+72 |
mov edx, str_blocksize |
mcall |
push dword edit1 |
call [edit_box_draw] |
push dword edit2 |
call [edit_box_draw] |
push dword edit3 |
call [edit_box_draw] |
push dword edit4 |
call [edit_box_draw] |
push dword Option_boxs1 |
call [option_box_draw] |
push dword Option_boxs2 |
call [option_box_draw] |
mcall 8,210*65536+170, 105*65536+16,0x00000010,0x085080DD |
mcall 4,260*65536+110, 0x80000000, str_transfer |
mcall 38,10*65536+380, 130*65536+130,0x00000000 |
mcall 4,350*65536+137, 0x80000000, str_kb_s |
mcall 47,1 shl 31 + 7 shl 16 + 1,kbps,305*65536+137,0x00000000 |
mcall 4,50*65536+137, 0x80000000, str_complete |
mcall 47,1 shl 31 + 3 shl 16 + 1,done,25*65536+137,0x00000000 |
mcall 12,2 |
ret |
start_transfer: |
; first, resolve the hostname |
push esp ; reserve stack place |
push esp ; fourth parameter |
push 0 ; third parameter |
push 0 ; second parameter |
push dword SRV ; first parameter |
call [getaddrinfo] |
pop esi |
; test for error |
test eax, eax |
jnz still |
mov esi, [esi] |
mov esi, [esi + sockaddr_in.sin_addr] |
mov dword [IP], esi |
mcall socket, AF_INET4, SOCK_DGRAM, 0 ; socket_open |
cmp eax, -1 |
je still |
mov [socketnum], eax |
mcall connect, [socketnum], sockaddr, sockaddr_len ; socket_connect |
cmp eax, -1 |
je still |
mov word [I_END], opcode_rrq |
cmp [option_group2],op3 |
je @f |
mov word [I_END], opcode_wrq |
@@: |
xor al , al |
mov edi, remote_addr |
mov ecx, 250 |
repnz scasb |
sub edi, remote_addr-1 |
mov ecx, edi |
mov edi, I_END+2 |
mov esi, remote_addr |
rep movsb |
cmp [option_group1], op1 |
je .ascii |
mov esi, octet |
movsd |
movsb |
jmp .send_request |
.ascii: |
mov esi, netascii |
movsd |
movsd |
.send_request: |
xor al, al |
stosb |
sub edi, I_END |
mov esi, edi |
mcall send, [socketnum], I_END |
mcall 40, 10000101b |
mov [last_ack], 0 |
receive_data_loop: |
mcall 23, TIMEOUT |
dec eax |
jz .red |
dec eax |
jz .key |
mcall recv, [socketnum], buffer, buffer_len, 0 ; receive data |
cmp word[buffer], opcode_data |
jne .error |
mov bx, [last_ack] |
cmp word [buffer + 2], bx |
jne .packet_got_lost |
inc [last_ack] |
cmp eax, 4+512 |
je .continue |
; last packet, or something else |
.error: |
.packet_got_lost: |
.continue: |
mov word[buffer], opcode_ack ; send ack |
mcall send, [socketnum], buffer, 4, 0 |
jmp receive_data_loop |
.red: |
call draw_window |
jmp receive_data_loop |
.key: |
mcall 2 |
cmp ah, 2 |
jz exit |
; close socket ? |
jmp receive_data_loop |
;-------------------------------- |
send_: |
invoke file_open, local_addr, O_READ |
or eax, eax |
jz .exit |
mov [fh], eax |
stdcall mem.Alloc, filebuffer_size |
or eax, eax |
jz .exit |
mov [fb], eax |
mov [last_ack], 0 |
mov [fo], 0 |
.read_chunk: |
invoke file_seek, [fh], [fo], SEEK_END |
cmp eax, -1 |
je .exit |
invoke file_read, [fh], [fb], filebuffer_size |
cmp eax, -1 |
je .exit |
add [fo], filebuffer_size |
cmp eax, filebuffer_size |
je .packet |
; ijhidfhfdsndsfqk |
.packet: |
movzx esi, [last_ack] |
and esi, 0x000000001f ; last five bits BUFFER SIZE MUST BE 16 kb for this to work !!! |
shl esi, 9 ; = * 512 |
add esi, [fb] |
mov edi, buffer |
mov ax, opcode_data |
stosw |
mov ax, [last_ack] |
stosw |
mov ecx, 512/4 |
rep movsd |
mcall send, [socketnum], buffer, 4+512, 0 ; send data |
.loop: |
mcall 23, TIMEOUT |
dec eax |
jz .red |
dec eax |
jz .key |
mcall recv, [socketnum], buffer, buffer_len, 0 ; receive ack |
cmp word[buffer], opcode_ack |
jne .exit |
mov ax, [last_ack] |
cmp word[buffer+2], ax |
jne .packet |
inc [last_ack] |
test [last_ack],0x001f |
jz .read_chunk |
jmp .packet |
.red: |
call draw_window |
jmp .loop |
.key: |
mcall 2 |
cmp ah, 2 |
jz exit |
; close socket ? |
jmp .loop |
.exit: |
invoke file_close, [fh] |
jmp still |
;------------------------- |
; DATA |
socketnum dd 0 |
kbps dd 0 |
done dd 0 |
sockaddr: |
dw AF_INET4 |
dw 0x4500 ; 69 |
IP db 192,168,1,115 |
sockaddr_len = $ - sockaddr |
align 16 |
@IMPORT: |
library box_lib , 'box_lib.obj', \ |
io_lib , 'libio.obj', \ |
network , 'network.obj' |
import box_lib ,\ |
edit_box_draw ,'edit_box' ,\ |
edit_box_key ,'edit_box_key' ,\ |
edit_box_mouse ,'edit_box_mouse' ,\ |
version_ed ,'version_ed' ,\ |
init_checkbox ,'init_checkbox2' ,\ |
check_box_draw ,'check_box_draw2' ,\ |
check_box_mouse ,'check_box_mouse2' ,\ |
version_ch ,'version_ch2' ,\ |
option_box_draw ,'option_box_draw' ,\ |
option_box_mouse ,'option_box_mouse' ,\ |
version_op ,'version_op' |
import io_lib ,\ |
file_find_first , 'file_find_first' ,\ |
file_find_next , 'file_find_next' ,\ |
file_find_close , 'file_find_close' ,\ |
file_size , 'file_size' ,\ |
file_open , 'file_open' ,\ |
file_read , 'file_read' ,\ |
file_write , 'file_write' ,\ |
file_seek , 'file_seek' ,\ |
file_tell , 'file_tell' ,\ |
file_eof? , 'file_iseof' ,\ |
file_seteof , 'file_seteof' ,\ |
file_truncate , 'file_truncate' ,\ |
file_close , 'file_close' |
import network ,\ |
inet_ntoa , 'inet_ntoa' ,\ |
getaddrinfo , 'getaddrinfo' ,\ |
freeaddrinfo , 'freeaddrinfo' |
edit1 edit_box 300,80,5 ,0xffffff,0x6f9480,0,0,0,99 ,SRV,mouse_dd,ed_focus, 11,11 |
edit2 edit_box 300,80,25,0xffffff,0x6a9480,0,0,0,99 ,remote_addr,mouse_dd,ed_figure_only, 5,5 |
edit3 edit_box 300,80,45,0xffffff,0x6a9480,0,0,0,99 ,local_addr,mouse_dd,ed_figure_only, 27,27 |
edit4 edit_box 40,340,68,0xffffff,0x6a9480,0,0,0,5 ,BLK,mouse_dd,ed_figure_only, 3,3 |
op1 option_box option_group1,80,68,6,12,0xffffff,0,0,netascii,octet-netascii |
op2 option_box option_group1,80,85,6,12,0xFFFFFF,0,0,octet,get-octet |
op3 option_box option_group2,210,68,6,12,0xffffff,0,0,get,put-get |
op4 option_box option_group2,210,85,6,12,0xFFFFFF,0,0,put,BLK-put |
option_group1 dd op1 |
option_group2 dd op3 |
Option_boxs1 dd op1,op2,0 |
Option_boxs2 dd op3,op4,0 |
str_title db 'TFTP client for KolibriOS',0 |
str_server db 'Server:',0 |
str_source db 'Remote file:',0 |
str_destination db 'Local file:',0 |
str_mode db 'Mode:',0 |
str_method db 'Method:',0 |
str_blocksize db 'Blocksize:',0 |
str_kb_s db 'kb/s',0 |
str_complete db '% complete',0 |
str_transfer db 'Transfer',0 |
str_error: |
._0 db 'Not defined, see error message (if any).',0 |
._1 db 'File not found.',0 |
._2 db 'Access violation.',0 |
._3 db 'Disk full or allocation exceeded.',0 |
._4 db 'Illegal TFTP operation.',0 |
._5 db 'Unknown transfer ID.',0 |
._6 db 'File already exists.',0 |
._7 db 'No such user.',0 |
netascii db 'NetASCII' |
octet db 'Octet' |
get db 'GET' |
put db 'PUT' |
BLK db "512",0,0,0 |
last_ack dw ? |
fh dd ? ; file handle |
fo dd ? ; file offset |
fb dd ? ; file buffer |
SRV db "192.168.1.115",0 |
rb (SRV + 256 - $) |
remote_addr db "IMG00",0 |
rb (remote_addr + 256 - $) |
local_addr db "/hd0/1/KolibriOS/kernel.mnt",0 |
rb (local_addr + 256 - $) |
I_END: |
mouse_dd dd ? |
buffer: |
rb buffer_len |
rb 0x1000 ; stack |
IM_END: |
/programs/network/vncc/logon.inc |
---|
0,0 → 1,257 |
red_logon: |
call draw_window_logon ; at first, draw the window |
still_logon: ; main cycle of application begins here |
mov eax,10 ; wait here for event |
mcall |
checkevent_logon: ; Check what event was called _logon: this will be used to return from textbox focus |
dec eax ; redraw request ? |
jz red_logon |
dec eax ; key in buffer ? |
jz key_logon |
dec eax ; button in buffer ? |
jz button_logon |
jmp still_logon |
key_logon: ; key event handler |
mov al,2 ; eax was zero so will now be 2 |
mcall ; just read it and ignore |
cmp ah,13 |
jne still_logon ; return to main loop |
ret ; enter key was pressed => return to logon |
button_logon: ; eax was zero so will now be 17 |
mov al,17 ; get id |
mcall |
cmp ah,1 ; close ? |
jz close_logon |
cmp ah,2 ; logon ? |
je connect_logon |
cmp ah,5 ; first ? |
jz dstbtn_logon |
srcbtn_logon: |
mov dword[addr],first |
jmp rk_logon |
dstbtn_logon: |
mov dword[addr],second |
rk_logon: |
mov edi,[addr] ; load the address of the string |
xor al,al ; mov al,0 ; the symbol we will search for |
mov ecx,STRLEN+1 ; length of the string (+1) |
cld ; search forward |
repne scasb ; do search now |
inc ecx ; we've found a zero or ecx became 0 |
mov eax,STRLEN+1 |
sub eax,ecx ; eax = address of <0> character |
mov [temp],eax ; position |
cmp dword[addr],dword second |
jne @f |
mov dword [passlen],eax |
@@: |
call print_text_logon |
mov edi,[addr] ; address of string |
add edi,[temp] ; cursor position |
.waitev_logon: |
mov eax,10 ; wait for event |
mcall |
cmp eax,2 ; button presed ? |
jne checkevent_logon ; a key is pressed or redraw is nessesary, goto checkevent |
mcall ; eax = 2, read button |
shr eax,8 |
cmp eax,8 |
jnz .nobs_logon ; BACKSPACE |
cmp edi,[addr] |
jz .waitev_logon |
dec edi |
mov byte[edi],0 |
cmp dword[addr],second |
jne @f |
dec [passlen] |
@@: |
call print_text_logon |
jmp .waitev_logon |
.nobs_logon: |
cmp eax,13 ; ENTER |
je still_logon |
cmp eax,192 |
jne .noclear_logon |
xor al,al |
mov edi,[addr] |
mov ecx,STRLEN |
rep stosb |
mov edi,[addr] |
call print_text_logon |
jmp .waitev_logon |
.noclear_logon: |
mov [edi],al |
cmp dword[addr],second |
jne @f |
inc [passlen] |
@@: |
call print_text_logon |
inc edi |
mov esi,[addr] |
add esi,STRLEN |
cmp esi,edi |
jnz .waitev_logon |
jmp still_logon |
; print strings (source & destination) |
print_text_logon: |
pusha |
mov eax, 8 |
mov ebx, 105*65536+200 |
mov ecx, 31*65536+13 |
mov edx, 4 |
mov esi, 0xEBEBEB |
mcall |
cmp byte[mode],0 |
je @f |
mov ecx, 49*65536+12 |
inc edx |
mcall |
@@: |
mov eax, 4 ; function 4 _logon: write text to window |
mov ebx, 107*65536+34 ; [x start] *65536 + [y start] |
xor ecx, ecx ; color of text RRGGBB |
mov edx, first ; pointer to text beginning |
mov esi, STRLEN ; text length |
mcall |
cmp byte[mode],0 |
je dont_draw_pass |
add ebx,16 |
mov edi,[passlen] |
@@: |
cmp edi,0 |
jle dont_draw_pass |
dec edi |
mov edx, passchar |
mov esi, 1 |
mcall |
add ebx,6*65536 |
jmp @r |
dont_draw_pass: |
popa |
ret |
close_logon: |
or eax,-1 |
mcall |
connect_logon: |
ret |
draw_window_logon: |
mcall 12, 1 ; start window draw |
pusha |
; DRAW WINDOW |
xor eax, eax ; function 0 _logon: define and draw window |
mov ebx, 160*65536+330 ; [x start] *65536 + [x size] |
mov ecx, 160*65536+100 ; [y start] *65536 + [y size] |
mov edx, 0x13DDDDDD ; color of work area RRGGBB |
mov edi, title ; WINDOW LABEL |
mcall |
mov eax, 8 ; LOGON BUTTON |
mov ebx, 220*65536+85 |
mov ecx, 63*65536+16 |
mov edx, 2 |
mov esi, 0xCCCCCC |
mcall |
call print_text_logon |
cmp byte[mode], 0 |
je servermode_ |
mov eax, 4 ; function 4 write text to window |
mov ebx, 25*65536+33 ; [x start] *65536 + [y start] |
xor ecx, ecx |
mov edx, userstr ; pointer to text beginning |
mov esi, passstr-userstr ; text length |
mcall |
add bl,19 |
mov edx, passstr ; pointer to text beginning |
mov esi, connectstr-passstr ; text length |
mcall |
jmp drawtherest_ |
servermode_: |
mov eax, 4 ; function 4 write text to window |
mov ebx, 25*65536+33 ; [x start] *65536 + [y start] |
xor ecx, ecx |
mov edx, serverstr ; pointer to text beginning |
mov esi, userstr-serverstr ; text length |
mcall |
drawtherest_: |
mov ebx, 240*65536+67 ; [x start] *65536 + [y start] |
mov edx, connectstr ; pointer to text beginning |
mov esi, connect_e-connectstr ; text length |
mcall |
popa |
inc ebx |
mcall |
ret |
; DATA AREA |
title db 'Kolibrios VNC client by HIDNPLAYR',0 |
first: db '192.168.1.5' |
rb STRLEN |
second: rb STRLEN |
passchar db '*' |
passlen dd 0 |
addr dd 0 |
temp dd 0 |
mode db 0 ; 0 = connection details, 1 = authentication |
serverstr: db 'server:' |
userstr: db 'username:' |
passstr: db 'password:' |
connectstr: db 'connect !' |
connect_e: |
I_END_logon: |
/programs/network/vncc/raw.inc |
---|
0,0 → 1,153 |
encoding_raw: |
DEBUGF 1,'RAW\n' |
mov ax,[frame.y] ; |
mov bx,[screen.width] ; |
mul bx ; |
shl edx,16 ; |
mov dx,ax ; [screen.width]*[frame.y] |
movzx eax,[frame.x] |
add edx,eax ; [screen.width]*[frame.y]+[frame.x] |
mov eax,3 ; |
mul edx ; ([screen.width]*[frame.y]+[frame.x])*3 |
add eax,framebuffer_data ; |
push eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3 |
mov ax,[frame.width] ; |
mov bx,3 ; |
mul bx ; |
shl edx,16 ; |
mov dx,ax ; [frame.width]*3 |
pop eax ; |
add edx,eax ; framebuffer_data+([screen.width]*[frame.y]+[frame.x])*3+[frame.width]*3 |
push eax ; |
push edx ; |
mov ax,[frame.height] ; |
dec ax ; |
mov bx,3 ; |
mul bx ; |
mov bx,[screen.width] ; |
mul bx ; |
shl edx,16 ; |
mov dx,ax ; |
mov ecx,edx ; |
pop edx ; |
add ecx,edx ; mov ecx,edx+([frame.height]-1)*[screen.width]*3 |
pop ebx |
.pixelloop32: |
cmp ebx,ecx |
jge next_rectangle |
; add esi,2 ; 32 bit code RAW - OK |
; mov al,[esi] ; |
; mov [ebx],al ; |
; inc ebx ; |
; dec esi ; |
; ; |
; mov al,[esi] ; |
; mov [ebx],al ; |
; inc ebx ; |
; dec esi ; |
; ; |
; mov al,[esi] ; |
; mov [ebx],al ; |
; inc ebx ; |
; add esi,4 ; |
; push ecx ; 16 bit code RAW |
; mov cl,51 |
; |
; mov ax,[esi] ; |
; xchg al,ah |
; and al,00011111b ; |
; xchg al,ah |
; mul cl |
; mov [ebx],al ; |
; inc ebx ; |
; |
; mov ax,[esi] ; |
; xchg al,ah |
; shr ax,5 ; |
; xchg al,ah |
; and al,00011111b ; |
; mul cl |
; mov [ebx],al ; |
; inc ebx ; |
; |
; mov ax,[esi] ; |
; xchg al,ah |
; shr ax,10 ; |
; and al,00011111b ; |
; mul cl |
; mov [ebx],al ; |
; inc ebx ; |
; |
; inc esi ; |
; inc esi ; |
; pop ecx |
push ecx ; 8 bit code RAW - OK |
mov cl,85 ; |
; |
mov al,[esi] ; |
shr al,4 ; |
and al,3 ; |
mul cl ; |
mov [ebx],al ; |
inc ebx ; |
; |
mov al,[esi] ; |
shr al,2 ; |
and al,3 ; |
mul cl ; |
mov [ebx],al ; |
inc ebx ; |
; |
mov al,[esi] ; |
and al,3 ; |
mul cl ; |
mov byte[ebx],al ; |
inc ebx ; |
inc esi ; |
pop ecx ; |
cmp ebx,edx |
jl .pixelloop32 |
push edx |
push ebx |
mov ax,[screen.width] |
mov bx,3 |
mul bx |
shl edx,16 |
mov dx,ax |
mov eax,edx |
pop ebx |
pop edx |
add ebx,eax ; eax = [screen.width]*3 |
add edx,eax |
push edx |
push ebx |
mov ax,[frame.width] |
mov bx,3 |
mul bx |
shl edx,16 |
mov dx,ax |
mov eax,edx |
pop ebx |
pop edx |
sub ebx,eax ; eax = [frame.width]*3 |
jmp .pixelloop32 |
/programs/network/vncc/structs.inc |
---|
0,0 → 1,22 |
struct pixel_format |
bpp db ? |
depth db ? |
big_endian db ? |
true_color db ? |
red_max dw ? |
green_max dw ? |
blue_max dw ? |
red_shift db ? |
green_shift db ? |
blue_shift db ? |
padding rb 3 |
ends |
struct framebuffer |
width dw ? |
height dw ? |
pixelformat pixel_format |
name_length dd ? |
name rb 256 |
ends |
/programs/network/vncc/thread.inc |
---|
0,0 → 1,239 |
thread_start: |
DEBUGF 1, 'I am the thread!\n' |
mcall 40, 1 shl 7 |
; resolve name |
push esp ; reserve stack place |
invoke getaddrinfo, first, 0, 0, esp |
pop esi |
; test for error |
test eax, eax |
jnz exit |
mov eax, [esi+addrinfo.ai_addr] |
mov eax, [eax+sockaddr_in.sin_addr] |
mov [sockaddr1.ip], eax |
; DEBUGF 1, 'Connecting to %u.%u.%u.%u:%u\n', \ |
; [server_ip]:1, [server_ip+1]:1, \ |
; [server_ip+2]:1, [server_ip+3]:1, \ |
; [server_port]:2 |
mcall socket, AF_INET4, SOCK_STREAM, 0 |
mov [socketnum], eax |
mcall connect, [socketnum], sockaddr1, 18 |
call wait_for_data |
cmp dword [receive_buffer], 'RFB ' |
jne no_rfb |
DEBUGF 1, 'received: %s\n', receive_buffer |
mcall send, [socketnum], handshake, 12, 0 |
DEBUGF 1, 'Sending handshake: protocol version\n' |
call wait_for_data |
cmp dword [receive_buffer], 0x00000000 |
je invalid_security |
cmp dword [receive_buffer], 0x01000000 |
je no_security |
cmp dword [receive_buffer], 0x02000000 |
je vnc_security |
jmp exit |
vnc_security: |
mov byte[mode], 1 |
call red_logon |
no_security: |
mcall send, [socketnum], shared, 1, 0 |
DEBUGF 1, 'Sending handshake: shared session?\n' |
mcall 23, 100*TIMEOUT |
call wait_for_data ; now the server should send init message |
DEBUGF 1, 'Serverinit: bpp: %u depth: %u bigendian: %u truecolor: %u\n', \ |
[receive_buffer+framebuffer.pixelformat.bpp]:1, \ |
[receive_buffer+framebuffer.pixelformat.depth]:1, \ |
[receive_buffer+framebuffer.pixelformat.big_endian]:1, \ |
[receive_buffer+framebuffer.pixelformat.true_color]:1 |
mov eax, dword [receive_buffer] |
mov dword [fbur.width], eax |
bswap eax |
mov dword [screen], eax |
mcall send, [socketnum], pixel_format8, 20, 0 |
DEBUGF 1, 'Sending pixel format\n' |
call read_data |
; eth.write_tcp [socket],8,encodings |
; DEBUGF 1,'Sending encoding info\n' |
; call read_data |
mov byte [thread_ready], 1 |
request_rfb: |
mov [fbur.inc], 2 |
mcall send, [socketnum], fbur, 10, 0 |
thread_loop: |
mcall 23, 100 |
call read_data ; Read the data into the buffer |
; cmp eax, 2 |
; jb mainloop |
DEBUGF 1,'Data received, %u bytes\n', eax |
cmp byte [receive_buffer],0 |
je framebufferupdate |
cmp byte [receive_buffer],1 |
je setcolourmapentries |
cmp byte [receive_buffer],2 |
je bell |
cmp byte [receive_buffer],3 |
je servercuttext |
jmp thread_loop |
align 4 |
framebufferupdate: |
mov ax, word [receive_buffer+2] |
xchg al, ah |
mov di, ax |
DEBUGF 1, 'Framebufferupdate: %u frames\n', di |
mov esi, receive_buffer+4 |
jmp rectangle_loop |
next_rectangle: |
call drawbuffer |
dec di |
test di, di |
jz request_rfb |
rectangle_loop: |
mov edx, [esi] |
bswap edx |
mov ebx, edx |
shr edx, 16 |
mov [frame.x], dx |
mov [frame.y], bx |
add esi, 4 |
mov ecx, [esi] |
bswap ecx |
mov eax, ecx |
shr ecx, 16 |
mov [frame.width], cx |
mov [frame.height], ax |
add esi, 4 |
mov eax, [esi] |
add esi, 4 |
mov ebx, esi |
sub ebx, receive_buffer+12 |
DEBUGF 1, 'frame: width=%u height=%u x=%u y=%u offset:%u encoding:',\ |
[frame.width]:2, [frame.height]:2, [frame.x]:2, [frame.y]:2, ebx |
cmp eax, 0 |
je encoding_raw |
; cmp eax, 1 |
; je encoding_copyrect |
cmp eax, 2 |
je encoding_RRE |
cmp eax, 5 |
je encoding_hextile |
cmp eax, 16 |
je encoding_ZRLE |
mov ebx, esi |
sub ebx, receive_buffer+8 |
DEBUGF 1, '\nunknown encoding: %u (offset %u)\n', eax, ebx |
jmp bell |
jmp thread_loop |
encoding_RRE: |
DEBUGF 1, 'RRE\n' |
jmp next_rectangle |
encoding_hextile: |
DEBUGF 1, 'hextile\n' |
jmp next_rectangle |
encoding_ZRLE: |
DEBUGF 1, 'ZRLE\n' |
jmp next_rectangle |
setcolourmapentries: |
DEBUGF 1, 'Server sent SetColourMapEntries message\n' |
jmp thread_loop |
bell: |
mcall 55, 55, , , beep |
jmp thread_loop |
servercuttext: |
DEBUGF 1, 'Server cut text\n' |
jmp thread_loop |
read_data: |
mov [datapointer], receive_buffer |
.loop: |
mcall 23, 100*TIMEOUT |
mcall recv, [socketnum], [datapointer], 4096, 0 |
cmp eax, -1 |
je .done |
add [datapointer], eax |
cmp eax, 4096 |
je .loop |
.done: |
mov eax, [datapointer] |
sub eax, receive_buffer |
ret |
wait_for_data: |
mcall 23, 500 |
mcall recv, [socketnum], receive_buffer, 4096, 0 |
cmp eax, -1 |
je wait_for_data |
test eax, eax |
jz wait_for_data |
ret |
/programs/network/vncc/vncc.asm |
---|
0,0 → 1,283 |
; |
; |
; VNC Client for kolibrios by hidnplayr |
; |
; hidnplayr@gmail.com |
; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd IM_END ; memory for app |
dd IM_END ; esp |
dd 0x0 , 0x0 ; I_Param , I_Path |
__DEBUG__ equ 1 |
__DEBUG_LEVEL__ equ 1 |
STRLEN = 64 ; password and server max length |
xpos = 4 ; coordinates of image |
ypos = 22 ; |
TIMEOUT = 5 ; timeout in seconds |
include '../macros.inc' |
include '../debug-fdo.inc' |
include '../proc32.inc' |
include '../dll.inc' |
include '../struct.inc' |
include '../network.inc' |
include 'structs.inc' |
include 'logon.inc' |
include 'raw.inc' |
include 'thread.inc' |
START: |
mcall 68, 11 ; init heap |
; load libraries |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
call red_logon |
mcall 40, 0 ; no events |
mcall 67, 0, 0, 0, 0 ; resize the window (hide it) |
mcall 51, 1, thread_start, thread_stack |
DEBUGF 1,'Thread created: %u\n', eax |
@@: |
mcall 5, 10 |
cmp byte [thread_ready], 0 |
je @r |
mcall 40, 100111b ; mouse, button, key, redraw |
mov edx, dword [screen] |
movzx esi, dx |
shr edx, 16 |
add edx, 2*xpos |
add esi, ypos+xpos |
mcall 67, 10, 10 ; resize the window |
mainloop: |
mcall 23, 50 ; wait for event, 0,5s timeout |
dec eax |
jz redraw |
dec eax |
jz key |
dec eax |
jz button |
sub eax, 3 |
jz mouse |
jmp mainloop |
key: |
DEBUGF 1,'Sending key event\n' |
mcall 2 |
mov byte [keyevent.key+3], ah |
mcall send, [socketnum], keyevent, 8, 0 |
jmp mainloop |
mouse: |
DEBUGF 1,'Sending mouse event\n' |
mcall 37, 1 ; get mouse pos |
sub eax, xpos shl 16 + ypos |
bswap eax |
mov [pointerevent.x], ax |
shr eax, 16 |
mov [pointerevent.y], ax |
mcall 37, 2 ; get mouse buttons |
test al, 00000010b ; test if right button was pressed (bit 1 in kolibri) |
jz @f |
add al, 00000010b ; in RFB protocol it is bit 2, so if we add bit 2 again, we'll get bit 3 and bit 1 will remain the same |
@@: |
mov [pointerevent.mask],al |
mcall send, [socketnum], pointerevent, 6, 0 |
jmp mainloop |
redraw: |
DEBUGF 1,'Drawing window\n' |
mcall 12, 1 |
mov ebx, dword[screen] |
movzx ecx, bx |
shr ebx, 16 |
mov edx, 0x74ffffff |
mov edi, name |
mcall 0 ; draw window |
call drawbuffer |
mcall 12, 2 |
jmp mainloop |
drawbuffer: |
mcall 7, framebuffer_data, dword[screen], 0 |
ret |
button: |
mcall 17 ; get id |
exit: |
DEBUGF 1, 'Closing time!\n' |
mcall close, [socketnum] |
mcall -1 |
no_rfb: |
DEBUGF 1, 'This is no vnc server!\n' |
jmp exit |
invalid_security: |
DEBUGF 1, 'Security error: %s\n', receive_buffer+5 |
jmp exit |
; DATA AREA |
include_debug_strings ; ALWAYS present in data section |
handshake db 'RFB 003.003', 10 |
shared db 0 |
beep db 0x85,0x25,0x85,0x40,0 |
pixel_format32 db 0 ; setPixelformat |
rb 3 ; padding |
.bpp db 32 ; bits per pixel |
.depth db 32 ; depth |
.big_endian db 0 ; big-endian flag |
.true_color db 1 ; true-colour flag |
.red_max db 0,255 ; red-max |
.green_max db 0,255 ; green-max |
.blue_max db 0,255 ; blue-max |
.red_shif db 0 ; red-shift |
.green_shift db 8 ; green-shift |
.blue_shift db 16 ; blue-shift |
rb 3 ; padding |
pixel_format16 db 0 ; setPixelformat |
rb 3 ; padding |
.bpp db 16 ; bits per pixel |
.depth db 15 ; depth |
.big_endian db 0 ; big-endian flag |
.true_color db 1 ; true-colour flag |
.red_max db 0,31 ; red-max |
.green_max db 0,31 ; green-max |
.blue_max db 0,31 ; blue-max |
.red_shif db 0 ; red-shift |
.green_shift db 5 ; green-shift |
.blue_shift db 10 ; blue-shift |
rb 3 ; padding |
pixel_format8 db 0 ; setPixelformat |
rb 3 ; padding |
.bpp db 8 ; bits per pixel |
.depth db 6 ; depth |
.big_endian db 0 ; big-endian flag |
.true_color db 1 ; true-colour flag |
.red_max db 0,3 ; red-max |
.green_max db 0,3 ; green-max |
.blue_max db 0,3 ; blue-max |
.red_shif db 0 ; red-shift |
.green_shift db 2 ; green-shift |
.blue_shift db 4 ; blue-shift |
rb 3 ; padding |
encodings db 2 ; setEncodings |
rb 1 ; padding |
db 1,0 ; number of encodings |
db 0,0,0,0 ; raw encoding (DWORD, Big endian order) |
db 1,0,0,0 ; Copyrect encoding |
fbur db 3 ; frame buffer update request |
.inc db 0 ; incremental |
.x dw 0 |
.y dw 0 |
.width dw 0 |
.height dw 0 |
keyevent db 4 ; keyevent |
.down db 0 ; down-flag |
dw 0 ; padding |
.key dd 0 ; key |
pointerevent db 5 ; pointerevent |
.mask db 0 ; button-mask |
.x dw 0 ; x-position |
.y dw 0 ; y-position |
sockaddr1: |
dw AF_INET4 |
.port dw 0x0c17 ; 5900 |
.ip dd 0 |
rb 10 |
thread_ready db 0 |
; import |
align 4 |
@IMPORT: |
library network, 'network.obj' |
import network, \ |
getaddrinfo, 'getaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
inet_ntoa, 'inet_ntoa' |
name db 'VNC client', 0 |
I_END: |
socketnum dd ? |
datapointer dd ? |
frame: |
.width dw ? |
.height dw ? |
.x dw ? |
.y dw ? |
screen: |
.height dw ? |
.width dw ? |
receive_buffer rb 5*1024*1024 ; 5 mb buffer for received data (incoming frbupdate etc) |
framebuffer_data rb 1024*768*3 ; framebuffer |
rb 0x1000 |
thread_stack: |
rb 0x1000 |
IM_END: |
/programs/network/vncc |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/network/zeroconf/trunk/dhcp.inc |
---|
File deleted |
/programs/network/zeroconf/trunk/ETH.INC |
---|
File deleted |
/programs/network/zeroconf/trunk/zeroconf.ini |
---|
File deleted |
\ No newline at end of file |
/programs/network/zeroconf/trunk/zeroconf.asm |
---|
File deleted |
/programs/network/zeroconf/trunk/debug-fdo.inc |
---|
File deleted |
/programs/network/zeroconf/trunk/build.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/zeroconf/trunk |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/network/zeroconf/dhcp.inc |
---|
0,0 → 1,263 |
;Name Number Length Meaning |
dhcp_pad_option equ 0 ; 0 None |
dhcp_end_option equ 255 ; 0 None |
dhcp_subnet_mask equ 1 ; 4 Subnet Mask Value |
dhcp_time_offset equ 2 ; 4 Time Offset in Seconds from UTC |
dhcp_router equ 3 ; N×4 Router addresses |
dhcp_time_server equ 4 ; N×4 Timeserver addresses |
dhcp_name_server equ 5 ; N×4 IEN-116 Server addresses |
dhcp_domain_server equ 6 ; N×4 DNS Server addresses |
dhcp_log_server equ 7 ; N×4 Logging Server addresses |
dhcp_quotes_server equ 8 ; N×4 Quotes Server addresses |
dhcp_lpr_server equ 9 ; N×4 Printer Server addresses |
dhcp_impress_server equ 10 ; N×4 Impress Server addresses |
dhcp_rlp_server equ 11 ; N×4 N RLP Server addresses |
dhcp_hostname equ 12 ; N Hostname string |
dhcp_boot_file_size equ 13 ; 2 Size of boot file in 512-octet blocks |
dhcp_merit_dump_file equ 14 ; N Client to dump and name the file to dump it to |
dhcp_domain_name equ 15 ; N The DNS domain name of the client |
dhcp_swap_server equ 16 ; 4 Swap Server address |
dhcp_root_path equ 17 ; N Path name for root disk |
dhcp_extension_file equ 18 ; N Path name for more BOOTP info |
;IP Layer Parameters per Host |
dhcp_forward equ 19 ; 1 Enable/Disable IP Forwarding |
dhcp_srcrte equ 20 ; 1 Enable/Disable Non-Local Source Routing |
dhcp_policy equ 21 ; N×8 Non-Local Source Routing Policy Filters |
dhcp_mag_dg_assembly equ 22 ; 2 Max Datagram Reassembly Size |
dhcp_default_ip_tll equ 23 ; 1 Default IP Time to Live |
dhcp_mtu_timeout equ 24 ; 4 Path MTU Aging Timeout |
dhcp_mtu_plateau equ 25 ; N×2 Path MTU Plateau Table |
;IP Layer Parameters per Interface |
dhcp_mtu_interface equ 26 ; 2 Interface MTU Size |
dhcp_mtu_subnet equ 27 ; 1 All Subnets are Local |
dhcp_broadcast_address equ 28 ; 4 Broadcast Address |
dhcp_mask_discovery equ 29 ; 1 Perform Mask Discovery |
dhcp_mask_supplier equ 30 ; 1 Provide Mask to Others |
dhcp_router_discovery equ 31 ; 1 Perform Router Discovery |
dhcp_router_request equ 32 ; 4 Router Solicitation Address |
dhcp_static_route equ 33 ; N×8 Static Routing Table |
;Link Layer Parameters per Interface |
dhcp_trailers equ 34 ; 1 Trailer Encapsulation |
dhcp_arp_timeout equ 35 ; 4 ARP Cache Timeout |
dhcp_ethernet equ 36 ; 1 Ethernet Encapsulation |
;TCP Parameters |
dhcp_default_tcp_tll equ 37 ; 1 Default TCP Time to Live |
dhcp_keepalive_time equ 38 ; 4 TCP Keepalive Interval |
dhcp_keepalive_data equ 39 ; 1 TCP Keepalive Garbage |
;Application and Service Parameters |
dhcp_nis_domain equ 40 ; N NIS Domain Name |
dhcp_nis_servers equ 41 ; N×4 NIS Server Addresses |
dhcp_ntp_servers equ 42 ; N×4 NTP Server Addresses |
dhcp_vendor_specific equ 43 ; N Vendor Specific Information |
dhcp_netbios_name_srv equ 44 ; N×4 NETBIOS Name Servers |
dhcp_netbios_dist_srv equ 45 ; N×4 NETBIOS Datagram Distribution |
dhcp_netbios_node_type equ 46 ; 1 NETBIOS Node Type |
dhcp_netbios_scope equ 47 ; N NETBIOS Scope |
dhcp_x_window_font equ 48 ; N×4 X Window Font Server |
dhcp_x_window_manager equ 49 ; N×4 X Window Display Manager |
dhcp_nis_domain_name equ 64 ; N NIS+ v3 Client Domain Name |
dhcp_nis_server_addr equ 65 ; N×4 NIS+ v3 Server Addresses |
dhcp_home_agent_addrs equ 68 ; N×4 Mobile IP Home Agent Addresses |
dhcp_smtp_server equ 69 ; N×4 Simple Mail Server Addresses |
dhcp_pop3_server equ 70 ; N×4 Post Office Server Addresses |
dhcp_nntp_server equ 71 ; N×4 Network News Server Addresses |
dhcp_www_server equ 72 ; N×4 WWW Server Addresses |
dhcp_finger_server equ 73 ; N×4 Finger Server Addresses |
dhcp_irc_server equ 74 ; N×4 Chat Server Addresses |
dhcp_streettalk_server equ 75 ; N×4 StreetTalk Server Addresses |
dhcp_stda_server equ 76 ; N×4 ST Directory Assist. Addresses |
;DHCP Extensions |
dhcp_address_request equ 50 ; 4 Requested IP Address |
dhcp_address_time equ 51 ; 4 IP Address Lease Time |
dhcp_option_overload equ 52 ; 1 Overload "sname" or "file" |
dhcp_msg_type equ 53 ; 1 DHCP Message Type |
dhcp_dhcp_server_id equ 54 ; 4 DHCP Server Identification |
dhcp_parameter_list equ 55 ; N Parameter Request List |
dhcp_dhcp_message equ 56 ; N DHCP Error Message |
dhcp_dhcp_max_msg_size equ 57 ; 2 DHCP Maximum Message Size |
dhcp_renewal_time equ 58 ; 4 DHCP Renewal (T1) Time |
dhcp_rebinding_time equ 59 ; 4 DHCP Rebinding (T2) Time |
dhcp_class_id equ 60 ; N Vendor Class Identifier |
dhcp_client_id equ 61 ; N Client Identifier |
dhcp_server_name equ 66 ; N TFTP Server Name |
dhcp_bootfile_name equ 67 ; N Boot File Name |
;Newer extensions |
dhcp_netware_ip_domain equ 62 ; N Netware/IP Domain Name |
dhcp_netware_ip_option equ 63 ; N Netware/IP sub Options |
dhcp_user_class equ 77 ; N User Class Information |
dhcp_directory_agent equ 78 ; N directory agent information |
dhcp_service_scope equ 79 ; N service location agent scope |
dhcp_rapid_commit equ 80 ; 0 Rapid Commit |
dhcp_client_fqdn equ 81 ; N Fully Qualified Domain Name |
dhcp_relay_agent_info equ 82 ; N Relay Agent Information, RFC 3046 |
dhcp_isns equ 83 ; N Internet Storage Name Service |
; 84 REMOVED/Unassigned |
dhcp_nds_servers equ 85 ; N Novell Directory Services |
dhcp_nds_tree_name equ 86 ; N Novell Directory Services |
dhcp_nds_conext equ 87 ; N Novell Directory Services |
dhcp_bcmcs equ 88 ; Controller Domain Name list |
dhcp_bcmcs equ 89 ; Controller IPv4 address option |
dhcp_authentication equ 90 ; N Authentication |
; 91 REMOVED/Unassigned |
; 92 REMOVED/Unassigned |
dhcp_client_system equ 93 ; N Client System Architecture |
dhcp_client_ndi equ 94 ; N Client Network Device Interface |
dhcp_ldap equ 95 ; N Lightweight Directory Access Protocol |
; 96 REMOVED/Unassigned |
dhcp_uuid_guid equ 97 ; N UUID/GUID-based Client Identifier |
dchp_user_auth equ 98 ; N Open Group's User Authentication |
; 99 REMOVED/Unassigned |
; 100 REMOVED/Unassigned |
; 101 REMOVED/Unassigned |
; 102 REMOVED/Unassigned |
; 103 REMOVED/Unassigned |
; 104 REMOVED/Unassigned |
; 105 REMOVED/Unassigned |
; 106 REMOVED/Unassigned |
; 107 REMOVED/Unassigned |
; 108 REMOVED/Unassigned |
; 109 REMOVED/Unassigned |
; 110 REMOVED/Unassigned |
; 111 REMOVED/Unassigned |
dhcp_netinfo_address equ 112 ; N NetInfo Parent Server Address |
dhcp_netinfo_tag equ 113 ; N NetInfo Parent Server Tag |
dhcp_url equ 114 ; N URL |
; 115 REMOVED/Unassigned |
dhcp_auto_config equ 116 ; N DHCP Auto-Configuration |
dhcp_ns_search equ 117 ; N Name Service Search |
dhcp_subnet_selection equ 118 ; 4 Subnet Selection Option |
dhcp_domain_search equ 119 ; N DNS domain search list |
dhcp_sip_servers equ 120 ; N SIP Servers DHCP Option |
dhcp_cl_static_route equ 121 ; N Classless Static Route Option |
dhcp_ccc equ 122 ; N CableLabs Client Configuration |
dhcp_geoconf equ 123 ; 16 GeoConf Option |
dhcp_v_i_vendor_class equ 124 ; Vendor-Identifying Vendor Class |
dhcp_v_i_vendor_spec equ 125 ; Vendor-Identifying Vendor-Specific |
; 126 REMOVED/Unassigned |
; 127 REMOVED/Unassigned |
dhcp_pxe equ 128 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_etherboot_sign equ 128 ; Etherboot signature. 6 bytes: E4:45:74:68:00:00 |
dhcp_docsis equ 128 ; DOCSIS "full security" server IP address |
dhcp_tftp_server_ip equ 128 ; TFTP Server IP address (for IP Phone software load) |
dhcp_pxe equ 129 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_kernel_options equ 129 ; Kernel options. Variable length string |
dhcp_call_server_ip equ 129 ; Call Server IP address |
dhcp_pxe equ 130 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_ethernet_interface equ 130 ; Ethernet interface. Variable length string. |
dhcp_siscrimination equ 130 ; Discrimination string (to identify vendor) |
dhcp_pxe equ 131 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_remote_stat_server equ 131 ; Remote statistics server IP address |
dhcp_pxe equ 132 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_802.1p equ 132 ; 802.1P VLAN ID |
dhcp_pxe equ 133 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_802.1q equ 133 ; 802.1Q L2 Priority |
dhcp_pxe equ 134 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_diffserv equ 134 ; Diffserv Code Point |
dhcp_pxe equ 135 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005) |
dhcp_http_proxy_psa equ 135 ; HTTP Proxy for phone-specific applications |
; 136 REMOVED/Unassigned |
; 137 REMOVED/Unassigned |
; 138 REMOVED/Unassigned |
; 139 REMOVED/Unassigned |
; 140 REMOVED/Unassigned |
; 141 REMOVED/Unassigned |
; 142 REMOVED/Unassigned |
; 143 REMOVED/Unassigned |
; 144 REMOVED/Unassigned |
; 145 REMOVED/Unassigned |
; 146 REMOVED/Unassigned |
; 147 REMOVED/Unassigned |
; 148 REMOVED/Unassigned |
; 149 REMOVED/Unassigned |
dhcp_tftp_server_addr equ 150 ; TFTP server address (Tentatively Assigned - 23 June 2005) |
dhcp_etherboot equ 150 ; Etherboot |
dhcp_grub_conf_path equ 150 ; GRUB configuration path name |
; 151 REMOVED/Unassigned |
; 152 REMOVED/Unassigned |
; 153 REMOVED/Unassigned |
; 154 REMOVED/Unassigned |
; 155 REMOVED/Unassigned |
; 156 REMOVED/Unassigned |
; 157 REMOVED/Unassigned |
; 158 REMOVED/Unassigned |
; 159 REMOVED/Unassigned |
; 160 REMOVED/Unassigned |
; 161 REMOVED/Unassigned |
; 162 REMOVED/Unassigned |
; 163 REMOVED/Unassigned |
; 164 REMOVED/Unassigned |
; 165 REMOVED/Unassigned |
; 166 REMOVED/Unassigned |
; 167 REMOVED/Unassigned |
; 168 REMOVED/Unassigned |
; 169 REMOVED/Unassigned |
; 170 REMOVED/Unassigned |
; 171 REMOVED/Unassigned |
; 172 REMOVED/Unassigned |
; 173 REMOVED/Unassigned |
; 174 REMOVED/Unassigned |
dhcp_etherboot equ 175 ; Etherboot (Tentatively Assigned - 23 June 2005) |
dhcp_ip_telephone equ 176 ; IP Telephone (Tentatively Assigned - 23 June 2005) |
dhcp_etherboot equ 177 ; Etherboot (Tentatively Assigned - 23 June 2005) |
dhcp_packetcable equ 177 ; PacketCable and CableHome (replaced by 122) |
; 178 REMOVED/Unassigned |
; 179 REMOVED/Unassigned |
; 180 REMOVED/Unassigned |
; 181 REMOVED/Unassigned |
; 182 REMOVED/Unassigned |
; 183 REMOVED/Unassigned |
; 184 REMOVED/Unassigned |
; 185 REMOVED/Unassigned |
; 186 REMOVED/Unassigned |
; 187 REMOVED/Unassigned |
; 188 REMOVED/Unassigned |
; 189 REMOVED/Unassigned |
; 190 REMOVED/Unassigned |
; 191 REMOVED/Unassigned |
; 192 REMOVED/Unassigned |
; 193 REMOVED/Unassigned |
; 194 REMOVED/Unassigned |
; 195 REMOVED/Unassigned |
; 196 REMOVED/Unassigned |
; 197 REMOVED/Unassigned |
; 198 REMOVED/Unassigned |
; 199 REMOVED/Unassigned |
; 200 REMOVED/Unassigned |
; 201 REMOVED/Unassigned |
; 202 REMOVED/Unassigned |
; 203 REMOVED/Unassigned |
; 204 REMOVED/Unassigned |
; 205 REMOVED/Unassigned |
; 206 REMOVED/Unassigned |
; 207 REMOVED/Unassigned |
dhcp_pxelinux.magic equ 208 ; pxelinux.magic (string) = F1:00:74:7E (241.0.116.126) (Tentatively Assigned - 23 June 2005) |
dhcp_pxelinux.conffile equ 209 ; pxelinux.configfile (text) (Tentatively Assigned - 23 June 2005) |
dhcp_pxelinux.path equ 210 ; pxelinux.pathprefix (text) (Tentatively Assigned - 23 June 2005) |
dhcp_pxelinux.reboot equ 211 ; pxelinux.reboottime (unsigned integer 32 bits) (Tentatively Assigned - 23 June 2005) |
; 212 REMOVED/Unassigned |
; 213 REMOVED/Unassigned |
; 214 REMOVED/Unassigned |
; 215 REMOVED/Unassigned |
; 216 REMOVED/Unassigned |
; 217 REMOVED/Unassigned |
; 218 REMOVED/Unassigned |
; 219 REMOVED/Unassigned |
dhcp_subnet_aloc equ 220 ; Subnet Allocation Option (Tentatively Assigned - 23 June 2005) |
dhcp_virtual_subnet equ 221 ; Virtual Subnet Selection Option (Tentatively Assigned - 23 June 2005) |
; 222 REMOVED/Unassigned |
; 223 REMOVED/Unassigned |
/programs/network/zeroconf/zeroconf.asm |
---|
0,0 → 1,620 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2010-2013. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; zeroconfig.asm - Zeroconfig service for KolibriOS ;; |
;; ;; |
;; Written by hidnplayr@kolibrios.org ;; |
;; Some code contributed by Derpenguin ;; |
;; ;; |
;; DHCP code is based on that by Mike Hibbet ;; |
; (DHCP client for menuetos) ;; |
;; ;; |
;; GNU GENERAL PUBLIC LICENSE ;; |
;; Version 2, June 1991 ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
format binary as "" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd IM_END ; size of image |
dd (I_END+0x100) ; memory for app |
dd (I_END+0x100) ; esp |
dd 0, 0 ; I_Param, I_Path |
; CONFIGURATION |
TIMEOUT = 60 ; in seconds |
BUFFER = 1024 ; in bytes |
__DEBUG__ = 1 ; enable/disable |
__DEBUG_LEVEL__ = 1 ; 1 = all, 2 = errors |
; CONFIGURATION FOR LINK-LOCAL |
PROBE_WAIT = 1 ; second (initial random delay) |
PROBE_MIN = 1 ; second (minimum delay till repeated probe) |
PROBE_MAX = 2 ; seconds (maximum delay till repeated probe) |
PROBE_NUM = 3 ; (number of probe packets) |
ANNOUNCE_NUM = 2 ; (number of announcement packets) |
ANNOUNCE_INTERVAL = 2 ; seconds (time between announcement packets) |
ANNOUNCE_WAIT = 2 ; seconds (delay before announcing) |
MAX_CONFLICTS = 10 ; (max conflicts before rate limiting) |
RATE_LIMIT_INTERVAL = 60 ; seconds (delay between successive attempts) |
DEFEND_INTERVAL = 10 ; seconds (min. wait between defensive ARPs) |
include '../proc32.inc' |
include '../macros.inc' |
include '../debug-fdo.inc' |
include '../network.inc' |
include 'dhcp.inc' |
include '../dll.inc' |
Ip2dword: |
push edx |
; This code validates if the query is an IP containing 4 numbers and 3 dots |
xor al, al ; make al (dot count) zero |
@@: |
cmp byte[edx],'0' ; check if this byte is a number, if not jump to no_IP |
jl no_IP ; |
cmp byte[edx],'9' ; |
jg no_IP ; |
inc edx ; the byte was a number, so lets check the next byte |
cmp byte[edx],0 ; is this byte zero? (have we reached end of query?) |
jz @f ; jump to next @@ then |
cmp byte[edx],':' |
jz @f |
cmp byte[edx],'.' ; is this byte a dot? |
jne @r ; if not, jump to previous @@ |
inc al ; the byte was a dot so increment al(dot count) |
inc edx ; next byte |
jmp @r ; lets check for numbers again (jump to previous @@) |
@@: ; we reach this when end of query reached |
cmp al,3 ; check if there where 3 dots |
jnz no_IP ; if not, jump to no_IP |
; The following code will convert this IP into a dword and output it in eax |
; If there is also a port number specified, this will be returned in ebx, otherwise ebx is -1 |
pop esi ; edx (query address) was pushed onto stack and is now popped in esi |
xor edx, edx ; result |
xor eax, eax ; current character |
xor ebx, ebx ; current byte |
.outer_loop: |
shl edx, 8 |
add edx, ebx |
xor ebx, ebx |
.inner_loop: |
lodsb |
test eax, eax |
jz .finish |
cmp al, '.' |
jz .outer_loop |
sub eax, '0' |
imul ebx, 10 |
add ebx, eax |
jmp .inner_loop |
.finish: |
shl edx, 8 |
add edx, ebx |
bswap edx ; we want little endian order |
ret |
no_IP: |
pop edx |
xor edx, edx |
ret |
START: |
mcall 40, EVM_STACK2 |
DEBUGF 1,">Zero-config service loaded\n" |
.wait: |
mcall 76, API_ETH + 4 ; get MAC of ethernet interface 0 |
cmp eax, -1 |
jne .start |
mcall 10 |
jmp .wait |
.start: |
mov word[MAC], bx |
mov dword[MAC+2], eax |
DEBUGF 1,"->MAC: %x-%x-%x-%x-%x-%x\n", [MAC+0]:2, [MAC+1]:2, [MAC+2]:2, [MAC+3]:2, [MAC+4]:2, [MAC+5]:2 |
mcall 40, EVM_STACK |
mcall 68, 11 |
stdcall dll.Load,@IMPORT |
or eax, eax |
jnz try_dhcp |
invoke ini.get_str, path, str_ipconfig, str_type, inibuf, 16, 0 |
cmp dword[inibuf], 'stat' |
jne try_dhcp |
invoke ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0 |
mov edx, inibuf |
call Ip2dword |
mcall 76, API_IPv4 + 3, edx |
invoke ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0 |
mov edx, inibuf |
call Ip2dword |
mcall 76, API_IPv4 + 9, edx |
invoke ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0 |
mov edx, inibuf |
call Ip2dword |
mcall 76, API_IPv4 + 5, edx |
invoke ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0 |
mov edx, inibuf |
call Ip2dword |
mcall 76, API_IPv4 + 7, edx |
mcall -1 |
try_dhcp: |
DEBUGF 1,"->Trying DHCP\n" |
mcall 75, 0, AF_INET4, SOCK_DGRAM, 0 ; open socket (parameters: domain, type, reserved) |
cmp eax, -1 |
je error |
mov [socketNum], eax |
DEBUGF 1,"->Socket %x opened\n", eax |
mcall 75, 2, [socketNum], sockaddr1, 18 ; bind socket to local port 68 |
cmp eax, -1 |
je error |
DEBUGF 1,"->Socket Bound to local port 68\n" |
mcall 75, 4, [socketNum], sockaddr2, 18 ; connect to 255.255.255.255 on port 67 |
cmp eax, -1 |
je error |
DEBUGF 1,"->Connected to 255.255.255.255 on port 67\n" |
mov [dhcpMsgType], 0x01 ; DHCP discover |
mov [dhcpLease], esi ; esi is still -1 (-1 = forever) |
mcall 26, 9 ; Get system time |
imul eax, 100 |
mov [currTime], eax |
build_request: ; Creates a DHCP request packet. |
DEBUGF 1,"->Building request\n" |
stdcall mem.Alloc, BUFFER |
mov [dhcpMsg], eax |
test eax, eax |
jz dhcp_error |
;;; todo: skip this bullcrap |
mov edi, eax |
mov ecx, BUFFER |
xor eax, eax |
rep stosb |
;; todo: put this in a buffer instead of writing bytes and words! |
mov edx, [dhcpMsg] |
; Boot protocol legacy |
mov [edx], byte 0x01 ; Boot request |
mov [edx+1], byte 0x01 ; Ethernet |
mov [edx+2], byte 0x06 ; Ethernet h/w len |
mov [edx+4], dword 0x11223344 ; xid ;;;;;;; |
mov eax, [currTime] |
mov [edx+8], eax ; secs, our uptime |
mov [edx+10], byte 0x80 ; broadcast flag set |
mov eax, dword [MAC] ; first 4 bytes of MAC |
mov [edx+28],dword eax |
mov ax, word [MAC+4] ; last 2 bytes of MAC |
mov [edx+32],word ax |
; DHCP extension |
mov [edx+236], dword 0x63538263 ; magic cookie |
mov [edx+240], word 0x0135 ; option DHCP msg type |
mov al, [dhcpMsgType] |
mov [edx+240+2], al |
mov [edx+240+3], word 0x0433 ; option Lease time = infinity |
mov eax, [dhcpLease] |
mov [edx+240+5], eax |
mov [edx+240+9], word 0x0432 ; option requested IP address |
mov eax, [dhcp.ip] |
mov [edx+240+11], eax |
mov [edx+240+15], word 0x0437 ; option request list |
mov [edx+240+17], dword 0x0f060301 |
cmp [dhcpMsgType], byte 0x01 ; Check which msg we are sending |
jne request_options |
mov [edx+240+21], byte 0xff ; "Discover" options |
mov [dhcpMsgLen], dword 262 ; end of options marker |
jmp send_dhcpmsg |
request_options: |
mov [edx+240+21], word 0x0436 ; server IP |
mov eax, [dhcpServerIP] |
mov [edx+240+23], eax |
mov [edx+240+27], byte 0xff ; end of options marker |
mov [dhcpMsgLen], dword 268 |
send_dhcpmsg: |
mcall 75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request ) |
mov eax, [dhcpMsg] ; Setup the DHCP buffer to receive response |
mov [dhcpMsgLen], eax ; Used as a pointer to the data |
mcall 23, TIMEOUT*10 ; wait for data |
read_data: ; we have data - this will be the response |
mcall 75, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
DEBUGF 1,"->%d bytes received\n", eax |
cmp eax, -1 |
je dhcp_error |
mov [dhcpMsgLen], eax |
; depending on which msg we sent, handle the response |
; accordingly. |
; If the response is to a dhcp discover, then: |
; 1) If response is DHCP OFFER then |
; 1.1) record server IP, lease time & IP address. |
; 1.2) send a request packet |
; If the response is to a dhcp request, then: |
; 1) If the response is DHCP ACK then |
; 1.1) extract the DNS & subnet fields. Set them in the stack |
cmp [dhcpMsgType], 0x01 ; did we send a discover? |
je discover |
cmp [dhcpMsgType], 0x03 ; did we send a request? |
je request |
call dhcp_end ; we should never reach here ;) |
jmp exit |
discover: |
call parse_response |
cmp [dhcpMsgType], 0x02 ; Was the response an offer? |
je send_request |
call dhcp_end |
jmp link_local |
send_request: |
mov [dhcpMsgType], 0x03 ; make it a request |
jmp build_request |
request: |
call parse_response |
cmp [dhcpMsgType], 0x05 ; Was the response an ACK? It should be |
jne read_data ; NO - read next packets |
call dhcp_end |
mcall 76, API_IPv4 + 3, [dhcp.ip] ; ip |
mcall 76, API_IPv4 + 5, [dhcp.dns] ; dns |
mcall 76, API_IPv4 + 7, [dhcp.subnet] ; subnet |
mcall 76, API_IPv4 + 9, [dhcp.gateway] ; gateway |
jmp exit |
dhcp_end: |
mcall close, [socketNum] |
stdcall mem.Free, [dhcpMsg] |
ret |
;*************************************************************************** |
; Function |
; parseResponse |
; |
; Description |
; extracts the fields ( client IP address and options ) from |
; a DHCP response |
; The values go into |
; dhcpMsgType,dhcpLease,dhcpClientIP,dhcpServerIP, |
; dhcpDNSIP, dhcpSubnet |
; The message is stored in dhcpMsg |
; |
;*************************************************************************** |
parse_response: |
DEBUGF 1,"Data received, parsing response\n" |
mov edx, [dhcpMsg] |
push dword [edx+16] |
pop [dhcp.ip] |
DEBUGF 1,"Client: %u.%u.%u.%u\n", [edx+16]:1, [edx+17]:1, [edx+18]:1, [edx+19]:1 |
; TODO: check if there really are options |
mov al, 240 ; Point to first option |
movzx ecx, al |
.next_option: |
add edx, ecx |
mov al, [edx] ; get message identifier |
cmp al, 0xff ; End of options? |
je .done |
cmp al, 0 |
je .pad |
; TODO: check if we still are inside the buffer |
inc edx |
movzx ecx, byte [edx] ; get data length |
inc edx ; point to data |
cmp al, dhcp_msg_type ; Msg type is a single byte option |
je .msgtype |
cmp al, dhcp_dhcp_server_id |
je .server |
cmp al, dhcp_address_time |
je .lease |
cmp al, dhcp_subnet_mask |
je .subnet |
cmp al, dhcp_router |
je .router |
cmp al, dhcp_domain_server |
je .dns |
DEBUGF 1,"Unsupported DHCP option: %u\n", al |
jmp .next_option |
.pad: |
xor ecx, ecx |
inc ecx |
jmp .next_option |
.msgtype: |
mov al, [edx] |
mov [dhcpMsgType], al |
DEBUGF 1,"DHCP Msg type: %u\n", al |
jmp .next_option ; Get next option |
.server: |
mov eax, [edx] |
mov [dhcpServerIP], eax |
DEBUGF 1,"Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
jmp .next_option |
.lease: |
pusha |
mov eax,[edx] |
bswap eax |
mov [dhcpLease],eax |
DEBUGF 1,"lease: %d\n",eax |
popa |
jmp .next_option |
.subnet: |
push dword [edx] |
pop [dhcp.subnet] |
DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
jmp .next_option |
.router: |
push dword [edx] |
pop [dhcp.gateway] |
DEBUGF 1,"Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
jmp .next_option |
.dns: |
push dword [edx] |
pop [dhcp.dns] |
DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 |
jmp .next_option |
.done: |
ret |
dhcp_error: |
call dhcp_end |
link_local: |
call random |
mov cx, ax |
shl ecx, 16 |
mov cx, 0xfea9 ; IP 169.254.0.0 link local net, see RFC3927 |
mcall 76, API_IPv4 + 3, ecx ; mask is 255.255.0.0 |
DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n", [generator+0]:1, [generator+1]:1 |
mcall 76, API_IPv4 + 7, 0xffff |
mcall 76, API_IPv4 + 9, 0x0 |
mcall 76, API_IPv4 + 5, 0x0 |
mcall 5, PROBE_WAIT*100 |
xor esi, esi |
probe_loop: |
call random ; create a pseudo random number in eax (seeded by MAC) |
cmp al, PROBE_MIN*100 ; check if al is bigger then PROBE_MIN |
jae @f ; all ok |
add al, (PROBE_MAX-PROBE_MIN)*100 ; al is too small |
@@: |
cmp al, PROBE_MAX*100 |
jbe @f |
sub al, (PROBE_MAX-PROBE_MIN)*100 |
@@: |
movzx ebx,al |
DEBUGF 1,"Waiting %u0ms\n",ebx |
mcall 5 |
DEBUGF 1,"Sending Probe\n" |
mcall 76, API_ARP + 6 |
inc esi |
cmp esi, PROBE_NUM |
jb probe_loop |
; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingned |
; IP within this time, we should create another adress, that have to be done later |
DEBUGF 1,"Waiting %us\n", ANNOUNCE_WAIT |
mcall 5, ANNOUNCE_WAIT*100 |
xor esi, esi |
announce_loop: |
DEBUGF 1,"Sending Announce\n" |
mcall 76, API_ARP + 6 |
inc esi |
cmp esi,ANNOUNCE_NUM |
je @f |
DEBUGF 1,"Waiting %us\n", ANNOUNCE_INTERVAL |
mcall 5, ANNOUNCE_INTERVAL*100 |
jmp announce_loop |
@@: |
error: |
DEBUGF 1,"Socket error\n" |
exit: ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;) |
mcall -1 |
random: ; Pseudo random actually |
mov eax, [generator] |
add eax, -43ab45b5h |
ror eax, 1 |
bswap eax |
xor eax, dword[MAC] |
ror eax, 1 |
xor eax, dword[MAC+2] |
mov [generator], eax |
ret |
; DATA AREA |
align 16 |
@IMPORT: |
library \ |
libini,'libini.obj' |
import libini, \ |
ini.get_str,'ini_get_str' |
include_debug_strings |
str_ip db 'ip', 0 |
str_subnet db 'subnet', 0 |
str_gateway db 'gateway', 0 |
str_dns db 'dns', 0 |
str_ipconfig db 'ipconfig', 0 |
str_type db 'type', 0 |
sockaddr1: |
dw AF_INET4 |
dw 68 shl 8 ; local port |
dd 0 ; local IP |
rb 10 |
sockaddr2: |
dw AF_INET4 |
dw 67 shl 8 ; destination port |
dd -1 ; destination IP |
rb 10 |
path db '/sys/network.ini' |
IM_END: |
inibuf rb 16 |
dhcpMsgType db ? |
dhcpLease dd ? |
dhcpServerIP dd ? |
dhcp: |
.ip dd ? |
.subnet dd ? |
.dns dd ? |
.gateway dd ? |
dhcpMsgLen dd ? |
socketNum dd ? |
MAC dp ? |
currTime dd ? |
generator dd ? |
dhcpMsg dd ? |
I_END: |
/programs/network/zeroconf |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |