mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-09-12 02:54:54 +00:00
Export dns_hostname_is_dotted_quad.
Of course one can just always call dns_resolve after dns_set_hostname. But an application might i.e. present a different user feedback depending on the fact if a name resolution is necessary at all. So given that DNS name resolution is already a two phase action it just seems natural to allow an application to read the already exsisting variable.
This commit is contained in:
parent
97d17d9c47
commit
bed14eb3d3
11
ip65/dns.s
11
ip65/dns.s
@ -14,6 +14,7 @@ MAX_DNS_MESSAGES_SENT = 8 ; timeout after sending 8 messages will be about
|
|||||||
.export dns_resolve
|
.export dns_resolve
|
||||||
.export dns_ip
|
.export dns_ip
|
||||||
.export dns_status
|
.export dns_status
|
||||||
|
.export dns_hostname_is_dotted_quad
|
||||||
.import ip65_error
|
.import ip65_error
|
||||||
.import cfg_dns
|
.import cfg_dns
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ hostname_copied: .res 1
|
|||||||
|
|
||||||
questions_in_response: .res 1
|
questions_in_response: .res 1
|
||||||
|
|
||||||
hostname_was_dotted_quad: .res 1
|
dns_hostname_is_dotted_quad: .res 1
|
||||||
|
|
||||||
|
|
||||||
.code
|
.code
|
||||||
@ -96,6 +97,8 @@ hostname_was_dotted_quad: .res 1
|
|||||||
; (e.g. "192.168.1.0",0)
|
; (e.g. "192.168.1.0",0)
|
||||||
; outputs:
|
; outputs:
|
||||||
; carry flag is set on error (i.e. hostname too long), clear otherwise
|
; carry flag is set on error (i.e. hostname too long), clear otherwise
|
||||||
|
; dns_hostname_is_dotted_quad: 1 if the hostname is an address in "dotted quad" format, 0 otherwise
|
||||||
|
; dns_ip: set to the ip address of the hostname (if dns_hostname_is_dotted_quad is 1)
|
||||||
dns_set_hostname:
|
dns_set_hostname:
|
||||||
stax dns_hostname
|
stax dns_hostname
|
||||||
; copy the hostname into a buffer suitable to copy directly into the qname field
|
; copy the hostname into a buffer suitable to copy directly into the qname field
|
||||||
@ -104,7 +107,7 @@ dns_set_hostname:
|
|||||||
bcs @wasnt_dotted_quad
|
bcs @wasnt_dotted_quad
|
||||||
; if the string was a dotted quad, then copy the parsed 4 bytes in to dns_ip
|
; if the string was a dotted quad, then copy the parsed 4 bytes in to dns_ip
|
||||||
lda #1
|
lda #1
|
||||||
sta hostname_was_dotted_quad
|
sta dns_hostname_is_dotted_quad
|
||||||
ldx #3 ; set destination address
|
ldx #3 ; set destination address
|
||||||
: lda dotted_quad_value,x
|
: lda dotted_quad_value,x
|
||||||
sta dns_ip,x
|
sta dns_ip,x
|
||||||
@ -116,7 +119,7 @@ dns_set_hostname:
|
|||||||
ldy #0 ; input pointer
|
ldy #0 ; input pointer
|
||||||
ldx #1 ; output pointer (start at 1, to skip first length offset, which will be filled in later)
|
ldx #1 ; output pointer (start at 1, to skip first length offset, which will be filled in later)
|
||||||
|
|
||||||
sty hostname_was_dotted_quad
|
sty dns_hostname_is_dotted_quad
|
||||||
sty dns_current_label_length
|
sty dns_current_label_length
|
||||||
sty dns_current_label_offset
|
sty dns_current_label_offset
|
||||||
sty hostname_copied
|
sty hostname_copied
|
||||||
@ -180,7 +183,7 @@ dns_set_hostname:
|
|||||||
; carry flag is set if there was an error, clear otherwise
|
; carry flag is set if there was an error, clear otherwise
|
||||||
; dns_ip: set to the ip address of the hostname (if no error)
|
; dns_ip: set to the ip address of the hostname (if no error)
|
||||||
dns_resolve:
|
dns_resolve:
|
||||||
lda hostname_was_dotted_quad
|
lda dns_hostname_is_dotted_quad
|
||||||
beq @hostname_not_dotted_quad
|
beq @hostname_not_dotted_quad
|
||||||
clc
|
clc
|
||||||
rts ; we already set dns_ip when copying the hostname
|
rts ; we already set dns_ip when copying the hostname
|
||||||
|
Loading…
Reference in New Issue
Block a user