Subversion Repositories Kolibri OS

Rev

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

Rev 4710 Rev 6026
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;   Written by hidnplayr@kolibrios.org                            ;;
6
;;   Written by hidnplayr@kolibrios.org                            ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;         GNU GENERAL PUBLIC LICENSE                              ;;
8
;;         GNU GENERAL PUBLIC LICENSE                              ;;
Line 208... Line 208...
208
 
208
 
Line 209... Line 209...
209
socket_receive:
209
socket_receive:
Line 210... Line 210...
210
 
210
 
Line 211... Line 211...
211
        pusha
211
        pusha
212
 
212
 
213
; TODO: read more data if we receive one full packet
213
; FIXME: make this a proper stream!
214
 
214
 
215
  .nextpacket:
215
  .nextpacket:
216
        mcall   recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT        ; read a packet
216
        mcall   recv, [socketnum], packetbuf, 1024, MSG_DONTWAIT        ; read a packet
Line 217... Line 217...
217
        inc     eax                                                     ; check if we got any data
217
        inc     eax                                                     ; check if we got any data
Line 218... Line 218...
218
        jz      .done                                                   ; TODO: handle errors!
218
        jz      .done                                                   ; TODO: handle errors!
219
        dec     eax
219
        dec     eax
220
        jz      .disconnected
220
        jz      .disconnected
221
 
221
 
222
; ok we have data, now feed it to the recoder
222
; ok we have data, now feed it to the command splicer
223
 
223
 
224
        lea     edx, [packetbuf + eax]                  ; edx = end pointer
-
 
225
        mov     esi, packetbuf                          ; esi = start pointer
224
        mov     ecx, eax
226
  .nextcommand:
225
        mov     esi, packetbuf                          ; esi = start pointer
227
        mov     edi, servercommand
226
  .nextcommand:
228
  .byteloop:
227
        mov     edi, servercommand
229
        call    get_next_byte                           ; reads byte from [esi] to al
228
  .byteloop:
-
 
229
        lodsb
230
        jnc     .nextpacket                             ; if CF is set, we need more data (TODO: dont throw away old data!!!)
230
        cmp     al, 10
-
 
231
        je      .got_command
-
 
232
        cmp     al, 13
Line 231... Line 233...
231
        cmp     al, 10
233
        je      .got_command
Line 232... Line 234...
232
        je      .got_command
234
        stosb
233
        cmp     al, 13
235
        dec     ecx
234
        je      .got_command
236
        jnz     .byteloop
235
        stosb
237
        ;;; FIXME
236
        jmp     .byteloop
238
        jmp     .nextpacket
-
 
239
 
237
 
240
; we have a command, call the serverparser
Line 238... Line 241...
238
; we have a command, call the serverparser
241
 
239
 
242
  .got_command:
240
  .got_command:
243
        mov     byte[edi], 0                            ; mark the end of the command