Finish up 1.1.4

This commit is contained in:
John Bintz 2024-04-26 22:22:46 -04:00
parent 12b859eaf3
commit 2ba9fd6c82
10 changed files with 84 additions and 80 deletions

24
API.md
View File

@ -337,30 +337,6 @@ out. There's no way to set this timeout, or cancel or override it via AMOS.
String with IP address, or blank string on error.
---
#### RESULT=Socket Status(Socket)
Returns basic connection information about a socket.
##### Warning
Since none of the socket processing of this extension happens in the
background, you're likely better off using other means to detect
socket status.
* Disconnected: Try a recv and get zero bytes back. Check Socket Errno.
* Broken: Try a send. If it fails, check Socket Errno.
* Ready: Use the Async Wait functions.
##### Returns
Status of socket:
* 0 = Closed
* 2 = Listening
* 6 = Connecting
* 7 = Connected
---

View File

@ -127,6 +127,9 @@ Socket Library Close
* [AQUABYSS](https://agedcode.com/agedcode/en/games/aquabyss)
* As of April 2023, the extension's been in heavy use for over a month
on the client side of the game.
* [Hop to the Top: Bunny's Revenge](https://rabbit.robsmithdev.co.uk/)
* The game uses this extension to send and receive high score information.
I also did some of the art for the game!
Doing something cool with the extension?
[Contact me](https://theindustriousrabbit.com/about) and I'll add it to the list!
@ -158,7 +161,7 @@ This project uses semantic versioning.
## License
Copyright 2023 John Bintz. Licensed under the MIT License.
Copyright 2023-2024 John Bintz. Licensed under the MIT License.
If you use this in your project, and you really want to,
throw a link to theindustriousrabbit.com somewhere! You can
@ -181,14 +184,75 @@ to contact me.
* Fix bug in Socket Wait Async Writing where result of getsockopt was
incorrectly used.
## Development
### 1.1.0 (2024-02-23)
* Fix bug in `Dns Get Host Address By Name$` where it assumed AMOS strings are
null-terminated. They are not.
* Add `Socket Herrno` to aid in debugging resolver errors.
### 1.1.1 (2024-03-17)
* Fix bug in `Socket Inet Ntoa$` where the null terminator on the result of
calling `Inet_NtoA` was being included in the AMOS string.
* Fix crash bug in `Socket Inet Ntoa$` if called with the BSD Socket library
was not open.
### 1.1.2 (2024-03-18)
* Fix all functions that return strings so that strings work properly
in AMOS. While you could kind of use the immediate return value of the
string, any future manipulation of that string would fail. This fixes
the following functions:
* `Socket Inet Ntoa$`
* `Dns Get Address By Name$`
* `Socket Recv$`
### 1.1.3
Internal release.
### 1.1.4 (2024-04-26)
* Fix bug in fdset macro where using D3 for a parameter could cause corruption
* Copy a null-terminated copy of IP address for `SocketIPAddressPortToSockaddr`
* Add test suite to exercise extension functionality
* Fix several crash bugs found due to the test suite
* Retructure API docs for easier reading
# Development
### Environment
#### Native Amiga
* Clone the [AMOS Professional source code](https://github.com/AOZ-Studio/AMOS-Professional-Official)
* Run `execute absdsocket`
* Note that you'll have to fix up some assigns and files in the AMOS Professional
source directory. I'll update this README with those changes once I track them down...
* Copy `AMOSPro Sources/+lequ.s` to `+LEqu.s`
* Generate the socket LVO file in the `src` directory
* Install [`fd2pragma`](https://aminet.net/package/dev/misc/fd2pragma) in your path
* Download `https://raw.githubusercontent.com/cnvogelg/amitools/master/amitools/data/fd/bsdsocket_lib.fd` to `src`
* In a Shell:
```
cd src
fd2pragma bsdsocket_lib.fd to "" special 20
```
* Fix up `src/absdsocket` to match your system's setup
* In a Shell:
```
cd src
execute absdsocket
```
#### Emulated setup (WinUAE, FS-UAE, Amiberry)
Run `bin/setup` to do most of the setups above.
### Debugging
Modify data in the `DebugArea` and read it by `Peek`/`Deek`/`Leek`ing from
the base address provided by `Socket Get Debug Area`.
### Releasing

Binary file not shown.

View File

@ -7,7 +7,7 @@
; extension number 18
ExtNb equ 18-1
Version MACRO
dc.b "1.1.3-20240417"
dc.b "1.1.4-20240426"
ENDM
VerNumber equ $1
@ -345,7 +345,7 @@ C_Tk dc.w 1,0
dc.b "socket close socke","t"+$80,"00",-1
AddTokenFunction SocketHerrno
dc.b "socket herrn","0"+$80,"0",-1
dc.b "socket herrn","o"+$80,"0",-1
; TOKEN_END
dc.w 0
@ -1372,8 +1372,10 @@ _SocketSelect_PerformSelect
PreserveStackFunction
EnsureBSDSocketLibrary _SocketInetNtoa_LibraryOpen
MOVE.L ChVide(A5),D3
RestoreStackFunction
Ret_Int
Ret_String
_SocketInetNtoa_LibraryOpen:
MOVE.L D3,D0
@ -1390,9 +1392,6 @@ _SocketInetNtoA_StringSizeLoop:
TST.B (A0)+
BNE _SocketInetNtoA_StringSizeLoop
MOVE.L A0,D3
SUB.L A2,D3 ; D3 = length
SUBQ #1,D3 ; get rid of the null terminator
MOVE.L A0,D4
SUB.L A2,D4 ; D4 = length
SUBQ #1,D4 ; get rid of the null terminator
@ -1413,13 +1412,8 @@ _SocketInetNtoA_StringSizeLoop:
SUBQ #1,D4
_SocketInetNtoA_StringCopyLoop:
MOVE.B (A2,D3),(A0,D3)
DBRA D3,_SocketInetNtoA_StringCopyLoop
; make the address even
EvenOutStringAddress A0,D3
MOVE.L A0,HiChaine(A5) ; Does L_Demande nuke A5 too?
MOVE.B (A2,D4),(A0,D4)
DBRA D4,_SocketInetNtoA_StringCopyLoop
MOVE.L A1,D3 ; string return
@ -2146,7 +2140,12 @@ _SocketCloseSocket_LibraryOpen:
Lib_Par SocketHerrno
; - - - - - - - - - - - - -
PreserveStackFunction
EnsureBSDSocketLibrary _SocketHerrno_LibraryOpen
RestoreStackFunction
Ret_Int
_SocketHerrno_LibraryOpen:
; set up tag list memory and place for herrno to go
Dlea AcceptScratchArea,A0
MOVE.L A0,A2

View File

@ -1,5 +1,5 @@
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; BSDSocket.s, list of the library functions on the 26-04-2024 14:45:36
; BSDSocket.s, list of the library functions on the 26-04-2024 20:54:05
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L_Cold: set 0

View File

@ -1,5 +1,5 @@
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; BSDSocket.s, library size on the 26-04-2024 14:45:36
; BSDSocket.s, library size on the 26-04-2024 20:54:05
;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lib_Size equ 39

View File

@ -9,5 +9,4 @@ FAILAT 21
copy AMOSPro_System:APSystem/AMOSPro_BSDSocket.lib AMOSPro_System:APSystem/AMOSPro_BSDSocket.lib.bak
FAILAT 10
copy AMOSPro_BSDSocket.Lib AMOSPro_System:APSystem/
;use an amos file here that includes the plugin to quickly build a test program
;apcmp "aqua_test_plugin.amos" inclib
apcmp "/test/TestSuite.amos" inclib

View File

@ -1,34 +0,0 @@
[Socket Library Open/Open Library] 1075577444
[Socket Library Open/Double open] 1075577444
[Socket Create Inet Socket] 0
[Socket Set Nonblocking/False] 0
[Socket Set Nonblocking/True] 0
[Socket Set Nonblocking/True] Preserving this state for rest of tests
[Dns Get Address By Name$/Bad domain name]
[Dns Get Address By Name$/localhost] 127.0.0.1
[Dns Get Address By Name$/aminet.net] 35.223.124.178
[Dns Get Address By Name$/aminet.net] Using this IP address for connection tests
[Dns Get Address By Name$/Returned string can be manipulated] Cat35.223.124.178Dog
[Socket Connect/port too high] -11
[Socket Connect/blank ip] -14
[Socket Connect/invalid ip] -1
[Socket Connect/aminet IP (35.223.124.178) from above] -1 (ok to be -1, will Wait Async Writing next)
[Socket Wait Async Writing/With unconnected socket/2 second timeout] 1
[Socket Wait Async Writing/With unconnected socket/Zero timeout] 1
[Socket Wait Async Writing/Connected socket/Two second timeout] 1
[Socket Wait Async Writing/Connected socket/Zero timeout] 1
[Socket Wait Async Writing/Connected socket/Attempt to get actual connection] 1
[Socket Wait Async Writing/Socket Send and Socket Send$/Socket send$ first half] 10
[Socket Wait Async Writing/Socket Send and Socket Send$/Socket send second half] 18
[Socket Wait Async Writing/Socket wait Async Reading/With unconnected socket/2 second timeout] 1
[Socket Wait Async Writing/Socket wait Async Reading/With unconnected socket/Zero timeout] 1
[Socket Wait Async Writing/Socket wait Async Reading/With aminet socket/2 second timeout] 1
[Socket Wait Async Writing/Socket wait Async Reading/With aminet socket/Zero timeout] 1
[Socket Wait Async Writing/Socket Recv$ and Socket Recv/Socket Recv$/Read 20 characters] HTTP/1.1 302 Found
[Socket Wait Async Writing/Socket Recv$ and Socket Recv/Socket Recv$/String can be manipulated] CatHTTP/1.1 302 Found
Dog
[Socket Wait Async Writing/Socket Recv$ and Socket Recv/Socket Read/Read 20 bytes] 20
[Socket Wait Async Writing/Socket Recv$ and Socket Recv/Socket Read/Data was read] Date: Fri, 26 Apr 20
[Socket Wait Async Writing/Socket Library Close/Close] Success
[Socket Wait Async Writing/Socket Library Close/Double close] Success

Binary file not shown.

Binary file not shown.