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
lda (ZPPTR1),y
and #S.SOCKET.STATUS.MASK
asl
tax
>PUSHB L.MSG1.S+1,x
@ -89,6 +90,10 @@ CS.RUN >LDYA L.MSG0
bne .2
lda (ZPPTR1)
lsr
lsr
lsr
lsr
cmp #S.SOCKET.SOCK.RAW+1
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
TimeOut.ms .BS 2
Socket .DA #S.SOCKET.SOCK.RAW
.BS 2
.BS 1
.DA #S.IP.PROTOCOL.ICMP
.BS 1
Socket.Src.Addr .BS 4
Socket.Src.Port .DA 0 Dynamic
Socket.Dst.Addr .BS 4

View File

@ -131,21 +131,12 @@ S.DNSCACHE.IP .EQ 8
S.DNSCACHE .EQ 12
*--------------------------------------
S.SOCKET.SOCK .EQ 0
S.SOCKET.SOCK.DGRAM .EQ 1
S.SOCKET.SOCK.STREAM .EQ 2
S.SOCKET.SOCK.RAW .EQ 3
S.SOCKET.SOCK.DGRAM .EQ $10
S.SOCKET.SOCK.STREAM .EQ $20
S.SOCKET.SOCK.RAW .EQ $30
S.SOCKET.SOCK.MASK .EQ $F0
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.STATUS .EQ 2
S.SOCKET.STATUS .EQ 0
S.SOCKET.STATUS.CLOSED .EQ 0
S.SOCKET.STATUS.LISTEN .EQ 1
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.CLOSING .EQ 9
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.PORT .EQ 8
@ -172,11 +176,10 @@ S.SOCKET.HQ.TAIL .EQ 17
S.SOCKET.HQ .EQ 18
S.SOCKET.HQ.MAX .EQ 14 14 hMem (frames)
* Stream type Queue
S.SOCKET.SQ.hInMem .EQ 16
S.SOCKET.SQ.hOutMem .EQ 17
*S.SOCKET.SQ.SIZE .EQ 18
S.SOCKET.SQ.INHEAD .EQ 20
S.SOCKET.SQ.INTAIL .EQ 22
S.SOCKET.SQ.INHEAD .EQ 16
S.SOCKET.SQ.INTAIL .EQ 18
S.SOCKET.SQ.OUTHEAD .EQ 20
S.SOCKET.SQ.OUTTAIL .EQ 22
S.SOCKET.SQ.SEQNUM .EQ 24
S.SOCKET.SQ.ACKNUM .EQ 28
*

View File

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

View File

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

View File

@ -200,7 +200,7 @@ TCP.IN.JMP.SYNRCVD
bcs *
txa
ldy #S.SOCKET.SQ.hInMem
ldy #S.SOCKET.STREAM.hInMem
sta (ZPPtrSKT),y
>PUSHW K.TCP.WSIZE
@ -209,7 +209,7 @@ TCP.IN.JMP.SYNRCVD
bcs *
txa
ldy #S.SOCKET.SQ.hOutMem
ldy #S.SOCKET.STREAM.hOutMem
sta (ZPPtrSKT),y
.8 clc
@ -312,7 +312,7 @@ TCP.SetDataInPtrAndLen
rts
*--------------------------------------
TCP.AddDataToSkt
ldy #S.SOCKET.SQ.hInMem
ldy #S.SOCKET.STREAM.hInMem
lda (ZPPtrSKT),y
>SYSCALL GetMemPtrA
>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"
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.STATUS.LISTEN
.DA 0
.BS 1
Socket.Src.Addr .BS 4
Socket.Src.Port .DA 80

View File

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