Commit graph

20 commits

Author SHA1 Message Date
XANTRONIX Development
25da758257 Implement patty_strlcpy()
Implement patty_strlcpy() for portability and correctness, to provide
BSD strlcpy() functionality for glibc systems while ensuring a nul
terminated string is written to a destination, truncating the source
string by one byte if need be to make room for the nul terminator
2024-03-01 00:20:47 -05:00
XANTRONIX Development
f80cc4055f Implement interface resetting
Changes:

    * Implement patty_ax25_if_reset() to allow pattyd(8) to attempt to
      reset the network interface in the event of an I/O error

    * Move existing link resetting code in src/aprs_is.c to
      patty_ax25_aprs_is_reset(); allow src/server.c to call this rather
      than within src/aprs_is.c itself

    * Implement patty_kiss_tnc_reset(); this simply sets errno to ENOSYS
      and returns -1 for the time being
2024-03-01 00:20:47 -05:00
XANTRONIX Development
58d9a37786 Don't include patty/ax25.h in includes 2024-03-01 00:20:47 -05:00
XANTRONIX Development
4f2f01ec0a Refactor patty_kiss_tnc_new()
Refactor patty_kiss_tnc_new() into the following initialization methods:

    * init_sock()
    * init_device()
    * init_termios()
2024-03-01 00:20:47 -05:00
XANTRONIX Development
a672b4e44a Use heap-allocated buffer in ax25dump(8) 2024-03-01 00:20:47 -05:00
XANTRONIX Development
6148977adf Fix bug parsing KISS frames not for port 0
Fix bug parsing KISS frames not for port 0 in patty_kiss_tnc_drain();
furthermore, ensure frames are only handled when they are indeed for
port 0
2024-03-01 00:20:47 -05:00
XANTRONIX Development
14354337cc Ensure dropped packets are not counted as RXed
Ensure dropped packets are not counted as RXed in the following
interface drivers:

    * src/tnc.c
    * src/aprs_is.c
2024-03-01 00:20:47 -05:00
XANTRONIX Development
986f329dd7 Track received frames, bytes in src/tnc.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
2b931ec357 Implement patty_ax25_if_ready()
Implement patty_ax25_if_ready() to provide a means of testing an
interface's readiness for performing I/O; this may also be used in the
future for some interface drivers which may require occasional keepalive
timers to maintain a link
2024-03-01 00:20:47 -05:00
XANTRONIX Development
80469ac535 Rename patty_ax25_if_ready() to if_pending()
Rename patty_ax25_if_ready() to if_pending() in src/if.c, as well as in
each driver implementing this method and any direct invocations of said
driver methods
2024-03-01 00:20:47 -05:00
XANTRONIX Development
b97b927e0c Remove unused patty_ax25_if_pending()
Remove unused patty_ax25_if_pending() from src/if.c, as well as from all
drivers implementing this method
2024-03-01 00:20:47 -05:00
XANTRONIX Development
50eaef806d Reset TNC command state on frame end 2024-03-01 00:20:47 -05:00
XANTRONIX Development
c8c00c994c Handle non-DATA KISS commands in src/tnc.c
Handle non-DATA KISS commands in src/tnc.c, rather than simply returning
-1 setting errno to EIO
2024-03-01 00:20:47 -05:00
XANTRONIX Development
dfd0978113 Move patty_ax25_if_stats accounting into drivers
Move patty_ax25_if_stats accounting into drivers to help provide a more
consistent interface for accessing and incrementing interface statistics
2024-03-01 00:20:47 -05:00
XANTRONIX Development
d5e2062dea Split patty_ax25_if_recv() into specific parts
Split patty_ax25_if_recv() into the following parts:

    * patty_ax25_if_fill(), to fill the internal PHY buffer

    * patty_ax25_if_drain(), to drain the internal PHY buffer and decode
      any data present in the buffer

    * patty_ax25_if_ready(), to test if a complete frame has been
      decoded

    * patty_ax25_if_flush(), to return the final number of bytes decoded
      in the PHY buffer and reset the decoding state

Other changes:

    * Implement a finite state machine for decoding KISS traffic in
      src/tnc.c, patty_ax25_kiss_drain()

    * Refactor src/server.c, handle_iface() to use the aforementioned
      frame receive/decode methods
2024-03-01 00:20:47 -05:00
XANTRONIX Development
2f5c877762 Fix uninitialized memory in patty_kiss_tnc_driver() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
4b1e0ff46d Better variable name in patty_kiss_tnc_recv() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
16b46168b2 Remove unneeded variable in patty_kiss_tnc_recv() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
30b17d337b Fix #include cycle in include/patty/kiss/tnc.h 2024-03-01 00:20:47 -05:00
XANTRONIX Development
cb33d799ff Implement patty_ax25_if_driver
Changes:

    * Implement patty_ax25_if_driver type, providing a vtable with
      pointers to methods implementing an AX.25 interface PHY

    * Implement patty_ax25_if_name() to return a pointer to the name
      string of an AX.25 interface

    * Decouple patty_kiss_tnc from src/if.c using patty_ax25_if_driver

    * Remove port input/output arguments from patty_kiss_tnc_send()
      and patty_kiss_tnc_recv(), respectively; use 0 as the default,
      but keep the port argument in patty_kiss_frame_send()

    * Implement patty_ax25_if_fd() to return file descriptor backing a
      PHY; use this rather than patty_kiss_tnc_fd() in src/server.c to
      further decouple interfaces from their implementation

    * Remove 'enum patty_ax25_if_type' type; refactor constructor
      patty_ax25_if_new() to no longer take this as an argument, but
      rather a patty_ax25_if_driver to use to instantiate the PHY
      with the information pointer passed

    * Break out patty_kiss_tnc code from src/kiss.c into src/tnc.c,
      leaving only patty_kiss_frame_send() in the original; this is
      needed to prevent a cyclic dependency within patty_ax25_sock and
      other areas

    * Rename patty_bin_if_config() to patty_bin_if_create(); a separate
      patty_bin_if_config() will likely be created later as necessary
      to change an existing interface

    * Split PHY-specific interface configuration code into separate
      delegates in bin/if.c

    * Implement usage of patty_error to better capture internal error
      states not currently representable with semantic error numbers
      while configuring and instantiating PHYs

    * Pass patty_error object to patty_bin_kiss_config() to receive
      detailed error information
2024-03-01 00:20:47 -05:00