Kernel version 0.9 : Room in TCP socket for In/Out Queues

This commit is contained in:
Rémy GIBERT 2017-02-08 07:52:30 +01:00
parent ec6669ec7e
commit 3e1bb79081
11 changed files with 66 additions and 56 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -74,6 +74,7 @@ CS.RUN >LDYA L.MSG0
ldy #S.SOCKET.STATUS ldy #S.SOCKET.STATUS
lda (ZPPTR1),y lda (ZPPTR1),y
and #S.SOCKET.STATUS.MASK
asl asl
tax tax
>PUSHB L.MSG1.S+1,x >PUSHB L.MSG1.S+1,x
@ -89,6 +90,10 @@ CS.RUN >LDYA L.MSG0
bne .2 bne .2
lda (ZPPTR1) lda (ZPPTR1)
lsr
lsr
lsr
lsr
cmp #S.SOCKET.SOCK.RAW+1 cmp #S.SOCKET.SOCK.RAW+1
bcc .3 bcc .3

View File

@ -332,8 +332,9 @@ MSG.REPLY >CSTR "32 bytes from %d.%d.%d.%d, icmp_seq=%D, ttl=%d, time=%D ms\n"
hLIBTCPIP .BS 1 hLIBTCPIP .BS 1
TimeOut.ms .BS 2 TimeOut.ms .BS 2
Socket .DA #S.SOCKET.SOCK.RAW Socket .DA #S.SOCKET.SOCK.RAW
.BS 2 .BS 1
.DA #S.IP.PROTOCOL.ICMP .DA #S.IP.PROTOCOL.ICMP
.BS 1
Socket.Src.Addr .BS 4 Socket.Src.Addr .BS 4
Socket.Src.Port .DA 0 Dynamic Socket.Src.Port .DA 0 Dynamic
Socket.Dst.Addr .BS 4 Socket.Dst.Addr .BS 4

View File

@ -131,21 +131,12 @@ S.DNSCACHE.IP .EQ 8
S.DNSCACHE .EQ 12 S.DNSCACHE .EQ 12
*-------------------------------------- *--------------------------------------
S.SOCKET.SOCK .EQ 0 S.SOCKET.SOCK .EQ 0
S.SOCKET.SOCK.DGRAM .EQ 1 S.SOCKET.SOCK.DGRAM .EQ $10
S.SOCKET.SOCK.STREAM .EQ 2 S.SOCKET.SOCK.STREAM .EQ $20
S.SOCKET.SOCK.RAW .EQ 3 S.SOCKET.SOCK.RAW .EQ $30
S.SOCKET.SOCK.MASK .EQ $F0
S.SOCKET.SO .EQ 1 S.SOCKET.STATUS .EQ 0
S.SOCKET.SO.DEBUG .EQ $01
S.SOCKET.SO.ACCEPTCONN .EQ $02
S.SOCKET.SO.REUSEADDR .EQ $04
S.SOCKET.SO.KEEPALIVE .EQ $08
S.SOCKET.SO.DONTROUTE .EQ $10
S.SOCKET.SO.BROADCAST .EQ $20
S.SOCKET.SO.USELOOPBACK .EQ $40
S.SOCKET.SO.LINGER .EQ $80
S.SOCKET.STATUS .EQ 2
S.SOCKET.STATUS.CLOSED .EQ 0 S.SOCKET.STATUS.CLOSED .EQ 0
S.SOCKET.STATUS.LISTEN .EQ 1 S.SOCKET.STATUS.LISTEN .EQ 1
S.SOCKET.STATUS.SYNSENT .EQ 2 S.SOCKET.STATUS.SYNSENT .EQ 2
@ -157,8 +148,21 @@ S.SOCKET.STATUS.FINWT1 .EQ 7
S.SOCKET.STATUS.FINWT2 .EQ 8 S.SOCKET.STATUS.FINWT2 .EQ 8
S.SOCKET.STATUS.CLOSING .EQ 9 S.SOCKET.STATUS.CLOSING .EQ 9
S.SOCKET.STATUS.TIMEWT .EQ 10 S.SOCKET.STATUS.TIMEWT .EQ 10
S.SOCKET.STATUS.MASK .EQ $0F
S.SOCKET.RAW.PROTO .EQ 3 S.SOCKET.SO .EQ 1
S.SOCKET.SO.DEBUG .EQ $01
S.SOCKET.SO.ACCEPTCONN .EQ $02
S.SOCKET.SO.REUSEADDR .EQ $04
S.SOCKET.SO.KEEPALIVE .EQ $08
S.SOCKET.SO.DONTROUTE .EQ $10
S.SOCKET.SO.BROADCAST .EQ $20
S.SOCKET.SO.USELOOPBACK .EQ $40
S.SOCKET.SO.LINGER .EQ $80
S.SOCKET.RAW.PROTO .EQ 2
S.SOCKET.STREAM.hInMem .EQ 2
S.SOCKET.STREAM.hOutMem .EQ 3
S.SOCKET.SRC.ADDR .EQ 4 S.SOCKET.SRC.ADDR .EQ 4
S.SOCKET.SRC.PORT .EQ 8 S.SOCKET.SRC.PORT .EQ 8
@ -172,11 +176,10 @@ S.SOCKET.HQ.TAIL .EQ 17
S.SOCKET.HQ .EQ 18 S.SOCKET.HQ .EQ 18
S.SOCKET.HQ.MAX .EQ 14 14 hMem (frames) S.SOCKET.HQ.MAX .EQ 14 14 hMem (frames)
* Stream type Queue * Stream type Queue
S.SOCKET.SQ.hInMem .EQ 16 S.SOCKET.SQ.INHEAD .EQ 16
S.SOCKET.SQ.hOutMem .EQ 17 S.SOCKET.SQ.INTAIL .EQ 18
*S.SOCKET.SQ.SIZE .EQ 18 S.SOCKET.SQ.OUTHEAD .EQ 20
S.SOCKET.SQ.INHEAD .EQ 20 S.SOCKET.SQ.OUTTAIL .EQ 22
S.SOCKET.SQ.INTAIL .EQ 22
S.SOCKET.SQ.SEQNUM .EQ 24 S.SOCKET.SQ.SEQNUM .EQ 24
S.SOCKET.SQ.ACKNUM .EQ 28 S.SOCKET.SQ.ACKNUM .EQ 28
* *

