Deleted Added
full compact
if_llatbl.h (286955) if_llatbl.h (287789)
1/*
2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
3 * Copyright (c) 2004-2008 Qing Li. All rights reserved.
4 * Copyright (c) 2008 Kip Macy. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
3 * Copyright (c) 2004-2008 Qing Li. All rights reserved.
4 * Copyright (c) 2008 Kip Macy. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 286955 2015-08-20 12:05:17Z melifaro $");
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 287789 2015-09-14 16:48:19Z melifaro $");
29
30#ifndef _NET_IF_LLATBL_H_
31#define _NET_IF_LLATBL_H_
32
33#include <sys/_rwlock.h>
34#include <netinet/in.h>
35
36struct ifnet;

--- 93 unchanged lines hidden (view full) ---

130 LLE_FREE_LOCKED(lle); \
131} while (0)
132
133
134typedef struct llentry *(llt_lookup_t)(struct lltable *, u_int flags,
135 const struct sockaddr *l3addr);
136typedef struct llentry *(llt_alloc_t)(struct lltable *, u_int flags,
137 const struct sockaddr *l3addr);
29
30#ifndef _NET_IF_LLATBL_H_
31#define _NET_IF_LLATBL_H_
32
33#include <sys/_rwlock.h>
34#include <netinet/in.h>
35
36struct ifnet;

--- 93 unchanged lines hidden (view full) ---

130 LLE_FREE_LOCKED(lle); \
131} while (0)
132
133
134typedef struct llentry *(llt_lookup_t)(struct lltable *, u_int flags,
135 const struct sockaddr *l3addr);
136typedef struct llentry *(llt_alloc_t)(struct lltable *, u_int flags,
137 const struct sockaddr *l3addr);
138typedef int (llt_delete_t)(struct lltable *, u_int flags,
139 const struct sockaddr *l3addr);
138typedef void (llt_delete_t)(struct lltable *, struct llentry *);
140typedef void (llt_prefix_free_t)(struct lltable *,
139typedef void (llt_prefix_free_t)(struct lltable *,
141 const struct sockaddr *prefix, const struct sockaddr *mask, u_int flags);
140 const struct sockaddr *addr, const struct sockaddr *mask, u_int flags);
142typedef int (llt_dump_entry_t)(struct lltable *, struct llentry *,
143 struct sysctl_req *);
144typedef uint32_t (llt_hash_t)(const struct llentry *, uint32_t);
145typedef int (llt_match_prefix_t)(const struct sockaddr *,
146 const struct sockaddr *, u_int, struct llentry *);
147typedef void (llt_free_entry_t)(struct lltable *, struct llentry *);
148typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *);
149typedef void (llt_free_tbl_t)(struct lltable *);

--- 7 unchanged lines hidden (view full) ---

157 SLIST_ENTRY(lltable) llt_link;
158 int llt_af;
159 int llt_hsize;
160 struct llentries *lle_head;
161 struct ifnet *llt_ifp;
162
163 llt_lookup_t *llt_lookup;
164 llt_alloc_t *llt_alloc_entry;
141typedef int (llt_dump_entry_t)(struct lltable *, struct llentry *,
142 struct sysctl_req *);
143typedef uint32_t (llt_hash_t)(const struct llentry *, uint32_t);
144typedef int (llt_match_prefix_t)(const struct sockaddr *,
145 const struct sockaddr *, u_int, struct llentry *);
146typedef void (llt_free_entry_t)(struct lltable *, struct llentry *);
147typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *);
148typedef void (llt_free_tbl_t)(struct lltable *);

--- 7 unchanged lines hidden (view full) ---

156 SLIST_ENTRY(lltable) llt_link;
157 int llt_af;
158 int llt_hsize;
159 struct llentries *lle_head;
160 struct ifnet *llt_ifp;
161
162 llt_lookup_t *llt_lookup;
163 llt_alloc_t *llt_alloc_entry;
165 llt_delete_t *llt_delete;
164 llt_delete_t *llt_delete_entry;
166 llt_prefix_free_t *llt_prefix_free;
167 llt_dump_entry_t *llt_dump_entry;
168 llt_hash_t *llt_hash;
169 llt_match_prefix_t *llt_match_prefix;
170 llt_free_entry_t *llt_free_entry;
171 llt_foreach_entry_t *llt_foreach_entry;
172 llt_link_entry_t *llt_link_entry;
173 llt_unlink_entry_t *llt_unlink_entry;

--- 33 unchanged lines hidden (view full) ---

207 struct sockaddr_storage *);
208
209/* helper functions */
210size_t lltable_drop_entry_queue(struct llentry *);
211
212struct llentry *lltable_alloc_entry(struct lltable *llt, u_int flags,
213 const struct sockaddr *l4addr);
214void lltable_free_entry(struct lltable *llt, struct llentry *lle);
165 llt_prefix_free_t *llt_prefix_free;
166 llt_dump_entry_t *llt_dump_entry;
167 llt_hash_t *llt_hash;
168 llt_match_prefix_t *llt_match_prefix;
169 llt_free_entry_t *llt_free_entry;
170 llt_foreach_entry_t *llt_foreach_entry;
171 llt_link_entry_t *llt_link_entry;
172 llt_unlink_entry_t *llt_unlink_entry;

