Subversion Repositories Kolibri OS

Rev

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

Rev 5545 Rev 6709
Line 309... Line 309...
309
.wait:
309
.wait:
310
; 2c. Wait for event with timeout.
310
; 2c. Wait for event with timeout.
311
        mcall   23      ; wait for event - must be stack event
311
        mcall   23      ; wait for event - must be stack event
312
; 2d. Check for timeout.
312
; 2d. Check for timeout.
313
        test    eax, eax
313
        test    eax, eax
314
        lea     eax, [esp+4]    ; pointer to (1)
-
 
315
        jz      .timeout
314
        jz      .timeout
316
; 3. Got packet. Call processing function.
315
; 3. Got packet. Call processing function.
317
        push    edi     ; second parameter: pointer to result
316
        push    edi     ; second parameter: pointer to result
318
        push    eax     ; first parameter: pointer to reqdata
317
        push    eax     ; first parameter: pointer to reqdata
319
        call    getaddrinfo_process
318
        call    getaddrinfo_process
Line 327... Line 326...
327
; 2f. Check that time is not over; if not, continue wait loop
326
; 2f. Check that time is not over; if not, continue wait loop
328
        cmp     ebx, 500
327
        cmp     ebx, 500
329
        jbe     .wait
328
        jbe     .wait
330
.timeout:
329
.timeout:
331
; 5. Timeout: abort and return error
330
; 5. Timeout: abort and return error
-
 
331
        lea     eax, [esp+4]    ; pointer to (1)
332
        push    eax
332
        push    eax
333
        call    getaddrinfo_abort
333
        call    getaddrinfo_abort
334
        and     dword [edi], 0
334
        and     dword [edi], 0
335
        push    EAI_AGAIN
335
        push    EAI_AGAIN
336
        pop     eax
336
        pop     eax
Line 676... Line 676...
676
        stosd
676
        stosd
677
; 7. Get DNS server address.
677
; 7. Get DNS server address.
678
        mcall   76, API_IPv4 + (1 shl 8) + 4 ; protocol IP=0, device number=0, function=get DNS address
678
        mcall   76, API_IPv4 + (1 shl 8) + 4 ; protocol IP=0, device number=0, function=get DNS address
679
        cmp     eax, -1
679
        cmp     eax, -1
680
        je      .ret.dnserr
680
        je      .ret.dnserr
681
        mov     esi, eax        ; put server address to esi
681
        push    eax             ; save server address to the stack
682
; 8. Open UDP socketnum to DNS server, port 53.
682
; 8. Open UDP socketnum to DNS server, port 53.
683
; 8a. Create new socketnum.
683
; 8a. Create new socketnum.
684
        mcall   75, 0, AF_INET4, SOCK_DGRAM
684
        mcall   75, 0, AF_INET4, SOCK_DGRAM, 0
-
 
685
        pop     esi             ; restore server address saved at step 7
685
        cmp     eax, -1 ; error?
686
        cmp     eax, -1 ; error?
686
        jz      .ret.dnserr
687
        jz      .ret.dnserr
687
        mov     ecx, eax        ; put socketnum handle to ecx
688
        mov     ecx, eax        ; put socketnum handle to ecx
688
; 8b. Create sockaddr structure on the stack.
689
; 8b. Create sockaddr structure on the stack.
689
        push    0
690
        push    0
690
        push    0       ; sin_zero
691
        push    0       ; sin_zero
691
        push    esi     ; sin_addr
692
        push    edi     ; sin_addr
692
        push    AF_INET4 + (53 shl 24)
693
        push    AF_INET4 + (53 shl 24)
693
                        ; sin_family and sin_port in network byte order
694
                        ; sin_family and sin_port in network byte order
694
; 8c. Connect.
695
; 8c. Connect.
695
        mcall   75, 4, , esp, sizeof.sockaddr_in
696
        mcall   75, 4, , esp, sizeof.sockaddr_in
696
; 8d. Restore the stack, undo 8b.
697
; 8d. Restore the stack, undo 8b.