summaryrefslogtreecommitdiffstats
path: root/netax25
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-06-20 22:53:50 +0000
committerRalf Baechle <ralf@linux-mips.org>2009-06-20 22:53:50 +0000
commit9f0de7de494c86e19d3c7166e245682453154b74 (patch)
treeaafee72e7405f69d5c3fc6169af5c36d123be4cc /netax25
parentbb128be6551cf26893a27d3964914915046a5098 (diff)
Move all header files to be installed to new subdirectory netax25.
Diffstat (limited to 'netax25')
-rw-r--r--netax25/ax25io.h87
-rw-r--r--netax25/axconfig.h108
-rw-r--r--netax25/axlib.h135
-rw-r--r--netax25/daemon.h49
-rw-r--r--netax25/kernel_ax25.h171
-rw-r--r--netax25/kernel_netrom.h84
-rw-r--r--netax25/kernel_rose.h116
-rw-r--r--netax25/mheard.h71
-rw-r--r--netax25/nrconfig.h101
-rw-r--r--netax25/procutils.h191
-rw-r--r--netax25/rsconfig.h95
-rw-r--r--netax25/ttyutils.h73
12 files changed, 1281 insertions, 0 deletions
diff --git a/netax25/ax25io.h b/netax25/ax25io.h
new file mode 100644
index 0000000..b699bcd
--- /dev/null
+++ b/netax25/ax25io.h
@@ -0,0 +1,87 @@
+/* AX25IO - Library for io manuipulation for AX.25 programs
+ * Copyright (C) 1998 Tomi Manninen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef _AX25IO_H
+#define _AX25IO_H
+
+#define AXBUFLEN 4096
+
+typedef struct ax25io_s {
+ int ifd; /* stdin socket index */
+ int ofd; /* stdout socket index */
+ char eol[4]; /* end-of-line sequence */
+ int eolmode; /* end-of-line translation on/off */
+ int telnetmode; /* telnet option negotiation on/off */
+ int tn_echo; /* will/wont echo */
+ int tn_linemode; /* will/wont linemode */
+ int size; /* size of the packet in input buffer */
+ int paclen; /* paclen */
+ unsigned char ibuf[AXBUFLEN]; /* input buffer */
+ unsigned char obuf[AXBUFLEN]; /* output buffer */
+ unsigned char gbuf[AXBUFLEN]; /* getline buffer */
+ int gbuf_usage; /* getline buffer usage */
+ int iptr; /* input pointer */
+ int optr; /* output pointer */
+ void *zptr; /* pointer to the compression struct */
+
+ struct ax25io_s *next; /* linked list pointer */
+} ax25io;
+
+#define EOLMODE_TEXT 0
+#define EOLMODE_BINARY 1
+#define EOLMODE_GW 2
+
+#define AX25_EOL "\r"
+#define NETROM_EOL AX25_EOL
+#define ROSE_EOL AX25_EOL
+#define INET_EOL "\r\n"
+#define UNSPEC_EOL "\n"
+#define INTERNAL_EOL 021271
+
+#define ZERR_STREAM_END 1024
+#define ZERR_STREAM_ERROR 1025
+#define ZERR_DATA_ERROR 1026
+#define ZERR_MEM_ERROR 1027
+#define ZERR_BUF_ERROR 1028
+#define ZERR_UNKNOWN 1029
+
+extern ax25io *axio_init(int, int, int, char *);
+extern void axio_end(ax25io *);
+extern void axio_end_all(void);
+
+extern int axio_compr(ax25io *, int);
+extern int axio_paclen(ax25io *, int);
+extern int axio_eolmode(ax25io *, int);
+extern int axio_cmpeol(ax25io *, ax25io *);
+extern int axio_tnmode(ax25io *, int);
+extern int axio_flush(ax25io *);
+
+extern int axio_getc(ax25io *);
+extern int axio_putc(int, ax25io *);
+
+extern char *axio_getline(ax25io *);
+extern int axio_gets(char *, int, ax25io *);
+extern int axio_puts(const char *, ax25io *);
+
+extern int axio_printf(ax25io *, const char *, ...);
+
+extern int axio_tn_do_linemode(ax25io *);
+extern int axio_tn_will_echo(ax25io *);
+extern int axio_tn_wont_echo(ax25io *);
+
+#endif /* _AX25IO_H */
diff --git a/netax25/axconfig.h b/netax25/axconfig.h
new file mode 100644
index 0000000..116f985
--- /dev/null
+++ b/netax25/axconfig.h
@@ -0,0 +1,108 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * This file contains the definitions of the entry points into the AX.25
+ * configuration functions.
+ */
+
+#ifndef _AXCONFIG_H
+#define _AXCONFIG_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This function must be called before using any of the other functions in
+ * this part of the library. It returns the number of active ports, or 0
+ * on failure.
+ */
+extern int ax25_config_load_ports(void);
+
+/*
+ * This function allows the enumeration of all the active configured ports.
+ * Passing NULL as the argument returns the first port name in the list,
+ * subsequent calls to this function should be made with the last port name
+ * returned. A NULL return indicates either an error, or the end of the list.
+ */
+extern char *ax25_config_get_next(char *);
+
+/*
+ * This function maps the device name onto the port name (as used in the axports
+ * file. On error a NULL is returned.
+ */
+extern char *ax25_config_get_name(char *);
+
+/*
+ * This function maps the port name onto the callsign of the port. On error a
+ * NULL is returned.
+ */
+extern char *ax25_config_get_addr(char *);
+
+/*
+ * This function maps the port name onto the device name of the port. On error a
+ * NULL is returned.
+ */
+extern char *ax25_config_get_dev(char *);
+
+/*
+ * This function maps the callsign onto the port name. The callsign should be
+ * in shifted format as per get{peer,sock}name(2). A null_ax25_address will
+ * return a "*" meaning all ports. On error NULL is returned.
+ */
+extern char *ax25_config_get_port(ax25_address *);
+
+/*
+ * This function takes the port name and returns the default window size. On
+ * error 0 is returned.
+ */
+extern int ax25_config_get_window(char *);
+
+/*
+ * This function takes the port name and returns the maximum packet length.
+ * On error a 0 is returned.
+ */
+extern int ax25_config_get_paclen(char *);
+
+/*
+ * This function takes the port name and returns the baud rate. On error a
+ * 0 is returned.
+ */
+extern int ax25_config_get_baud(char *);
+
+/*
+ * This function takes the port name and returns the description of the port.
+ * On error a NULL is returned.
+ */
+extern char *ax25_config_get_desc(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/axlib.h b/netax25/axlib.h
new file mode 100644
index 0000000..1164059
--- /dev/null
+++ b/netax25/axlib.h
@@ -0,0 +1,135 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * Callsign conversion functions, converts callsigns into network bit
+ * shifted format and vica versa.
+ */
+
+#ifndef _AXLIB_H
+#define _AXLIB_H
+
+#include <netax25/ax25.h>
+#include <netrose/rose.h>
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Libax25 version.
+ */
+extern char libax25_version[];
+
+/*
+ * The special "null" address, used as the default callsign in routing and
+ * in other places.
+ */
+extern ax25_address null_ax25_address;
+
+/*
+ * This function converts an ASCII representation of a callsign into network
+ * format. It returns -1 on error, 0 otherwise.
+ */
+extern int ax25_aton_entry(const char *, char *);
+
+/*
+ * This converts a string with optional digipeaters into a structure understood
+ * by the kernel code.
+ *
+ * The string should be in the format:
+ *
+ * callsign [[V | VIA] callsign ...]
+ *
+ * On error a -1 is returned, otherwise the length of the structure is returned.
+ */
+extern int ax25_aton(const char *, struct full_sockaddr_ax25 *);
+
+/*
+ * Similar to convert_call above except the callsign(s) are not held in a
+ * string but in a NULL terminated array of pointers to the strings.
+ * On error a -1 is returned, otherwise the length of the structure is returned.
+ */
+extern int ax25_aton_arglist(const char ** , struct full_sockaddr_ax25 *);
+
+/*
+ * This function converts an ASCII representation of a Rose address into
+ * network format. It returns -1 on error, 0 otherwise. The address must be
+ * ten numbers long.
+ */
+extern int rose_aton(const char *, char *);
+
+/*
+ * This function returns the textual representation of a callsign in
+ * network format. The data returned is in a statically allocated area, and
+ * subsequent calls will destroy previous callsigns returned.
+ */
+extern char *ax25_ntoa(const ax25_address *);
+
+/*
+ * This function returns the textual representation of a Rose address in
+ * network format. The data returned is in a statically allocated area, and
+ * subsequent calls will destroy previous callsigns returned.
+ */
+extern char *rose_ntoa(const rose_address *);
+
+/*
+ * Compares two AX.25 callsigns in network format. Returns a 0 if they are
+ * identical, 1 if they differ, or 2 if only the SSIDs differ.
+ */
+extern int ax25_cmp(const ax25_address *, const ax25_address *);
+
+/*
+ * Compares two Rose addresses in network format. Returns a 0 if they are
+ * identical, 1 if they differ.
+ */
+extern int rose_cmp(const rose_address *, const rose_address *);
+
+/*
+ * Validates an AX.25 callsign, returns TRUE if it is valid, or FALSE if it
+ * is not. The callsign should be AX.25 shifted format.
+ */
+extern int ax25_validate(const char *);
+
+/*
+ * Converts the giver string to upper case. It returns a pointer to the
+ * original string.
+ */
+extern char *strupr(char *);
+
+/*
+ * Converts the giver string to lower case. It returns a pointer to the
+ * original string.
+ */
+extern char *strlwr(char *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/daemon.h b/netax25/daemon.h
new file mode 100644
index 0000000..cd9c220
--- /dev/null
+++ b/netax25/daemon.h
@@ -0,0 +1,49 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * Function to convert a running process into a "proper" daemon.
+ */
+
+#ifndef _DAEMON_H
+#define _DAEMON_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The argument is whether to ignore the death of child processes. The function
+ * return non-zero if all was OK, else zero if there was a problem.
+ */
+extern int daemon_start(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/kernel_ax25.h b/netax25/kernel_ax25.h
new file mode 100644
index 0000000..e1b6abb
--- /dev/null
+++ b/netax25/kernel_ax25.h
@@ -0,0 +1,171 @@
+/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NETAX25_AX25_H
+#define _NETAX25_AX25_H 1
+
+#include <features.h>
+#include <sys/socket.h>
+
+/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */
+#define SOL_AX25 257
+
+/* AX.25 flags: */
+#define AX25_WINDOW 1
+#define AX25_T1 2
+#define AX25_T2 5
+#define AX25_T3 4
+#define AX25_N2 3
+#define AX25_BACKOFF 6
+#define AX25_EXTSEQ 7
+#define AX25_PIDINCL 8
+#define AX25_IDLE 9
+#define AX25_PACLEN 10
+#define AX25_IPMAXQUEUE 11
+#define AX25_IAMDIGI 12
+#define AX25_KILL 99
+
+/* AX.25 socket ioctls: */
+#define SIOCAX25GETUID (SIOCPROTOPRIVATE)
+#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
+#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
+#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3)
+#define SIOCAX25BPQADDR (SIOCPROTOPRIVATE+4)
+#define SIOCAX25GETPARMS (SIOCPROTOPRIVATE+5)
+#define SIOCAX25SETPARMS (SIOCPROTOPRIVATE+6)
+#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7)
+#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8)
+#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9)
+#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10)
+#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11)
+
+/* unknown: */
+#define AX25_NOUID_DEFAULT 0
+#define AX25_NOUID_BLOCK 1
+#define AX25_SET_RT_IPMODE 2
+
+/* Digipeating flags: */
+#define AX25_DIGI_INBAND 0x01 /* Allow digipeating within port */
+#define AX25_DIGI_XBAND 0x02 /* Allow digipeating across ports */
+
+/* Maximim number of digipeaters: */
+#define AX25_MAX_DIGIS 8
+
+
+typedef struct
+ {
+ char ax25_call[7]; /* 6 call + SSID (shifted ascii) */
+ }
+ax25_address;
+
+struct sockaddr_ax25
+ {
+ sa_family_t sax25_family;
+ ax25_address sax25_call;
+ int sax25_ndigis;
+ };
+
+/*
+ * The sockaddr struct with the digipeater adresses:
+ */
+struct full_sockaddr_ax25
+ {
+ struct sockaddr_ax25 fsa_ax25;
+ ax25_address fsa_digipeater[AX25_MAX_DIGIS];
+ };
+#define sax25_uid sax25_ndigis
+
+struct ax25_routes_struct
+ {
+ ax25_address port_addr;
+ ax25_address dest_addr;
+ unsigned char digi_count;
+ ax25_address digi_addr[AX25_MAX_DIGIS];
+ };
+
+/* The AX.25 ioctl structure: */
+struct ax25_ctl_struct
+ {
+ ax25_address port_addr;
+ ax25_address source_addr;
+ ax25_address dest_addr;
+ unsigned int cmd;
+ unsigned long arg;
+ unsigned char digi_count;
+ ax25_address digi_addr[AX25_MAX_DIGIS];
+ };
+
+struct ax25_info_struct
+ {
+ unsigned int n2, n2count;
+ unsigned int t1, t1timer;
+ unsigned int t2, t2timer;
+ unsigned int t3, t3timer;
+ unsigned int idle, idletimer;
+ unsigned int state;
+ unsigned int rcv_q, snd_q;
+ };
+
+struct ax25_fwd_struct
+ {
+ ax25_address port_from;
+ ax25_address port_to;
+ };
+
+/* AX.25 route structure: */
+struct ax25_route_opt_struct
+ {
+ ax25_address port_addr;
+ ax25_address dest_addr;
+ int cmd;
+ int arg;
+ };
+
+/* AX.25 BPQ stuff: */
+struct ax25_bpqaddr_struct
+ {
+ char dev[16];
+ ax25_address addr;
+ };
+
+/* Definitions for the AX.25 `values' fields: */
+#define AX25_VALUES_IPDEFMODE 0 /* 'D'=DG 'V'=VC */
+#define AX25_VALUES_AXDEFMODE 1 /* 8=Normal 128=Extended Seq Nos */
+#define AX25_VALUES_NETROM 2 /* Allow NET/ROM - 0=No 1=Yes */
+#define AX25_VALUES_TEXT 3 /* Allow PID=Text - 0=No 1=Yes */
+#define AX25_VALUES_BACKOFF 4 /* 'E'=Exponential 'L'=Linear */
+#define AX25_VALUES_CONMODE 5 /* Allow connected modes - 0=No 1=Yes */
+#define AX25_VALUES_WINDOW 6 /* Default window size for standard AX.25 */
+#define AX25_VALUES_EWINDOW 7 /* Default window size for extended AX.25 */
+#define AX25_VALUES_T1 8 /* Default T1 timeout value */
+#define AX25_VALUES_T2 9 /* Default T2 timeout value */
+#define AX25_VALUES_T3 10 /* Default T3 timeout value */
+#define AX25_VALUES_N2 11 /* Default N2 value */
+#define AX25_VALUES_DIGI 12 /* Digipeat mode */
+#define AX25_VALUES_IDLE 13 /* mode vc idle timer */
+#define AX25_VALUES_PACLEN 14 /* AX.25 MTU */
+#define AX25_VALUES_IPMAXQUEUE 15 /* Maximum number of buffers enqueued */
+#define AX25_MAX_VALUES 20
+
+struct ax25_parms_struct
+ {
+ ax25_address port_addr;
+ unsigned short values[AX25_MAX_VALUES];
+ };
+
+#endif /* netax25/ax25.h */
diff --git a/netax25/kernel_netrom.h b/netax25/kernel_netrom.h
new file mode 100644
index 0000000..4984772
--- /dev/null
+++ b/netax25/kernel_netrom.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NETROM_NETROM_H
+#define _NETROM_NETROM_H 1
+
+#include <netax25/ax25.h>
+
+/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx. */
+#define SOL_NETROM 259
+
+/* NetRom control values: */
+#define NETROM_T1 1
+#define NETROM_T2 2
+#define NETROM_N2 3
+#define NETROM_PACLEN 5
+#define NETROM_T4 6
+#define NETROM_IDLE 7
+
+#define NETROM_KILL 99
+
+/* Type of route: */
+#define NETROM_NEIGH 0
+#define NETROM_NODE 1
+
+struct nr_route_struct
+ {
+ int type;
+ ax25_address callsign;
+ char device[16];
+ unsigned int quality;
+ char mnemonic[7];
+ ax25_address neighbour;
+ unsigned int obs_count;
+ unsigned int ndigis;
+ ax25_address digipeaters[AX25_MAX_DIGIS];
+ };
+
+/* NetRom socket ioctls: */
+#define SIOCNRGETPARMS (SIOCPROTOPRIVATE+0)
+#define SIOCNRSETPARMS (SIOCPROTOPRIVATE+1)
+#define SIOCNRDECOBS (SIOCPROTOPRIVATE+2)
+#define SIOCNRRTCTL (SIOCPROTOPRIVATE+3)
+#define SIOCNRCTLCON (SIOCPROTOPRIVATE+4)
+
+/* NetRom parameter structure: */
+struct nr_parms_struct
+ {
+ unsigned int quality;
+ unsigned int obs_count;
+ unsigned int ttl;
+ unsigned int timeout;
+ unsigned int ack_delay;
+ unsigned int busy_delay;
+ unsigned int tries;
+ unsigned int window;
+ unsigned int paclen;
+ };
+
+/* NetRom control structure: */
+struct nr_ctl_struct
+ {
+ unsigned char index;
+ unsigned char id;
+ unsigned int cmd;
+ unsigned long arg;
+ };
+
+#endif /* netrom/netrom.h */
diff --git a/netax25/kernel_rose.h b/netax25/kernel_rose.h
new file mode 100644
index 0000000..e4ba7d7
--- /dev/null
+++ b/netax25/kernel_rose.h
@@ -0,0 +1,116 @@
+/* Definitions for Rose packet radio address family.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* What follows is copied from the 2.1.93 <linux/rose.h>. */
+
+#ifndef _NETROSE_ROSE_H
+#define _NETROSE_ROSE_H 1
+
+/* Socket level values. */
+#define SOL_ROSE 260
+
+
+/* These are the public elements of the Linux kernel Rose
+ implementation. For kernel AX.25 see the file ax25.h. This file
+ requires ax25.h for the definition of the ax25_address structure. */
+#define ROSE_MTU 251
+
+#define ROSE_MAX_DIGIS 6
+
+#define ROSE_DEFER 1
+#define ROSE_T1 2
+#define ROSE_T2 3
+#define ROSE_T3 4
+#define ROSE_IDLE 5
+#define ROSE_QBITINCL 6
+#define ROSE_HOLDBACK 7
+
+#define SIOCRSGCAUSE (SIOCPROTOPRIVATE + 0)
+#define SIOCRSSCAUSE (SIOCPROTOPRIVATE + 1)
+#define SIOCRSL2CALL (SIOCPROTOPRIVATE + 2)
+#define SIOCRSSL2CALL (SIOCPROTOPRIVATE + 2)
+#define SIOCRSACCEPT (SIOCPROTOPRIVATE + 3)
+#define SIOCRSCLRRT (SIOCPROTOPRIVATE + 4)
+#define SIOCRSGL2CALL (SIOCPROTOPRIVATE + 5)
+#define SIOCRSGFACILITIES (SIOCPROTOPRIVATE + 6)
+
+#define ROSE_DTE_ORIGINATED 0x00
+#define ROSE_NUMBER_BUSY 0x01
+#define ROSE_INVALID_FACILITY 0x03
+#define ROSE_NETWORK_CONGESTION 0x05
+#define ROSE_OUT_OF_ORDER 0x09
+#define ROSE_ACCESS_BARRED 0x0B
+#define ROSE_NOT_OBTAINABLE 0x0D
+#define ROSE_REMOTE_PROCEDURE 0x11
+#define ROSE_LOCAL_PROCEDURE 0x13
+#define ROSE_SHIP_ABSENT 0x39
+
+
+typedef struct
+{
+ char rose_addr[5];
+} rose_address;
+
+struct sockaddr_rose
+{
+ sa_family_t srose_family;
+ rose_address srose_addr;
+ ax25_address srose_call;
+ int srose_ndigis;
+ ax25_address srose_digi;
+};
+
+struct full_sockaddr_rose
+{
+ sa_family_t srose_family;
+ rose_address srose_addr;
+ ax25_address srose_call;
+ unsigned int srose_ndigis;
+ ax25_address srose_digis[ROSE_MAX_DIGIS];
+};
+
+struct rose_route_struct
+{
+ rose_address address;
+ unsigned short int mask;
+ ax25_address neighbour;
+ char device[16];
+ unsigned char ndigis;
+ ax25_address digipeaters[AX25_MAX_DIGIS];
+};
+
+struct rose_cause_struct
+{
+ unsigned char cause;
+ unsigned char diagnostic;
+};
+
+struct rose_facilities_struct
+{
+ rose_address source_addr, dest_addr;
+ ax25_address source_call, dest_call;
+ unsigned char source_ndigis, dest_ndigis;
+ ax25_address source_digis[ROSE_MAX_DIGIS];
+ ax25_address dest_digis[ROSE_MAX_DIGIS];
+ unsigned int rand;
+ rose_address fail_addr;
+ ax25_address fail_call;
+};
+
+#endif /* netrose/rose.h */
diff --git a/netax25/mheard.h b/netax25/mheard.h
new file mode 100644
index 0000000..7e7875f
--- /dev/null
+++ b/netax25/mheard.h
@@ -0,0 +1,71 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * This file documents the layout of the mheard file. Since this file is
+ * common to at least two of the AX25 utilities, it is documented here.
+ */
+#ifndef MHEARD_H
+#define MHEARD_H
+
+struct mheard_struct {
+ ax25_address from_call;
+ ax25_address to_call;
+ char portname[20];
+ unsigned int count;
+ unsigned int sframes;
+ unsigned int uframes;
+ unsigned int iframes;
+ unsigned int ndigis;
+ ax25_address digis[8];
+ time_t first_heard;
+ time_t last_heard;
+
+#define MHEARD_TYPE_SABM 0
+#define MHEARD_TYPE_SABME 1
+#define MHEARD_TYPE_DISC 2
+#define MHEARD_TYPE_UA 3
+#define MHEARD_TYPE_DM 4
+#define MHEARD_TYPE_RR 5
+#define MHEARD_TYPE_RNR 6
+#define MHEARD_TYPE_REJ 7
+#define MHEARD_TYPE_FRMR 8
+#define MHEARD_TYPE_I 9
+#define MHEARD_TYPE_UI 10
+#define MHEARD_TYPE_UNKNOWN 11
+ unsigned int type;
+
+#define MHEARD_MODE_TEXT 0x0001
+#define MHEARD_MODE_ARP 0x0002
+#define MHEARD_MODE_IP_DG 0x0004
+#define MHEARD_MODE_IP_VC 0x0008
+#define MHEARD_MODE_NETROM 0x0010
+#define MHEARD_MODE_ROSE 0x0020
+#define MHEARD_MODE_FLEXNET 0x0040
+#define MHEARD_MODE_TEXNET 0x0080
+#define MHEARD_MODE_PSATPB 0x0100
+#define MHEARD_MODE_PSATFT 0x0200
+#define MHEARD_MODE_SEGMENT 0x4000
+#define MHEARD_MODE_UNKNOWN 0x8000
+ unsigned int mode;
+
+ char spare[128];
+};
+
+#endif
diff --git a/netax25/nrconfig.h b/netax25/nrconfig.h
new file mode 100644
index 0000000..ffe7668
--- /dev/null
+++ b/netax25/nrconfig.h
@@ -0,0 +1,101 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * This file contains the definitions of the entry points into the NET/ROM
+ * configuration functions.
+ */
+
+#ifndef _NRCONFIG_H
+#define _NRCONFIG_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This function must be called before using any of the other functions in
+ * this part of the library. It returns the number of active ports, or 0
+ * on failure.
+ */
+extern int nr_config_load_ports(void);
+
+/*
+ * This function allows the enumeration of all the active configured ports.
+ * Passing NULL as the argument returns the first port name in the list,
+ * subsequent calls to this function should be made with the last port name
+ * returned. A NULL return indicates either an error, or the end of the list.
+ */
+extern char *nr_config_get_next(char *);
+
+/*
+ * This function maps the device name onto the port name (as used in the axports
+ * file. On error a NULL is returned.
+ */
+extern char *nr_config_get_name(char *);
+
+/*
+ * This function maps the port name onto the callsign of the port. On error a
+ * NULL is returned.
+ */
+extern char *nr_config_get_addr(char *);
+
+/*
+ * This function maps the port name onto the device name of the port. On error a
+ * NULL is returned.
+ */
+extern char *nr_config_get_dev(char *);
+
+/*
+ * This function maps the callsign in AX.25 shifted format onto the port name.
+ * On error, NULL is returned.
+ */
+extern char *nr_config_get_port(ax25_address *);
+
+/*
+ * This function takes the port name and returns the alias of the port. On
+ * error NULL is returned.
+ */
+extern char *nr_config_get_alias(char *);
+
+/*
+ * This function takes the port name and returns the maximum packet length.
+ * On error a 0 is returned.
+ */
+extern int nr_config_get_paclen(char *);
+
+/*
+ * This function takes the port name and returns the description of the port.
+ * On error a NULL is returned.
+ */
+extern char *nr_config_get_desc(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/procutils.h b/netax25/procutils.h
new file mode 100644
index 0000000..eabea20
--- /dev/null
+++ b/netax25/procutils.h
@@ -0,0 +1,191 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * Support routines to simplify the reading of the /proc/net/ax25* and
+ * /proc/net/nr* files.
+ */
+
+#ifndef _PROCUTILS_H
+#define _PROCUTILS_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct proc_ax25_route {
+ char call[10];
+ char dev[14];
+ int cnt;
+ long t;
+
+ struct proc_ax25_route *next;
+};
+
+struct proc_ax25 {
+ unsigned long magic;
+ char dev[14];
+ char src_addr[10];
+ char dest_addr[10];
+ char digi_addr[8][11];
+ int ndigi;
+ unsigned char st;
+ unsigned short vs, vr, va;
+ unsigned short t1, t1timer, t2, t2timer, t3, t3timer;
+ unsigned short idle, idletimer;
+ unsigned char n2, n2count;
+ unsigned short rtt;
+ unsigned char window;
+ unsigned short paclen;
+ unsigned long sndq, rcvq;
+ unsigned long inode;
+
+ struct proc_ax25 *next;
+};
+
+struct proc_nr {
+ char user_addr[10], dest_node[10], src_node[10];
+ char dev[14];
+ char my_circuit[6], ur_circuit[6];
+ unsigned char st;
+ unsigned short vs, vr, va;
+ unsigned short t1, t1timer, t2, t2timer, t4, t4timer;
+ unsigned short idle, idletimer;
+ unsigned char n2, n2count;
+ unsigned char window;
+ unsigned long sndq, rcvq;
+ unsigned long inode;
+
+ struct proc_nr *next;
+};
+
+struct proc_nr_neigh {
+ int addr;
+ char call[10];
+ char dev[14];
+ int qual;
+ int lock;
+ int cnt;
+
+ struct proc_nr_neigh *next;
+};
+
+struct proc_nr_nodes {
+ char call[10], alias[7];
+ unsigned char w, n;
+ unsigned char qual1, qual2, qual3;
+ unsigned char obs1, obs2, obs3;
+ int addr1, addr2, addr3;
+
+ struct proc_nr_nodes *next;
+};
+
+struct proc_rs {
+ char dest_addr[11], dest_call[10];
+ char src_addr[11], src_call[10];
+ char dev[14];
+ unsigned short lci;
+ unsigned int neigh;
+ unsigned char st;
+ unsigned short vs, vr, va;
+ unsigned short t, t1, t2, t3;
+ unsigned short hb;
+ unsigned long sndq, rcvq;
+
+ struct proc_rs *next;
+};
+
+struct proc_rs_route {
+ unsigned short lci1;
+ char address1[11], call1[10];
+ unsigned int neigh1;
+ unsigned short lci2;
+ char address2[11], call2[10];
+ unsigned int neigh2;
+
+ struct proc_rs_route *next;
+};
+
+struct proc_rs_neigh {
+ int addr;
+ char call[10];
+ char dev[14];
+ int count;
+ char mode[4];
+ char restart[4];
+ unsigned short t0, tf;
+
+ struct proc_rs_neigh *next;
+};
+
+struct proc_rs_nodes {
+ char address[11];
+ unsigned char mask;
+ unsigned char n;
+ unsigned int neigh1, neigh2, neigh3;
+
+ struct proc_rs_nodes *next;
+};
+
+extern struct proc_ax25 *read_proc_ax25(void);
+extern void free_proc_ax25(struct proc_ax25 *ap);
+
+extern struct proc_ax25_route *read_proc_ax25_route(void);
+extern void free_proc_ax25_route(struct proc_ax25_route *rp);
+
+extern struct proc_nr *read_proc_nr(void);
+extern void free_proc_nr(struct proc_nr *);
+
+extern struct proc_nr_neigh *read_proc_nr_neigh(void);
+extern void free_proc_nr_neigh(struct proc_nr_neigh *np);
+
+extern struct proc_nr_nodes *read_proc_nr_nodes(void);
+extern void free_proc_nr_nodes(struct proc_nr_nodes *np);
+
+extern struct proc_rs *read_proc_rs(void);
+extern void free_proc_rs(struct proc_rs *);
+
+extern struct proc_rs_neigh *read_proc_rs_neigh(void);
+extern void free_proc_rs_neigh(struct proc_rs_neigh *);
+
+extern struct proc_rs_nodes *read_proc_rs_nodes(void);
+extern void free_proc_rs_nodes(struct proc_rs_nodes *);
+
+extern struct proc_rs_route *read_proc_rs_routes(void);
+extern void free_proc_rs_routes(struct proc_rs_route *);
+
+extern char *get_call(int uid);
+
+extern struct proc_ax25 *find_link(const char *src, const char *dest, const char *dev);
+extern struct proc_nr_neigh *find_neigh(int addr, struct proc_nr_neigh *neigh);
+extern struct proc_nr_nodes *find_node(char *addr, struct proc_nr_nodes *nodes);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/rsconfig.h b/netax25/rsconfig.h
new file mode 100644
index 0000000..cff212c
--- /dev/null
+++ b/netax25/rsconfig.h
@@ -0,0 +1,95 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/*
+ * This file contains the definitions of the entry points into the Rose
+ * configuration functions.
+ */
+
+#ifndef _RSCONFIG_H
+#define _RSCONFIG_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This function must be called before using any of the other functions in
+ * this part of the library. It returns the number of active ports, or 0
+ * on failure.
+ */
+extern int rs_config_load_ports(void);
+
+/*
+ * This function allows the enumeration of all the active configured ports.
+ * Passing NULL as the argument returns the first port name in the list,
+ * subsequent calls to this function should be made with the last port name
+ * returned. A NULL return indicates either an error, or the end of the list.
+ */
+extern char *rs_config_get_next(char *);
+
+/*
+ * This function maps the device name onto the port name (as used in the axports
+ * file. On error a NULL is returned.
+ */
+extern char *rs_config_get_name(char *);
+
+/*
+ * This function maps the port name onto the address of the port. On error a
+ * NULL is returned.
+ */
+extern char *rs_config_get_addr(char *);
+
+/*
+ * This function maps the port name onto the device name of the port. On error a
+ * NULL is returned.
+ */
+extern char *rs_config_get_dev(char *);
+
+/*
+ * This function maps the Rose address in network format onto the port name.
+ * On error, NULL is returned.
+ */
+extern char *rs_config_get_port(rose_address *);
+
+/*
+ * This function takes the port name and returns the maximum packet length.
+ * On error a 0 is returned.
+ */
+extern int rs_config_get_paclen(char *);
+
+/*
+ * This function takes the port name and returns the description of the port.
+ * On error a NULL is returned.
+ */
+extern char *rs_config_get_desc(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/netax25/ttyutils.h b/netax25/ttyutils.h
new file mode 100644
index 0000000..d16996a
--- /dev/null
+++ b/netax25/ttyutils.h
@@ -0,0 +1,73 @@
+/* LIBAX25 - Library for AX.25 programs
+ * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
+ * and Alan Cox.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Generic serial port handling functions.
+ */
+
+#ifndef _TTYUTILS_H
+#define _TTYUTILS_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Put a given file descriptor into raw mode, if the hwflag is set to TRUE
+ * then hardware handshaking is enabled. Returns TRUE if successful.
+ */
+extern int tty_raw(int fd, int hwflag);
+
+/*
+ * Set the speed of the given file descriptor. Returns TRUE is it was
+ * successful.
+ */
+extern int tty_speed(int fd, int speed);
+
+/*
+ * Determines whether a given tty is already open by another process. Returns
+ * TRUE if is already locked, or FALSE if it is free.
+ */
+extern int tty_is_locked(char *tty);
+
+/*
+ * Creates a lock file for the given tty. It writes the process ID to the
+ * file so take care if doing a fork. Returns TRUE if everything was OK.
+ */
+extern int tty_lock(char *tty);
+
+/*
+ * Removes the lock file for a given tty. Returns TRUE if successful.
+ */
+extern int tty_unlock(char *tty);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif