patty/include/patty/ax25.h

92 lines
2.3 KiB
C
Raw Normal View History

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>
#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
#define PATTY_AX25_MAX_HOPS 8
2020-06-16 18:48:29 -04:00
#define PATTY_AX25_SOCK_PATH_SIZE 256
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 {
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;
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>
#include <patty/ax25/sock.h>
#include <patty/ax25/server.h>
#define PATTY_AX25_ADDR_CHAR_VALID(c) \
((c >= 0x20 && c <= 0x7e))
#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);
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 */