Commit graph

251 commits

Author SHA1 Message Date
d4e7933e6b Make examples take callsign as local/remote address 2024-03-01 00:20:46 -05:00
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
1265108efd Reply to I frames outside of SABM(E) with DM 2024-03-01 00:20:46 -05:00
5be0f40405 Allow all printable 7-bit ASCII chars in addresses 2024-03-01 00:20:46 -05:00
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
c2766a4405 Don't print info len on non-UI frames 2024-03-01 00:20:46 -05:00
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
b281925eba Significantly simplify dictionaries
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
2024-03-01 00:20:46 -05:00
a7cab09e47 Handle incrementing seq_send elsewhere 2024-03-01 00:20:46 -05:00
0bfd5795ad Do a slightly better job handling sock control fields 2024-03-01 00:20:46 -05:00
3e99af64d1 Use tcdrain() to flush frames to raw socks 2024-03-01 00:20:46 -05:00
aa5fda4424 Simplify U frame test macros 2024-03-01 00:20:46 -05:00
4d397f76f1 Fix PATTY_AX25_CONTROL_UNNUMBERED_INFO() macro 2024-03-01 00:20:46 -05:00
84ae427037 Move raw frame capture to patty_ax25_if
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()
2024-03-01 00:20:46 -05:00
1888b70ed9 Drop patty_ax25_server member fds_w 2024-03-01 00:20:46 -05:00
8d24566e83 Implement generalized enumerate types; REJ reply 2024-03-01 00:20:46 -05:00
9ec0255204 De-embiggen an expression 2024-03-01 00:20:46 -05:00
9f13c67518 Provide shorter names for programs in examples/ 2024-03-01 00:20:46 -05:00
84809755a1 Implement clients_by_sock convenience methods
Implement clients_by_sock convenience methods in src/server.c
2024-03-01 00:20:46 -05:00
3d2922f2a4 Remove trailing whitespace 2024-03-01 00:20:46 -05:00
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
1abf0890d9 Show function errors in testclient-promisc.c 2024-03-01 00:20:46 -05:00
08389b8781 Show function names in errors in examples/decode.c 2024-03-01 00:20:46 -05:00
b9a6ef9ff3 Move test files to examples/; build libpatty 2024-03-01 00:20:46 -05:00
f271bd33ee Update configure from birchvm 2024-03-01 00:20:46 -05:00
5a14f81c4a whitespace 2024-03-01 00:20:46 -05:00
619890c206 Shave off a few lines of code in src/server.c 2024-03-01 00:20:46 -05:00
bd68e33973 Implement src/testclient-promisc.c
Implement src/testclient-promisc.c to demonstrate raw packet access
("promiscuous mode") to interfaces
2024-03-01 00:20:46 -05:00
2c3ff15d16 Refactor src/decode.c in terms of patty_print_frame() 2024-03-01 00:20:46 -05:00
cbea4ad7a8 Implement src/print.c
Implement src/print.c to provide facilities for pretty printing packets
to any FILE handle
2024-03-01 00:20:46 -05:00
73ae096b2d Implement openif(), raw packet interface access 2024-03-01 00:20:46 -05:00
c853b79529 Remove unnecessary #include <stdio.h> 2024-03-01 00:20:46 -05:00
36bd5c9a44 Delete unnecessary example src/ptmx.c 2024-03-01 00:20:46 -05:00
65bfa95820 s/socket/fd/ for all such named members, variables 2024-03-01 00:20:46 -05:00
5a3660450f Get rid of patty_list_iterator (too expensive) 2024-03-01 00:20:46 -05:00
c6aac035e1 Add proto arg to patty_ax25_sock_new()
Other changes:

    * Remove proto arg from patty_ax25_sock_send() and
      patty_ax25_sock_write(); instead, use the proto member of
      patty_ax25_sock
2024-03-01 00:20:46 -05:00
085ac4e650 Implement missing functions in src/sock.c
Implement the following missing functions in src/sock.c:

    * patty_ax25_sock_pty()

    * patty_ax25_sock_bind_if()
2024-03-01 00:20:46 -05:00
ffcc171c48 Remove PATTY_AX25_SOCK_NONBLOCK option 2024-03-01 00:20:46 -05:00
484e68e417 Remove commented cruft from src/sock.c 2024-03-01 00:20:46 -05:00
f835f19e53 Move some stuff, remove some damn labels 2024-03-01 00:20:46 -05:00
2b1bc4c30e Well, I have WORKING FREAKING SESSIONS BAYBEE 2024-03-01 00:20:46 -05:00
22bf692a61 SO BLOODY CLOSE 2024-03-01 00:20:46 -05:00
94f073c38d Add some error message for some what-the-fuck-styled errors 2024-03-01 00:20:46 -05:00
a60e562fdb Factor out code for handling SABM frames 2024-03-01 00:20:46 -05:00
17b2313edc Keep accounting of RX/TX bytes, frames 2024-03-01 00:20:46 -05:00
7fd05f607a Huh, I managed to make something nice 2024-03-01 00:20:46 -05:00
d5ee0c7a9e No need to make a big fuss 2024-03-01 00:20:46 -05:00
eb261c9890 Don't hardcode those values there 2024-03-01 00:20:46 -05:00
a6666b4de4 Don't need that, either 2024-03-01 00:20:46 -05:00
4ff1f1a714 Nomenclature is important 2024-03-01 00:20:46 -05:00