]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/blob - drivers/staging/batman-adv/types.h
Staging: batman-adv: remove redundant pointer to originator interface
[lisovros/linux_canprio.git] / drivers / staging / batman-adv / types.h
1 /*
2  * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
3  *
4  * Marek Lindner, Simon Wunderlich
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA
19  *
20  */
21
22
23
24
25
26 #ifndef TYPES_H
27 #define TYPES_H
28
29 #include "packet.h"
30 #include "bitarray.h"
31
32 #define BAT_HEADER_LEN (sizeof(struct ethhdr) + ((sizeof(struct unicast_packet) > sizeof(struct bcast_packet) ? sizeof(struct unicast_packet) : sizeof(struct bcast_packet))))
33
34
35 struct batman_if {
36         struct list_head list;
37         int16_t if_num;
38         char *dev;
39         char if_active;
40         char addr_str[ETH_STR_LEN];
41         struct net_device *net_dev;
42         atomic_t seqno;
43         unsigned char *packet_buff;
44         int packet_len;
45         struct rcu_head rcu;
46
47 };
48
49 struct orig_node {               /* structure for orig_list maintaining nodes of mesh */
50         uint8_t orig[ETH_ALEN];
51         struct neigh_node *router;
52         TYPE_OF_WORD *bcast_own;
53         uint8_t *bcast_own_sum;
54         uint8_t tq_own;
55         int tq_asym_penalty;
56         unsigned long last_valid;        /* when last packet from this node was received */
57 /*      uint8_t  gwflags;      * flags related to gateway functions: gateway class */
58         uint8_t  flags;                 /* for now only VIS_SERVER flag. */
59         unsigned char *hna_buff;
60         int16_t  hna_buff_len;
61         uint16_t last_real_seqno;   /* last and best known squence number */
62         uint8_t last_ttl;         /* ttl of last received packet */
63         TYPE_OF_WORD bcast_bits[NUM_WORDS];
64         uint16_t last_bcast_seqno;  /* last broadcast sequence number received by this host */
65         struct list_head neigh_list;
66 };
67
68 struct neigh_node {
69         struct list_head list;
70         uint8_t addr[ETH_ALEN];
71         uint8_t real_packet_count;
72         uint8_t tq_recv[TQ_GLOBAL_WINDOW_SIZE];
73         uint8_t tq_index;
74         uint8_t tq_avg;
75         uint8_t last_ttl;
76         unsigned long last_valid;            /* when last packet via this neighbor was received */
77         TYPE_OF_WORD real_bits[NUM_WORDS];
78         struct orig_node *orig_node;
79         struct batman_if *if_incoming;
80 };
81
82 struct bat_priv {
83         struct net_device_stats stats;
84         atomic_t aggregation_enabled;
85         atomic_t vis_mode;
86         atomic_t orig_interval;
87         struct kobject *mesh_obj;
88 };
89
90 struct device_client {
91         struct list_head queue_list;
92         unsigned int queue_len;
93         unsigned char index;
94         spinlock_t lock;
95         wait_queue_head_t queue_wait;
96 };
97
98 struct device_packet {
99         struct list_head list;
100         struct icmp_packet icmp_packet;
101 };
102
103 struct hna_local_entry {
104         uint8_t addr[ETH_ALEN];
105         unsigned long last_seen;
106         char never_purge;
107 };
108
109 struct hna_global_entry {
110         uint8_t addr[ETH_ALEN];
111         struct orig_node *orig_node;
112 };
113
114 struct forw_packet {               /* structure for forw_list maintaining packets to be send/forwarded */
115         struct hlist_node list;
116         unsigned long send_time;
117         uint8_t own;
118         struct sk_buff *skb;
119         unsigned char *packet_buff;
120         uint16_t packet_len;
121         uint32_t direct_link_flags;
122         uint8_t num_packets;
123         struct delayed_work delayed_work;
124         struct batman_if *if_incoming;
125 };
126
127 /* While scanning for vis-entries of a particular vis-originator
128  * this list collects its interfaces to create a subgraph/cluster
129  * out of them later
130  */
131 struct if_list_entry {
132         uint8_t addr[ETH_ALEN];
133         bool primary;
134         struct hlist_node list;
135 };
136
137 #endif