Commit graph

396 commits

Author SHA1 Message Date
XANTRONIX Development
311a8b106f Fix small stylistic issues 2024-03-01 00:20:46 -05:00
XANTRONIX Development
acce657f63 Fix byte order of extended control encode, decode
Fix byte order of extended format control encoding and decoding in the
following src/frame.c functions:

    * patty_ax25_frame_decode_control()

    * patty_ax25_frame_encode_reply_to()
2024-03-01 00:20:46 -05:00
XANTRONIX Development
08c952ae07 Fix issue setting parameter bit fields in sock.c
Fix issue setting parameter bit fields in patty_ax25_sock_send_xid() in
src/sock.c, wherein the numerical values were simply bitwise ORed
2024-03-01 00:20:46 -05:00
XANTRONIX Development
d494ffecfc Fix issues encoding extended frame control fields
Changes:

    * When encoding extended frame control fields, ensure the least
      significant byte is written first, as per the AX.25 v2.2 standard
2024-03-01 00:20:46 -05:00
XANTRONIX Development
8b741cadc8 Remove patty_ax25_sock_mode_set() 2024-03-01 00:20:46 -05:00
XANTRONIX Development
754baabf11 Don't exit when unable to decode specific frames
Changes:

    * Modify examples/ax25dump.c and decode.c to not die upon failure to
      decode a specific frame or field; instead, indicate the error,
      print a hex dump of the frame, and move on to the next frame
2024-03-01 00:20:46 -05:00
XANTRONIX Development
4bfe7da77b Handle XID frames in src/server.c
Handle XID frames in src/server.c by decoding the parameter information
and passing it to patty_ax25_sock_params_set()
2024-03-01 00:20:46 -05:00
XANTRONIX Development
052c7d94d0 Implement functions for setting params on sockets
Changes:

    * Implement patty_ax25_sock_upgrade() to upgrade a socket from the
      default AX.25 2.0 parameters to AX.25 2.2 parameters, meant to be
      used upon receipt of an XID frame

    * Implement patty_ax25_sock_params_set() to set lowest common
      denominator parameters to a socket, downgrading or adapting to the
      parameters advertised by a peer XID frame as necessary
2024-03-01 00:20:46 -05:00
XANTRONIX Development
a4f50d6bea Add Classes of Procedures, HDLC params to sockets
Changes:

    * Define different sets of default parameters for AX.25 versions
      2.2 and prior

    * Add flags_classes, flags_hdlc and version to patty_ax25_sock

    * Remove flags member from patty_ax25_sock

    * Inherit Classes of Procedures value from interface when an
      interface is bound to a socket
2024-03-01 00:20:46 -05:00
XANTRONIX Development
5a64ea15d3 Don't send TX I len, TX window in XID frames
Don't send TX I len, TX window in XID frames, as the only relevant
information the peer can action upon is the originating station's
RX parameters
2024-03-01 00:20:46 -05:00
XANTRONIX Development
bd148fff10 Add Class of Procedures flag to patty_ax25_if 2024-03-01 00:20:46 -05:00
XANTRONIX Development
cd41101425 Declare default classes of procedures in ax25.h 2024-03-01 00:20:46 -05:00
XANTRONIX Development
ab27aebb55 Remove enum patty_ax25_sock_flags 2024-03-01 00:20:46 -05:00
XANTRONIX Development
87a9f1eb3f Fix sequencing issues with SABM vs SABME sockets 2024-03-01 00:20:46 -05:00
XANTRONIX Development
420b406411 Use fflush() for each frame in examples/ax25dump.c 2024-03-01 00:20:46 -05:00
XANTRONIX Development
305653e19b Don't bind SSID to interface addresses
Changes:

    * Remove ssid arguments from functions in src/if.c
2024-03-01 00:20:46 -05:00
XANTRONIX Development
e95994bf19 Implement patty_ax25_sock_send_xid()
Implement patty_ax25_sock_send_xid() to send the current socket
parameters to a remote peer
2024-03-01 00:20:46 -05:00
XANTRONIX Development
92ff180d57 Use bigger defaults for session parameters
Changes:

    * Declare bigger defaults for certain session parameters in
      include/patty/ax25/sock.h

    * Use patty_ax25_sock_reset() to initialize parameter variables in
      patty_ax25_sock_new(), to save many lines of code

    * Add patty_ax25_sock member n_ack
