Debian Codegraph @

ax25rtd/ax25rtd.h

raw symbols SCIP
1 /*
2 * Copyright (c) 1996 Joerg Reuter ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 */
20
21 /* Defines for defaults */
22
23 #define IP_MAXROUTES 4096
24 #define AX25_MAXROUTES 4096
25 #define AX25_MAXCALLS 32
26
27 /* Some AX.25 stuff */
28
29 #define NEW_ARP 1
30 #define NEW_ROUTE 2
31 #define NEW_IPMODE 4
32
33 #define SEG_FIRST 0x80
34 #define SEG_REM 0x7F
35
36 #define PID_SEGMENT 0x08
37 #define PID_ARP 0xCD
38 #define PID_IP 0xCC
39 #define PID_NETROM 0xCF
40
41 #define HDLCAEB 0x01
42 #define SSSID_SPARE 0x40
43 #define AX25_REPEATED 0x80
44
45 #define LAPB_I 0x00
46 #define LAPB_S 0x01
47 #define LAPB_UI 0x03
48 #define LAPB_PF 0x10
49
50 #define ALEN 6
51 #define AXLEN 7
52 #define IPLEN 20
53
54 /* structs for the caches */
55
56 typedef struct ip_rt_entry_ {
57 struct ip_rt_entry_ *next, *prev;
58 unsigned long ip;
59 char iface[14];
60 ax25_address call;
61 char ipmode;
62 time_t timestamp;
63 char invalid;
64 } ip_rt_entry;
65
66 typedef struct ax25_rt_entry_ {
67 struct ax25_rt_entry_ *next, *prev;
68 char iface[14];
69 ax25_address call;
70 ax25_address digipeater[AX25_MAX_DIGIS];
71 int ndigi;
72 long cnt;
73 time_t timestamp;
74 } ax25_rt_entry;
75
76 /* struct for the channel configuration */
77
78 typedef struct config_ {
79 struct config_ *next;
80 char port[128];
81 char dev[14];
82
83 char ax25_add_route;
84 char ax25_for_me;
85 char ax25_add_default;
86
87 char ip_add_route;
88 char ip_add_arp;
89 char ip_adjust_mode;
90 char ip_arp_use_netlink;
91
92 unsigned int dg_mtu;
93 unsigned int vc_mtu;
94 unsigned long tcp_irtt;
95
96 unsigned long netmask;
97 unsigned long ip;
98
99 int nmycalls;
100 ax25_address mycalls[AX25_MAXCALLS];
101
102 struct full_sockaddr_ax25 ax25_default_path;
103 } config;
104
105 /* global variables */
106
107 extern int reload;
108
109 extern config *Config;
110
111 extern ip_rt_entry * ip_routes;
112 extern int ip_routes_cnt;
113 extern int ip_maxroutes;
114
115 extern ax25_rt_entry * ax25_routes;
116 extern int ax25_routes_cnt;
117 extern int ax25_maxroutes;
118
119 extern char ip_encaps_dev[];
120 extern char iproute2_table[];
121
122 /* config.c */
123
124 void load_config(void);
125 void reload_config(void);
126 void load_cache(void);
127 void save_cache(void);
128 void interpret_command(int fd, char *buf);
129
130 /* listener.c */
131
132 int call_is_mycall(config *config, ax25_address *call);
133 int set_arp(config *config, long ip, ax25_address *call);
134 int set_route(config *config, long ip);
135 int set_ax25_route(config *config, ax25_rt_entry *rt);
136 int set_ipmode(config *config, ax25_address *call, int ipmode);
137 int del_kernel_ip_route(char *dev, long ip);
138 int del_kernel_ax25_route(char *dev, ax25_address *call);
139 void ax25_receive(int sock);
140
141 /* ax25rtd.c */
142
143 void daemon_shutdown(int reason);
144 int set_ipmode(config *config, ax25_address *call, int ipmode);
145 config * dev_get_config(char *dev);
146 config * port_get_config(char *port);
147
148 /* cache_dump.c */
149
150 void dump_ip_routes(int fd, int cmd);
151 void dump_ax25_routes(int fd, int cmd);
152 void dump_config(int fd);
153
154 /* cache_ctl.c */
155
156 int update_ip_route(config *config, unsigned long ip, int ipmode, ax25_address *call, time_t timestamp);
157 ax25_rt_entry * update_ax25_route(config *config, ax25_address *call, int ndigi, ax25_address *digi, time_t timestamp);
158 int del_ip_route(unsigned long ip);
159 int invalidate_ip_route(unsigned long ip);
160 int del_ax25_route(config * config, ax25_address *call);
161 void expire_ax25_route(time_t when);
162 void expire_ip_route(time_t when);