View File

@ -91,6 +91,7 @@ ICMP.IN.ECHOREP jsr IP.FillTmpSocketSrcDst
.3 lda (ZPPtrSKT) .3 lda (ZPPtrSKT)
beq .7 beq .7
and #S.SOCKET.SOCK.MASK
cmp #S.SOCKET.SOCK.RAW cmp #S.SOCKET.SOCK.RAW
bne .7 bne .7

View File

@ -128,7 +128,7 @@ SKT.Send >PULLB hSocket
pla pla
jsr SKT.GetA.I jsr SKT.GetA.I
bcs .9 bcs .9
and #S.SOCKET.SOCK.MASK
cmp #S.SOCKET.SOCK.DGRAM cmp #S.SOCKET.SOCK.DGRAM
beq SKT.SEND.UDP beq SKT.SEND.UDP
@ -163,23 +163,23 @@ SKT.SEND.UDP lda #S.IP.PROTOCOL.UDP
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
SKT.SEND.TCP lda #S.IP.PROTOCOL.TCP SKT.SEND.TCP ldy #S.SOCKET.STREAM.hOutMem
jsr FRM.NewA lda (ZPPtrSKT),y
bcs .9 >SYSCALL GetMemPtrA
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base
>LDAXI S.TCP-2 ldy #S.SOCKET.SQ.OUTHEAD
jsr SKT.SetFrameOutLenAX lda (ZPPtrSKT),y
* clc
adc ZPDataInLen
tax
>LDAXI S.TCP iny
jsr SKT.SetDataOutPtrAX lda (ZPPtrSKT),y
adc ZPDataInLen+1
jsr SKT.SetFrameOutDstIP
jsr SKT.SetFrameOutPorts clc
jsr SKT.CopyDataInToOut
jmp FRM.SendTCP
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -245,6 +245,7 @@ SKT.CLOSEA cmp #K.SKTTABLE.SIZE
jsr SKT.GetA.I jsr SKT.GetA.I
bcs .9 bcs .9
and #S.SOCKET.SOCK.MASK
cmp #S.SOCKET.SOCK.DGRAM cmp #S.SOCKET.SOCK.DGRAM
beq .8 beq .8

View File

@ -200,7 +200,7 @@ TCP.IN.JMP.SYNRCVD
bcs * bcs *
txa txa
ldy #S.SOCKET.SQ.hInMem ldy #S.SOCKET.STREAM.hInMem
sta (ZPPtrSKT),y sta (ZPPtrSKT),y
>PUSHW K.TCP.WSIZE >PUSHW K.TCP.WSIZE
@ -209,7 +209,7 @@ TCP.IN.JMP.SYNRCVD
bcs * bcs *
txa txa
ldy #S.SOCKET.SQ.hOutMem ldy #S.SOCKET.STREAM.hOutMem
sta (ZPPtrSKT),y sta (ZPPtrSKT),y
.8 clc .8 clc
@ -312,7 +312,7 @@ TCP.SetDataInPtrAndLen
rts rts
*-------------------------------------- *--------------------------------------
TCP.AddDataToSkt TCP.AddDataToSkt
ldy #S.SOCKET.SQ.hInMem ldy #S.SOCKET.STREAM.hInMem
lda (ZPPtrSKT),y lda (ZPPtrSKT),y
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base >STYA ZPTmpPtr1 Make ZPTmpPtr1=buffer base

