Subversion Repositories Kolibri OS

Rev

Rev 2627 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2627 Rev 2635
Line 4... Line 4...
4
; hidnplayr@gmail.com
4
; hidnplayr@gmail.com
5
;
5
;
6
; GPLv2
6
; GPLv2
7
;
7
;
Line -... Line 8...
-
 
8
 
-
 
9
DEBUG                   = 0             ; if set to one, program will run in a single thread
8
 
10
 
Line 9... Line 11...
9
BUFFERSIZE              = 8192
11
BUFFERSIZE              = 8192
10
 
12
 
11
; using multiple's of 4
13
; using multiple's of 4
Line 58... Line 60...
58
include '../dll.inc'
60
include '../dll.inc'
59
include '../struct.inc'
61
include '../struct.inc'
60
include '../libio.inc'
62
include '../libio.inc'
Line 61... Line 63...
61
 
63
 
-
 
64
include '../network.inc'
-
 
65
 
-
 
66
macro sendFTP str {
-
 
67
local string, length
-
 
68
        xor     edi, edi
-
 
69
        mcall   send, [ebp + thread_data.socketnum], string, length
-
 
70
 
-
 
71
iglobal
-
 
72
string db str, 13, 10
-
 
73
length = $ - string
-
 
74
\}
-
 
75
}
62
include '../network.inc'
76
 
Line 63... Line 77...
63
include 'commands.inc'
77
include 'commands.inc'
64
 
78
 
65
start:
79
start:
Line 151... Line 165...
151
                                                ; One second timeout, we will use this to check if console is still working
165
                                                ; One second timeout, we will use this to check if console is still working
Line 152... Line 166...
152
 
166
 
153
        test    eax, eax                        ; network event?
167
        test    eax, eax                        ; network event?
Line -... Line 168...
-
 
168
        jz      .checkconsole
-
 
169
 
-
 
170
if DEBUG
154
        jz      .checkconsole
171
        jmp     threadstart
155
 
172
else
-
 
173
        mcall   51, 1, threadstart, 0           ; Start a new thread for every incoming connection
156
        mcall   51, 1, threadstart, 0           ; Start a new thread for every incoming connection
174
                                                ; NOTE: upon initialisation of the thread, stack will not be available!
Line 157... Line 175...
157
                                                ; NOTE: upon initialisation of the thread, stack will not be available!
175
end if
Line 158... Line 176...
158
        jmp     mainloop
176
        jmp     mainloop
Line 193... Line 211...
193
        mcall   accept, [socketnum], sockaddr1, sockaddr1.length        ; time to accept the awaiting connection..
211
        mcall   accept, [socketnum], sockaddr1, sockaddr1.length        ; time to accept the awaiting connection..
194
        cmp     eax, -1
212
        cmp     eax, -1
195
        je      thread_exit
213
        je      thread_exit
196
        mov     [ebp + thread_data.socketnum], eax
214
        mov     [ebp + thread_data.socketnum], eax
Line -... Line 215...
-
 
215
 
-
 
216
if DEBUG
-
 
217
        mcall   close, [socketnum]                                      ; close the listening socket
-
 
218
end if
197
 
219
 
198
        mov     [ebp + thread_data.state], STATE_CONNECTED
220
        mov     [ebp + thread_data.state], STATE_CONNECTED
199
        mov     [ebp + thread_data.permissions], 0
221
        mov     [ebp + thread_data.permissions], 0
200
        mov     [ebp + thread_data.mode], MODE_NOTREADY
222
        mov     [ebp + thread_data.mode], MODE_NOTREADY
201
        lea     eax, [ebp + thread_data.buffer]
223
        lea     eax, [ebp + thread_data.buffer]
Line 382... Line 404...
382
import  libini,\
404
import  libini,\
383
        ini.get_str,            'ini_get_str',\
405
        ini.get_str,            'ini_get_str',\
384
        ini.get_int,            'ini_get_int'
406
        ini.get_int,            'ini_get_int'
Line 385... Line 407...
385
 
407
 
386
import  libio,\
-
 
387
        libio.init,             'lib_init',\
408
import  libio,\
388
        file.size,              'file_size',\
409
        file.size,              'file_size',\
389
        file.open,              'file_open',\
410
        file.open,              'file_open',\
390
        file.read,              'file_read',\
411
        file.read,              'file_read',\
391
        file.close,             'file_close',\
412
        file.close,             'file_close',\
392
        file.find.first,        'file_find_first',\
413
        file.find.first,        'file_find_first',\
393
        file.find.next,         'file_find_next',\
414
        file.find.next,         'file_find_next',\
Line -... Line 415...
-
 
415
        file.find.close,        'file_find_close'
-
 
416
 
-
 
417
 
394
        file.find.close,        'file_find_close'
418
IncludeIGlobals
Line 395... Line 419...
395
 
419
 
Line 396... Line 420...
396
 
420