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