View File

@ -176,9 +176,9 @@ MSG.ABORT >CSTR "HTTPD:User Aborted\n"
MSG.INCOMING >CSTR "HTTPD:Incoming Connection From : %d.%d.%d.%d\n" MSG.INCOMING >CSTR "HTTPD:Incoming Connection From : %d.%d.%d.%d\n"
hLIBTCPIP .BS 1 hLIBTCPIP .BS 1
*-------------------------------------- *--------------------------------------
Socket .DA #S.SOCKET.SOCK.STREAM Socket .DA #S.SOCKET.SOCK.STREAM+S.SOCKET.STATUS.LISTEN
.DA #S.SOCKET.SO.ACCEPTCONN .DA #S.SOCKET.SO.ACCEPTCONN
.DA #S.SOCKET.STATUS.LISTEN .DA 0
.BS 1 .BS 1
Socket.Src.Addr .BS 4 Socket.Src.Addr .BS 4
Socket.Src.Port .DA 80 Socket.Src.Port .DA 80

View File

@ -59,7 +59,7 @@ CS.INIT >LDYA L.LIBTCPIP
CS.RUN jsr Init.Timeout CS.RUN jsr Init.Timeout
>LDYA L.MSG.TCPWAIT >LDYA L.MSG.TCPWAIT
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
.1 >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ? .1 >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
bcs .99 bcs .99
@ -73,7 +73,7 @@ CS.RUN jsr Init.Timeout
bcc .1 bcc .1
.99 >LDYA L.MSG.TCPIPERR .99 >LDYA L.MSG.TCPIPERR
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
lda #SYSMGR.ERRSYN lda #SYSMGR.ERRSYN
sec sec
rts rts
@ -94,7 +94,7 @@ CS.RUN.INIT ldx #3
sta (pData),y sta (pData),y
>LDYA L.MSG.INITOK >LDYA L.MSG.INITOK
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
.11 >SYSCALL Sleep .11 >SYSCALL Sleep
ldy #bCTRLC ldy #bCTRLC
@ -119,17 +119,17 @@ CS.RUN.INIT ldx #3
bpl .2 bpl .2
>LDYA L.MSG.INCOMING >LDYA L.MSG.INCOMING
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
bra .11 bra .11
.9 >LDYA L.MSG.SKTERR .9 >LDYA L.MSG.SKTERR
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
lda #SYSMGR.ERRSYN lda #SYSMGR.ERRSYN
sec sec
rts rts
.99 >LDYA L.MSG.ABORT .99 >LDYA L.MSG.ABORT
>SYSCALL PSTROutYA >SYSCALL CPrintFYA
lda #0 lda #0
sec sec
rts rts
@ -199,18 +199,17 @@ Wait.TimeOut sec
CS.END CS.END
*-------------------------------------- *--------------------------------------
LIBTCPIP >PSTR "libtcpip.o" LIBTCPIP >PSTR "libtcpip.o"
MSG.TCPWAIT >PSTR "NFSD:Waiting for TCP/IP initializing...\n" MSG.TCPWAIT >CSTR "NFSD:Waiting for TCP/IP initializing...\n"
MSG.INITOK >PSTR "NFSD:Init Ok, Listening.\n" MSG.INITOK >CSTR "NFSD:Init Ok, Listening.\n"
MSG.TCPIPERR >PSTR "NFSD:TCP/IP Not initialized properly\n" MSG.TCPIPERR >CSTR "NFSD:TCP/IP Not initialized properly\n"
MSG.SKTERR >PSTR "NFSD:Listen Error\n" MSG.SKTERR >CSTR "NFSD:Listen Error\n"
MSG.ABORT >PSTR "NFSD:User Aborted\n" MSG.ABORT >CSTR "NFSD:User Aborted\n"
MSG.INCOMING >PSTR "NFSD:Incoming Connection From : %d.%d.%d.%d\n" MSG.INCOMING >CSTR "NFSD:Incoming Connection From : %d.%d.%d.%d\n"
hLIBTCPIP .BS 1 hLIBTCPIP .BS 1
*-------------------------------------- *--------------------------------------
Socket .DA #S.SOCKET.SOCK.DGRAM Socket .DA #S.SOCKET.SOCK.DGRAM+S.SOCKET.STATUS.LISTEN
.DA #S.SOCKET.SO.ACCEPTCONN .DA #S.SOCKET.SO.ACCEPTCONN
.DA #S.SOCKET.STATUS.LISTEN .BS 2
.BS 1
Socket.Src.Addr .BS 4 Socket.Src.Addr .BS 4
Socket.Src.Port .DA 2049 Socket.Src.Port .DA 2049
Socket.Dst.Addr .BS 4 Socket.Dst.Addr .BS 4