Rev 1206 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1206 | Rev 1208 | ||
---|---|---|---|
Line 673... | Line 673... | ||
673 | ; query class = IN (internet IPv4 address) = 1 |
673 | ; query class = IN (internet IPv4 address) = 1 |
674 | ; Note that network byte order is big-endian. |
674 | ; Note that network byte order is big-endian. |
675 | mov eax, 0x01000100 |
675 | mov eax, 0x01000100 |
676 | stosd |
676 | stosd |
677 | ; 7. Get DNS server address. |
677 | ; 7. Get DNS server address. |
678 | ; Get number of running cards. |
- | |
679 | mcall 73, -1 |
- | |
680 | xchg eax, edx |
- | |
681 | ; Loop for all initialized network cards, scanning for initialized DNS address. |
- | |
682 | mov ebx, 0x00000004 ; protocol IP=0, device number=0, function=get DNS address |
678 | mcall 75, 0x00000004 ; protocol IP=0, device number=0, function=get DNS address |
683 | .get_dns_loop: |
- | |
684 | mcall 75 |
- | |
685 | cmp eax, -1 |
679 | cmp eax, -1 |
686 | jz .get_dns_next |
- | |
687 | test ecx, ecx |
- | |
688 | jnz .got_dns |
- | |
689 | dec edx |
- | |
690 | jz .get_dns_done |
- | |
691 | .get_dns_next: |
- | |
692 | inc bh |
- | |
693 | jnz .get_dns_loop |
- | |
694 | ; all possible devices were checked, none found - return error |
- | |
695 | .get_dns_done: |
- | |
696 | jmp .ret.dnserr |
680 | je .ret.dnserr |
697 | .got_dns: |
- | |
698 | mov esi, ecx ; put server address to esi |
681 | mov esi, eax ; put server address to esi |
699 | ; 8. Open UDP socket to DNS server, port 53. |
682 | ; 8. Open UDP socket to DNS server, port 53. |
700 | ; 8a. Create new socket. |
683 | ; 8a. Create new socket. |
701 | mcall 74, 0, AF_INET, IPPROTO_UDP |
684 | mcall 74, 0, AF_INET, IPPROTO_UDP |
702 | cmp eax, -1 ; error? |
685 | cmp eax, -1 ; error? |
703 | jz .ret.dnserr |
686 | jz .ret.dnserr |
704 | xchg ecx, eax ; put socket handle to ecx |
687 | mov ecx, eax ; put socket handle to ecx |
705 | ; 8b. Create sockaddr structure on the stack. |
688 | ; 8b. Create sockaddr structure on the stack. |
706 | push 0 |
689 | push 0 |
707 | push 0 ; sin_zero |
690 | push 0 ; sin_zero |
708 | push esi ; sin_addr |
691 | push esi ; sin_addr |
709 | push AF_INET + (53 shl 24) |
692 | push AF_INET + (53 shl 24) |
710 | ; sin_family and sin_port in network byte order |
693 | ; sin_family and sin_port in network byte order |
711 | ; 8c. Call the system. |
694 | ; 8c. Connect. |
712 | mcall 74, 4, , esp, sizeof.sockaddr_in |
695 | mcall 74, 4, , esp, sizeof.sockaddr_in |
713 | ; 8d. Restore the stack, undo 8b. |
696 | ; 8d. Restore the stack, undo 8b. |
714 | add esp, esi |
697 | add esp, esi |
715 | ; 8e. Check result. |
698 | ; 8e. Check result. |
716 | cmp eax, -1 |
699 | cmp eax, -1 |
Line 776... | Line 759... | ||
776 | push ebx esi edi |
759 | push ebx esi edi |
777 | mov edi, [.reqdata] |
760 | mov edi, [.reqdata] |
778 | ; 2. Read UDP datagram. |
761 | ; 2. Read UDP datagram. |
779 | mov ecx, [edi+__gai_reqdata.socket] |
762 | mov ecx, [edi+__gai_reqdata.socket] |
780 | push edi |
763 | push edi |
781 | mcall 74, 6, , , 512, 0 |
764 | mcall 74, 7, , , 512, 0 |
782 | pop edi |
765 | pop edi |
783 | ; 3. Ignore events for other sockets (return if no data read) |
766 | ; 3. Ignore events for other sockets (return if no data read) |
784 | test eax, eax |
767 | test eax, eax |
785 | jz .ret.more_processing_required |
768 | jz .ret.more_processing_required |
786 | ; 4. Sanity check: discard too short packets. |
769 | ; 4. Sanity check: discard too short packets. |