Commit graph

18 commits

Author SHA1 Message Date
XANTRONIX Development
4c00c441bb Remove localcall arg from examples/ax25dump.c 2024-03-01 00:20:46 -05:00
XANTRONIX Development
1f4ffc98ac Implement new patty client code
Implement new patty client code, replacing src/call.c with src/client.c
providing clients with an interface dealing with file descriptors valid
in their process space; this also obviates the need to open a Unix
domain socket to a patty server explicitly, and helps keep track of
sockets opened on the server, locally

Changes:

    * Implement patty_client_new() to handle opening the server Unix
      domain socket, and to allocate a dict for mapping server-side
      sockets with current process file descriptors

    * Reimplement all server calls in src/call.c around the new
      patty_client type; calls which result in the creation of a
      Unix98 PTY by the patty server now handle opening the local PTY
      and setting the file descriptor to raw mode.  Furthermore, these
      calls deal exclusively in terms of current process file
      descriptors

    * Refactor src/server.c to use the new patty_client type and calls

    * Refactor examples/client.c, examples/server.c, examples/ax25dump.c
      to use the new patty_client type and calls

    * Fix a bug in src/server.c, respond_accept() wherein a 0, rather
      than the file descriptor of the socket, is sent to the client as a
      return value
2024-03-01 00:20:46 -05:00
XANTRONIX Development
9463e22481 Use ptsname(), not ptsname_r(), for portability 2024-03-01 00:20:46 -05:00
XANTRONIX Development
10745bbabf Set raw TTY attributes on patty_kiss_tnc_new_fd()
Changes:

    * Use cfmakeraw() to set raw TTY attributes in KISS TNC constructor
      patty_kiss_tnc_new_fd()

    * Restore previous TTY attributes in patty_kiss_tnc_destroy()
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
420b406411 Use fflush() for each frame in examples/ax25dump.c 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
d4e7933e6b Make examples take callsign as local/remote address 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
XANTRONIX Development
ebbfb50b1c Use KISS framing for raw sockets
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
2024-03-01 00:20:46 -05:00
XANTRONIX Development
9f13c67518 Provide shorter names for programs in examples/ 2024-03-01 00:20:46 -05:00
XANTRONIX Development
ab2c283542 Refactor socket(), openif() as setsockopt()
Other changes:

    * Fix blocking on disconnects when a raw socket is bound to an
      interface
2024-03-01 00:20:46 -05:00
XANTRONIX Development
1abf0890d9 Show function errors in testclient-promisc.c 2024-03-01 00:20:46 -05:00
XANTRONIX Development
08389b8781 Show function names in errors in examples/decode.c 2024-03-01 00:20:46 -05:00
XANTRONIX Development
b9a6ef9ff3 Move test files to examples/; build libpatty 2024-03-01 00:20:46 -05:00
XANTRONIX Development
0f37a37775 Better prototypes; better config 2024-03-01 00:20:46 -05:00
XANTRONIX Development
7eb8babd21 Initial commit of examples/patty.conf 2024-03-01 00:20:46 -05:00
XANTRONIX Development
bbf3db7466 Add examples/ax25config.txt 2024-03-01 00:20:45 -05:00