forked from KolibriOS/kolibrios
Many bugfixes.
git-svn-id: svn://kolibrios.org@4655 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d391f62d11
commit
96b5daac91
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
format binary as ""
|
format binary as ""
|
||||||
|
|
||||||
|
__DEBUG__ = 0
|
||||||
|
__DEBUG_LEVEL__ = 1
|
||||||
|
|
||||||
use32
|
use32
|
||||||
org 0x0
|
org 0x0
|
||||||
|
|
||||||
@ -32,17 +35,16 @@ include '../../dll.inc'
|
|||||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||||
|
|
||||||
include '../../network.inc'
|
include '../../network.inc'
|
||||||
|
include '../../debug-fdo.inc'
|
||||||
|
|
||||||
|
|
||||||
filebuffer_size = 4*4096 ; 16kb (dont try to change it yet..)
|
|
||||||
TIMEOUT = 100
|
TIMEOUT = 100
|
||||||
buffer_len = 1500
|
buffer_len = 4096
|
||||||
|
|
||||||
opcode_rrq = 1
|
opcode_rrq = 1 shl 8
|
||||||
opcode_wrq = 2
|
opcode_wrq = 2 shl 8
|
||||||
opcode_data = 3
|
opcode_data = 3 shl 8
|
||||||
opcode_ack = 4
|
opcode_ack = 4 shl 8
|
||||||
opcode_error = 5
|
opcode_error = 5 shl 8
|
||||||
|
|
||||||
; read/write request packet
|
; read/write request packet
|
||||||
;
|
;
|
||||||
@ -81,22 +83,18 @@ START:
|
|||||||
or eax, eax
|
or eax, eax
|
||||||
jnz exit
|
jnz exit
|
||||||
|
|
||||||
stop_transfer:
|
home:
|
||||||
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY + EVM_STACK
|
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY + EVM_STACK
|
||||||
|
|
||||||
red_win:
|
redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
align 4
|
mainloop:
|
||||||
still:
|
|
||||||
mcall 10
|
mcall 10
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz red_win
|
jz redraw
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz key
|
jz key
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz button
|
jz button
|
||||||
|
|
||||||
@ -108,7 +106,7 @@ still:
|
|||||||
invoke option_box_mouse, Option_boxs1
|
invoke option_box_mouse, Option_boxs1
|
||||||
invoke option_box_mouse, Option_boxs2
|
invoke option_box_mouse, Option_boxs2
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
button:
|
button:
|
||||||
mcall 17
|
mcall 17
|
||||||
@ -117,7 +115,7 @@ button:
|
|||||||
je start_transfer
|
je start_transfer
|
||||||
|
|
||||||
test ah , ah
|
test ah , ah
|
||||||
jz still
|
jz mainloop
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mcall -1
|
mcall -1
|
||||||
@ -129,7 +127,7 @@ key:
|
|||||||
invoke edit_box_key, edit3
|
invoke edit_box_key, edit3
|
||||||
invoke edit_box_key, edit4
|
invoke edit_box_key, edit4
|
||||||
|
|
||||||
jmp still
|
jmp mainloop
|
||||||
|
|
||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
@ -176,31 +174,50 @@ draw_window:
|
|||||||
mov esi, [sc.work_button]
|
mov esi, [sc.work_button]
|
||||||
mcall 8, 210 shl 16 + 170, 105 shl 16 + 16, 0x10
|
mcall 8, 210 shl 16 + 170, 105 shl 16 + 16, 0x10
|
||||||
|
|
||||||
mov ecx, 0x80000000
|
mcall 38, 10 shl 16 + 380, 130 shl 16 + 130, [sc.work_graph]
|
||||||
or ecx, [sc.work_button_text]
|
|
||||||
mcall 4, 260 shl 16 + 110, , str_transfer
|
|
||||||
|
|
||||||
|
cmp [errormsg], 0
|
||||||
|
je .no_error
|
||||||
|
|
||||||
|
mov ecx, 0x80000000
|
||||||
|
or ecx, [sc.work_text]
|
||||||
|
mcall 4, 20 shl 16 + 137, , [errormsg]
|
||||||
|
mcall 12, 2
|
||||||
|
jmp .draw_btn
|
||||||
|
|
||||||
|
.no_error:
|
||||||
mov ecx, 0x80000000
|
mov ecx, 0x80000000
|
||||||
or ecx, [sc.work_text]
|
or ecx, [sc.work_text]
|
||||||
mcall 4, 350 shl 16 + 137, , str_kb_s
|
mcall 4, 350 shl 16 + 137, , str_kb_s
|
||||||
mcall 4, 50 shl 16 + 137, , str_complete
|
mcall 4, 50 shl 16 + 137, , str_complete
|
||||||
|
|
||||||
mcall 38, 10 shl 16 + 380, 130 shl 16 + 130, [sc.work_graph]
|
|
||||||
|
|
||||||
mcall 47, 1 shl 31 + 7 shl 16 + 1, kbps, 305 shl 16 + 137, [sc.work_text]
|
mcall 47, 1 shl 31 + 7 shl 16 + 1, kbps, 305 shl 16 + 137, [sc.work_text]
|
||||||
mcall 47, 1 shl 31 + 3 shl 16 + 1, done, 25 shl 16 + 137, ;[sc.work_text]
|
mcall 47, 1 shl 31 + 3 shl 16 + 1, done, 25 shl 16 + 137
|
||||||
|
|
||||||
|
.draw_btn:
|
||||||
|
cmp [socketnum], 0
|
||||||
|
je .no_transfer
|
||||||
|
|
||||||
|
mov ecx, 0x80000000
|
||||||
|
or ecx, [sc.work_button_text]
|
||||||
|
mcall 4, 270 shl 16 + 110, , str_stop
|
||||||
|
|
||||||
mcall 12, 2
|
mcall 12, 2
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.no_transfer:
|
||||||
|
mov ecx, 0x80000000
|
||||||
|
or ecx, [sc.work_button_text]
|
||||||
|
mcall 4, 260 shl 16 + 110, , str_transfer
|
||||||
|
|
||||||
|
mcall 12, 2
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
start_transfer:
|
start_transfer:
|
||||||
|
|
||||||
; first, resolve the hostname
|
; resolve the hostname
|
||||||
|
mov [errormsg], str_err_resolve
|
||||||
|
|
||||||
push esp ; reserve stack place
|
push esp ; reserve stack place
|
||||||
|
|
||||||
@ -212,226 +229,321 @@ start_transfer:
|
|||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
|
|
||||||
; test for error
|
; test for error
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz still
|
jnz home
|
||||||
|
|
||||||
mov esi, [esi]
|
mov eax, [esi + addrinfo.ai_addr]
|
||||||
mov esi, [esi + sockaddr_in.sin_addr]
|
mov eax, [eax + sockaddr_in.sin_addr]
|
||||||
mov dword [IP], esi
|
mov [sockaddr.ip], eax
|
||||||
|
|
||||||
mcall socket, AF_INET4, SOCK_DGRAM, 0 ; socket_open
|
; free allocated memory
|
||||||
|
push esi
|
||||||
|
call [freeaddrinfo]
|
||||||
|
|
||||||
|
; Open a socket & connect to server
|
||||||
|
mov [errormsg], str_err_socket
|
||||||
|
|
||||||
|
mcall socket, AF_INET4, SOCK_DGRAM, 0
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je still
|
je home
|
||||||
|
|
||||||
mov [socketnum], eax
|
mov [socketnum], eax
|
||||||
|
|
||||||
mcall connect, [socketnum], sockaddr, sockaddr_len ; socket_connect
|
mcall connect, [socketnum], sockaddr, sockaddr_len
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je still
|
je home
|
||||||
|
|
||||||
mov word [I_END], opcode_rrq
|
; Create the read/write request packet
|
||||||
cmp [option_group2],op3
|
mov word[buffer], opcode_rrq
|
||||||
|
cmp [option_group2], op3
|
||||||
je @f
|
je @f
|
||||||
mov word [I_END], opcode_wrq
|
mov word[buffer], opcode_wrq
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
xor al , al
|
; Copy in the remote filename (asciiz)
|
||||||
|
xor al, al
|
||||||
mov edi, remote_addr
|
mov edi, remote_addr
|
||||||
mov ecx, 250
|
mov ecx, 255
|
||||||
repnz scasb
|
repnz scasb
|
||||||
sub edi, remote_addr-1
|
lea ecx, [edi - remote_addr - 1]
|
||||||
mov ecx, edi
|
|
||||||
mov edi, I_END+2
|
|
||||||
mov esi, remote_addr
|
mov esi, remote_addr
|
||||||
|
mov edi, buffer+2
|
||||||
rep movsb
|
rep movsb
|
||||||
|
stosb
|
||||||
|
|
||||||
|
; Append the data type (asciiz)
|
||||||
cmp [option_group1], op1
|
cmp [option_group1], op1
|
||||||
je .ascii
|
je .ascii
|
||||||
|
|
||||||
mov esi, octet
|
mov esi, octet
|
||||||
movsd
|
movsd
|
||||||
movsb
|
movsb
|
||||||
|
|
||||||
jmp .send_request
|
jmp .send_request
|
||||||
|
|
||||||
.ascii:
|
.ascii:
|
||||||
|
|
||||||
mov esi, netascii
|
mov esi, netascii
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
|
|
||||||
|
; Send the request to the server
|
||||||
.send_request:
|
.send_request:
|
||||||
|
|
||||||
xor al, al
|
xor al, al
|
||||||
stosb
|
stosb
|
||||||
|
lea esi, [edi - buffer]
|
||||||
|
xor edi, edi
|
||||||
|
mcall send, [socketnum], buffer
|
||||||
|
cmp eax, -1
|
||||||
|
je home
|
||||||
|
|
||||||
sub edi, I_END
|
; Jump to send/receive code
|
||||||
mov esi, edi
|
cmp word[buffer], opcode_wrq
|
||||||
mcall send, [socketnum], I_END
|
je tftp_send
|
||||||
|
|
||||||
|
|
||||||
|
tftp_receive:
|
||||||
|
|
||||||
mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK
|
mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK
|
||||||
|
|
||||||
mov [last_ack], 0
|
mov [last_ack], 0
|
||||||
|
mov [errormsg], 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
receive_data_loop:
|
|
||||||
|
|
||||||
mcall 23, TIMEOUT
|
|
||||||
|
|
||||||
dec eax
|
|
||||||
jz .red
|
|
||||||
|
|
||||||
dec eax
|
|
||||||
jz .key
|
|
||||||
|
|
||||||
|
|
||||||
mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT ; 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
|
call draw_window
|
||||||
|
|
||||||
jmp receive_data_loop
|
; Open/create local file
|
||||||
|
mov [file_struct.subfn], 2
|
||||||
|
mov [file_struct.offset], 0
|
||||||
|
mov [file_struct.size], 0
|
||||||
|
mcall 70, file_struct
|
||||||
|
|
||||||
|
; Truncate it to 0 bytes
|
||||||
|
mov [file_struct.subfn], 4
|
||||||
|
mcall 70, file_struct
|
||||||
|
|
||||||
.key:
|
; Set parameters for writing to file
|
||||||
mcall 2
|
mov [file_struct.subfn], 3
|
||||||
cmp ah, 2
|
mov [file_struct.data], buffer + 4
|
||||||
jz exit
|
|
||||||
|
|
||||||
; close socket ?
|
.loop:
|
||||||
|
mcall 23, TIMEOUT
|
||||||
|
dec eax
|
||||||
|
jz .red
|
||||||
|
dec eax
|
||||||
|
dec eax
|
||||||
|
jz .button
|
||||||
|
|
||||||
jmp receive_data_loop
|
mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT ; receive data
|
||||||
|
cmp eax, -1
|
||||||
|
je .loop
|
||||||
|
|
||||||
|
DEBUGF 1, "Got %u bytes\n", eax
|
||||||
|
cmp word[buffer], opcode_error
|
||||||
|
je tftp_error
|
||||||
|
cmp word[buffer], opcode_data
|
||||||
|
jne .error
|
||||||
|
|
||||||
|
; Verify ACK number
|
||||||
|
mov bx, word[buffer + 2]
|
||||||
|
rol bx, 8
|
||||||
|
cmp [last_ack], 0
|
||||||
|
je @f
|
||||||
|
cmp [last_ack], bx
|
||||||
|
jne .packet_got_lost
|
||||||
|
inc bx
|
||||||
|
@@:
|
||||||
|
mov [last_ack], bx
|
||||||
|
|
||||||
|
; Write to the file
|
||||||
|
lea ecx, [eax - 4]
|
||||||
|
mov [file_struct.size], ecx
|
||||||
|
mcall 70, file_struct
|
||||||
|
add [file_struct.offset], ecx
|
||||||
|
|
||||||
|
; Send ACK
|
||||||
|
mov word[buffer], opcode_ack
|
||||||
|
mcall send, [socketnum], buffer, 4, 0
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.packet_got_lost:
|
||||||
|
;TODO
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.red:
|
||||||
|
call draw_window
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.button:
|
||||||
|
mcall 17
|
||||||
|
cmp ah, 1
|
||||||
|
jne .abort
|
||||||
|
|
||||||
|
mcall close, [socketnum]
|
||||||
|
mcall -1
|
||||||
|
|
||||||
|
.abort:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_abort
|
||||||
|
jmp home
|
||||||
|
|
||||||
|
.error:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_err_unexp
|
||||||
|
jmp home
|
||||||
|
|
||||||
|
.done:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_success
|
||||||
|
jmp home
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tftp_send:
|
||||||
|
|
||||||
|
mcall 40, EVM_REDRAW + EVM_BUTTON + EVM_STACK
|
||||||
|
|
||||||
;--------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
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 [last_ack], 0
|
||||||
mov [fo], 0
|
mov [errormsg], 0
|
||||||
|
|
||||||
.read_chunk:
|
call draw_window
|
||||||
|
|
||||||
invoke file_seek, [fh], [fo], SEEK_END
|
mov [file_struct.subfn], 0
|
||||||
cmp eax, -1
|
mov [file_struct.offset], 0
|
||||||
je .exit
|
mov [file_struct.size], buffer_len
|
||||||
invoke file_read, [fh], [fb], filebuffer_size
|
mov [file_struct.data], buffer + 4
|
||||||
cmp eax, -1
|
|
||||||
je .exit
|
|
||||||
add [fo], filebuffer_size
|
|
||||||
cmp eax, filebuffer_size
|
|
||||||
je .packet
|
|
||||||
|
|
||||||
; ijhidfhfdsndsfqk
|
.next:
|
||||||
|
|
||||||
.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 edi, buffer
|
||||||
mov ax, opcode_data
|
mov ax, opcode_data
|
||||||
stosw
|
stosw
|
||||||
mov ax, [last_ack]
|
mov ax, [last_ack]
|
||||||
stosw
|
stosw
|
||||||
mov ecx, 512/4
|
|
||||||
rep movsd
|
|
||||||
|
|
||||||
mcall send, [socketnum], buffer, 4+512, 0 ; send data
|
mcall 70, file_struct
|
||||||
|
test eax, eax
|
||||||
|
; jnz .done
|
||||||
|
mov [size], ebx
|
||||||
|
|
||||||
|
.resend:
|
||||||
|
mov ebx, [size]
|
||||||
|
lea esi, [ebx + 4]
|
||||||
|
xor edi, edi
|
||||||
|
mcall send, [socketnum], buffer
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
|
|
||||||
mcall 23, TIMEOUT
|
mcall 23, TIMEOUT
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz .red
|
jz .red
|
||||||
|
|
||||||
dec eax
|
dec eax
|
||||||
jz .key
|
dec eax
|
||||||
|
jz .button
|
||||||
|
|
||||||
mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT ; receive ack
|
mcall recv, [socketnum], buffer, buffer_len, MSG_DONTWAIT
|
||||||
|
cmp eax, -1
|
||||||
|
je .loop
|
||||||
|
|
||||||
|
cmp word[buffer], opcode_error
|
||||||
|
je tftp_error
|
||||||
cmp word[buffer], opcode_ack
|
cmp word[buffer], opcode_ack
|
||||||
jne .exit
|
jne .error
|
||||||
|
|
||||||
mov ax, [last_ack]
|
mov ax, [last_ack]
|
||||||
cmp word[buffer+2], ax
|
cmp word[buffer+2], ax
|
||||||
jne .packet
|
jne .resend
|
||||||
|
|
||||||
|
mov eax, [size]
|
||||||
|
cmp eax, buffer_len
|
||||||
|
jb .done
|
||||||
|
add [file_struct.offset], eax
|
||||||
|
|
||||||
inc [last_ack]
|
inc [last_ack]
|
||||||
test [last_ack],0x001f
|
jmp .next
|
||||||
jz .read_chunk
|
|
||||||
jmp .packet
|
|
||||||
|
|
||||||
|
|
||||||
.red:
|
|
||||||
|
|
||||||
|
.red:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
|
.button:
|
||||||
|
mcall 17
|
||||||
|
cmp ah, 1
|
||||||
|
jne .abort
|
||||||
|
|
||||||
.key:
|
mcall close, [socketnum]
|
||||||
mcall 2
|
mcall -1
|
||||||
cmp ah, 2
|
|
||||||
jz exit
|
|
||||||
|
|
||||||
; close socket ?
|
.abort:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_abort
|
||||||
|
jmp home
|
||||||
|
|
||||||
jmp .loop
|
.error:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_err_unexp
|
||||||
|
jmp home
|
||||||
|
|
||||||
.exit:
|
.done:
|
||||||
invoke file_close, [fh]
|
mcall close, [socketnum]
|
||||||
jmp still
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
mov [errormsg], str_success
|
||||||
|
jmp home
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tftp_error:
|
||||||
|
mcall close, [socketnum]
|
||||||
|
xor eax, eax
|
||||||
|
mov [socketnum], eax
|
||||||
|
|
||||||
|
mov ax, word[buffer+2]
|
||||||
|
xchg al, ah
|
||||||
|
|
||||||
|
test ax, ax
|
||||||
|
jz .0
|
||||||
|
dec ax
|
||||||
|
jz .1
|
||||||
|
dec ax
|
||||||
|
jz .2
|
||||||
|
dec ax
|
||||||
|
jz .3
|
||||||
|
dec ax
|
||||||
|
jz .4
|
||||||
|
dec ax
|
||||||
|
jz .5
|
||||||
|
dec ax
|
||||||
|
jz .6
|
||||||
|
dec ax
|
||||||
|
jz .7
|
||||||
|
|
||||||
|
.0:
|
||||||
|
mov [errormsg], str_error.0
|
||||||
|
jmp home
|
||||||
|
.1:
|
||||||
|
mov [errormsg], str_error.1
|
||||||
|
jmp redraw
|
||||||
|
.2:
|
||||||
|
mov [errormsg], str_error.2
|
||||||
|
jmp home
|
||||||
|
.3:
|
||||||
|
mov [errormsg], str_error.3
|
||||||
|
jmp home
|
||||||
|
.4:
|
||||||
|
mov [errormsg], str_error.4
|
||||||
|
jmp home
|
||||||
|
.5:
|
||||||
|
mov [errormsg], str_error.5
|
||||||
|
jmp home
|
||||||
|
.6:
|
||||||
|
mov [errormsg], str_error.6
|
||||||
|
jmp home
|
||||||
|
.7:
|
||||||
|
mov [errormsg], str_error.7
|
||||||
|
jmp home
|
||||||
|
|
||||||
;-------------------------
|
;-------------------------
|
||||||
; DATA
|
; DATA
|
||||||
@ -439,48 +551,41 @@ send_:
|
|||||||
socketnum dd 0
|
socketnum dd 0
|
||||||
kbps dd 0
|
kbps dd 0
|
||||||
done dd 0
|
done dd 0
|
||||||
|
errormsg dd str_welcome
|
||||||
|
|
||||||
sockaddr:
|
sockaddr:
|
||||||
dw AF_INET4
|
dw AF_INET4
|
||||||
dw 0x4500 ; 69
|
dw 0x4500 ; 69
|
||||||
IP db 192, 168, 1, 115
|
.ip dd ?
|
||||||
|
|
||||||
sockaddr_len = $ - sockaddr
|
sockaddr_len = $ - sockaddr
|
||||||
|
|
||||||
|
file_struct:
|
||||||
|
.subfn dd ?
|
||||||
|
.offset dd ?
|
||||||
|
dd 0
|
||||||
|
.size dd ?
|
||||||
|
.data dd ?
|
||||||
|
db 0
|
||||||
|
.filename dd local_addr
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
@IMPORT:
|
@IMPORT:
|
||||||
|
|
||||||
library box_lib , 'box_lib.obj', \
|
library box_lib , 'box_lib.obj' ,\
|
||||||
io_lib , 'libio.obj', \
|
network , 'network.obj'
|
||||||
network , 'network.obj'
|
|
||||||
|
|
||||||
import box_lib ,\
|
import box_lib ,\
|
||||||
edit_box_draw ,'edit_box' ,\
|
edit_box_draw , 'edit_box' ,\
|
||||||
edit_box_key ,'edit_box_key' ,\
|
edit_box_key , 'edit_box_key' ,\
|
||||||
edit_box_mouse ,'edit_box_mouse' ,\
|
edit_box_mouse , 'edit_box_mouse' ,\
|
||||||
version_ed ,'version_ed' ,\
|
version_ed , 'version_ed' ,\
|
||||||
init_checkbox ,'init_checkbox2' ,\
|
init_checkbox , 'init_checkbox2' ,\
|
||||||
check_box_draw ,'check_box_draw2' ,\
|
check_box_draw , 'check_box_draw2' ,\
|
||||||
check_box_mouse ,'check_box_mouse2' ,\
|
check_box_mouse , 'check_box_mouse2' ,\
|
||||||
version_ch ,'version_ch2' ,\
|
version_ch , 'version_ch2' ,\
|
||||||
option_box_draw ,'option_box_draw' ,\
|
option_box_draw , 'option_box_draw' ,\
|
||||||
option_box_mouse ,'option_box_mouse' ,\
|
option_box_mouse, 'option_box_mouse' ,\
|
||||||
version_op ,'version_op'
|
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 ,\
|
import network ,\
|
||||||
inet_ntoa , 'inet_ntoa' ,\
|
inet_ntoa , 'inet_ntoa' ,\
|
||||||
@ -488,10 +593,10 @@ import network ,\
|
|||||||
freeaddrinfo , 'freeaddrinfo'
|
freeaddrinfo , 'freeaddrinfo'
|
||||||
|
|
||||||
|
|
||||||
edit1 edit_box 300, 80, 5, 0xffffff, 0x6f9480, 0, 0, 0, 99, SRV, mouse_dd, ed_focus, 13, 13
|
edit1 edit_box 300, 80, 5, 0xffffff, 0x6f9480, 0, 0, 0, 255, SRV, mouse_dd, ed_focus, 13, 13
|
||||||
edit2 edit_box 300, 80, 25, 0xffffff, 0x6a9480, 0, 0, 0, 99, remote_addr, mouse_dd, ed_figure_only, 5, 5
|
edit2 edit_box 300, 80, 25, 0xffffff, 0x6f9480, 0, 0, 0, 255, remote_addr, mouse_dd, 0, 4, 4
|
||||||
edit3 edit_box 300, 80, 45, 0xffffff, 0x6a9480, 0, 0, 0, 99, local_addr, mouse_dd, ed_figure_only, 27, 27
|
edit3 edit_box 300, 80, 45, 0xffffff, 0x6f9480, 0, 0, 0, 255, local_addr, mouse_dd, 0, 12, 12
|
||||||
edit4 edit_box 40, 340, 68, 0xffffff, 0x6a9480, 0, 0, 0, 5, BLK, mouse_dd, ed_figure_only, 3, 3
|
edit4 edit_box 40, 340, 68, 0xffffff, 0x6f9480, 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
|
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
|
op2 option_box option_group1, 80, 85, 6, 12, 0xFFFFFF, 0, 0, octet, get-octet
|
||||||
@ -514,45 +619,51 @@ str_blocksize db 'Blocksize:', 0
|
|||||||
str_kb_s db 'kB/s', 0
|
str_kb_s db 'kB/s', 0
|
||||||
str_complete db '% complete', 0
|
str_complete db '% complete', 0
|
||||||
str_transfer db 'Transfer', 0
|
str_transfer db 'Transfer', 0
|
||||||
|
str_stop db 'Stop', 0
|
||||||
|
|
||||||
str_error:
|
str_error:
|
||||||
._0 db 'Not defined, see error message (if any).', 0
|
.0 db 'Error.', 0 ; not further defined error
|
||||||
._1 db 'File not found.', 0
|
.1 db 'File not found.', 0
|
||||||
._2 db 'Access violation.', 0
|
.2 db 'Access violation.', 0
|
||||||
._3 db 'Disk full or allocation exceeded.', 0
|
.3 db 'Disk full or allocation exceeded.', 0
|
||||||
._4 db 'Illegal TFTP operation.', 0
|
.4 db 'Illegal TFTP operation.', 0
|
||||||
._5 db 'Unknown transfer ID.', 0
|
.5 db 'Unknown transfer ID.', 0
|
||||||
._6 db 'File already exists.', 0
|
.6 db 'File already exists.', 0
|
||||||
._7 db 'No such user.', 0
|
.7 db 'No such user.', 0
|
||||||
|
|
||||||
|
str_welcome db 'Welcome.', 0
|
||||||
|
str_err_resolve db 'Unable to resolve server address.', 0
|
||||||
|
str_err_socket db 'Socket error.', 0
|
||||||
|
str_err_unexp db 'Unexpected command from server.', 0
|
||||||
|
str_success db 'Operation completed successfully.', 0
|
||||||
|
str_abort db 'Operation aborted by user.', 0
|
||||||
|
|
||||||
netascii db 'NetASCII'
|
netascii db 'NetASCII'
|
||||||
octet db 'Octet'
|
octet db 'Octet'
|
||||||
get db 'GET'
|
get db 'GET'
|
||||||
put db 'PUT'
|
put db 'PUT'
|
||||||
|
|
||||||
BLK db "512", 0, 0, 0
|
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
|
SRV db "192.168.1.115", 0
|
||||||
rb (SRV + 256 - $)
|
rb (SRV + 256 - $)
|
||||||
|
|
||||||
remote_addr db "IMG00", 0
|
remote_addr db "file", 0
|
||||||
rb (remote_addr + 256 - $)
|
rb (remote_addr + 256 - $)
|
||||||
|
|
||||||
local_addr db "/hd0/1/KolibriOS/kernel.mnt", 0
|
local_addr db "/tmp0/1/file", 0
|
||||||
rb (local_addr + 256 - $)
|
rb (local_addr + 256 - $)
|
||||||
|
|
||||||
|
include_debug_strings
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
|
|
||||||
|
last_ack dw ?
|
||||||
|
size dd ?
|
||||||
|
mouse_dd dd ?
|
||||||
|
|
||||||
sc system_colors
|
sc system_colors
|
||||||
|
|
||||||
mouse_dd dd ?
|
|
||||||
buffer rb buffer_len
|
buffer rb buffer_len
|
||||||
|
|
||||||
IM_END:
|
IM_END:
|
Loading…
Reference in New Issue
Block a user