This source file includes following definitions.
- dn_dev_islocal
1
2 #ifndef _NET_DN_DEV_H
3 #define _NET_DN_DEV_H
4
5
6 struct dn_dev;
7
8 struct dn_ifaddr {
9 struct dn_ifaddr __rcu *ifa_next;
10 struct dn_dev *ifa_dev;
11 __le16 ifa_local;
12 __le16 ifa_address;
13 __u32 ifa_flags;
14 __u8 ifa_scope;
15 char ifa_label[IFNAMSIZ];
16 struct rcu_head rcu;
17 };
18
19 #define DN_DEV_S_RU 0
20 #define DN_DEV_S_CR 1
21 #define DN_DEV_S_DS 2
22 #define DN_DEV_S_RI 3
23 #define DN_DEV_S_RV 4
24 #define DN_DEV_S_RC 5
25 #define DN_DEV_S_OF 6
26 #define DN_DEV_S_HA 7
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 struct dn_dev_parms {
69 int type;
70 int mode;
71 #define DN_DEV_BCAST 1
72 #define DN_DEV_UCAST 2
73 #define DN_DEV_MPOINT 4
74 int state;
75 int forwarding;
76 unsigned long t2;
77 unsigned long t3;
78 int priority;
79 char *name;
80 int (*up)(struct net_device *);
81 void (*down)(struct net_device *);
82 void (*timer3)(struct net_device *, struct dn_ifaddr *ifa);
83 void *sysctl;
84 };
85
86
87 struct dn_dev {
88 struct dn_ifaddr __rcu *ifa_list;
89 struct net_device *dev;
90 struct dn_dev_parms parms;
91 char use_long;
92 struct timer_list timer;
93 unsigned long t3;
94 struct neigh_parms *neigh_parms;
95 __u8 addr[ETH_ALEN];
96 struct neighbour *router;
97 struct neighbour *peer;
98 unsigned long uptime;
99 };
100
101 struct dn_short_packet {
102 __u8 msgflg;
103 __le16 dstnode;
104 __le16 srcnode;
105 __u8 forward;
106 } __packed;
107
108 struct dn_long_packet {
109 __u8 msgflg;
110 __u8 d_area;
111 __u8 d_subarea;
112 __u8 d_id[6];
113 __u8 s_area;
114 __u8 s_subarea;
115 __u8 s_id[6];
116 __u8 nl2;
117 __u8 visit_ct;
118 __u8 s_class;
119 __u8 pt;
120 } __packed;
121
122
123
124 struct endnode_hello_message {
125 __u8 msgflg;
126 __u8 tiver[3];
127 __u8 id[6];
128 __u8 iinfo;
129 __le16 blksize;
130 __u8 area;
131 __u8 seed[8];
132 __u8 neighbor[6];
133 __le16 timer;
134 __u8 mpd;
135 __u8 datalen;
136 __u8 data[2];
137 } __packed;
138
139 struct rtnode_hello_message {
140 __u8 msgflg;
141 __u8 tiver[3];
142 __u8 id[6];
143 __u8 iinfo;
144 __le16 blksize;
145 __u8 priority;
146 __u8 area;
147 __le16 timer;
148 __u8 mpd;
149 } __packed;
150
151
152 void dn_dev_init(void);
153 void dn_dev_cleanup(void);
154
155 int dn_dev_ioctl(unsigned int cmd, void __user *arg);
156
157 void dn_dev_devices_off(void);
158 void dn_dev_devices_on(void);
159
160 void dn_dev_init_pkt(struct sk_buff *skb);
161 void dn_dev_veri_pkt(struct sk_buff *skb);
162 void dn_dev_hello(struct sk_buff *skb);
163
164 void dn_dev_up(struct net_device *);
165 void dn_dev_down(struct net_device *);
166
167 int dn_dev_set_default(struct net_device *dev, int force);
168 struct net_device *dn_dev_get_default(void);
169 int dn_dev_bind_default(__le16 *addr);
170
171 int register_dnaddr_notifier(struct notifier_block *nb);
172 int unregister_dnaddr_notifier(struct notifier_block *nb);
173
174 static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
175 {
176 struct dn_dev *dn_db;
177 struct dn_ifaddr *ifa;
178 int res = 0;
179
180 rcu_read_lock();
181 dn_db = rcu_dereference(dev->dn_ptr);
182 if (dn_db == NULL) {
183 printk(KERN_DEBUG "dn_dev_islocal: Called for non DECnet device\n");
184 goto out;
185 }
186
187 for (ifa = rcu_dereference(dn_db->ifa_list);
188 ifa != NULL;
189 ifa = rcu_dereference(ifa->ifa_next))
190 if ((addr ^ ifa->ifa_local) == 0) {
191 res = 1;
192 break;
193 }
194 out:
195 rcu_read_unlock();
196 return res;
197 }
198
199 #endif