Implement the AX.25 v2.2 XID parameter exchange as a preamble for
initiating connections with peers, with the following workflow:
* Upon a connect() call, send an XID frame to the peer
* When a DM is received, assume the peer is unable to accept a
connection
* When a FRMR is received, assume the peer does not adhere to the
AX.25 v2.2 standard, and attempt to initiate a connection with a
SABM frame instead
* When an XID is received, adapt local parameters to meet the
needs of the peer, and respond with an SABM or an SABME frame,
depending on which mode is indicated
Use patty_ax25_sock_bind_if() in server_connect() to ensure any other
functions which must take place are attended to when assigning an
interface to a socket
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()
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
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
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
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
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
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
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
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
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
Use KISS framing for raw sockets to avoid multiple write() calls from
being buffered, which caused read() on the other end of a file
descriptor to read more than frame at once
Significantly simplify dictionaries so that dictionary keys are always
uint32_t; this number can be an arbitrary integer, be it a file
descriptor, for instance, or a hashed value
Move raw frame interface capture to patty_ax25_if, patty_ax25_sock; this
resolves the issue wherein only bytes received, not sent, would be
captured by a raw socket bound to a specific interface with setsockopt()