--- 33 unchanged lines hidden (view full) ---

206 struct sockaddr_storage *);
207
208/* helper functions */
209size_t lltable_drop_entry_queue(struct llentry *);
210
211struct llentry *lltable_alloc_entry(struct lltable *llt, u_int flags,
212 const struct sockaddr *l4addr);
213void lltable_free_entry(struct lltable *llt, struct llentry *lle);
214int lltable_delete_addr(struct lltable *llt, u_int flags,
215 const struct sockaddr *l3addr);
215void lltable_link_entry(struct lltable *llt, struct llentry *lle);
216void lltable_unlink_entry(struct lltable *llt, struct llentry *lle);
217void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa);
218struct ifnet *lltable_get_ifp(const struct lltable *llt);
219int lltable_get_af(const struct lltable *llt);
220
221int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f,
222 void *farg);
223/*
224 * Generic link layer address lookup function.
225 */
226static __inline struct llentry *
227lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
228{
229
230 return (llt->llt_lookup(llt, flags, l3addr));
231}
232
216void lltable_link_entry(struct lltable *llt, struct llentry *lle);
217void lltable_unlink_entry(struct lltable *llt, struct llentry *lle);
218void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa);
219struct ifnet *lltable_get_ifp(const struct lltable *llt);
220int lltable_get_af(const struct lltable *llt);
221
222int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f,
223 void *farg);
224/*
225 * Generic link layer address lookup function.
226 */
227static __inline struct llentry *
228lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
229{
230
231 return (llt->llt_lookup(llt, flags, l3addr));
232}
233
233static __inline int
234lla_delete(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
235{
236
237 return (llt->llt_delete(llt, flags, l3addr));
238}
239
240
241int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
242
243#include <sys/eventhandler.h>
244enum {
245 LLENTRY_RESOLVED,
246 LLENTRY_TIMEDOUT,
247 LLENTRY_DELETED,
248 LLENTRY_EXPIRED,
249};
250typedef void (*lle_event_fn)(void *, struct llentry *, int);
251EVENTHANDLER_DECLARE(lle_event, lle_event_fn);
252#endif /* _NET_IF_LLATBL_H_ */
234int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);
235
236#include <sys/eventhandler.h>
237enum {
238 LLENTRY_RESOLVED,
239 LLENTRY_TIMEDOUT,
240 LLENTRY_DELETED,
241 LLENTRY_EXPIRED,
242};
243typedef void (*lle_event_fn)(void *, struct llentry *, int);
244EVENTHANDLER_DECLARE(lle_event, lle_event_fn);
245#endif /* _NET_IF_LLATBL_H_ */