]> Kevux Git Server - fll/commit
Update: Replace f_fss_simple_packet_identify() with f_fss_simple_packet_extract(...
authorKevin Day <thekevinday@gmail.com>
Mon, 4 Sep 2023 20:04:37 +0000 (15:04 -0500)
committerKevin Day <thekevinday@gmail.com>
Mon, 4 Sep 2023 23:55:17 +0000 (18:55 -0500)
commit3927ae8ee1c4aeec62121322fcf66681b77c85bf
tree54c4660f2f457893694e8f2737327810544fe73c
parent2de65d04281a933dbe76aab66fe7ede5028c33af
Update: Replace f_fss_simple_packet_identify() with f_fss_simple_packet_extract() and f_fss_simple_packet_extract_range().

The implementation of f_fss_simple_packet_identify() appears to be some sort of hybrid between actual code and brainstorming.
This appears to be by accident and the resulting logic of the function is nonsense.

Fix the logic in f_fss_simple_packet_identify().
I also see no reason to perform an identify call.
The FSS Packet design is so simple that I could just add 1, 4, or 5 to determine any of the parts.
Therefore, instead implement f_fss_simple_packet_extract() and f_fss_simple_packet_extract_range() to extract the Control bits and the Size integer.
The Payload part is not extracted but for the f_fss_simple_packet_extract_range(), the range for the Payload is determined.
This allows for the caller to determine how they want to manage the memory allocation.

This is a case where object-oriented would shine had I used C++ or some other object-oriented language.
I don't have this option available and so I am going to only have f_fss_simple_packet_t and f_fss_simple_packet_range_t with their respective f_fss_simple_packet_extract() and f_fss_simple_packet_extract_range() functions.

Unit tests are now provided for these two new functions.
16 files changed:
build/stand_alone/fake.config.h
level_0/f_fss/c/fss/simple_packet.c
level_0/f_fss/c/fss/simple_packet.h
level_0/f_fss/data/build/settings-tests
level_0/f_fss/tests/unit/c/test-fss-simple_packet_delete.h
level_0/f_fss/tests/unit/c/test-fss-simple_packet_destroy.h
level_0/f_fss/tests/unit/c/test-fss-simple_packet_extract.c [new file with mode: 0644]
level_0/f_fss/tests/unit/c/test-fss-simple_packet_extract.h [new file with mode: 0644]
level_0/f_fss/tests/unit/c/test-fss-simple_packet_extract_range.c [new file with mode: 0644]
level_0/f_fss/tests/unit/c/test-fss-simple_packet_extract_range.h [new file with mode: 0644]
level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.h
level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.h
level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.h
level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.h
level_0/f_fss/tests/unit/c/test-fss.c
level_0/f_fss/tests/unit/c/test-fss.h