Kevin Day [Sat, 22 Jul 2023 15:38:57 +0000 (10:38 -0500)]
Progress: Continue memory array related changes.
I noticed that I could also implement f_memory_array_append() and f_memory_array_append_all() methods if I used memcpy() and a multiplication over the type size.
This:
const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_socket_t), (void **) &destination->array, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
for (f_number_unsigned_t i = 0; i < source.used; ++i) {
destination->array[destination->used++] = source.array[i];
} // for
return F_none;
Could instead become:
const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_socket_t), (void **) &destination->array, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
This could then be logic could then be moved into something like f_memory_array_append_all(), further simplifying the code into:
return f_memory_array_append(source.array, source.used, sizeof(f_socket_t), (void **) &destination->array, &destination->used, &destination->size);
I need to think of the function structure that I want and so I only decided to comment in this commit.
Such a change is not implemented yet but may be done at some later time.
Kevin Day [Wed, 19 Jul 2023 04:11:32 +0000 (23:11 -0500)]
Progress: Continue memory array related changes, replacing the f_memory_structure entirely.
The f_memory_array set of functions now fully replaces the f_memory_structure functions and related macros.
I think those structure macros are nifty but they are not in use enough anymore and the f_memory_array structure is what I am going forward with.
There is still an enormouse amount of changes to do.
Kevin Day [Tue, 18 Jul 2023 04:56:33 +0000 (23:56 -0500)]
Progress: Add memory array allocation functionality and begin to use it where possible.
The pattern for handling the standard array structure is now well established.
Provide a memory array functionality for handling the most basic form.
This should reduce repeated code where possible.
It would be interesting if this reduces the size of the resulting binary but with inline optimizations it may be possible that this actually increases the size of the resulting binary.
Update the comments and tests.
There are a lot of files that will need to be updated to use these new functions.
Most of these are in the f_type_array project.
Kevin Day [Mon, 17 Jul 2023 05:24:37 +0000 (00:24 -0500)]
Update: Add FSS Simple Packet related functionality and remove delimit and comment types.
The FSS Simple Packet functionality is added, to provide for processing of the FSS Simple Packet.
The f_fss_simple_packet_ranges_t represents a set of ranges for designating where/how the packet is defined within some string.
The delimit and comment types are just helper type definitions for existing number types.
Simplify the design by getting rid of those, replacing them with the type that they effectively represent.
A lot of code is updated to reflect this change.
This is an encrypted variation of the FSS-000F "Simple Packet" specification.
The third control bit (from the left) represents that the Simple Packet is encrypted.
The requirements for the format of the actual contents of Payload Block is further relaxed due encrypted data needing to be private (for what should be obvious reasons).
Add "Properties: " and related styling to the documentation comments for type definition structures.
Fix capitalization and other formatting issues that I noticed.
I did not focus on any of the programs.
However, some program related files happened to be open and so I updated those out of convenience.
A follow up commit will be needed to address the programs and any other files in which I may have missed in this pass.
Kevin Day [Sat, 15 Jul 2023 03:00:11 +0000 (22:00 -0500)]
Update: Specifications, adding explicit version date and change license line format.
Add a version, which contains the date of the last change to each of the specifications.
There will eventually be a specification version number such as "1.2.3".
The license line in the comments at the top of each specification is of this form: "license: ".
Remove the colon so that the comment, if extracted, could be processed as something simple like FSS-0000.
Kevin Day [Fri, 14 Jul 2023 03:07:57 +0000 (22:07 -0500)]
Update: Conversion should return F_number_positive and F_number_negative without error bit and do some clean up.
Do not treat F_number_positive and F_number_negative as an error.
The "unsigned" concept should be internal to the function and not whether or not the user input has a sign.
If F_number_negative is returned, the value can still be of type f_number_unsigned_t.
This is because the return status designates the effective sign.
The caller can then decide whether or not this is an error.
Kevin Day [Thu, 13 Jul 2023 03:24:07 +0000 (22:24 -0500)]
Update: Use status_signal instead of status_thread.
The status_thread is being used specifically for the signal thread.
Change the standard practice to have this renamed to status_signal.
This then helps make other status names make more sense.
Rather than have status_thread, status_thread_a, and status_thread_b, instead have status_signal, status_a, and status_b.
Kevin Day [Sun, 9 Jul 2023 16:33:46 +0000 (11:33 -0500)]
Update: Network additions and improvements, minor documentation comment clean ups.
Add f_network_is_ip_address() along with appropriate unit tests.
The unit test are not as thorough as they could be.
I did not fully review the IPv6 standard, which has a rather absurd design.
There are likely things that I do not yet know about that are not supported.
Specifically do not support port number on any IPv6 address without brackets.
(The IPv6 address notation standard is horribly written.)
Kevin Day [Sat, 8 Jul 2023 03:36:17 +0000 (22:36 -0500)]
Update: Socket bind functions, socket address family enumeration, and rename max_backlog.
Change the f_socket_bind_local() bind function to not call memset() and use the new address structure.
Add f_socket_bind_inet4() and f_socket_bind_inet6() bind functions in a similar way to f_socket_bind_local().
Update the appropriate documentation.
Add the appropriate unit tests.
The name max_backlog for f_socket_listen() is better named backlog_max as per the FLL style practices.
Kevin Day [Thu, 6 Jul 2023 03:38:12 +0000 (22:38 -0500)]
Update: Socket improvements regarding structure and styling.
The f_socket_t structure has "struct sockaddr" as a pointer.
This means mass allocation becomes less practical due to needing to create the actual "struct sockaddr" as needed.
Implement an f_socket_address_t union that accepts the cost of less memory efficiency to improve the usability.
This now allows for mixed types to be stored in the array without needing complicated code to manage different arrays.
The caller will have to be responsible for properly setting the appropriate structure as needed.
Organize the code styling to be more consistent with alphabetical ordering.
I likely have some of the comments to update as well (a follow up commit will be necessary).
Kevin Day [Thu, 29 Jun 2023 04:38:30 +0000 (23:38 -0500)]
Update: Relax the requirement in the license to be less verbose.
Do not specifically use my name "Kevin Day".
Instead refer to the "original license owner" or some authorized party.
This will make the license more flexible.
This also addresses a define name design problem where I have two cases that _F_type_array_file_h would be defined.
For now, just rename the _F_type_array_file_h to _F_type_array__file_h for the top-level file.
Kevin Day [Sat, 24 Jun 2023 20:58:06 +0000 (15:58 -0500)]
Feature: Add f_file_select() for select().
This is more of a wrapper around select() (unlike f_file_poll() which is a bit more than a wrapper around poll()).
The arguments would be more difficult than worth it to simplify and normalize in the FLL typedef style.
Kevin Day [Sat, 24 Jun 2023 03:08:45 +0000 (22:08 -0500)]
Feature: Add additional network and socket related functions.
Add the following:
- f_file_poll() for poll().
- f_socket_read_stream() for recv().
- f_socket_write_stream() for send().
Add f_poll_t, f_polls_t, and f_pollss_t typedefs.
This adds the appropriate array management functions.
To be consistent with type_file.h a new type_array_file.h is created to manage these.
Update the existing f_signal_read() to use the new typdef f_poll_t.
Kevin Day [Thu, 22 Jun 2023 03:26:54 +0000 (22:26 -0500)]
Feature: Add f_network_to_ip_string() and f_network_from_ip_string() functions.
Provide support for inet_ntop() and inet_pton().
String are handling in FLL via f_string_static_t and f_string_dynamic_t.
The functions f_network_to_ip_string() and f_network_from_ip_string() are written to convert to these string types.
This implements a custom f_network_family_ip_t type to pass the digit IP address.
The idea here is to help reduce how much the FLL API is locked into the "libc" or POSIX API.
The structures are allocated using "{ 0 }" to take advantage of the supposed relatively new feature that treats this as an initialize all to NULL.
Kevin Day [Wed, 21 Jun 2023 01:54:31 +0000 (20:54 -0500)]
Feature: Add f_file_manipulate() as a wrapper for fcntl().
This also adds the unit tests.
The unit tests includes additional fixes where several of the wrapped functions are not being setup properly.
The fact that has not triggered an error in the past is concerning.
Kevin Day [Wed, 21 Jun 2023 01:51:05 +0000 (20:51 -0500)]
Feature: Add F_again and F_again_not status codes.
The fcntl() function uses two forms of privilege failures.
The EPERM is already translated to F_prohibited.
Therefore, add F_again (and F_again_not) so that EAGAIN can be used for that.
Kevin Day [Tue, 20 Jun 2023 02:52:12 +0000 (21:52 -0500)]
Feature: Add f_socket_name_host() and f_socket_name_peer().
Add missing network socket related functions for getting the "name" of the local or remote connections.
The local name is retuned as a string.
The remote name is returned on the f_socket_t structure.
I considered doing the work necessary to better generalize this but I decided not to.
I can leave that for once I am better experience in the network programming.
Kevin Day [Tue, 20 Jun 2023 02:51:00 +0000 (21:51 -0500)]
Cleanup: Rename *_total_parameters_d to *_parameter_total_d.
The naming scheme for the total parameters define is out of synchronization with the practices.
Rename this to be more in line with the current practices.
Kevin Day [Sat, 17 Jun 2023 17:41:52 +0000 (12:41 -0500)]
Update: Remove f_array_length_t and related, replacing with f_number_unsigned_t and appropriate.
This simplifies the design.
Doing this comes at a cost of some flexibility and hackability.
After some consideration, I have decided that it can introduce more complicated handling when needing to process both f_array_length_t and f_number_unsigned_t during I/O.
This should keep things simple.
I decided to maintain the custom functions for managing this.
I could use an ifdef wrapper and call the appropriate calls within, but I can do that for another time if I decide to (and remember to).
Kevin Day [Fri, 16 Jun 2023 03:13:17 +0000 (22:13 -0500)]
Cleanup: Remove no longer needed programs.
The fss_read is mostly complete for these programs.
Additional review and testing is needed but I can do that slowly over time.
The runtime unit tests suggests that these are reasonably complete.
The Embedded List Read is not deleted because it is not complete.
There are bugs in both the 0.6.x and the 0.7.x versions.
A rewrite of that mess is needed (and has been for a long time).
I will push this off for now due to it being low priority.
Kevin Day [Thu, 15 Jun 2023 03:13:00 +0000 (22:13 -0500)]
Progress: Fix issues in runtime tests for fss_read not relating to Embedded List and Payload.
More runtime tests now pass.
The Extended List tests still fail in some cases.
I noticed that the Extended List line count is not handling the closing brace.
The count is inaccurate.
This is a bug in the 0.6.x branch and needs to be fixed there.
The fix is in place for this branch but the tests currently fail because they generated expect files are incorrect in this case.
There are other similar problems in different FSS read programs regarding --total and parameters like --at or --line that need to be fixed in the 0.6.x branch as well.
The Embedded List and Payload need special handling and are not addressed here.
Other things regarding fss_read not done:
- The help printing needs to be updated for each program.
- Any remaining todo and fixme.
- The pipe input and output.
There is likely a lot of room for improvement but I am going to ignore such things for now as my priorities are elsewhere.
Kevin Day [Sat, 10 Jun 2023 04:04:33 +0000 (23:04 -0500)]
Update: Complete most of the runtime times for FSS Read program.
Note that this says "most".
I noticed a segmentation fault with FSS-0.6.x versions of fss_embedded_list_read.
This needs to be addressed but is not done so here.
This does not address the tests that fail.
A subsequent commit will follow to address these failures.
These failures are most likely due to that I have not finished migrating all of the fss_read standards.
This also adds some files with UTF-8 characters in the name.
Kevin Day [Fri, 9 Jun 2023 04:15:10 +0000 (23:15 -0500)]
Bugfix: Use arguments passed to fake when processing build with the custom build arguments.
The custom build arguments are passed when the make mode is being used to call the build mode.
The mode arguments passed to the fake program, these should be propagated into the custom build arguments for the build mode.
Kevin Day [Wed, 31 May 2023 03:07:14 +0000 (22:07 -0500)]
Bugfix: Fix runtime tests and problems exposed by runtime tests.
Add additional runtime tests to handle more cases.
The --select functionality is now completed.
This includes using --select with --name and --total.
The quotes are not being handled properly.
This has been fixed by the previous commit (e793c5a5b9f3c3c636e55e0b52df1a11590827cb).
The fss_read tests are updated to better test and expose this potential problem (adding single and double quote usage).
I used the 0.6.x fss_*_read functions to generate the expected output.
This exposed a mistake in the fss_extended_read in the 0.6.x branch where the wrong quotes are being used.
The expecations have been manually corrected and I now need to go back and fix this bug in the 0.6.x branch.
Kevin Day [Wed, 31 May 2023 03:00:02 +0000 (22:00 -0500)]
Bugfix: Quotes in FSS read functions are not being properly handled.
At some point in time the intended behavior changed from using the literal quote character to an enumeration representing the quote character on FSS read calls.
This transition is incomplete and broken.
Finish the transition, passing the enumeration representation rather than the literal character.
Remove an unnecessary initialization on the quote because the private function being called also initializes the variable.
Relocate the f_uint8s_increase() call to be after changing the error status to ensure that the quotes array is properly incremented.
Update the documentation comments to better clarify this behavior in regards to the enumeration.
Kevin Day [Tue, 30 May 2023 22:47:35 +0000 (17:47 -0500)]
Cleanup: FSS Read testfile and related.
Add some new lines to the testfile.
Remove a redundant directory create operation in the testfile.
Remove the '=' character as it does not provide anything useful when printing the test status.