1.1.0 applied and working

This commit is contained in:
John Bintz 2024-04-25 14:40:47 -04:00
parent ade45f63b8
commit fdab7b432e
5 changed files with 104 additions and 13 deletions

5
.gitignore vendored
View File

@ -4,3 +4,8 @@ dist/
build/
aminet/
Disk.info
test/
stuff/
patches/
.vamosrc
activate

Binary file not shown.

View File

@ -7,7 +7,7 @@
; extension number 18
ExtNb equ 18-1
Version MACRO
dc.b "1.0.1-20230403"
dc.b "1.1.0-20240223"
ENDM
VerNumber equ $1
@ -68,6 +68,20 @@ Error_PortOutOfRange EQU -11
Error_FdsetOutOfRange EQU -11
Error_UnableToBind EQU -12
; socket herrno and tag lists
; built from:
; * https://wiki.amigaos.net/amiga/autodocs/bsdsocket.doc.txt
; * https://github.com/deplinenoise/amiga-sdk/blob/master/netinclude/amitcp/socketbasetags.h
; * http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_2._guide/node012E.html
TAG_USER EQU (1<<31)
SBTF_REF EQU $8000
SBTB_CODE EQU 1
SBTS_CODE EQU $3FFF
SBTC_HERRNO EQU 6
HerrnoTag EQU (TAG_USER|SBTF_REF|((SBTC_HERRNO&SBTS_CODE)<<SBTB_CODE))
; wrap code that doesn't take arguments with these
PreserveStackInstruction MACRO
MOVEM.L A2-A6/D6-D7,-(SP)
@ -330,6 +344,9 @@ C_Tk dc.w 1,0
AddTokenFunction SocketCloseSocket
dc.b "socket close socke","t"+$80,"00",-1
AddTokenFunction SocketHerrno
dc.b "socket herrn","0"+$80,"0",-1
; TOKEN_END
dc.w 0
dc.l 0 ; Important!
@ -386,6 +403,8 @@ getsockopt_len ds.l 1
MaxSocketSeen dc.w 0
sockaddr_ram ds.l 1
; also used for errno tags
AcceptScratchArea ds.b 16
SelectScratchArea ds.l 2
@ -1900,26 +1919,52 @@ _SocketReuseAddr_LibraryOpen:
Ret_String
_DnsGetHostAddressByName_LibraryOpen:
; string so you need demande, hichaine, and chvide
MOVE.L D3,A0 ; name
ADD.L #2,A0 ; skip length, string is null terminated (?)
MOVE.W (A0)+,D0 ; d0 contains length
MOVE.L D0,D1 ; d1 also has length
MOVE.L D0,D2 ; d2 also has length
Rjsr L_RamFast ; d0 contains address
BNE .StringRamAllocated
WithDataStorage
LoadBSDSocketBase
CALLLIB gethostbyname
EndDataStorage
MOVE.L ChVide(A5),D3
RestoreStackFunction
Ret_String
.StringRamAllocated:
MOVE.L D0,A1 ; a1 contains address
SUBQ #1,D1 ; reduce by one for DBRA
.KeepCopyingAMOSString
MOVE.B (A0)+,(A1)+ ; byte copy
DBRA D1,.KeepCopyingAMOSString ; keep copying
MOVE.B #0,(A1)+ ; null terminate string
MOVE.L D0,A0 ; first param of gethostbyname
MOVEM.L A0/D2,-(SP)
WithDataStorage
LoadBSDSocketBase
CALLLIB gethostbyname
EndDataStorage
MOVEM.L (SP)+,A0/D2
; free the ram before we go any farther
MOVE.L D0,-(SP)
MOVE.L A0,A1
MOVE.L D2,D0
Rjsr L_RamFree
MOVE.L (SP)+,D0
TST.L D0
BNE _DnsGetHostAddressByName_GetIPAddress
BNE .GetIPAddress
RestoreStackFunction
MOVE.L ChVide(A5),D3
Ret_String
_DnsGetHostAddressByName_GetIPAddress:
.GetIPAddress:
MOVE.L D0,A0
MOVE.L 16(A0),A1 ; **h_addr_list
MOVE.L (A1),A1 ; *h_addr_list
@ -2053,6 +2098,46 @@ _SocketCloseSocket_LibraryOpen:
RestoreStackFunction
Ret_Int
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Int=Socket Herrno
;
; Return Herrno value, errors related to DNS resolution
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lib_Par SocketHerrno
; - - - - - - - - - - - - -
PreserveStackFunction
; set up tag list memory and place for herrno to go
Dlea AcceptScratchArea,A0
MOVE.L A0,A2
Dlea SelectScratchArea,A1
; build the tag list
MOVE.L HerrnoTag,(A0)+
MOVE.L A1,(A0)+
MOVE.L 0,(A0)+
MOVE.L 0,(A0)+
MOVE.L A2,A0
WithDataStorage
LoadBSDSocketBase
CALLLIB SocketBaseTagList
EndDataStorage
TST.L D0
BEQ .success
; failed
MOVE.L #-1,D3
RestoreStackFunction
Ret_Int
.success
MOVE.L (A1),D3
RestoreStackFunction
Ret_Int
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Even if you do not have error messages, you MUST

View File

@ -1,5 +1,5 @@
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; BSDSocket.s, list of the library functions on the 25-04-2024 13:11:43
; BSDSocket.s, list of the library functions on the 25-04-2024 14:34:43
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L_Cold: set 0
@ -37,3 +37,4 @@ L_SetSockoptInt: set 32
L_DnsGetHostAddressByName:set 33
L_SocketSetTimeout: set 34
L_SocketCloseSocket: set 35
L_SocketHerrno: set 36

View File

@ -1,5 +1,5 @@
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; BSDSocket.s, library size on the 25-04-2024 13:11:43
; BSDSocket.s, library size on the 25-04-2024 14:34:43
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lib_Size equ 38
Lib_Size equ 39