OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [net/] [ax25.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 *      Declarations of AX.25 type objects.
3
 *
4
 *      Alan Cox (GW4PTS)       10/11/93
5
 */
6
 
7
#ifndef _AX25_H
8
#define _AX25_H 
9
#include <linux/ax25.h>
10
 
11
#define AX25_SLOWHZ                     10      /* Run timing at 1/10 second - gives us better resolution for 56kbit links */
12
 
13
#define AX25_T1CLAMPLO                  (1 * AX25_SLOWHZ)       /* If defined, clamp at 1 second **/
14
#define AX25_T1CLAMPHI                  (30 * AX25_SLOWHZ)      /* If defined, clamp at 30 seconds **/
15
 
16
#define AX25_BPQ_HEADER_LEN             16
17
#define AX25_KISS_HEADER_LEN            1
18
 
19
#define AX25_HEADER_LEN                 17
20
#define AX25_ADDR_LEN                   7
21
#define AX25_DIGI_HEADER_LEN            (AX25_MAX_DIGIS * AX25_ADDR_LEN)
22
#define AX25_MAX_HEADER_LEN             (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN)
23
 
24
/* AX.25 Protocol IDs */
25
#define AX25_P_ROSE                     0x01
26
#define AX25_P_IP                       0xCC
27
#define AX25_P_ARP                      0xCD
28
#define AX25_P_TEXT                     0xF0
29
#define AX25_P_NETROM                   0xCF
30
#define AX25_P_SEGMENT                  0x08
31
 
32
/* AX.25 Segment control values */
33
#define AX25_SEG_REM                    0x7F
34
#define AX25_SEG_FIRST                  0x80
35
 
36
#define AX25_CBIT                       0x80    /* Command/Response bit */
37
#define AX25_EBIT                       0x01    /* HDLC Address Extension bit */
38
#define AX25_HBIT                       0x80    /* Has been repeated bit */
39
 
40
#define AX25_SSSID_SPARE                0x60    /* Unused bits in SSID for standard AX.25 */
41
#define AX25_ESSID_SPARE                0x20    /* Unused bits in SSID for extended AX.25 */
42
#define AX25_DAMA_FLAG                  0x20    /* Well, it is *NOT* unused! (dl1bke 951121 */
43
 
44
#define AX25_COND_ACK_PENDING           0x01
45
#define AX25_COND_REJECT                0x02
46
#define AX25_COND_PEER_RX_BUSY          0x04
47
#define AX25_COND_OWN_RX_BUSY           0x08
48
 
49
#ifndef _LINUX_NETDEVICE_H
50
#include <linux/netdevice.h>
51
#endif
52
 
53
/*
54
 * These headers are taken from the KA9Q package by Phil Karn. These specific
55
 * files have been placed under the GPL (not the whole package) by Phil.
56
 *
57
 *
58
 * Copyright 1991 Phil Karn, KA9Q
59
 *
60
 * This program is free software; you can redistribute it and/or modify
61
 * it under the terms of the GNU General Public License as published by
62
 * the Free Software Foundation; version 2 dated June, 1991.
63
 *
64
 * This program is distributed in the hope that it will be useful,
65
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
66
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
67
 * GNU General Public License for more details.
68
 *
69
 * You should have received a copy of the GNU General Public License
70
 * along with this program;  if not, write to the Free Software
71
 * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
72
 */
73
 
74
/* Upper sub-layer (LAPB) definitions */
75
 
76
/* Control field templates */
77
#define AX25_I                  0x00    /* Information frames */
78
#define AX25_S                  0x01    /* Supervisory frames */
79
#define AX25_RR                 0x01    /* Receiver ready */
80
#define AX25_RNR                0x05    /* Receiver not ready */
81
#define AX25_REJ                0x09    /* Reject */
82
#define AX25_U                  0x03    /* Unnumbered frames */
83
#define AX25_SABM               0x2f    /* Set Asynchronous Balanced Mode */
84
#define AX25_SABME              0x6f    /* Set Asynchronous Balanced Mode Extended */
85
#define AX25_DISC               0x43    /* Disconnect */
86
#define AX25_DM                 0x0f    /* Disconnected mode */
87
#define AX25_UA                 0x63    /* Unnumbered acknowledge */
88
#define AX25_FRMR               0x87    /* Frame reject */
89
#define AX25_UI                 0x03    /* Unnumbered information */
90
 
91
#define AX25_PF                 0x10    /* Poll/final bit for standard AX.25 */
92
#define AX25_EPF                0x01    /* Poll/final bit for extended AX.25 */
93
 
94
#define AX25_ILLEGAL            0x100   /* Impossible to be a real frame type */
95
 
96
#define AX25_POLLOFF            0
97
#define AX25_POLLON             1
98
 
99
/* AX25 L2 C-bit */
100
#define AX25_COMMAND            1
101
#define AX25_RESPONSE           2
102
 
103
/* Define Link State constants. */
104
 
105
enum {
106
        AX25_STATE_0,
107
        AX25_STATE_1,
108
        AX25_STATE_2,
109
        AX25_STATE_3,
110
        AX25_STATE_4
111
};
112
 
113
#define AX25_MAX_DEVICES        20      /* Max No of AX.25 devices */
114
 
115
#define AX25_MODULUS            8       /*  Standard AX.25 modulus */
116
#define AX25_EMODULUS           128     /*  Extended AX.25 modulus */
117
 
118
enum {
119
        AX25_VALUES_IPDEFMODE,  /* 0=DG 1=VC */
120
        AX25_VALUES_AXDEFMODE,  /* 0=Normal 1=Extended Seq Nos */
121
        AX25_VALUES_BACKOFF,    /* 0=None 1=Linear 2=Exponential */
122
        AX25_VALUES_CONMODE,    /* Allow connected modes - 0=No 1=no "PID text" 2=all PIDs */
123
        AX25_VALUES_WINDOW,     /* Default window size for standard AX.25 */
124
        AX25_VALUES_EWINDOW,    /* Default window size for extended AX.25 */
125
        AX25_VALUES_T1,         /* Default T1 timeout value */
126
        AX25_VALUES_T2,         /* Default T2 timeout value */
127
        AX25_VALUES_T3,         /* Default T3 timeout value */
128
        AX25_VALUES_IDLE,       /* Connected mode idle timer */
129
        AX25_VALUES_N2,         /* Default N2 value */
130
        AX25_VALUES_PACLEN,     /* AX.25 MTU */
131
        AX25_MAX_VALUES         /* THIS MUST REMAIN THE LAST ENTRY OF THIS LIST */
132
};
133
 
134
#define AX25_DEF_IPDEFMODE      0                        /* Datagram */
135
#define AX25_DEF_AXDEFMODE      0                        /* Normal */
136
#define AX25_DEF_BACKOFF        1                       /* Linear backoff */
137
#define AX25_DEF_CONMODE        2                       /* Connected mode allowed */
138
#define AX25_DEF_WINDOW         2                       /* Window=2 */
139
#define AX25_DEF_EWINDOW        32                      /* Module-128 Window=32 */
140
#define AX25_DEF_T1             (10 * AX25_SLOWHZ)      /* T1=10s */
141
#define AX25_DEF_T2             (3 * AX25_SLOWHZ)       /* T2=3s  */
142
#define AX25_DEF_T3             (300 * AX25_SLOWHZ)     /* T3=300s */
143
#define AX25_DEF_N2             10                      /* N2=10 */
144
#define AX25_DEF_IDLE           (0 * 60 * AX25_SLOWHZ)  /* Idle=None */
145
#define AX25_DEF_PACLEN         256                     /* Paclen=256 */
146
 
147
typedef struct ax25_uid_assoc {
148
        struct ax25_uid_assoc   *next;
149
        uid_t                   uid;
150
        ax25_address            call;
151
} ax25_uid_assoc;
152
 
153
typedef struct {
154
        ax25_address            calls[AX25_MAX_DIGIS];
155
        unsigned char           repeated[AX25_MAX_DIGIS];
156
        unsigned char           ndigi;
157
        char                    lastrepeat;
158
} ax25_digi;
159
 
160
typedef struct ax25_cb {
161
        struct ax25_cb          *next;
162
        ax25_address            source_addr, dest_addr;
163
        struct device           *device;
164
        unsigned char           dama_slave, iamdigi;
165
        unsigned char           state, modulus, pidincl;
166
        unsigned short          vs, vr, va;
167
        unsigned char           condition, backoff;
168
        unsigned char           n2, n2count;
169
        unsigned short          t1, t2, t3, idle, rtt;
170
        unsigned short          t1timer, t2timer, t3timer, idletimer;
171
        unsigned short          paclen;
172
        unsigned short          fragno, fraglen;
173
        ax25_digi               *digipeat;
174
        struct sk_buff_head     write_queue;
175
        struct sk_buff_head     reseq_queue;
176
        struct sk_buff_head     ack_queue;
177
        struct sk_buff_head     frag_queue;
178
        unsigned char           window;
179
        struct timer_list       timer;
180
        struct sock             *sk;            /* Backlink to socket */
181
} ax25_cb;
182
 
183
#ifndef _LINUX_SYSCTL_H
184
#include <linux/sysctl.h>
185
#endif
186
 
187
struct ax25_dev {
188
        char                    name[20];
189
        struct device           *dev;
190
        struct device           *forward;
191
        struct ctl_table        systable[AX25_MAX_VALUES+1];
192
        int                     values[AX25_MAX_VALUES];
193
};
194
 
195
/* af_ax25.c */
196
extern ax25_address null_ax25_address;
197
extern char *ax2asc(ax25_address *);
198
extern ax25_address *asc2ax(char *);
199
extern int  ax25cmp(ax25_address *, ax25_address *);
200
extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct device *);
201
extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct device *);
202
extern void ax25_destroy_socket(ax25_cb *);
203
extern struct device *ax25rtr_get_dev(ax25_address *);
204
extern int  ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
205
        void *, void *, unsigned int);
