This source file includes following definitions.
- net_alias_is
- net_alias_has
- net_alias_main_dev
- net_alias_nextdev
- net_alias_nextdev_set
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _NET_ALIAS_H
18 #define _NET_ALIAS_H
19
20 #include <linux/types.h>
21 #include <linux/if.h>
22 #include <linux/netdevice.h>
23
24
25
26
27
28 #define NET_ALIAS_MAX_SLOT 256
29
30 struct net_alias;
31 struct net_alias_info;
32 struct net_alias_type;
33
34
35
36
37
38
39
40 struct net_alias
41 {
42 struct device dev;
43 char name[IFNAMSIZ];
44 unsigned hash;
45 unsigned slot;
46 void *data;
47 struct device *main_dev;
48 struct net_alias_type *nat;
49 struct net_alias *next;
50 };
51
52
53
54
55
56
57
58 struct net_alias_info
59 {
60 int n_aliases;
61 struct device *taildev;
62 struct net_alias *hash_tab[16];
63 };
64
65
66
67
68
69
70
71 struct net_alias_type
72 {
73 int type;
74 int n_attach;
75 char name[16];
76 __u32 (*get_addr32)
77 (struct net_alias_type *this, struct sockaddr*);
78 int (*dev_addr_chk)
79 (struct net_alias_type *this, struct device *, struct sockaddr *);
80 struct device * (*dev_select)
81 (struct net_alias_type *this, struct device *, struct sockaddr *sa);
82 int (*alias_init_1)
83 (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa);
84 int (*alias_done_1)
85 (struct net_alias_type *this, struct net_alias *alias);
86 int (*alias_print_1)
87 (struct net_alias_type *this, struct net_alias *alias, char *buf, int len);
88 struct net_alias_type *next;
89 };
90
91
92
93
94
95
96 static __inline__ int
97 net_alias_is(struct device *dev)
98 {
99 return (dev->my_alias != NULL);
100 }
101
102
103
104
105
106
107 static __inline__ int
108 net_alias_has(struct device *dev)
109 {
110 return (dev->alias_info != NULL);
111 }
112
113
114 extern void net_alias_init(void);
115
116 extern struct device * net_alias_dev_get(char *dev_name, int aliasing_ok, int *err, struct sockaddr *sa, void *data);
117 extern int net_alias_dev_rehash(struct device *dev, struct sockaddr *sa);
118
119 extern int net_alias_getinfo(char *buf, char **, off_t , int , int );
120 extern int net_alias_types_getinfo(char *buf, char **, off_t , int , int );
121
122 extern int register_net_alias_type(struct net_alias_type *nat, int type);
123 extern int unregister_net_alias_type(struct net_alias_type *nat);
124
125 extern struct device * net_alias_dev_chk(struct device *main_dev, struct sockaddr *sa, int flags_on, int flags_off);
126 extern struct device * net_alias_dev_chk32(struct device *main_dev, int family, __u32 addr32, int flags_on, int flags_off);
127
128 extern struct device * net_alias_dev_rcv_sel(struct device *main_dev, struct sockaddr *sa_src, struct sockaddr *sa_dst);
129 extern struct device * net_alias_dev_rcv_sel32(struct device *main_dev, int family, __u32 src, __u32 dst);
130
131
132
133
134
135
136
137 static __inline__ struct device *net_alias_main_dev(struct device *dev)
138 {
139 return (net_alias_is(dev))? dev->my_alias->main_dev : dev;
140 }
141
142
143
144
145
146
147
148 static __inline__ struct device *
149 net_alias_nextdev(struct device *dev)
150 {
151 return (dev->alias_info)? dev->alias_info->taildev->next : dev->next;
152 }
153
154
155
156
157
158
159
160 static __inline__ struct device *
161 net_alias_nextdev_set(struct device *dev, struct device *nextdev)
162 {
163 struct device *pdev = dev;
164 if (net_alias_has(dev))
165 {
166 pdev = dev->alias_info->taildev;
167 }
168 pdev->next = nextdev;
169 return nextdev;
170 }
171
172 #endif