Commit graph

42 commits

Author SHA1 Message Date
854d3bc9a7 Fix bug in patty_ax25_if_addr_add()
Fix bug in patty_ax25_if_addr_add() wherein, due to a typo of memcpy()
rather than memcmp(), the function would never fail to add an address
to an interface, even if it already exists on the interface
2024-03-01 00:20:47 -05:00
5cb98de5d0 Allow setting baud, flow control for TNCs
Changes:

    * Add argument to patty_kiss_tnc_new(), patty_kiss_tnc_new_fd(),
      a pointer to patty_kiss_tnc_info, to allow specifying baud and
      flow control

    * Rework patty_ax25_if_kiss_tnc_info to hold patty_kiss_tnc_info as
      a hack to allow instantiating a KISS TNC-based network interface
      with desired baud and flow control
2024-03-01 00:20:47 -05:00
9734c97f35 Implement src/daemon.c
Implement src/daemon.c to provide a high level method to instantiate a
patty server

Changes:

    * Refactor src/server.c, src/route.c, src/if.c methods which accept
      callsign arguments to use a patty_ax25_addr pointer instead; this
      has significantly reduced the number of redundant calls to
      patty_ax25_pton()

    * Decouple patty_ax25_addr from patty_ax25_if_info types when
      creating new interfaces with patty_ax25_if_new(); instead, take a
      separate patty_ax25_addr argument

    * Split patty_ax25_server_run() into the following methods:

          - patty_ax25_server_start()
          - patty_ax25_server_stop()
          - patty_ax25_server_event_handle()

      This is intended to allow possible integration into other event
      loops.

    * Implement src/daemon.c to allow quick instantiation of a server,
      interfaces, and routes, and to encapsulate the setting of
      configuration variables; callsigns and interface names are handled
      as character strings

    * Rename examples/server.c to examples/daemon.c; reimplement in
      terms of the patty_daemon code

    *
2024-03-01 00:20:47 -05:00
6bb71a37ff Fix segfault in patty_ax25_if_addr_match() 2024-03-01 00:20:47 -05:00
bdbab9c5e7 Disregard TEST, UA and XID not addressed to iface 2024-03-01 00:20:47 -05:00
222e51100e Implement SSID suffix stringes in pton()/ntop()
Implement SSID suffix stringes in pton()/ntop() to make it more
straightforward to specify addresses to bind, connect to, or add routes
for

Changes:

    * Implement SSID suffix string formatting in patty_ax25_ntop(); drop
      the 'ssid' pointer argument

    * Implement SSID suffix string parsing in patty_ax25_pton(); drop
      the 'ssid' argument

    * Change all calls to patty_ax25_ntop() and patty_ax25_pton() to use
      their new calling convention
2024-03-01 00:20:47 -05:00
d0d17b58fb Implement support for sending frames with SOCK_RAW
Changes:

    * When associating a promiscuous socket with an interface, rather
      than creating a patty_kiss_tnc object, simply store the socket
      file descriptor and use patty_kiss_frame_send() to send incoming
      or outgoing frames for that interface to the promiscuous socket

    * Add special initialization code in src/sock.c for SOCK_RAW; don't
      allocate any buffers, but instead set a few flags and otherwise
      use 0-initialized defaults

    * Implement handle_sock_raw() in src/server.c to check to see if any
      raw frames are pending, and if so, send them to the associated
      interface if provided by setsockopt()

    * Make patty_ax25_sock_bind_if() only call the function
      patty_ax25_if_add_promisc() only if the socket status is PROMISC;
      this allows support for non-promiscuous sockets used for outbound
      purposes
2024-03-01 00:20:47 -05:00
2c585ca4fe Keep default Classes of Procedures for socks, ifs
Keep distinct default Classes of Procedures parameter flag values for
sockets and interfaces, as the Asynchronous Balanced Mode parameter does
not apply to the interface itself, and the Half/Full Duplex parameters
do not apply to the sock
2024-03-01 00:20:46 -05:00
529112225a Make duplicate interface addresses emit EADDRINUSE 2024-03-01 00:20:46 -05:00
bd148fff10 Add Class of Procedures flag to patty_ax25_if 2024-03-01 00:20:46 -05:00
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
ffe8599db1 Rename tx, rx_bufsz to mtu, mru in src/if.c 2024-03-01 00:20:46 -05:00
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
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
3e99af64d1 Use tcdrain() to flush frames to raw socks 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
5a3660450f Get rid of patty_list_iterator (too expensive) 2024-03-01 00:20:46 -05:00
17b2313edc Keep accounting of RX/TX bytes, frames 2024-03-01 00:20:46 -05:00
bdb73c8805 Making significant headway towards a working server 2024-03-01 00:20:46 -05:00
4aced9e9c1 ...I've been busy. 2024-03-01 00:20:46 -05:00
d265ce8756 More stuff 2024-03-01 00:20:46 -05:00
eb45bd192d Just need to make a damn client/server test already 2024-03-01 00:20:46 -05:00
c4fa41dab4 I am getting AWFULLY close to being able to run this code 2024-03-01 00:20:46 -05:00
d2e278f715 Massive refactoring afoot 2024-03-01 00:20:46 -05:00
fa3f4a2e0e Start of massive refactor 2024-03-01 00:20:46 -05:00
34afdba9e4 Suppress int/void* cast compiler errors 2024-03-01 00:20:46 -05:00
a8db220bbd Major refactor WIP 2024-03-01 00:20:46 -05:00
68a01bb992 Fix LLVM warnings 2024-03-01 00:20:46 -05:00
2e0adee54e Remove _unix suffix from patty_kiss_tnc_fd_unix() 2024-03-01 00:20:46 -05:00
153dc17c7b Start to whittle down src/ax25.c, include/ax25.h 2024-03-01 00:20:46 -05:00
66e5de9d6c Make patty_kiss_tnc_open() use default buffer size
Make patty_kiss_tnc_open() use default buffer size

Other changes:

    * Make src/decode.c no longer require a filename to use as a TNC
2024-03-01 00:20:46 -05:00
4e5634cbc7 My final commit 2024-03-01 00:20:46 -05:00
53791bf21d Ahh, that's better 2024-03-01 00:20:46 -05:00
5fb55973ad Manage the bits that'll go into select(2) or whatevs 2024-03-01 00:20:46 -05:00
a76ea9125a Just a little hit 2024-03-01 00:20:46 -05:00
13cfe03cbe Walt, we need to talk 2024-03-01 00:20:46 -05:00
ff76e77336 Stub out patty_ax25_next_event() 2024-03-01 00:20:46 -05:00
6adb4f098b I think that's much nicer 2024-03-01 00:20:46 -05:00
0d40883e59 Can you feel heavy metal??? 2024-03-01 00:20:46 -05:00
e85df9e29e Well, it does compile 2024-03-01 00:20:46 -05:00
1397c7e479 Oh cock 2024-03-01 00:20:46 -05:00