206
extern int  ax25_rebuild_header(void *, struct device *, unsigned long, struct sk_buff *);
207
extern ax25_uid_assoc *ax25_uid_list;
208
extern int  ax25_uid_policy;
209
extern ax25_address *ax25_findbyuid(uid_t);
210
extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
211
extern int  ax25_dev_is_dama_slave(struct device *);    /* dl1bke 951121 */
212
 
213
#include <net/ax25call.h>
214
 
215
/* ax25_in.c */
216
extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int, int);
217
 
218
/* ax25_out.c */
219
extern void ax25_output(ax25_cb *, int, struct sk_buff *);
220
extern void ax25_kick(ax25_cb *);
221
extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
222
extern void ax25_nr_error_recovery(ax25_cb *);
223
extern void ax25_establish_data_link(ax25_cb *);
224
extern void ax25_transmit_enquiry(ax25_cb *);
225
extern void ax25_enquiry_response(ax25_cb *);
226
extern void ax25_timeout_response(ax25_cb *);
227
extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
228
extern void dama_enquiry_response(ax25_cb *);                   /* dl1bke 960114 */
229
extern void dama_establish_data_link(ax25_cb *);
230
 
231
/* ax25_route.c */
232
extern struct ax25_dev ax25_device[];
233
extern int  ax25_rt_get_info(char *, char **, off_t, int, int);
234
extern int  ax25_cs_get_info(char *, char **, off_t, int, int);
235
extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
236
extern ax25_digi *ax25_rt_find_path(ax25_address *, struct device *);
237
extern void ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
238
extern void ax25_rt_device_down(struct device *);
239
extern int  ax25_rt_ioctl(unsigned int, void *);
240
extern char ax25_rt_mode_get(ax25_address *, struct device *);
241
extern int  ax25_dev_get_value(struct device *, int);
242
extern void ax25_dev_device_up(struct device *);
243
extern void ax25_dev_device_down(struct device *);
244
extern int  ax25_fwd_ioctl(unsigned int, struct ax25_fwd_struct *);
245
extern struct device *ax25_fwd_dev(struct device *);
246
extern void ax25_rt_free(void);
247
 
