]>
Commit | Line | Data |
---|---|---|
5beef3c9 AL |
1 | /* |
2 | * Copyright (C) 2007-2009 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 | struct socket *raw_sock; | |
43 | atomic_t seqno; | |
44 | unsigned char *packet_buff; | |
45 | int packet_len; | |
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 | struct batman_if *batman_if; | |
54 | TYPE_OF_WORD *bcast_own; | |
55 | uint8_t *bcast_own_sum; | |
56 | uint8_t tq_own; | |
57 | int tq_asym_penalty; | |
58 | unsigned long last_valid; /* when last packet from this node was received */ | |
59 | /* uint8_t gwflags; * flags related to gateway functions: gateway class */ | |
60 | uint8_t flags; /* for now only VIS_SERVER flag. */ | |
61 | unsigned char *hna_buff; | |
62 | int16_t hna_buff_len; | |
63 | uint16_t last_real_seqno; /* last and best known squence number */ | |
64 | uint8_t last_ttl; /* ttl of last received packet */ | |
65 | TYPE_OF_WORD bcast_bits[NUM_WORDS]; | |
66 | uint16_t last_bcast_seqno; /* last broadcast sequence number received by this host */ | |
67 | struct list_head neigh_list; | |
68 | }; | |
69 | ||
70 | struct neigh_node { | |
71 | struct list_head list; | |
72 | uint8_t addr[ETH_ALEN]; | |
73 | uint8_t real_packet_count; | |
74 | uint8_t tq_recv[TQ_GLOBAL_WINDOW_SIZE]; | |
75 | uint8_t tq_index; | |
76 | uint8_t tq_avg; | |
77 | uint8_t last_ttl; | |
78 | unsigned long last_valid; /* when last packet via this neighbour was received */ | |
79 | TYPE_OF_WORD real_bits[NUM_WORDS]; | |
80 | struct orig_node *orig_node; | |
81 | struct batman_if *if_incoming; | |
82 | }; | |
83 | ||
84 | struct bat_priv { | |
85 | struct net_device_stats stats; | |
86 | }; | |
87 | ||
88 | struct device_client { | |
89 | struct list_head queue_list; | |
90 | unsigned int queue_len; | |
91 | unsigned char index; | |
92 | spinlock_t lock; | |
93 | wait_queue_head_t queue_wait; | |
94 | }; | |
95 | ||
96 | struct device_packet { | |
97 | struct list_head list; | |
98 | struct icmp_packet icmp_packet; | |
99 | }; | |
100 | ||
101 | struct hna_local_entry { | |
102 | uint8_t addr[ETH_ALEN]; | |
103 | unsigned long last_seen; | |
104 | char never_purge; | |
105 | }; | |
106 | ||
107 | struct hna_global_entry { | |
108 | uint8_t addr[ETH_ALEN]; | |
109 | struct orig_node *orig_node; | |
110 | }; | |
111 | ||
112 | struct forw_packet { /* structure for forw_list maintaining packets to be send/forwarded */ | |
113 | struct hlist_node list; | |
114 | unsigned long send_time; | |
115 | uint8_t own; | |
116 | unsigned char *packet_buff; | |
117 | uint16_t packet_len; | |
118 | uint32_t direct_link_flags; | |
119 | uint8_t num_packets; | |
120 | struct delayed_work delayed_work; | |
121 | struct batman_if *if_incoming; | |
122 | }; | |
123 | ||
124 | #endif |