2015-07-03 03:02:22 +00:00
|
|
|
#ifndef _PATTY_AX25_H
|
|
|
|
#define _PATTY_AX25_H
|
|
|
|
|
2015-07-20 02:22:41 -05:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <patty/kiss.h>
|
2015-07-23 23:55:44 +00:00
|
|
|
#include <patty/list.h>
|
2015-07-20 02:22:41 -05:00
|
|
|
#include <patty/dict.h>
|
|
|
|
|
2020-07-10 00:01:50 -04:00
|
|
|
#define PATTY_AX25_ADDR_SIZE 7
|
2020-06-16 18:48:29 -04:00
|
|
|
#define PATTY_AX25_CALLSIGN_LEN 6
|
|
|
|
#define PATTY_AX25_IF_NAME_SIZE 8
|
2020-07-10 00:01:50 -04:00
|
|
|
#define PATTY_AX25_MAX_HOPS 8
|
2020-06-16 18:48:29 -04:00
|
|
|
#define PATTY_AX25_SOCK_PATH_SIZE 256
|
|
|
|
|
2020-07-10 00:01:50 -04:00
|
|
|
enum patty_ax25_version {
|
|
|
|
PATTY_AX25_OLD,
|
|
|
|
PATTY_AX25_2_0,
|
|
|
|
PATTY_AX25_2_2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum patty_ax25_proto {
|
|
|
|
PATTY_AX25_PROTO_UNKNOWN = 0x00,
|
|
|
|
PATTY_AX25_PROTO_ISO_8208 = 0x01,
|
|
|
|
PATTY_AX25_PROTO_TCP_VJ_COMPR = 0x06,
|
|
|
|
PATTY_AX25_PROTO_TCP_VJ = 0x07,
|
|
|
|
PATTY_AX25_PROTO_FRAGMENT = 0x08,
|
|
|
|
PATTY_AX25_PROTO_TEXNET = 0xc3,
|
|
|
|
PATTY_AX25_PROTO_LQP = 0xc4,
|
|
|
|
PATTY_AX25_PROTO_APPLETALK = 0xca,
|
|
|
|
PATTY_AX25_PROTO_APPLETALK_ARP = 0xcb,
|
|
|
|
PATTY_AX25_PROTO_INET = 0xcc,
|
|
|
|
PATTY_AX25_PROTO_INET_ARP = 0xcd,
|
|
|
|
PATTY_AX25_PROTO_FLEXNET = 0xce,
|
|
|
|
PATTY_AX25_PROTO_NETROM = 0xcf,
|
|
|
|
PATTY_AX25_PROTO_NONE = 0xf0,
|
|
|
|
PATTY_AX25_PROTO_ESCAPE = 0xff
|
|
|
|
};
|
|
|
|
|
2020-06-07 02:46:12 -04:00
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
typedef struct _patty_ax25_addr {
|
2020-07-14 17:01:32 -04:00
|
|
|
char callsign[PATTY_AX25_CALLSIGN_LEN];
|
2020-06-07 02:46:12 -04:00
|
|
|
uint8_t ssid;
|
|
|
|
} patty_ax25_addr;
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
typedef struct _patty_ax25_if patty_ax25_if;
|
2020-05-27 22:03:42 -04:00
|
|
|
|
2015-07-18 12:06:25 -05:00
|
|
|
#include <patty/ax25/frame.h>
|
2020-06-16 18:48:29 -04:00
|
|
|
#include <patty/ax25/call.h>
|
2015-07-24 22:28:39 +00:00
|
|
|
#include <patty/ax25/if.h>
|
2020-06-18 18:50:24 -04:00
|
|
|
#include <patty/ax25/route.h>
|
2020-06-20 02:25:26 -04:00
|
|
|
#include <patty/ax25/sock.h>
|
2020-06-25 23:36:13 -04:00
|
|
|
#include <patty/ax25/server.h>
|
2015-08-09 09:50:12 -05:00
|
|
|
|
2020-07-10 00:01:50 -04:00
|
|
|
#define PATTY_AX25_ADDR_CHAR_VALID(c) \
|
2020-07-10 15:58:35 -04:00
|
|
|
((c >= 0x20 && c <= 0x7e))
|
2020-07-10 00:01:50 -04:00
|
|
|
|
|
|
|
#define PATTY_AX25_ADDR_OCTET_LAST(c) \
|
|
|
|
((c & 0x01) == 0x01)
|
|
|
|
|
|
|
|
#define PATTY_AX25_ADDR_SSID_NUMBER(c) \
|
|
|
|
((c & 0x1e) >> 1)
|
|
|
|
|
|
|
|
#define PATTY_AX25_ADDR_SSID_C(c) \
|
|
|
|
((c & 0x80) == 0x80)
|
|
|
|
|
|
|
|
#define PATTY_AX25_ADDR_SSID_REPEATED(c) \
|
|
|
|
((c & 0x80) == 0x80)
|
|
|
|
|
2020-06-07 02:46:12 -04:00
|
|
|
int patty_ax25_pton(const char *callsign,
|
|
|
|
uint8_t ssid,
|
|
|
|
patty_ax25_addr *addr);
|
|
|
|
|
|
|
|
int patty_ax25_ntop(const patty_ax25_addr *addr,
|
|
|
|
char *dest,
|
|
|
|
uint8_t *ssid,
|
|
|
|
size_t len);
|
|
|
|
|
2020-06-25 20:37:12 -04:00
|
|
|
void patty_ax25_addr_hash(uint32_t *hash,
|
|
|
|
const patty_ax25_addr *addr);
|
|
|
|
|
2020-07-14 17:02:17 -04:00
|
|
|
size_t patty_ax25_addr_copy(void *buf,
|
|
|
|
patty_ax25_addr *addr,
|
|
|
|
uint8_t ssid_flags);
|
|
|
|
|
2015-07-24 21:07:03 -05:00
|
|
|
#endif /* _PATTY_AX25_H */
|