Commit Graph

72 Commits

Author SHA1 Message Date
Bobbi Webber-Manners 95615458aa Rebased on latest IP65. Needs latest CC65 to build. 2022-09-14 13:02:41 -04:00
Oliver Schmidt 6971e9216f Added central error strings. 2020-04-15 14:52:59 +02:00
Oliver Schmidt 773de74bc4 Fixed code formatting. 2020-04-13 21:19:15 +02:00
Jonno Downes e0bd530148 use ephemeral ports 2020-01-19 14:36:59 +01:00
Oliver Schmidt 2594daeb6b Fixed dotted_quad().
Omitting the middle digit because it is '0' must only be done if the high digit was omitted too (because it was '0'). If the high digit is '1' or '2' (and therefore not omitted) then the middle digit must never be omitted.
2019-05-10 11:55:32 +02:00
Oliver Schmidt 4577c2ab19 Removed Ethernet driver I/O base.
So far the base address of the Ethernet chip was a general property of all Ethernet drivers. It served two purposes:
1. Allowing to use a single Ethernet driver for a certain Ethernet chip, no matter what machine was connected to the chip.
2. Allowing use an Ethernet card in all Apple II slots.

However, we now use customized Ethernet drivers for the individual machines so 1.) isn't relevant anymore. In fact one wants to omit the overhead of a runtime-adjustable base address where it isn't needed.

So only the Apple II slots are left. But this should rather be a driver-internal approach then. We should just hand the driver the slot number the user wants to use and have the driver do its thing.

Independently from the aspect if the driver parameter is a base address or a slot number the parameter handling was changed too. For asm programs there was so far a specific init function to be called prior to the main init function if it was desired to chnage the parameter default. This was done to keep the main init function backward compatible. But now that the parameter (now the slot number) is only used on the Apple II anyhow it seems reasonable to drop the specific init function again and just provide the parameter to the main init function. All C64-only user code can stay as-is. Only Apple II user code needs to by adjusted. Please note that this change only affects asm programs, C programs always used a single init function with the Apple II slot number as parameter.
2019-05-02 14:44:24 +02:00
Oliver Schmidt b18d657753 Don't trash parameter in AX. 2018-12-09 19:49:30 +01:00
Oliver Schmidt 6a296b2058 Improved URL selector handling.
parse_url stores the URL selector in the output_buffer - which is currently 520 bytes. A new entry point called parse_url_buffer was added which instead stores the URL selector in a buffer provided by the user.

url_download now calls the new parse_url_buffer instead of parse_url. The buffer for the URL selector is simply the download_buffer. So the download_buffer is used twice: First to hold the URL selector to be sent as request to the server and then to hold the response received from the server.

However, the URL selector still can't exceed the MSS (aka 1460 bytes).

