x86: Do not reserve brk for DMI if it's not going to be used
[linux-2.6/cjktty.git] / drivers / staging / batman-adv / main.h
blobfacb6b79ee5231f0982e9fa03f0766759fe6976f
1 /*
2 * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
4 * Marek Lindner, Simon Wunderlich
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.
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.
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
22 /* Kernel Programming */
23 #define LINUX
25 #define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
26 #define DRIVER_DESC "B.A.T.M.A.N. advanced"
27 #define DRIVER_DEVICE "batman-adv"
29 #define SOURCE_VERSION "0.2.1-beta"
32 /* B.A.T.M.A.N. parameters */
34 #define TQ_MAX_VALUE 255
35 #define JITTER 20
36 #define TTL 50 /* Time To Live of broadcast messages */
37 #define MAX_ADDR 16 /* number of interfaces which can be added to
38 * batman. */
40 #define PURGE_TIMEOUT 200000 /* purge originators after time in ms if no
41 * valid packet comes in -> TODO: check
42 * influence on TQ_LOCAL_WINDOW_SIZE */
43 #define LOCAL_HNA_TIMEOUT 3600000
45 #define TQ_LOCAL_WINDOW_SIZE 64 /* sliding packet range of received originator
46 * messages in squence numbers (should be a
47 * multiple of our word size) */
48 #define TQ_GLOBAL_WINDOW_SIZE 5
49 #define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
50 #define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1
51 #define TQ_TOTAL_BIDRECT_LIMIT 1
53 #define TQ_HOP_PENALTY 10
55 #define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
57 #define PACKBUFF_SIZE 2000
58 #define LOG_BUF_LEN 8192 /* has to be a power of 2 */
59 #define ETH_STR_LEN 20
61 #define MAX_AGGREGATION_BYTES 512 /* should not be bigger than 512 bytes or
62 * change the size of
63 * forw_packet->direct_link_flags */
64 #define MAX_AGGREGATION_MS 100
66 #define MODULE_INACTIVE 0
67 #define MODULE_ACTIVE 1
68 #define MODULE_DEACTIVATING 2
72 * Logging
75 #define LOG_TYPE_CRIT 0 /* highest priority for fatal errors such as
76 * blocked sockets / failed packet delivery /
77 * programming errors */
78 #define LOG_TYPE_WARN 1 /* warnings for small errors like wrong user
79 * input / damaged packets / etc */
80 #define LOG_TYPE_NOTICE 2 /* notice information for new interfaces /
81 * changed settings / new originators / etc */
82 #define LOG_TYPE_BATMAN 4 /* all messages related to routing / flooding /
83 * broadcasting / etc */
84 #define LOG_TYPE_ROUTES 8 /* route or hna added / changed / deleted */
85 #define LOG_TYPE_CRIT_NAME "critical"
86 #define LOG_TYPE_WARN_NAME "warnings"
87 #define LOG_TYPE_NOTICE_NAME "notices"
88 #define LOG_TYPE_BATMAN_NAME "batman"
89 #define LOG_TYPE_ROUTES_NAME "routes"
92 * Vis
95 /* #define VIS_SUBCLUSTERS_DISABLED */
98 * Kernel headers
101 #include <linux/mutex.h> /* mutex */
102 #include <linux/module.h> /* needed by all modules */
103 #include <linux/netdevice.h> /* netdevice */
104 #include <linux/if_ether.h> /* ethernet header */
105 #include <linux/poll.h> /* poll_table */
106 #include <linux/kthread.h> /* kernel threads */
107 #include <linux/pkt_sched.h> /* schedule types */
108 #include <linux/workqueue.h> /* workqueue */
109 #include <net/sock.h> /* struct sock */
110 #include <linux/jiffies.h>
111 #include "types.h"
113 #ifndef REVISION_VERSION
114 #define REVISION_VERSION_STR ""
115 #else
116 #define REVISION_VERSION_STR " "REVISION_VERSION
117 #endif
119 extern struct list_head if_list;
120 extern struct hlist_head forw_bat_list;
121 extern struct hlist_head forw_bcast_list;
122 extern struct hashtable_t *orig_hash;
124 extern spinlock_t orig_hash_lock;
125 extern spinlock_t forw_bat_list_lock;
126 extern spinlock_t forw_bcast_list_lock;
128 extern atomic_t originator_interval;
129 extern atomic_t vis_interval;
130 extern atomic_t aggregation_enabled;
131 extern int16_t num_hna;
132 extern int16_t num_ifs;
134 extern struct net_device *soft_device;
136 extern unsigned char broadcastAddr[];
137 extern atomic_t module_state;
138 extern struct workqueue_struct *bat_event_workqueue;
140 void activate_module(void);
141 void shutdown_module(void);
142 void inc_module_count(void);
143 void dec_module_count(void);
144 int addr_to_string(char *buff, uint8_t *addr);
145 int compare_orig(void *data1, void *data2);
146 int choose_orig(void *data, int32_t size);
147 int is_my_mac(uint8_t *addr);
148 int is_bcast(uint8_t *addr);
149 int is_mcast(uint8_t *addr);