2024-03-01 00:20:46 -05:00
XANTRONIX Development
afbaeea95e Implement patty_ax25_frame_encode_xid()
Implement patty_ax25_frame_encode_xid() to encode a patty_ax25_params
object into a buffer to be used as an Information field
2024-03-01 00:20:46 -05:00
XANTRONIX Development
6911a59455 Rename patty_ax25_params 'found' to 'flags' 2024-03-01 00:20:46 -05:00
XANTRONIX Development
5e1d74c971 Rename 'flag' arguments to 'pf' in sock methods 2024-03-01 00:20:46 -05:00
XANTRONIX Development
1fbf09c9ba Refactor parameter decoding/display
Changes:

    * Implement patty_ax25_params struct to contain all parameters
      supported by patty, at the interface and socket level alike

    * Move parameter enumerate types into include/patty/ax25.h, from
      include/patty/ax25/frame.h; make corrections as necessary

    * Reimplement patty_ax25_frame_decode_xid() to parse known XID
      information parameters into a patty_ax25_params object

    * Implement patty_print_params() in src/print.c

    * Refactor patty_print_frame() as patty_print_frame_header(),
      without a call to patty_print_hexdump(); this allows
      patty_print_params() to be called prior to patty_print_hexdump(),
      for better readability

    * Use patty_print_params() in examples/ax25dump.c, decode.c

    * Refactor usage of patty_ax25_frame_decode_xid() in src/server.c to
      parse XID frames into a patty_ax25_params object
2024-03-01 00:20:46 -05:00
XANTRONIX Development
a722b8f9b3 Better implementation of AX.25 v2.2 default params 2024-03-01 00:20:46 -05:00
XANTRONIX Development
aeee7449eb Use new signature for XID param callback 2024-03-01 00:20:46 -05:00
XANTRONIX Development
c7410cb2a4 Refactor patty_ax25_frame_decode_xid()
Refactor patty_ax25_frame_decode_xid() to support the remote possibility
of multiple ISO 8885 groups
2024-03-01 00:20:46 -05:00
XANTRONIX Development
199d641d6f Fix small header issue 2024-03-01 00:20:46 -05:00
XANTRONIX Development
708d347e14 Fix bad logic parsing XID parameters 2024-03-01 00:20:46 -05:00
XANTRONIX Development
b34cffc0f3 Use 0xaf, not 0x8f, for XID control 2024-03-01 00:20:46 -05:00
XANTRONIX Development
ffe8599db1 Rename tx, rx_bufsz to mtu, mru in src/if.c 2024-03-01 00:20:46 -05:00
XANTRONIX Development
a638966486 Add peer parameter flags to patty_ax25_sock 2024-03-01 00:20:46 -05:00
XANTRONIX Development
7715a8c070 Implement variable size sock frame slots 2024-03-01 00:20:46 -05:00
XANTRONIX Development
ce8c5b1cbb Initial code for handling XID in src/server.c
Write initial code for handling XID frames in src/server.c
2024-03-01 00:20:46 -05:00
XANTRONIX Development
18134dde49 Implement patty_ax25_frame_decode_xid()
Implement patty_ax25_frame_decode_xid() to decode XID frame data,
adhering to the basic structure of ISO 8885 as closely as possible
2024-03-01 00:20:46 -05:00
XANTRONIX Development
b505f2743c Set default sock frame len to 328
Set default sock frame len to 328 as per AX.25 spec, to handle full
header with maximum number of repeaters, 8-bit control field, protocol
identifier, and 256 information field bytes
2024-03-01 00:20:46 -05:00
XANTRONIX Development
61f84054e4 Remove unused patty_ax25_frame_decode() def 2024-03-01 00:20:46 -05:00
XANTRONIX Development
1eb3d09608 Handle receipt of REJ, SREJ frames
Utilizing the sock TX ring buffer, respond to peer requests to resend
certain numbered I frames indicated by REJ and SREJ frames
2024-03-01 00:20:46 -05:00
XANTRONIX Development
c26c7509f4 Implement ring buffer for sock sent frames
Implement ring buffer for frames sent in a SABM or SABME session,
facilitating the ability to retransmit select frames upon request,
retaining a copy of the full frame and its transmitted size
2024-03-01 00:20:46 -05:00
XANTRONIX Development
6df612b910 Reply to I frames with REJ only with P/F bit set 2024-03-01 00:20:46 -05:00
XANTRONIX Development
34353fa1d9 Remove FRMR responses from server
Remove FRMR responses from server, as they are not included in the
current AX.25 v2.2 standard
2024-03-01 00:20:46 -05:00
XANTRONIX Development
9066fe10da Implement better handling of command/response bits
Implement better handling of command/response bits whilst decoding and
encoding addresses

