2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2019-05-05 17:15:37 +00:00
|
|
|
|
AUTO 3,1
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # DNS.Clear
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Clear DNS Cache
|
2023-10-18 05:41:12 +00:00
|
|
|
|
* ## ASM
|
2021-05-19 12:44:47 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
DNS.Clear ldx #K.DNSCACHE.SIZE*S.DNSCACHE
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.1 stz DNS.CACHE-1,x
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # DNS.Query
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Query DNS for specified host
|
2023-10-18 05:41:12 +00:00
|
|
|
|
* ## ASM
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* PUSHW = PTR to IP to fill with cached data
|
2021-05-19 12:44:47 +00:00
|
|
|
|
* PUSHW = hostname PTR to PSTR
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* CC: hit: IP filled with address
|
2021-05-19 12:44:47 +00:00
|
|
|
|
* CS: missed
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
DNS.Query >PULLW ZPPtrDNS Get host string
|
2016-01-09 22:36:24 +00:00
|
|
|
|
>PULLW ZPPtrIP Get IP address to fill
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
DNS.Query.I jsr DNS.FIND.BY.NAME
|
2016-03-15 17:16:14 +00:00
|
|
|
|
bcs DNS.REQUEST
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
lda (ZPCachePtr) get status...
|
|
|
|
|
bpl .9 Pending...
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
lda ZPCachePtr
|
|
|
|
|
clc
|
2016-03-27 21:06:56 +00:00
|
|
|
|
adc #S.DNSCACHE.IP
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sta ZPCachePtr
|
|
|
|
|
bcc .1
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
inc ZPCachePtr+1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.1 ldy #3
|
2016-03-27 21:06:56 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.2 lda (ZPCachePtr),y
|
2016-01-09 22:36:24 +00:00
|
|
|
|
sta (ZPPtrIP),y
|
2016-03-15 17:16:14 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.9 lda #ERR.DNS.PENDING
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2016-03-13 22:09:00 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-08 15:41:00 +00:00
|
|
|
|
DNS.REQUEST lda hDNSSocket
|
2018-09-10 15:07:26 +00:00
|
|
|
|
beq .99
|
2016-03-27 21:06:56 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
jsr DNS.CSTR2DNS Y=DNS string len+0
|
|
|
|
|
bcs .99
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda /S.DNS.QTYPE.A
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta DNS.MSG,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #S.DNS.QTYPE.A
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta DNS.MSG,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda /S.DNS.QCLASS.IN
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta DNS.MSG,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda #S.DNS.QCLASS.IN
|
2016-03-13 22:09:00 +00:00
|
|
|
|
sta DNS.MSG,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
|
|
|
|
sty DNS.MSG.LEN
|
|
|
|
|
stz DNS.MSG.LEN+1
|
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
>LDYA A2osX.R16
|
2016-03-15 17:16:14 +00:00
|
|
|
|
>STYA DNS.MSG.ID
|
|
|
|
|
>STYA DNS.TmpCache+S.DNSCACHE.ID
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
lda #S.DNSCACHE.STATUS.PENDING
|
2023-01-06 14:02:35 +00:00
|
|
|
|
ldx #K.DNS.PENDING.TTL
|
2016-03-15 17:16:14 +00:00
|
|
|
|
jsr DNS.ADD.I
|
|
|
|
|
bcs .9
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
jsr DNS.REQUEST.SEND
|
|
|
|
|
bcs .99
|
2018-10-08 15:41:00 +00:00
|
|
|
|
|
|
|
|
|
lda #ERR.DNS.PENDING
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-09-10 15:07:26 +00:00
|
|
|
|
|
|
|
|
|
.99 lda #ERR.DNS.ERROR
|
2019-06-05 15:34:49 +00:00
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
2018-09-10 15:07:26 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DNS.REQUEST.SEND
|
2018-11-06 19:26:45 +00:00
|
|
|
|
>LDYAI UDP.PORT.DNS
|
|
|
|
|
>STYA SA.REMOTE+S.SOCKADDR.PORT
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
ldy #3
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-11-06 19:26:45 +00:00
|
|
|
|
.1 lda IPCFG+S.IPCFG.DNS1,y
|
2018-11-01 08:53:47 +00:00
|
|
|
|
sta SA.REMOTE+S.SOCKADDR.ADDR,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-11-06 19:26:45 +00:00
|
|
|
|
jsr .4
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2020-09-05 13:38:04 +00:00
|
|
|
|
lda IPCFG+S.IPCFG.DNS2
|
|
|
|
|
beq .8
|
|
|
|
|
|
2018-11-06 19:26:45 +00:00
|
|
|
|
ldy #3
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-11-06 19:26:45 +00:00
|
|
|
|
.2 lda IPCFG+S.IPCFG.DNS2,y
|
|
|
|
|
sta SA.REMOTE+S.SOCKADDR.ADDR,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
2018-10-08 15:41:00 +00:00
|
|
|
|
|
2021-05-19 12:44:47 +00:00
|
|
|
|
.4 >PUSHB hDNSSocket
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>PUSHW L.DNS.MSG
|
2021-05-19 12:44:47 +00:00
|
|
|
|
>PUSHW DNS.MSG.LEN
|
|
|
|
|
>PUSHW L.SA.REMOTE
|
2018-10-08 15:41:00 +00:00
|
|
|
|
jmp SKT.SendTo
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2018-11-06 19:26:45 +00:00
|
|
|
|
.8 clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2018-09-10 15:07:26 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DNS.CSTR2DNS lda (ZPPtrDNS)
|
|
|
|
|
beq .9
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
>LDYA ZPPtrDNS
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 strlen
|
2018-09-10 15:07:26 +00:00
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
bne .9
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
cpy #K.DNS.MAXLEN-1
|
|
|
|
|
bcs .9
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
lda #0 Ending 0
|
|
|
|
|
sta DNS.MSG.NAME+1,y
|
|
|
|
|
|
|
|
|
|
phy save len for later
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
dey
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
.1 lda (ZPPtrDNS),y
|
|
|
|
|
and #$7f
|
|
|
|
|
cmp #'.'
|
2019-10-06 12:50:43 +00:00
|
|
|
|
beq .3
|
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
cmp #'A'
|
2019-10-06 12:50:43 +00:00
|
|
|
|
bcc .2
|
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
cmp #'Z'+1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
bcs .2
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
adc #$20
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
|
|
|
|
.2 inx
|
|
|
|
|
bra .4
|
|
|
|
|
|
|
|
|
|
.3 txa
|
2018-09-10 15:07:26 +00:00
|
|
|
|
ldx #0
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
|
|
|
|
.4 sta DNS.MSG.NAME+1,y
|
2018-09-10 15:07:26 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
stx DNS.MSG.NAME
|
2018-09-10 20:42:21 +00:00
|
|
|
|
pla Get back Len
|
|
|
|
|
sec +1
|
|
|
|
|
adc #S.DNS-S.UDP compute offset next to NAME
|
|
|
|
|
tay
|
|
|
|
|
* clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2018-09-10 15:07:26 +00:00
|
|
|
|
.9 sec
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # DNS.Add
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Add a static DNS record
|
2023-10-18 05:41:12 +00:00
|
|
|
|
* ## ASM
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* PUSHW = PTR to IP
|
2018-05-23 15:27:37 +00:00
|
|
|
|
* PUSHW = hostname CSTR to Add
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*\--------------------------------------
|
|
|
|
|
DNS.Add >PULLW ZPPtrDNS Get host string
|
2016-01-09 22:36:24 +00:00
|
|
|
|
>PULLW ZPPtrIP Get host IP address
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-16 16:37:02 +00:00
|
|
|
|
ldy #3
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-16 16:37:02 +00:00
|
|
|
|
.1 lda (ZPPtrIP),y
|
|
|
|
|
sta DNS.TmpCache+S.DNSCACHE.IP,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2023-01-06 14:02:35 +00:00
|
|
|
|
lda #S.DNSCACHE.STATUS.RESOLVED+S.DNSCACHE.STATUS.STATIC
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
DNS.ADD.I sta DNS.TmpCache
|
|
|
|
|
stx DNS.TmpCache+S.DNSCACHE.TTL
|
2016-03-16 16:37:02 +00:00
|
|
|
|
stz DNS.TmpCache+S.DNSCACHE.TTL+1
|
|
|
|
|
stz DNS.TmpCache+S.DNSCACHE.TTL+2
|
|
|
|
|
stz DNS.TmpCache+S.DNSCACHE.TTL+3
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
jsr DNS.FIND.BY.NAME
|
2016-03-27 21:06:56 +00:00
|
|
|
|
bcc .2 Found, go update...
|
2016-03-16 16:37:02 +00:00
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
jsr DNS.FIND.FREE
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
>LDYA ZPPtrDNS
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 strdup
|
2016-03-15 17:16:14 +00:00
|
|
|
|
bcs .9
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-10-26 21:46:01 +00:00
|
|
|
|
txa
|
2016-03-27 21:06:56 +00:00
|
|
|
|
ldy #S.DNSCACHE.hNAME
|
|
|
|
|
sta (ZPCachePtr),y
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
.2 lda DNS.TmpCache
|
|
|
|
|
sta (ZPCachePtr)
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
ldy #S.DNSCACHE.ID
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-16 16:37:02 +00:00
|
|
|
|
.3 lda DNS.TmpCache,y
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sta (ZPCachePtr),y
|
2016-03-27 21:06:56 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.DNSCACHE
|
|
|
|
|
bne .3
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
clc
|
2016-03-27 21:06:56 +00:00
|
|
|
|
.9 rts
|
2017-02-15 16:14:41 +00:00
|
|
|
|
*/--------------------------------------
|
2017-10-06 15:25:14 +00:00
|
|
|
|
* # DNS.GetCAche
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Return a Ptr to DNS Cache Table
|
2023-10-18 05:41:12 +00:00
|
|
|
|
* ## ASM
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2017-02-15 16:14:41 +00:00
|
|
|
|
* Y,A = PTR to DNS.CACHE
|
|
|
|
|
*\--------------------------------------
|
2017-10-06 15:25:14 +00:00
|
|
|
|
DNS.GetCAche >LDYA L.DNS.CACHE
|
2019-10-06 12:50:43 +00:00
|
|
|
|
>STYA ZPCachePtr
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DNS.FIND.BY.NAME
|
2019-10-06 12:50:43 +00:00
|
|
|
|
jsr DNS.GetCAche
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
ldx #K.DNSCACHE.SIZE
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.1 lda (ZPCachePtr)
|
|
|
|
|
beq .6 empty DNS cache entry?
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
phx
|
2018-09-06 12:27:37 +00:00
|
|
|
|
>PUSHW ZPPtrDNS
|
2016-03-15 17:16:14 +00:00
|
|
|
|
ldy #S.DNSCACHE.hNAME
|
|
|
|
|
lda (ZPCachePtr),y
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 GetMemPtr
|
2021-05-04 17:31:21 +00:00
|
|
|
|
>PUSHYA
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 StrCaseCmp
|
2019-05-13 15:40:37 +00:00
|
|
|
|
plx
|
2018-01-15 16:51:44 +00:00
|
|
|
|
bcc .8
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
|
|
|
|
.6 jsr DNS.NextCache
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-10-06 12:50:43 +00:00
|
|
|
|
dex
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bne .1
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sec
|
2018-01-15 16:51:44 +00:00
|
|
|
|
.8 rts
|
2016-03-15 17:16:14 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-17 07:31:11 +00:00
|
|
|
|
DNS.UPDATE.BY.ID
|
2019-10-06 12:50:43 +00:00
|
|
|
|
jsr DNS.GetCAche
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
ldx #K.DNSCACHE.SIZE
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
.1 lda (ZPCachePtr)
|
|
|
|
|
beq .6 empty DNS cache entry?
|
2016-03-27 21:06:56 +00:00
|
|
|
|
bmi .6 resolved ?
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
ldy #S.DNSCACHE.ID
|
|
|
|
|
lda (ZPCachePtr),y
|
|
|
|
|
cmp DNS.TmpCache+S.DNSCACHE.ID
|
|
|
|
|
bne .6
|
2023-01-06 14:02:35 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZPCachePtr),y
|
|
|
|
|
cmp DNS.TmpCache+S.DNSCACHE.ID+1
|
|
|
|
|
bne .6
|
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
lda #S.DNSCACHE.STATUS.RESOLVED
|
|
|
|
|
sta (ZPCachePtr)
|
|
|
|
|
ldy #S.DNSCACHE.TTL
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
.2 lda DNS.TmpCache,y
|
|
|
|
|
sta (ZPCachePtr),y
|
2016-03-27 21:06:56 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #S.DNSCACHE
|
2016-03-17 07:31:11 +00:00
|
|
|
|
bne .2
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
|
|
|
|
.6 jsr DNS.NextCache
|
|
|
|
|
|
|
|
|
|
dex
|
2016-03-17 07:31:11 +00:00
|
|
|
|
bne .1
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-06 12:50:43 +00:00
|
|
|
|
DNS.FIND.FREE jsr DNS.GetCAche
|
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
sta TmpDWord
|
|
|
|
|
sta TmpDWord+1
|
|
|
|
|
sta TmpDWord+2
|
|
|
|
|
sta TmpDWord+3
|
2019-05-13 15:40:37 +00:00
|
|
|
|
|
|
|
|
|
ldx #K.DNSCACHE.SIZE
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.1 lda (ZPCachePtr)
|
|
|
|
|
beq .8 empty DNS cache entry?
|
2019-05-13 15:40:37 +00:00
|
|
|
|
|
2018-05-24 15:21:38 +00:00
|
|
|
|
bit #S.DNSCACHE.STATUS.STATIC+S.DNSCACHE.STATUS.PENDING
|
2019-05-13 15:40:37 +00:00
|
|
|
|
bne .7 Static/Pending.....skip
|
2023-01-06 14:02:35 +00:00
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
phx
|
2016-03-15 17:16:14 +00:00
|
|
|
|
ldy #S.DNSCACHE.TTL
|
2016-03-16 16:37:02 +00:00
|
|
|
|
ldx #3
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sec
|
2023-01-06 14:02:35 +00:00
|
|
|
|
|
2016-03-27 21:06:56 +00:00
|
|
|
|
.2 lda TmpDWord,x is saved TTL greater then actual TTL?
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sbc (ZPCachePtr),y
|
|
|
|
|
iny
|
2016-03-16 16:37:02 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
bcc .6 no,
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
ldy #S.DNSCACHE.TTL
|
2016-03-16 16:37:02 +00:00
|
|
|
|
ldx #3
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.3 lda (ZPCachePtr),y Save new lowest TTL
|
|
|
|
|
sta TmpDWord,x
|
|
|
|
|
iny
|
2016-03-16 16:37:02 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
>LDYA ZPCachePtr
|
|
|
|
|
>STYA ZPTmpPtr1 save lowest TTL slot ...
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
.6 plx
|
|
|
|
|
|
2019-10-06 12:50:43 +00:00
|
|
|
|
.7 jsr DNS.NextCache
|
|
|
|
|
|
|
|
|
|
dex
|
2016-03-15 17:16:14 +00:00
|
|
|
|
bne .1 no empty slot found, discard lowest TTL
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
>LDYA ZPTmpPtr1
|
|
|
|
|
>STYA ZPCachePtr
|
2016-03-16 16:37:02 +00:00
|
|
|
|
jsr DNS.FREE
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2016-03-15 17:16:14 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-06 12:50:43 +00:00
|
|
|
|
DNS.EXPIRE jsr DNS.GetCAche
|
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
ldx #K.DNSCACHE.SIZE
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.1 lda (ZPCachePtr)
|
|
|
|
|
beq .7 empty DNS cache entry?
|
2019-05-13 15:40:37 +00:00
|
|
|
|
|
2018-05-24 15:21:38 +00:00
|
|
|
|
bit #S.DNSCACHE.STATUS.STATIC
|
|
|
|
|
bne .7
|
2019-05-13 15:40:37 +00:00
|
|
|
|
phx
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
ldy #S.DNSCACHE.TTL
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
ldx #4
|
|
|
|
|
clc
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
2016-03-15 17:16:14 +00:00
|
|
|
|
.2 lda (ZPCachePtr),y
|
|
|
|
|
sbc #0
|
|
|
|
|
sta (ZPCachePtr),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-03-15 17:16:14 +00:00
|
|
|
|
dex
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
bcs .6
|
2016-03-15 17:16:14 +00:00
|
|
|
|
jsr DNS.FREE
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.6 plx
|
2019-10-06 12:50:43 +00:00
|
|
|
|
|
|
|
|
|
.7 jsr DNS.NextCache
|
|
|
|
|
|
2019-05-13 15:40:37 +00:00
|
|
|
|
.8 dex
|
2016-03-15 17:16:14 +00:00
|
|
|
|
bne .1
|
2019-05-13 15:40:37 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-15 17:16:14 +00:00
|
|
|
|
DNS.FREE ldy #S.DNSCACHE.hNAME
|
|
|
|
|
lda (ZPCachePtr),y
|
2016-03-20 22:16:01 +00:00
|
|
|
|
beq .1
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 FreeMem
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.1 lda #0
|
2016-03-15 17:16:14 +00:00
|
|
|
|
sta (ZPCachePtr)
|
2019-10-03 06:25:27 +00:00
|
|
|
|
DNS.FREE.RTS rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-08 15:41:00 +00:00
|
|
|
|
DNS.POLL lda hDNSSocket
|
2019-06-05 15:34:49 +00:00
|
|
|
|
beq DNS.FREE.RTS
|
|
|
|
|
|
2018-10-08 15:41:00 +00:00
|
|
|
|
jsr SKT.Recv
|
2019-06-05 15:34:49 +00:00
|
|
|
|
bcs DNS.FREE.RTS
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2019-06-05 15:34:49 +00:00
|
|
|
|
sta hFrameIn
|
2019-05-05 17:15:37 +00:00
|
|
|
|
>SYSCALL2 GetMemPtr
|
2017-01-31 16:40:37 +00:00
|
|
|
|
>STYA ZPFrameInPtr
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2018-11-01 08:53:47 +00:00
|
|
|
|
ldy #S.DNS.F
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
and /S.DNS.F.QR
|
|
|
|
|
beq .9
|
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
ldy #S.DNS.ID
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-27 21:06:56 +00:00
|
|
|
|
sta DNS.TmpCache+S.DNSCACHE.ID
|
2016-03-17 07:31:11 +00:00
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-27 21:06:56 +00:00
|
|
|
|
sta DNS.TmpCache+S.DNSCACHE.ID+1
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldy #S.DNS.ANCOUNT+1
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
beq .9
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
pha save Answer count...
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldy #S.DNS.QDCOUNT+1
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-20 22:16:01 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DNS Point to DATA
|
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
tax
|
|
|
|
|
beq .3 no QUERY to skip
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
beq .2
|
2016-03-20 22:16:01 +00:00
|
|
|
|
bpl .11 Pointer ?
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
iny yes, skip 2 bytes
|
2016-03-13 22:09:00 +00:00
|
|
|
|
iny
|
2016-03-20 22:16:01 +00:00
|
|
|
|
bra .2
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.11 tya
|
|
|
|
|
sec
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc (ZPFrameInPtr),y Skip LEN+1 bytes
|
2016-03-13 22:09:00 +00:00
|
|
|
|
tay
|
2016-03-20 22:16:01 +00:00
|
|
|
|
bra .1
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2021-05-19 12:44:47 +00:00
|
|
|
|
.2 iny
|
2016-03-20 22:16:01 +00:00
|
|
|
|
iny
|
|
|
|
|
iny Skip QTYPE & QCLASS
|
|
|
|
|
iny
|
2016-03-27 21:06:56 +00:00
|
|
|
|
iny next pos
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.21 dex skip another QUERY ?
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .1
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
plx get back answer count
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.3 lda (ZPFrameInPtr),y
|
2016-03-20 22:16:01 +00:00
|
|
|
|
beq .32
|
2021-05-19 12:44:47 +00:00
|
|
|
|
bpl .31 Pointer ?
|
2016-03-20 22:16:01 +00:00
|
|
|
|
iny yes, skip 2 bytes
|
2016-03-17 07:31:11 +00:00
|
|
|
|
iny
|
2016-03-20 22:16:01 +00:00
|
|
|
|
bra .32
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.31 tya
|
|
|
|
|
sec
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc (ZPFrameInPtr),y Skip LEN+1 bytes
|
2016-03-20 22:16:01 +00:00
|
|
|
|
tay
|
|
|
|
|
bra .3
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.32 iny skip S.DNS.QTYPE HIGH
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2016-03-17 07:31:11 +00:00
|
|
|
|
cmp #S.DNS.QTYPE.A
|
2016-03-20 22:16:01 +00:00
|
|
|
|
beq .40
|
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc #7 skip CLASS,TTL+DATALENHIGH
|
|
|
|
|
tay
|
|
|
|
|
sec skip DATALENLO
|
2017-01-31 16:40:37 +00:00
|
|
|
|
adc (ZPFrameInPtr),y add DATALEN
|
2016-03-20 22:16:01 +00:00
|
|
|
|
tay
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
bra .9
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-20 22:16:01 +00:00
|
|
|
|
.40 iny skip QCLASS
|
2016-03-17 07:31:11 +00:00
|
|
|
|
iny
|
2016-03-27 21:06:56 +00:00
|
|
|
|
iny next pos
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
ldx #3
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.4 lda (ZPFrameInPtr),y
|
2016-03-17 07:31:11 +00:00
|
|
|
|
sta DNS.TmpCache+S.DNSCACHE.TTL,x
|
2016-03-20 22:16:01 +00:00
|
|
|
|
iny
|
2016-03-17 07:31:11 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .4
|
|
|
|
|
|
|
|
|
|
iny skip DATALEN
|
|
|
|
|
iny
|
|
|
|
|
ldx #0
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.5 lda (ZPFrameInPtr),y
|
2016-03-17 07:31:11 +00:00
|
|
|
|
sta DNS.TmpCache+S.DNSCACHE.IP,x
|
2016-03-27 21:06:56 +00:00
|
|
|
|
iny
|
2016-03-17 07:31:11 +00:00
|
|
|
|
inx
|
|
|
|
|
cpx #4
|
|
|
|
|
bne .5
|
2020-09-05 13:38:04 +00:00
|
|
|
|
|
2016-03-17 07:31:11 +00:00
|
|
|
|
jsr DNS.UPDATE.BY.ID
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
.9 jmp FRM.DiscardIn
|
2016-03-13 22:09:00 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-06 12:50:43 +00:00
|
|
|
|
DNS.NextCache lda ZPCachePtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.DNSCACHE
|
|
|
|
|
sta ZPCachePtr
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPCachePtr+1
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-10-06 12:50:43 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2020-06-07 08:06:51 +00:00
|
|
|
|
SAVE usr/src/lib/libtcpip.s.dns
|
|
|
|
|
LOAD usr/src/lib/libtcpip.s
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|