A2osX/LIB/LIBTCPIP.S.ICMP.txt

80 lines
1.6 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-05-05 17:15:37 +00:00
AUTO 3,1
.LIST OFF
*--------------------------------------
ICMP.IN ldy #S.ICMP.TYPE
lda (ZPFrameInPtr),y
cmp #S.ICMP.TYPE.ECHOREP
beq ICMP.IN.ECHOREP
cmp #S.ICMP.TYPE.ECHOREQ
bne ICMP.IN.EXIT
*--------------------------------------
ICMP.IN.ECHOREQ ldy #S.IP.DST+3
ldx #3
.1 lda (ZPFrameInPtr),y
cmp IPCFG+S.IPCFG.IP,x
bne ICMP.IN.EXIT
dey
dex
bne .1
ldy #S.ICMP.TYPE
lda #S.ICMP.TYPE.ECHOREP
sta (ZPFrameInPtr),y
2018-09-21 15:28:46 +00:00
jsr ARP.AddFromFrameInPtr
2018-09-21 15:28:46 +00:00
lda hFrameIn
2019-06-05 15:34:49 +00:00
* stz hFrameIn DO NOT DISCARD this frame,it is SOURCE frame!!!
2018-09-21 15:28:46 +00:00
sta hFrameOut
>LDYA ZPFrameInPtr
>STYA ZPFrameOutPtr
ldx #3
2018-09-21 15:28:46 +00:00
ldy #S.IP.DST+3
2016-03-16 07:19:54 +00:00
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
2018-09-21 15:28:46 +00:00
sta (ZPFrameOutPtr),y
dey
dex
bpl .3
2019-07-07 20:48:57 +00:00
clc Queue if fail
jmp FRM.SendIP
ICMP.IN.EXIT lda hFrameIn
2018-08-08 15:13:37 +00:00
beq .8
2019-05-05 17:15:37 +00:00
>SYSCALL2 FreeMem
2018-09-18 20:43:48 +00:00
stz hFrameIn
2018-08-08 15:13:37 +00:00
.8 rts
*--------------------------------------
2018-10-08 15:41:00 +00:00
ICMP.IN.ECHOREP jsr FRM.GetTargetSKT.RAW
ldy #S.ICMP.IDENTIFIER
lda (ZPFrameInPtr),y
2019-07-07 20:48:57 +00:00
sta SKT.LOC.ADDR+S.SOCKADDR.PORT+1
iny
lda (ZPFrameInPtr),y
2019-07-07 20:48:57 +00:00
sta SKT.LOC.ADDR+S.SOCKADDR.PORT
2018-10-08 15:41:00 +00:00
jsr SKT.FindMatchingLocRem
2019-06-05 15:34:49 +00:00
bcs ICMP.IN.EXIT
2018-10-08 15:41:00 +00:00
ldy #S.SOCKET.PROTO
lda (ZPPtrSKT),y
cmp #S.IP.PROTOCOL.ICMP
2019-06-05 15:34:49 +00:00
bne ICMP.IN.EXIT
2018-10-08 15:41:00 +00:00
lda hFrameIn
jsr SKT.AddToQueueA
2019-06-05 15:34:49 +00:00
bcs ICMP.IN.EXIT Q full, discard...
rts
2017-02-13 07:26:18 +00:00
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/LIB/LIBTCPIP.S.ICMP
LOAD USR/SRC/LIB/LIBTCPIP.S
ASM