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