1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
20#define _NET_BATMAN_ADV_ORIGINATOR_H_
21
22#include "main.h"
23
24#include <linux/compiler.h>
25#include <linux/if_ether.h>
26#include <linux/jhash.h>
27#include <linux/types.h>
28
29struct netlink_callback;
30struct seq_file;
31struct sk_buff;
32
33bool batadv_compare_orig(const struct hlist_node *node, const void *data2);
34int batadv_originator_init(struct batadv_priv *bat_priv);
35void batadv_originator_free(struct batadv_priv *bat_priv);
36void batadv_purge_orig_ref(struct batadv_priv *bat_priv);
37void batadv_orig_node_put(struct batadv_orig_node *orig_node);
38struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
39 const u8 *addr);
40struct batadv_hardif_neigh_node *
41batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface,
42 const u8 *neigh_addr);
43void
44batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh);
45struct batadv_neigh_node *
46batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
47 struct batadv_hard_iface *hard_iface,
48 const u8 *neigh_addr);
49void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node);
50struct batadv_neigh_node *
51batadv_orig_router_get(struct batadv_orig_node *orig_node,
52 const struct batadv_hard_iface *if_outgoing);
53struct batadv_neigh_ifinfo *
54batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh,
55 struct batadv_hard_iface *if_outgoing);
56struct batadv_neigh_ifinfo *
57batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh,
58 struct batadv_hard_iface *if_outgoing);
59void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo);
60
61int batadv_hardif_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb);
62int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset);
63
64struct batadv_orig_ifinfo *
65batadv_orig_ifinfo_get(struct batadv_orig_node *orig_node,
66 struct batadv_hard_iface *if_outgoing);
67struct batadv_orig_ifinfo *
68batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
69 struct batadv_hard_iface *if_outgoing);
70void batadv_orig_ifinfo_put(struct batadv_orig_ifinfo *orig_ifinfo);
71
72int batadv_orig_seq_print_text(struct seq_file *seq, void *offset);
73int batadv_orig_dump(struct sk_buff *msg, struct netlink_callback *cb);
74int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset);
75int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
76 unsigned int max_if_num);
77int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface,
78 unsigned int max_if_num);
79struct batadv_orig_node_vlan *
80batadv_orig_node_vlan_new(struct batadv_orig_node *orig_node,
81 unsigned short vid);
82struct batadv_orig_node_vlan *
83batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
84 unsigned short vid);
85void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan);
86
87
88
89
90
91
92
93
94
95static inline u32 batadv_choose_orig(const void *data, u32 size)
96{
97 u32 hash = 0;
98
99 hash = jhash(data, ETH_ALEN, hash);
100 return hash % size;
101}
102
103struct batadv_orig_node *
104batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data);
105
106#endif
107