Changes:

    * Add an enum patty_ax25_frame_cr argument to functions in
      src/sock.c which send specific types of frames

    * Detect AX.25 version >2.0 based on the command/response SSID bits

    * Simplify address copying/encoding by usage of the new function
      patty_ax25_addr_copy()

    * Implement showing AX.25 version, command/response indicator for
      frames in src/print.c
2024-03-01 00:20:46 -05:00
XANTRONIX Development
79d1393e74 Implement patty_ax25_addr_copy()
Implement patty_ax25_addr_copy() as a means to copy a patty_ax25_addr
object from one location in memory to another, ensuring that the SSID
field only contains at minimum the station identifier (0-15) and the
reserved bits 0x60
2024-03-01 00:20:46 -05:00
XANTRONIX Development
cbae61db27 Use PATTY_AX25_CALLSIGN_LEN in patty_ax25_addr 2024-03-01 00:20:46 -05:00
XANTRONIX Development
359742f949 Implement support for handling SABME frames 2024-03-01 00:20:46 -05:00
XANTRONIX Development
905d5b117c Better handle read()s of multiple frames from TNC
Implement better handling of situations when read() captures multiple
TNC frames; ensure each frame is handled in src/server.c, function
handle_iface(), to ensure packets aren't ignored before the next
select() call
2024-03-01 00:20:46 -05:00
XANTRONIX Development
f0c1a0e782 I like those names better 2024-03-01 00:20:46 -05:00
XANTRONIX Development
d4e7933e6b Make examples take callsign as local/remote address 2024-03-01 00:20:46 -05:00
XANTRONIX Development
566f302a1f Adhere to proper P/F procedure
Adhere to proper P/F procedure for SABM, I, and DISC frames
2024-03-01 00:20:46 -05:00
XANTRONIX Development
1265108efd Reply to I frames outside of SABM(E) with DM 2024-03-01 00:20:46 -05:00
XANTRONIX Development
5be0f40405 Allow all printable 7-bit ASCII chars in addresses 2024-03-01 00:20:46 -05:00
XANTRONIX Development
a4518a839a Implement better modulo-128 I and S frame support
Changes:

    * Split patty_ax25_frame_decode() into the following:

      - patty_ax25_frame_decode_address()
      - patty_ax25_frame_decode_control()

      This allows for look up an established socket for a given address
      pair, to determine if an SABME session is in progress,
      necessitating modulo-128 control decoding

    * Decode I and S N(R), N(S) sequence numbers, poll/final
      bits properly in both modulo-8 and modulo-128 mode

    * Perform better frame control validation

    * Implement the following functions in src/sock.c:

      - patty_ax25_sock_send_rr()
      - patty_ax25_sock_send_rnr()
      - patty_ax25_sock_send_rej()
      - patty_ax25_sock_send_srej()

      Corresponding functions have been removed from src/server.c

    * Implement better functions in src/sock.c for encoding frame
      control, with send/receive sequences associated with the socket,
      with modulo-128 encoding for SABME sessions

Other changes:

    * Move or delete macros from include/patty/ax25/macros.h into
      include/patty/ax25.h and include/patty/ax25/frame.h

    * Move definitions from include/patty/ax25/proto.h to header file
      include/patty/ax25.h

    * Perform better bounds checking while decoding frames

    * Improve frame control printing in src/print.c; display frame
      type names, N(R), (NS) sequence numbers, and poll/final bits
2024-03-01 00:20:46 -05:00