Subversion Repositories Kolibri OS

Rev

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

Rev 2554 Rev 2557
Line 2... Line 2...
2
parse_cmd:                              ; esi must point to command
2
parse_cmd:                              ; esi must point to command
3
 
3
 
Line -... Line 4...
-
 
4
        cmp     byte [esi+3], 0x20
-
 
5
        jae     @f
-
 
6
        mov     byte [esi+3], 0
-
 
7
       @@:
-
 
8
 
4
        mov     eax, [esi]
9
        mov     eax, [esi]
5
        and     eax, not 0x20202020     ; convert to upper case
10
        and     eax, not 0x20202020     ; convert to upper case
6
                                        ; (also convert spaces to null)
11
                                        ; (also convert spaces to null)
7
        mov     edi, commands           ; list of commands to scan
12
        mov     edi, commands           ; list of commands to scan
8
  .scanloop:
13
  .scanloop:
9
        cmp     eax, [edi]
14
        cmp     eax, [edi]
10
        jb      .error
-
 
11
        jl      .try_next
15
        jne     .try_next
Line 12... Line 16...
12
 
16
 
Line 13... Line 17...
13
        jmp     dword [edi+4]
17
        jmp     dword [edi+4]
14
 
18
 
15
  .try_next:
19
  .try_next:
16
        add     edi, 8
20
        add     edi, 8
Line 17... Line 21...
17
        cmp     byte [edi], 0
21
        cmp     byte [edi], 0
-
 
22
        jne     .scanloop
-
 
23
 
18
        jne     .scanloop
24
  .error:
Line 19... Line 25...
19
 
25
        mcall   send, [socketnum2], str500, str500.length, 0
20
  .error:
26
 
Line 21... Line 27...
21
        ret
27
        ret
22
 
28
 
Line 23... Line 29...
23
 
29
 
Line 43... Line 49...
43
        dd cmdNOOP
49
        dd cmdNOOP
Line 44... Line 50...
44
 
50
 
45
        db 'PWD', 0
51
        db 'PASS'
Line -... Line 52...
-
 
52
        dd cmdPASS
-
 
53
 
-
 
54
        db 'PWD', 0
46
        dd cmdPWD
55
        dd cmdPWD
47
 
56
 
Line 48... Line 57...
48
        db 'PORT'
57
        db 'PORT'
49
        dd cmdPORT
58
        dd cmdPORT
Line 104... Line 113...
104
 
113
 
Line 105... Line 114...
105
align 4
114
align 4
Line 106... Line 115...
106
cmdPWD:
115
cmdPASS:
-
 
116
 
-
 
117
        mcall   send, [socketnum2], str230, str230.length, 0
-
 
118
        mov     [state], STATE_ACTIVE
-
 
119
 
-
 
120
        ret
-
 
121
 
-
 
122
align 4
-
 
123
cmdPWD:
107
 
124
 
Line 108... Line 125...
108
        ret
125
        ret
Line 109... Line 126...
109
 
126
 
Line 116... Line 133...
116
cmdQUIT:
133
cmdQUIT:
Line 117... Line 134...
117
 
134
 
118
        ret
135
        mcall   send, [socketnum2], str221, str221.length, 0
Line -... Line 136...
-
 
136
        mcall   close, [socketnum2]
-
 
137
 
-
 
138
        ret
119
 
139
 
Line 120... Line 140...
120
align 4
140
align 4
121
cmdRETR:
141
cmdRETR:
Line 131... Line 151...
131
cmdSYST:
151
cmdSYST:
Line 132... Line 152...
132
 
152
 
133
        ret
153
        mcall   send, [socketnum2], str215, str215.length, 0
Line -... Line 154...
-
 
154
 
-
 
155
        ret
134
 
156
 
Line 135... Line 157...
135
align 4
157
align 4
136
cmdTYPE:
158
cmdTYPE:
Line 137... Line 159...
137
 
159
 
Line 138... Line 160...
138
        ret
160
        ret
139
 
161
 
Line -... Line 162...
-
 
162
align 4
-
 
163
cmdUSER:
-
 
164
 
140
align 4
165
        mcall   send, [socketnum2], str331, str331.length, 0
Line 141... Line 166...
141
cmdUSER:
166
        mov     [state], STATE_LOGIN
142
 
167
 
143
        ret
168
        ret
-
 
169
 
144
 
170
 
145
 
171
 
146
 
172
str150  db '150 Here it comes...', 13, 10
-
 
173
str200  db '200 Command OK.', 13, 10
147
str150  db '150 Here it comes...', 13, 10
174
str215  db '215 UNIX type: L8', 13, 10
148
str200  db '200 Command OK.', 13, 10
175
.length = $ - str215
149
str215  db '215 UNIX type: L8', 13, 10
176
str220  db '220 KolibriOS FTP Daemon 1.0', 13, 10
-
 
177
.length = $ - str220
150
str220  db '220 KolibriOS FTP Daemon 1.0', 13, 10
178
str221  db '221 Bye!', 13, 10
151
.length = $ - str220
179
.length = $ - str221
152
str221  db '221 Bye!', 13, 10
180
str225  db '225 Abort successful', 13, 10
-
 
181
str226  db '226 Transfer OK, Closing connection', 13, 10
153
str225  db '225 Abort successful', 13, 10
182
str230  db '230 You are now logged in.', 13, 10
-
 
183
.length = $ - str230
154
str226  db '226 Transfer OK, Closing connection', 13, 10
184
str250  db '250 command successful', 13, 10