| 1 |
/* LIBAX25 - Library for AX.25 programs |
| 2 |
* Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat |
| 3 |
* and Alan Cox. |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Library General Public License for more details. |
| 14 |
: |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, see |
| 17 |
* <https://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
/* |
| 20 |
* Support routines to simplify the reading of the /proc/net/ax25* and |
| 21 |
* /proc/net/nr* files. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef _PROCUTILS_H |
| 25 |
#define _PROCUTILS_H |
| 26 |
|
| 27 |
#ifndef TRUE |
| 28 |
#define TRUE 1 |
| 29 |
#endif |
| 30 |
|
| 31 |
#ifndef FALSE |
| 32 |
#define FALSE 0 |
| 33 |
#endif |
| 34 |
|
| 35 |
#ifdef __cplusplus |
| 36 |
extern "C" { |
| 37 |
#endif |
| 38 |
|
| 39 |
struct proc_ax25_route { |
| 40 |
char call[10]; |
| 41 |
char dev[14]; |
| 42 |
int cnt; |
| 43 |
long t; |
| 44 |
|
| 45 |
struct proc_ax25_route *next; |
| 46 |
}; |
| 47 |
|
| 48 |
struct proc_ax25 { |
| 49 |
unsigned long magic; |
| 50 |
char dev[14]; |
| 51 |
char src_addr[10]; |
| 52 |
char dest_addr[10]; |
| 53 |
char digi_addr[8][11]; |
| 54 |
int ndigi; |
| 55 |
unsigned char st; |
| 56 |
unsigned short vs, vr, va; |
| 57 |
unsigned long t1timer, t1, t2timer, t2, t3timer, t3; |
| 58 |
unsigned long idletimer, idle; |
| 59 |
unsigned char n2count, n2; |
| 60 |
unsigned long rtt; |
| 61 |
unsigned char window; |
| 62 |
unsigned short paclen; |
| 63 |
unsigned short sndq, rcvq; |
| 64 |
unsigned long inode; |
| 65 |
|
| 66 |
struct proc_ax25 *next; |
| 67 |
}; |
| 68 |
|
| 69 |
struct proc_nr { |
| 70 |
char user_addr[10], dest_node[10], src_node[10]; |
| 71 |
char dev[14]; |
| 72 |
char my_circuit[6], ur_circuit[6]; |
| 73 |
unsigned char st; |
| 74 |
unsigned short vs, vr, va; |
| 75 |
unsigned long t1timer, t1, t2timer, t2, t4timer, t4; |
| 76 |
unsigned long idletimer, idle; |
| 77 |
unsigned char n2count, n2; |
| 78 |
unsigned char window; |
| 79 |
unsigned short sndq, rcvq; |
| 80 |
unsigned long inode; |
| 81 |
|
| 82 |
struct proc_nr *next; |
| 83 |
}; |
| 84 |
|
| 85 |
struct proc_nr_neigh { |
| 86 |
int addr; |
| 87 |
char call[10]; |
| 88 |
char dev[14]; |
| 89 |
int qual; |
| 90 |
int lock; |
| 91 |
int cnt; |
| 92 |
|
| 93 |
struct proc_nr_neigh *next; |
| 94 |
}; |
| 95 |
|
| 96 |
struct proc_nr_nodes { |
| 97 |
char call[10], alias[7]; |
| 98 |
unsigned char w, n; |
| 99 |
unsigned char qual1, qual2, qual3; |
| 100 |
unsigned char obs1, obs2, obs3; |
| 101 |
int addr1, addr2, addr3; |
| 102 |
|
| 103 |
struct proc_nr_nodes *next; |
| 104 |
}; |
| 105 |
|
| 106 |
struct proc_rs { |
| 107 |
char dest_addr[11], dest_call[10]; |
| 108 |
char src_addr[11], src_call[10]; |
| 109 |
char dev[14]; |
| 110 |
unsigned short lci; |
| 111 |
unsigned int neigh; |
| 112 |
unsigned char st; |
| 113 |
unsigned short vs, vr, va; |
| 114 |
unsigned short t, t1, t2, t3; |
| 115 |
unsigned short hb; |
| 116 |
unsigned long sndq, rcvq; |
| 117 |
|
| 118 |
struct proc_rs *next; |
| 119 |
}; |
| 120 |
|
| 121 |
struct proc_rs_route { |
| 122 |
unsigned short lci1; |
| 123 |
char address1[11], call1[10]; |
| 124 |
unsigned int neigh1; |
| 125 |
unsigned short lci2; |
| 126 |
char address2[11], call2[10]; |
| 127 |
unsigned int neigh2; |
| 128 |
|
| 129 |
struct proc_rs_route *next; |
| 130 |
}; |
| 131 |
|
| 132 |
struct proc_rs_neigh { |
| 133 |
int addr; |
| 134 |
char call[10]; |
| 135 |
char dev[14]; |
| 136 |
unsigned int count; |
| 137 |
unsigned int use; |
| 138 |
char mode[4]; |
| 139 |
char restart[4]; |
| 140 |
unsigned short t0, tf; |
| 141 |
|
| 142 |
struct proc_rs_neigh *next; |
| 143 |
}; |
| 144 |
|
| 145 |
struct proc_rs_nodes { |
| 146 |
char address[11]; |
| 147 |
unsigned char mask; |
| 148 |
unsigned char n; |
| 149 |
unsigned int neigh1, neigh2, neigh3; |
| 150 |
|
| 151 |
struct proc_rs_nodes *next; |
| 152 |
}; |
| 153 |
|
| 154 |
extern struct proc_ax25 *read_proc_ax25(void); |
| 155 |
extern void free_proc_ax25(struct proc_ax25 *ap); |
| 156 |
|
| 157 |
extern struct proc_ax25_route *read_proc_ax25_route(void); |
| 158 |
extern void free_proc_ax25_route(struct proc_ax25_route *rp); |
| 159 |
|
| 160 |
extern struct proc_nr *read_proc_nr(void); |
| 161 |
extern void free_proc_nr(struct proc_nr *); |
| 162 |
|
| 163 |
extern struct proc_nr_neigh *read_proc_nr_neigh(void); |
| 164 |
extern void free_proc_nr_neigh(struct proc_nr_neigh *np); |
| 165 |
|
| 166 |
extern struct proc_nr_nodes *read_proc_nr_nodes(void); |
| 167 |
extern void free_proc_nr_nodes(struct proc_nr_nodes *np); |
| 168 |
|
| 169 |
extern struct proc_rs *read_proc_rs(void); |
| 170 |
extern void free_proc_rs(struct proc_rs *); |
| 171 |
|
| 172 |
extern struct proc_rs_neigh *read_proc_rs_neigh(void); |
| 173 |
extern void free_proc_rs_neigh(struct proc_rs_neigh *); |
| 174 |
|
| 175 |
extern struct proc_rs_nodes *read_proc_rs_nodes(void); |
| 176 |
extern void free_proc_rs_nodes(struct proc_rs_nodes *); |
| 177 |
|
| 178 |
extern struct proc_rs_route *read_proc_rs_routes(void); |
| 179 |
extern void free_proc_rs_routes(struct proc_rs_route *); |
| 180 |
|
| 181 |
extern char *get_call(int uid); |
| 182 |
|
| 183 |
extern struct proc_ax25 *find_link(const char *src, const char *dest, const char *dev); |
| 184 |
extern struct proc_nr_neigh *find_neigh(int addr, struct proc_nr_neigh *neigh); |
| 185 |
extern struct proc_nr_nodes *find_node(char *addr, struct proc_nr_nodes *nodes); |
| 186 |
|
| 187 |
#ifdef _cplusplus |
| 188 |
} |
| 189 |
#endif |
| 190 |
|
| 191 |
#endif |