Note: The User-Agent string was shortened by two bytes as that allows a "default" URL (incl. 'http://' but without port number) of exactly 1400 bytes to end up as 1460 bytes URL selector.
2018-11-13 13:19:47 +01:00
Oliver Schmidt 41de6a76bd Allow URLs and URL selectors > 255 chars.
Note: The URL selector is stored in the output_buffer - which is currently 520 bytes. Beside all of the URL (apart from a potential "http://") the 'get' and the 'http_preamble' have to fit into that buffer. Therefore URLs mustn't exceed 450 chars. However, we omit a check to avoid further code size increase as most of the time URLs are known to be much shorter anyhow. If the URLs might become large we just leave it up to the user to check their length.
2018-10-30 22:02:47 +01:00
Oliver Schmidt 1813ce7f7d Allow tcp_send_string to send strings > 255 chars. 2018-10-30 21:07:15 +01:00
Christian Groessler e6a7ce4f45 ip65.s (ip65_random_word): use Atari's POKEY 'RANDOM' register 2018-09-10 01:09:14 +02:00
Oliver Schmidt d79db04aa1 Make use of recently added popptr1. 2018-08-14 11:20:29 +02:00
Oliver Schmidt fc61ee5358 Fixed recent change.
Brought back re-initialization of port hi-byte.
2018-08-03 00:49:56 +02:00
Oliver Schmidt 74eec87860 Improved handling of abbreviated URLs.
- There was already an explicit code path for something like 'wwww.google.com/' but that code path ended up with the protocol type unset and the port set to 0. Now the protocol defaults to HTTP and the port defaults to 80.
- There was no provision for something like http://www.google.com', rather it was just assumed that the slash after the hostname is always found. Now there's a check if the slash is actually found, and if it isn't found then an empty path is explicitly used.
2018-08-03 00:46:17 +02:00
Oliver Schmidt 4ef85827db Replaced version file with hard coded identifier.
Have the HTTP client work in just the same way the HTTP server does.
2018-08-01 19:00:39 +02:00
Oliver Schmidt 6eb4aef0e8 Enhanced C interface to user input control. 2018-08-01 19:00:39 +02:00
Oliver Schmidt 0bd53f3af7 Added C interface to Ethernet driver configuration. 2018-08-01 19:00:39 +02:00
Oliver Schmidt c47a89ce1a Split url.s into url.s and download.s.
url_parse() doesn't require TCP so it makes sense to allow a program using url_parse() to link successfully without TCP support.
2018-07-22 19:22:57 +02:00
Oliver Schmidt 3fb437f7cb Added C interface to URL functions. 2018-07-20 18:12:51 +02:00
Oliver Schmidt c1ddcbc5af Added C interface to TFTP functions. 2018-07-20 14:51:20 +02:00
Oliver Schmidt 3a490bcb9e Minor style fix. 2018-07-20 13:59:06 +02:00
Oliver Schmidt 59d86f7638 Reduced the advertised TCP window size to the MSS. 2018-06-10 14:47:42 +02:00
Oliver Schmidt d4f7569278 Removed last KPR_* constants. 2018-02-23 16:41:33 +01:00
Oliver Schmidt c89a2ae1ba Adjusted include file extension to ca65 practice. 2018-02-23 16:36:05 +01:00
Oliver Schmidt b84527c8a3 Removed last KIPPER leftover. 2018-02-23 16:33:21 +01:00
Oliver Schmidt 3c88dec698 Removed unused stuff. 2018-02-23 15:53:03 +01:00
Oliver Schmidt 7090fb5bdd Allow C programs to set the Apple II slot number. 2018-02-22 22:33:47 +01:00
Oliver Schmidt 673e2da011 Added C interface to HTTPD functions. 2017-12-07 23:03:04 +01:00
Oliver Schmidt b973526d7e Replaced HTTP response zero-termination with explicit length.
If we want to be able to send application/octet-stream we can't rely on the HTTP response to not contain a zero byte.
2017-12-07 22:57:40 +01:00
Oliver Schmidt d282290cf0 Removed HTTP output post processing completely.
I don't see the use case for inserting HTTP variables as-is into the HTTP output.
2017-12-07 21:39:25 +01:00
Oliver Schmidt 9f652e7c21 Changed HTTP response Server field to something more generic. 2017-11-15 19:24:50 +01:00
Oliver Schmidt d2d5edca44 Export httpd_send_response.
The HTTP callback is explicitly allowed to send the HTTP response on its own and set the carry to signal that. Therefore it seems reasonable to export httpd_send_response to allow the HTTP callback to make use of the given infrastructure to send the HTTP response.
2017-11-15 19:24:50 +01:00
Oliver Schmidt 4faf0cbeae Minor style adjustment. 2017-11-15 19:24:49 +01:00
Oliver Schmidt 5427dee30d Added C interface to SNTP function. 2017-11-09 21:48:08 +01:00
Oliver Schmidt e6684904cf Made tcp_listen return the client IP address.
Together with the recent change to provide the inbound data buffer address and length to the TCP callback function as C parameters this change allows the TCP API to get along without any global variable :-)
2017-11-08 20:59:06 +01:00
Oliver Schmidt e1bf89d1a8 Use parameters for TCP C callback.
In contrast to the multiple UDP callbacks there's only one TCP callback so it easy to provide a wrapper for the C callback that pushes C parameters on the stack.
2017-11-07 23:05:05 +01:00
Oliver Schmidt 9a8ba804bc Added C interface to TCP functions. 2017-11-06 23:36:44 +01:00
Oliver Schmidt c6efcebf97 Added C interface to timer handling. 2017-11-05 23:16:34 +01:00
Oliver Schmidt 3c9ab2eb5f Added C interface to abort key control. 2017-11-05 22:55:55 +01:00
Oliver Schmidt 6680772b04 Introduced C interface to IP65.
The IP5 usage of ld65 segments and zeropage variables was made compatible with cc65 C programs already a while ago. This commit is the next logical step which is to introduce the actual C interface to IP65.

IP65 for C programs shares the the ip65.lib / ip65_tcp.lib with IP65 for assembler programs. However the various libraries from the 'drivers' are not reused. Instead there's exactly one library for every target named ip65_<target>.lib. Those libraries contain only functions used by ip65.lib / ip65_tcp.lib.

TODOs:

- Introduce c64_timer.s and atr_timer.s.
- Add a C interface to the rest of the IP65 functionality (especially TCP).
2017-11-05 14:28:49 +01:00
Oliver Schmidt 23ae6c155b Adjusted comment to (surprising) reality. 2017-10-29 00:08:33 +02:00
Oliver Schmidt 90c83387f2 Removed unused stuff. 2017-10-27 22:56:04 +02:00
Oliver Schmidt 3541c20ba2 Fixed sequence number of initial TCP ACK packet on tcp_connect.
So far the sequence number for the first packet after the initial SYN packet was calculated directly before returning from tcp_connect. This is however far to late as the ACK packet to be send as response for the SYN,ACK packet sent by the server already needs that sequence number. Therefore it is now calculated right after a successful reception of the SYN,ACK packet is detected.
2017-08-12 17:02:56 +02:00
Oliver Schmidt 3359061ce2 Added Telnet65 app.
The file telnet.s in the 'ip65' directory for sure wasn't belonging into a library as it contained a main loop. So I introduced an 'apps' directory for actual apps coming with IP65. The file telnet.s was moved to apps, renamed telnet65.s and heavily modified.

The file c64vt100.s was made up from several files taken from CaTer (www.opppf.de/Cater) and adjusted for the new use case. The was done before for KIPPERTERM. However this time I deliberately avoided unnecessary code reformatting to allow for as easy as possible integration of potential upcoming changes in CaTer.

The file a2vt100.s was copied from c64vt100.s and adjusted to the monochrome 80 column screen of the Apple //e. Again unnecessary code changes were avoided to allow to easily merge upcoming changes from c64vt100.s.

The files atrvt100.s and vic20vt100.s are for now just dummies to allow to successfully link Telnet65. Work for an actually functional Telnet65 would start with a copy of c64vt100.s (as it was done with a2vt100.s).
2017-05-19 00:12:42 +02:00
Oliver Schmidt e3b941008c Fixed error value.
So far the error value was set to KPR_ERROR_TIMEOUT_ON_RECEIVE on negative answer from the DNS server. Now KPR_ERROR_DNS_LOOKUP_FAILED (which was already defined) is set.
2017-05-15 22:09:10 +02:00
Oliver Schmidt 1a5bd8c7e5 Fixed ARP setup.
In general I consider the approach of a netmask length a typical case of over-optimzation - incl. the typical downside of an "unnecessary" bug. However as the optimization is already present I opted to not remove it but rather fix the bug:

So far the gateway was in usual environments only used if the target IP address differed already in the first byte from the local net IP addresses. Now the gateway is used correctly - even for i.e. the address 192.168.1.1 from the local net  192.168.0.x
2017-05-15 21:20:51 +02:00
Oliver Schmidt fccc7e2dc2 Some minor changes. 2017-05-02 20:39:27 +02:00
Oliver Schmidt 8745021d7d Avoid trash of zero page variable.
It's not save to presume any zero page variable to stay intact after using the Ethernet drivers to perform actual network I/O. In example a necessary ARP lookup may require network I/O in not anticipated scenarios. Therefore the tftp_filename is rather to be placed in a normal variable and copied to a zero page variable just-in-time.
2017-04-10 09:06:18 +02:00
Oliver Schmidt ae98e5c01d Removed cfg_get_configuration_ptr.
cfg_get_configuration_ptr was introduced for NB64 - which is out of scope for this IP65.
2015-07-08 16:20:47 +02:00
Oliver Schmidt b3067aa499 Export dns_hostname_is_dotted_quad.
Of course one can just always call dns_resolve after dns_set_hostname. But an application might i.e. present a different user feedback depending on the fact if a name resolution is necessary at all. So given that DNS name resolution is already a two phase action it just seems natural to allow an application to read the already exsisting variable.
2015-04-13 21:01:59 +02:00