a314 icon indicating copy to clipboard operation
a314 copied to clipboard

Implement networking through bsdsocket.library

Open niklasekstrom opened this issue 4 years ago • 6 comments

Write a bsdsocket.library that forwards network calls to the RPi.

The API seems straight-forward enough: https://wiki.amigaos.net/amiga/autodocs/bsdsocket.doc.txt.

Each time bsdsocket.library is opened a new Library structure should be allocated, initialized and returned, in accordance with the description of bsdsocket.library/OpenLibrary in the linked document.

niklasekstrom avatar Jul 25 '19 09:07 niklasekstrom

Just an update: I have made a fair amount of progress on this, and with a few more hours of hacking I should have a useful subset of the API functions implemented.

I was able to get amitcp_telnet (http://aminet.net/package/comm/tcp/amitcp_telnet) to run under WB 1.3 (there was a single 2.0 function called), so that's what I'm using to test with.

niklasekstrom avatar Aug 08 '19 21:08 niklasekstrom

I have implemented the following functions: socket, connect, send, recv, shutdown, setsockopt, IoctlSocket, CloseSocket, WaitSelect, SetErrnoPtr, Inet_NtoA, inet_addr, gethostbyname, getservbyname. These are all the functions that amitcp_telnet call, and so that program now works.

The trickiest part has been to realize which arguments need to be byte-swapped due to that the Amiga is big-endian and the RPi is little-endian. Another issue, that I (mostly) haven't dealt with, is that it should be possible to interrupt blocking functions using signals such as by ctrl-c.

Implementing the rest of the functions should be conceptually straight forward but a bit time consuming. If anyone wants to use this functionality then let me know and I will put in some effort to finish it up.

niklasekstrom avatar Aug 10 '19 18:08 niklasekstrom

I think this is a killer feature!

nonarkitten avatar Aug 16 '19 22:08 nonarkitten

Just an update: I have made a fair amount of progress on this, and with a few more hours of hacking I should have a useful subset of the API functions implemented.

I was able to get amitcp_telnet (http://aminet.net/package/comm/tcp/amitcp_telnet) to run under WB 1.3 (there was a single 2.0 function called), so that's what I'm using to test with.

All TCP/IP-stacks on the Amiga implementing the bsdsocket.library API requires kickstart 2.0+, so software written for it generally had no reason to support less - it will make it much easier for you to get software for testing if you use kickstart 2.0+ yourself.

Also want to add that it is a highly useful feature to be able to use bsdsocket.library software on the Amiga.

patrikaxelsson avatar May 08 '20 12:05 patrikaxelsson

@patrikaxelsson I think you're right about the need for Workbench 2.0+.

Do you have some application in mind that uses bsdsocket.library? For me, downloading files and copying files on my network is sorted through "pi wget " and a314fs.

niklasekstrom avatar May 08 '20 13:05 niklasekstrom

AmIRC would be nice. RPI could run BittleBee (https://www.bitlbee.org) and you could access Telegram, Discord and other interesting messaging applications.

jcagigal avatar Jul 14 '20 12:07 jcagigal