]> arthur.barton.de Git - netatalk.git/blob - etc/atalkd/rtmp.h
Initial revision
[netatalk.git] / etc / atalkd / rtmp.h
1 /*
2  * Copyright (c) 1990,1993 Regents of The University of Michigan.
3  * All Rights Reserved. See COPYRIGHT.
4  */
5
6 /*
7  * We have an rtmptab circular linked list for each gateway.  Entries
8  * are inserted in the order we get them.  The expectation is that
9  * we will get a complexity of N for the stable case.  If we have N
10  * existing entries, and M new entries, we'll have on the order of
11  * N + ( M * N ) complexity (really it will be something more than
12  * that, maybe N + ( M * ( N + 1/2 M )).  Note that having a list to
13  * search is superior to a hash table if you are expecting bad data:
14  * you have the opportunity to range-check the incoming data.
15  *
16  * We keep several ZIP related flags and counters here.  For ZIP Extended
17  * Replies, we must keep a flag indicating that the zone is up or down.
18  * This flag is necessary for ZIP Extended Replies which cross packet
19  * boundaries: even tho the rtmptab entry has data, it is not yet
20  * complete.  For ZIP in general, we keep a flag indicating that we've
21  * asked for a ZIP (E)Reply.  If this flag is not set, we won't process
22  * ZIP Reply data for given rtmptab entries.  Lastly, we keep a count of
23  * the number of times we've asked for ZIP Reply data.  When this value
24  * reaches some value (3?), we can optionally stop asking.
25  */
26
27 #ifndef ATALKD_RTMP_H
28 #define ATALKD_RTMP_H 1
29
30 #include <sys/cdefs.h>
31
32 struct rtmptab {
33     struct rtmptab      *rt_next,
34                         *rt_prev;
35     struct rtmptab      *rt_inext,
36                         *rt_iprev;
37     u_short             rt_firstnet, rt_lastnet;
38     u_char              rt_hops;
39     u_char              rt_state;
40     u_char              rt_flags;
41     u_char              rt_nzq;         /* number of zip queries issued */
42     struct gate         *rt_gate;       /* gate is NULL for interfaces */
43     struct list         *rt_zt;
44     const struct interface    *rt_iface;
45 };
46
47 struct rtmp_head {
48     u_short     rh_net;
49     u_char      rh_nodelen;
50     u_char      rh_node;
51 };
52
53 struct rtmp_tuple {
54     u_short     rt_net;
55     u_char      rt_dist;
56 };
57 #define SZ_RTMPTUPLE    3
58
59 #define RTMPTAB_PERM    0
60 #define RTMPTAB_GOOD    1
61 #define RTMPTAB_SUSP1   2
62 #define RTMPTAB_SUSP2   3
63 #define RTMPTAB_BAD     4
64
65 #define RTMPTAB_ZIPQUERY        0x01
66 #define RTMPTAB_HASZONES        0x02
67 #define RTMPTAB_EXTENDED        0x04
68 #define RTMPTAB_ROUTE           0x08
69
70 #ifndef BSD4_4
71 #define RTMP_ADD        SIOCADDRT
72 #define RTMP_DEL        SIOCDELRT
73 #else BSD4_4
74 #define RTMP_ADD        RTM_ADD
75 #define RTMP_DEL        RTM_DELETE
76 #endif BSD4_4
77
78 #define STARTUP_FIRSTNET        0xff00
79 #define STARTUP_LASTNET         0xfffe
80
81 extern int      rtfd;
82 struct rtmptab  *newrt __P((const struct interface *));
83 void rtmp_delzonemap  __P((struct rtmptab *));
84
85 #endif /* atalkd/rtmp.h */