| 1 |
/* ax25ipd.h general configuration info |
| 2 |
* |
| 3 |
* Copyright 1991, Michael Westerhof, Sun Microsystems, Inc. |
| 4 |
* This software may be freely used, distributed, or modified, providing |
| 5 |
* this header is not removed. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
/* |
| 10 |
* Modifications added for dual port kiss TNC |
| 11 |
* by Michael Durrant VE3PNX and D. Jeff Dionne Feb 4, 1995 |
| 12 |
*/ |
| 13 |
|
| 14 |
/* |
| 15 |
* cleaned up and prototyped for inclusion into the standard linux ax25 |
| 16 |
* toolset in january 1997 by rob mayfield, vk5xxx/vk5zeu |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
* added route flags, it's a little ugly, but is extensible fairly easily. |
| 21 |
* provided a mechanism for handling broadcast traffic |
| 22 |
* Terry Dawson, VK2KTJ, July 1997. |
| 23 |
* |
| 24 |
* Minor bug fixes. |
| 25 |
* Terry Dawson, VK2KTJ, September 2001. |
| 26 |
*/ |
| 27 |
|
| 28 |
/* Define the current version number |
| 29 |
* |
| 30 |
* The first digit represents the major release (0 is a prototype release) |
| 31 |
* |
| 32 |
* The second represents major changes that might affect configuration |
| 33 |
* file formats or compilation sequences, or anything that may make |
| 34 |
* existing setups change. |
| 35 |
* |
| 36 |
* The last digit(s) marks simple bug fixes. |
| 37 |
* |
| 38 |
*/ |
| 39 |
|
| 40 |
#define IPPROTO_AX25 93 |
| 41 |
#define DEFAULT_UDP_PORT 10093 |
| 42 |
|
| 43 |
#include <limits.h> |
| 44 |
|
| 45 |
extern int udp_mode; /* true if we need a UDP socket */ |
| 46 |
extern int ip_mode; /* true if we need the raw IP socket */ |
| 47 |
extern unsigned short my_udp; /* the UDP port to use (network byte order) */ |
| 48 |
extern char ttydevice[PATH_MAX]; /* the tty device for serial comms */ |
| 49 |
extern int ttyspeed; /* The baud rate on the tty device */ |
| 50 |
extern unsigned char mycallsign[7]; /* My callsign, shifted ASCII with SSID */ |
| 51 |
extern unsigned char mycallsign2[7]; /* My seconds port callsign, shifted ASCII with SSID */ |
| 52 |
extern unsigned char myalias[7]; /* An alias to use */ |
| 53 |
extern unsigned char myalias2[7]; /* An alias for second port */ |
| 54 |
extern char bc_text[128]; /* The text for beacon messages */ |
| 55 |
extern int bc_interval; /* The interval, in seconds, between beacons */ |
| 56 |
extern int bc_every; /* true=every, false=after */ |
| 57 |
extern int digi; /* True if we are connected to a TNC */ |
| 58 |
extern int loglevel; /* Verbosity level */ |
| 59 |
/* addition for dual port flag */ |
| 60 |
extern int dual_port; |
| 61 |
|
| 62 |
struct ax25ipd_stats { |
| 63 |
int kiss_in; /* # packets received */ |
| 64 |
int kiss_toobig; /* packet too large */ |
| 65 |
int kiss_badtype; /* control byte non-zero */ |
| 66 |
int kiss_out; /* # packets sent */ |
| 67 |
int kiss_beacon_outs; /* # of beacons sent */ |
| 68 |
int kiss_tooshort; /* packet too short to be a valid frame */ |
| 69 |
int kiss_not_for_me; /* packet not for me (in digi mode) */ |
| 70 |
int kiss_i_am_dest; /* I am destination (in digi mode) */ |
| 71 |
int kiss_no_ip_addr; /* Couldn't find an IP addr for this call */ |
| 72 |
int udp_in; /* # packets received */ |
| 73 |
int udp_out; /* # packets sent */ |
| 74 |
int ip_in; /* # packets received */ |
| 75 |
int ip_out; /* # packets sent */ |
| 76 |
int ip_failed_crc; /* from ip, but failed CRC check */ |
| 77 |
int ip_tooshort; /* packet too short to be a valid frame */ |
| 78 |
int ip_not_for_me; /* packet not for me (in digi mode) */ |
| 79 |
int ip_i_am_dest; /* I am destination (in digi mode) */ |
| 80 |
}; |
| 81 |
|
| 82 |
extern struct ax25ipd_stats stats; |
| 83 |
|
| 84 |
#define MAX_FRAME 2048 |
| 85 |
|
| 86 |
extern void LOGLn(int level, const char *str, ...); |
| 87 |
|
| 88 |
#define LOGL1(arg...) LOGLn(1, ##arg) |
| 89 |
#define LOGL2(arg...) LOGLn(2, ##arg) |
| 90 |
#define LOGL3(arg...) LOGLn(3, ##arg) |
| 91 |
#define LOGL4(arg...) LOGLn(4, ##arg) |
| 92 |
|
| 93 |
#define AXRT_BCAST 1 |
| 94 |
#define AXRT_DEFAULT 2 |
| 95 |
|
| 96 |
/* start external prototypes */ |
| 97 |
/* end external prototypes */ |
| 98 |
|
| 99 |
/* kiss.c */ |
| 100 |
void kiss_init(void); |
| 101 |
void assemble_kiss(unsigned char *, int); |
| 102 |
void send_kiss(unsigned char, unsigned char *, int); |
| 103 |
void param_add(int, int); |
| 104 |
void dump_params(void); |
| 105 |
void send_params(void); |
| 106 |
/* void do_beacon(void); not here it isnt !! xxx */ |
| 107 |
|
| 108 |
/* routing.c */ |
| 109 |
void route_init(void); |
| 110 |
void route_add(unsigned char *, unsigned char *, int, unsigned int); |
| 111 |
void bcast_add(unsigned char *); |
| 112 |
unsigned char *call_to_ip(unsigned char *); |
| 113 |
int is_call_bcast(unsigned char *); |
| 114 |
void send_broadcast(unsigned char *, int); |
| 115 |
void dump_routes(void); |
| 116 |
|
| 117 |
/* config.c */ |
| 118 |
void config_init(void); |
| 119 |
void config_read(char *); |
| 120 |
int parse_line(char *); |
| 121 |
int a_to_call(char *, unsigned char *); |
| 122 |
char *call_to_a(unsigned char *); |
| 123 |
void dump_config(void); |
| 124 |
|
| 125 |
/* process.c */ |
| 126 |
void process_init(void); |
| 127 |
void from_kiss(unsigned char *, int); |
| 128 |
void from_ip(unsigned char *, int); |
| 129 |
/* void do_broadcast(void); where did this go ?? xxx */ |
| 130 |
void do_beacon(void); |
| 131 |
int addrmatch(unsigned char *, unsigned char *); |
| 132 |
unsigned char *next_addr(unsigned char *); |
| 133 |
void add_crc(unsigned char *, int); |
| 134 |
void dump_ax25frame(char *, unsigned char *, int); |
| 135 |
|
| 136 |
/* io.c */ |
| 137 |
void io_init(void); |
| 138 |
void io_open(void); |
| 139 |
void io_start(void); |
| 140 |
void send_ip(unsigned char *, int, unsigned char *); |
| 141 |
void send_tty(unsigned char *, int); |
| 142 |
|
| 143 |
/* crc.c */ |
| 144 |
unsigned short int compute_crc(unsigned char *, int); |
| 145 |
unsigned short int pppfcs(unsigned short, unsigned char *, int); |
| 146 |
unsigned short int compute_crc(unsigned char *, int); |
| 147 |
int ok_crc(unsigned char *, int); |
| 148 |
|
| 149 |
/* io.c */ |
| 150 |
extern int ttyfd_bpq; |
| 151 |
extern int ttyfd; |
| 152 |
|
| 153 |
/* bpqether.c */ |
| 154 |
int send_bpq(unsigned char *buf, int len); |
| 155 |
int receive_bpq(unsigned char *buf, int l); |
| 156 |
int open_ethertap(char *ifname); |
| 157 |
int set_bpq_dev_call_and_up(char *ethertap_name); |
| 158 |
|
| 159 |
/* |
| 160 |
* end |
| 161 |
*/ |