248
/* ax25_subr.c */
249
extern void ax25_clear_queues(ax25_cb *);
250
extern void ax25_frames_acked(ax25_cb *, unsigned short);
251
extern void ax25_requeue_frames(ax25_cb *);
252
extern int  ax25_validate_nr(ax25_cb *, unsigned short);
253
extern int  ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
254
extern void ax25_send_control(ax25_cb *, int, int, int);
255
extern unsigned short ax25_calculate_t1(ax25_cb *);
256
extern void ax25_calculate_rtt(ax25_cb *);
257
extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
258
        ax25_address *, ax25_digi *, int *, int *);     /* dl1bke 951121 */
259
extern int  build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
260
        ax25_digi *, int, int);
261
extern int  size_ax25_addr(ax25_digi *);
262
extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
263
extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
264
extern void ax25_dama_on(ax25_cb *);    /* dl1bke 951121 */
265
extern void ax25_dama_off(ax25_cb *);   /* dl1bke 951121 */
266
extern void ax25_disconnect(ax25_cb *, int);
267
 
268
/* ax25_timer.c */
269
extern void ax25_set_timer(ax25_cb *);
270
extern void ax25_t1_timeout(ax25_cb *);
271
extern void ax25_link_failed(ax25_cb *, int);
272
extern int  (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *);
273
extern int  ax25_listen_mine(ax25_address *, struct device *);
274
 
275
/* sysctl_net_ax25.c */
276
extern void ax25_register_sysctl(void);
277
extern void ax25_unregister_sysctl(void);
278
 
279
/* ... */
280
 
281
extern ax25_cb *volatile ax25_list;
282
 
283
/* support routines for modules that use AX.25, in ax25_timer.c */
284
extern int  ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, ax25_cb *));
285
extern void ax25_protocol_release(unsigned int);
286
extern int  ax25_linkfail_register(void (*)(ax25_cb *, int));
287
extern void ax25_linkfail_release(void (*)(ax25_cb *, int));
288
extern int  ax25_listen_register(ax25_address *, struct device *);
289
extern void ax25_listen_release(ax25_address *, struct device *);
290
extern int  ax25_protocol_is_registered(unsigned int);
291
 
292
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.