1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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 Lesser General Public
* License along with this library; if not, see
* <https://www.gnu.org/licenses/>.
*/
/*
* 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 long t1timer, t1, t2timer, t2, t3timer, t3;
unsigned long idletimer, idle;
unsigned char n2count, n2;
unsigned long rtt;
unsigned char window;
unsigned short paclen;
unsigned short 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 long t1timer, t1, t2timer, t2, t4timer, t4;
unsigned long idletimer, idle;
unsigned char n2count, n2;
unsigned char window;
unsigned short 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];
unsigned int count;
unsigned int use;
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
|