mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-17 05:31:54 +00:00
Kernel version 0.9 : TCP & Sockets....
This commit is contained in:
parent
66600f0c4d
commit
69aa077d8c
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.DEV.po
BIN
A2OSX.DEV.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -247,7 +247,7 @@ Socket.Src.Addr .BS 4
|
||||
Socket.Src.Port .DA 0 Dynamic
|
||||
Socket.Dst.Addr .BS 4
|
||||
Socket.Dst.Port .DA UDP.PORT.PMAP
|
||||
.BS 16
|
||||
.BS S.SOCKET-16
|
||||
*--------------------------------------
|
||||
RPC.Request .HS 12345678 XID
|
||||
.HS 00000000 0=CALL
|
||||
|
@ -84,7 +84,8 @@ ICMP.IN.ECHOREP jsr IP.FillTmpSocketSrcDst
|
||||
lda (ZPFrameInPtr),y
|
||||
sta TmpSocket+S.SOCKET.DST.PORT
|
||||
|
||||
>LDYA L.SKT.TABLE
|
||||
lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldx #0
|
||||
|
@ -26,7 +26,8 @@ SKT.New >PULLW ZPTmpPtr1
|
||||
iny
|
||||
sta (ZPTmpPtr1),y
|
||||
|
||||
.1 >LDYA L.SKT.TABLE
|
||||
.1 lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPTmpPtr2
|
||||
|
||||
lda #$ff
|
||||
@ -79,16 +80,64 @@ SKT.New >PULLW ZPTmpPtr1
|
||||
dey
|
||||
bpl .7
|
||||
|
||||
ldx TmpOffset
|
||||
lda (ZPTmpPtr1)
|
||||
and #S.SOCKET.SOCK.MASK
|
||||
cmp #S.SOCKET.SOCK.STREAM
|
||||
bne .8
|
||||
|
||||
ldy #S.SOCKET.SO
|
||||
lda (ZPTmpPtr1),y
|
||||
and #S.SOCKET.SO.ACCEPTCONN
|
||||
bne .8
|
||||
|
||||
jsr SKT.New.TCP
|
||||
bcs .99
|
||||
|
||||
.8 ldx TmpOffset
|
||||
>LDYA ZPTmpPtr3
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #ERR.SKT.OOS
|
||||
sec
|
||||
rts
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
SKT.ACCEPTA jsr SKT.GetA.I
|
||||
SKT.New.TCP ldy #S.SOCKET.SQ.INFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hInMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hOutMem
|
||||
sta (ZPTmpPtr3),y
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
SKT.AcceptA jsr SKT.GetA.I
|
||||
bcs .9
|
||||
ldy #S.SOCKET.SO
|
||||
lda (ZPPtrSKT),y
|
||||
@ -315,7 +364,7 @@ SKT.SEND.RAW ldy #S.SOCKET.RAW.PROTO
|
||||
* ##Out :
|
||||
* A = hFrame
|
||||
*\--------------------------------------
|
||||
SKT.RCVDA jsr SKT.GetA.I
|
||||
SKT.RcvdA jsr SKT.GetA.I
|
||||
bcs .9
|
||||
|
||||
ldy #S.SOCKET.HQ.TAIL
|
||||
@ -345,13 +394,24 @@ SKT.RCVDA jsr SKT.GetA.I
|
||||
.99 sec
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* #SKT.Read (STREAM)
|
||||
* #SKT.Rcvd (STREAM)
|
||||
* ##In :
|
||||
* PULLB = hSocket
|
||||
* PULLW = pBuf
|
||||
* PULLW = len
|
||||
* ##Out :
|
||||
* Y,A = bytes read
|
||||
*\--------------------------------------
|
||||
SKT.Rcvd sec
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* #SKT.GetCA (STREAM)
|
||||
* ##In :
|
||||
* A = hSocket
|
||||
* ##Out :
|
||||
* A = hFrame
|
||||
* A = char
|
||||
*\--------------------------------------
|
||||
SKT.Read
|
||||
SKT.GetCA
|
||||
*--------------------------------------
|
||||
SKT.CLOSEA cmp #K.SKTTABLE.SIZE
|
||||
bcs SKT.GetA.9
|
||||
@ -380,33 +440,37 @@ SKT.CLOSEA cmp #K.SKTTABLE.SIZE
|
||||
*--------------------------------------
|
||||
SKT.GetA cmp #K.SKTTABLE.SIZE
|
||||
bcs SKT.GetA.9
|
||||
|
||||
jsr SKT.GetA.I
|
||||
|
||||
bcs SKT.GetA.9
|
||||
|
||||
>LDYA ZPPtrSKT
|
||||
rts
|
||||
|
||||
SKT.GetA.I stz ZPPtrSKT
|
||||
SKT.GetA.I pha
|
||||
lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
lsr
|
||||
ror ZPPtrSKT
|
||||
lsr
|
||||
ror ZPPtrSKT
|
||||
lsr
|
||||
ror ZPPtrSKT
|
||||
plx
|
||||
beq .8
|
||||
|
||||
pha
|
||||
|
||||
lda ZPPtrSKT
|
||||
adc L.SKT.TABLE
|
||||
.1 lda ZPPtrSKT
|
||||
clc
|
||||
adc #S.SOCKET
|
||||
sta ZPPtrSKT
|
||||
pla
|
||||
adc L.SKT.TABLE+1
|
||||
sta ZPPtrSKT+1
|
||||
bcc .2
|
||||
|
||||
inc ZPPtrSKT+1
|
||||
|
||||
.2 dex
|
||||
bne .1
|
||||
|
||||
lda (ZPPtrSKT)
|
||||
beq SKT.GetA.9
|
||||
|
||||
rts CC
|
||||
.8 rts CC
|
||||
|
||||
SKT.GetA.9 lda #ERR.SKT.BAD
|
||||
sec
|
||||
@ -442,7 +506,8 @@ SKT.AddToQueueA sta .2+1
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
SKT.GETTABLE >LDYA L.SKT.TABLE
|
||||
SKT.GETTABLE lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -36,7 +36,8 @@ TCP.IN ldy #S.IP.SRC+3
|
||||
lda (ZPFrameInPtr),y
|
||||
sta TmpSocket+S.SOCKET.SRC.PORT
|
||||
|
||||
>LDYA L.SKT.TABLE
|
||||
lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldx #0
|
||||
@ -194,37 +195,6 @@ TCP.IN.JMP.SYNRCVD
|
||||
lda #S.SOCKET.STATUS.ESTBLSH
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
ldy #S.SOCKET.SQ.INFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPPtrSKT),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
ldy #S.SOCKET.SQ.OUTFREE
|
||||
lda #K.TCP.WSIZE
|
||||
sta (ZPPtrSKT),y
|
||||
iny
|
||||
lda /K.TCP.WSIZE
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs *
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hInMem
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
>PUSHW K.TCP.WSIZE
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs *
|
||||
txa
|
||||
|
||||
ldy #S.SOCKET.STREAM.hOutMem
|
||||
sta (ZPPtrSKT),y
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
@ -21,7 +21,8 @@ UDP.IN jsr IP.FillTmpSocketSrcDst
|
||||
lda (ZPFrameInPtr),y
|
||||
sta TmpSocket+S.SOCKET.SRC.PORT
|
||||
|
||||
>LDYA L.SKT.TABLE
|
||||
lda hSocketTable
|
||||
>SYSCALL GetMemPtrA
|
||||
>STYA ZPPtrSKT
|
||||
|
||||
ldx #0
|
||||
|
@ -103,7 +103,6 @@ L.DNS.SOCKET .DA DNS.SOCKET
|
||||
L.DNS.MSG .DA DNS.MSG
|
||||
L.ARP.CACHE .DA ARP.CACHE
|
||||
L.DNS.CACHE .DA DNS.CACHE
|
||||
L.SKT.TABLE .DA SKT.TABLE
|
||||
L.TmpSocket .DA TmpSocket
|
||||
L.TCP.MSG .DA TCP.MSG
|
||||
L.TCP.IN.JMP .DA TCP.IN.JMP.CLOSED
|
||||
@ -127,10 +126,17 @@ LIB.LOAD lda bFirstLoad
|
||||
>LDYAI K.DYNPORT.START
|
||||
>STYA DYNPORT.LAST
|
||||
|
||||
>PUSHWI K.SKTTABLE.SIZE*S.SOCKET
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
stx hSocketTable
|
||||
|
||||
inc bFirstLoad
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
LIB.UNLOAD clc
|
||||
rts
|
||||
@ -288,7 +294,7 @@ DNS.SOCKET.SA .BS 4
|
||||
DNS.SOCKET.SP .DA 0 Dynamic
|
||||
DNS.SOCKET.DA .BS 4
|
||||
DNS.SOCKET.DP .DA UDP.PORT.DNS
|
||||
.BS 16
|
||||
.BS S.SOCKET-16
|
||||
*--------------------------------------
|
||||
DNS.MSG.LEN .BS 2
|
||||
DNS.MSG
|
||||
@ -302,7 +308,6 @@ DNS.MSG.NAME .BS K.DNS.MAXLEN+6
|
||||
IPCFG .BS S.IPCFG
|
||||
ARP.CACHE .BS K.ARPCACHE.SIZE*S.ARPCACHE
|
||||
DNS.CACHE .BS K.DNSCACHE.SIZE*S.DNSCACHE
|
||||
SKT.TABLE .BS K.SKTTABLE.SIZE*S.SOCKET
|
||||
FRM.QUEUE.Tail .BS 1
|
||||
FRM.QUEUE.Head .BS 1
|
||||
FRM.QUEUE.hMem .BS K.FRMQUEUE.SIZE
|
||||
@ -310,6 +315,7 @@ FRM.QUEUE.State .BS K.FRMQUEUE.SIZE
|
||||
FRM.QUEUE.Retry .BS K.FRMQUEUE.SIZE
|
||||
*--------------------------------------
|
||||
bFirstLoad .DA #0
|
||||
hSocketTable .BS 1
|
||||
DevFlags .BS 1
|
||||
DYNPORT.LAST .BS 2
|
||||
hDNSSocket1 .BS 1
|
||||
|
@ -11,6 +11,7 @@ AUTO 6
|
||||
.INB /A2OSX.DEV/INC/MACROS.I
|
||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||
.INB /A2OSX.DEV/INC/LIBTCPIP.I
|
||||
.INB /A2OSX.DEV/INC/DHCP.I
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 100 10 sec.
|
||||
*--------------------------------------
|
||||
@ -242,7 +243,7 @@ CS.DOEVENT lda (pEvent)
|
||||
CS.QUIT ldy #hSocket
|
||||
lda (pData),y
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
|
||||
* >LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
|
||||
|
||||
lda hLIBTCPIP
|
||||
>SYSCALL UnloadLibA
|
||||
|
Loading…
x
Reference in New Issue
Block a user