Changes: * Implement patty_ax25_if_driver type, providing a vtable with pointers to methods implementing an AX.25 interface PHY * Implement patty_ax25_if_name() to return a pointer to the name string of an AX.25 interface * Decouple patty_kiss_tnc from src/if.c using patty_ax25_if_driver * Remove port input/output arguments from patty_kiss_tnc_send() and patty_kiss_tnc_recv(), respectively; use 0 as the default, but keep the port argument in patty_kiss_frame_send() * Implement patty_ax25_if_fd() to return file descriptor backing a PHY; use this rather than patty_kiss_tnc_fd() in src/server.c to further decouple interfaces from their implementation * Remove 'enum patty_ax25_if_type' type; refactor constructor patty_ax25_if_new() to no longer take this as an argument, but rather a patty_ax25_if_driver to use to instantiate the PHY with the information pointer passed * Break out patty_kiss_tnc code from src/kiss.c into src/tnc.c, leaving only patty_kiss_frame_send() in the original; this is needed to prevent a cyclic dependency within patty_ax25_sock and other areas * Rename patty_bin_if_config() to patty_bin_if_create(); a separate patty_bin_if_config() will likely be created later as necessary to change an existing interface * Split PHY-specific interface configuration code into separate delegates in bin/if.c * Implement usage of patty_error to better capture internal error states not currently representable with semantic error numbers while configuring and instantiating PHYs * Pass patty_error object to patty_bin_kiss_config() to receive detailed error information
33 lines
813 B
C
33 lines
813 B
C
#ifndef _PATTY_KISS_H
|
|
#define _PATTY_KISS_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#define PATTY_KISS_FEND 0xc0
|
|
#define PATTY_KISS_FESC 0xdb
|
|
#define PATTY_KISS_TFEND 0xdc
|
|
#define PATTY_KISS_TFESC 0xdd
|
|
|
|
#define PATTY_KISS_COMMAND(cmd) \
|
|
((cmd & 0x0f))
|
|
|
|
#define PATTY_KISS_COMMAND_PORT(cmd) \
|
|
((cmd & 0xf0) >> 4)
|
|
|
|
enum patty_kiss_command {
|
|
PATTY_KISS_DATA = 0x00,
|
|
PATTY_KISS_TXDELAY = 0x01,
|
|
PATTY_KISS_PERSISTENCE = 0x02,
|
|
PATTY_KISS_SLOT_TIME = 0x03,
|
|
PATTY_KISS_TX_TAIL = 0x04,
|
|
PATTY_KISS_FULL_DUPLEX = 0x05,
|
|
PATTY_KISS_HW_SET = 0x06,
|
|
PATTY_KISS_RETURN = 0xff
|
|
};
|
|
|
|
ssize_t patty_kiss_frame_send(int fd,
|
|
const void *buf,
|
|
size_t len,
|
|
int port);
|
|
|
|
#endif /* _PATTY_KISS_H */
|