Commit Graph

21 Commits

Author SHA1 Message Date
Stephen Heumann a38e2f716a Detect when Marinetti has disconnected, and close all sessions at that time.
Also, detect and give an error when invalid session numbers are used.
2017-04-24 17:47:16 -05:00
Stephen Heumann c4286a024e Add options to give somewhat better compatibility with the AFP server in OS X 10.5.
*The OS X server doesn't support ProDOS-type file type info, so trying to set it will give an error. This normally causes GS/OS to give an error when creating a file. There is now an option to ignore the error and proceed with creating the file, although the file type still won't be set.

*The OS X server seems to restrict each write operation to a small size based on the ASP quantum, so there is now an option for this. Using this option means we may write less than requested, but the AppleShare FST can detect this and proceed to write the rest.
2017-04-22 18:46:26 -05:00
Stephen Heumann 78a300f799 Add an option to tell the server that the GS is going to sleep after each command sent.
This tells the server to keep the session alive (typically for at least several hours) without sending or expecting tickles. This is useful in cases where our run queue procedure is not run regularly or at all, e.g. in text-mode shells.

The implementation here is geared toward compatibility with Netatalk and differs from Apple's published standards in a couple ways. It may or may not work with other servers.
2017-04-21 21:09:57 -05:00
Stephen Heumann 8f72c9b89f Flag an error if we are expecting to receive data and don't get any for 30 seconds.
This prevents the system from hanging indefinitely if the network suddenly disconnects in the middle of an AFP operation.
2017-04-19 23:54:19 -05:00
Stephen Heumann fe2680b65a Bail out early if we're in P8 mode.
This avoids any possible strange behavior with calling Marinetti in P8 mode. It also ensures that I/O operations in P8 mode will give an error, but not terminate the connection: it will still be alive when we get back to GS/OS, unless the server has killed it due to inactivity (which is quite possible).
2017-04-16 18:25:58 -05:00
Stephen Heumann 93e2a5a864 Call attention routine when appropriate, and handle close requests from the server. 2017-04-16 16:19:59 -05:00
Stephen Heumann 5b5295fd40 Fixes related to error handling and asynchronous command support. 2017-04-16 15:17:55 -05:00
Stephen Heumann 9d6dad03b4 Add support for soft reset.
This can occur when control-reset is pressed in P8 mode. It’s supposed to reinitialize the AppleTalk stack. In our case, we mark connections to be reset once we're back in GS/OS, since we can't call Marinetti in P8 mode.
2017-04-16 13:36:01 -05:00
Stephen Heumann 7d2c225d2f Add code to close the sessions when the system is shutting down.
This only works if our init is loaded before Marinetti’s, because otherwise Marinetti’s shutdown notification procedure gets control first and shuts down the connection.
2017-04-16 00:37:57 -05:00
Stephen Heumann a52a041389 Add support for rewriting login requests to force use of AFP version 2.2.
This should add support for a greater variety of servers, which may only support AFP 2.2 and up (or refuse to use older versions over TCP).

The IIgs software is designed for AFP 2.0. AFP 2.2 is close enough that things seem to work, but there could potentially be a few compatibility issues.
2017-04-15 18:11:24 -05:00
Stephen Heumann d4857e483f Implement option to let read replies return more data than the specified reply buffer size.
This could be unsafe for some forms of client code, but it looks like the AppleShare FST always actually has a large enough buffer to hold the full amount being requested, and can deal with up to 65535 bytes being returned at once. We take advantage of this to do larger reads in a single request, which provides a noticeable performance advantage.
2017-04-15 00:06:43 -05:00
Stephen Heumann 3b2f1b6a25 Pass through calls we don’t handle to the original AppleTalk stack.
It is now possible to have AFP volumes mounted over both AppleTalk and TCP/IP simultaneously.
2017-04-09 20:57:09 -05:00
Stephen Heumann c119492cec Work around problem with asynchronous polling calls from AppleShare FST.
This patch disables asynchronous SPCommand calls to work around the problem, which was causing hangs and crashes when those calls triggered. This effectively prevents the FST from automatically polling to check if the volume has been changed, but shouldn't cause other problems.
2017-04-03 20:19:30 -05:00
Stephen Heumann 3f40a3190d Modify FPRead requests so they don’t return more data than will fit in the reply buffer.
This issue arises because ASP requests and replies are limited to a “quantum size” of 4624 bytes even if the amount requested is larger, and the AppleShare FST relies on this behavior in sizing its buffers. DSI does not have this limitation, so it was returning more data than would fit in the buffer.

Also improve error checking, so an error is reported in cases where the buffer is too small.
2017-04-03 16:36:50 -05:00
Stephen Heumann 17421e0ba5 Add support for calling asynchronous completion routines.
At this point it can connect and largely work, but there are still several issues.
2017-04-03 15:39:37 -05:00
Stephen Heumann 9720f37531 Initial code for installing our commands.
This code works to some extent, but tends to cause system hangs.

Also includes some DSI implementation fixes.
2017-04-01 15:32:32 -05:00
Stephen Heumann ee83e402f8 Implement support for DSIWrite, plus a few other cleanups. 2017-03-23 02:31:06 -05:00
Stephen Heumann 275f3456ba Add support for sending DSICommand requests. 2017-03-22 20:13:20 -05:00
Stephen Heumann 83c702fcbb Include the FPGetSrvrInfo AFP-level request in DSIGetInfo packets.
The macOS AFP server gives a response even without this, but the protocol spec says it should be there.
2017-03-20 00:58:17 -05:00
Stephen Heumann 0b0a422c33 Updates to support opening and closing a session. 2017-03-19 17:23:42 -05:00
Stephen Heumann b5c3a29f37 Initial version, with test program.
It can currently send a GetStatus request and get a response.
2017-03-18 19:42:25 -05:00