]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/blob - drivers/staging/batman-adv/types.h
Staging: batman-adv: move /proc interface handling to /sys
[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_status;
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 kobject *hardif_obj;
46         struct rcu_head rcu;
47
48 };
49
50 struct orig_node {               /* structure for orig_list maintaining nodes of mesh */
51         uint8_t orig[ETH_ALEN];
52         struct neigh_node *router;
53         TYPE_OF_WORD *bcast_own;
54         uint8_t *bcast_own_sum;
55         uint8_t tq_own;
56         int tq_asym_penalty;
57         unsigned long last_valid;        /* when last packet from this node was received */
58 /*      uint8_t  gwflags;      * flags related to gateway functions: gateway class */
59         uint8_t  flags;                 /* for now only VIS_SERVER flag. */
60         unsigned char *hna_buff;
61         int16_t  hna_buff_len;
62         uint16_t last_real_seqno;   /* last and best known squence number */
63         uint8_t last_ttl;         /* ttl of last received packet */
64         TYPE_OF_WORD bcast_bits[NUM_WORDS];
65         uint16_t last_bcast_seqno;  /* last broadcast sequence number received by this host */
66         struct list_head neigh_list;
67 };
68
69 struct neigh_node {
70         struct list_head list;
71         uint8_t addr[ETH_ALEN];
72         uint8_t real_packet_count;
73         uint8_t tq_recv[TQ_GLOBAL_WINDOW_SIZE];
74         uint8_t tq_index;
75         uint8_t tq_avg;
76         uint8_t last_ttl;
77         unsigned long last_valid;            /* when last packet via this neighbor was received */
78         TYPE_OF_WORD real_bits[NUM_WORDS];
79         struct orig_node *orig_node;
80         struct batman_if *if_incoming;
81 };
82
83 struct bat_priv {
84         struct net_device_stats stats;
85         atomic_t aggregation_enabled;
86         atomic_t vis_mode;
87         atomic_t orig_interval;
88         char num_ifaces;
89         struct batman_if *primary_if;
90         struct kobject *mesh_obj;
91 };
92
93 struct device_client {
94         struct list_head queue_list;
95         unsigned int queue_len;
96         unsigned char index;
97         spinlock_t lock;
98         wait_queue_head_t queue_wait;
99 };
100
101 struct device_packet {
102         struct list_head list;
103         struct icmp_packet icmp_packet;
104 };
105
106 struct hna_local_entry {
107         uint8_t addr[ETH_ALEN];
108         unsigned long last_seen;
109         char never_purge;
110 };
111
112 struct hna_global_entry {
113         uint8_t addr[ETH_ALEN];
114         struct orig_node *orig_node;
115 };
116
117 struct forw_packet {               /* structure for forw_list maintaining packets to be send/forwarded */
118         struct hlist_node list;
119         unsigned long send_time;
120         uint8_t own;
121         struct sk_buff *skb;
122         unsigned char *packet_buff;
123         uint16_t packet_len;
124         uint32_t direct_link_flags;
125         uint8_t num_packets;
126         struct delayed_work delayed_work;
127         struct batman_if *if_incoming;
128 };
129
130 /* While scanning for vis-entries of a particular vis-originator
131  * this list collects its interfaces to create a subgraph/cluster
132  * out of them later
133  */
134 struct if_list_entry {
135         uint8_t addr[ETH_ALEN];
136         bool primary;
137         struct hlist_node list;
138 };
139
140 #endif