changed IPN_SWITCH->IPN_VDESWITCH
[vde.git] / ipn / ipn_hash.h
blob947e16d783a088b4ab46cb681c1e196061fe0d93
1 #ifndef _IPN_HASH_H
2 #define _IPN_HASH_H
3 /*
4 * Inter process networking (virtual distributed ethernet) module
5 * Hash table for Ethernet management
6 * (part of the View-OS project: wiki.virtualsquare.org)
8 * Copyright (C) 2007 Renzo Davoli (renzo@cs.unibo.it)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * Due to this file being licensed under the GPL there is controversy over
16 * whether this permits you to write a module that #includes this file
17 * without placing your module under the GPL. Please consult a lawyer for
18 * advice before doing this.
22 #include <linux/init.h>
23 #include <linux/module.h>
24 #include <linux/types.h>
25 #include <linux/timer.h>
26 #include <linux/list.h>
27 #include <linux/jiffies.h>
29 struct ipn_hash {
30 struct hlist_head *hashtable;
31 struct list_head lrulist;
32 int mask; /* size-1 where size must be a power of 2 */
33 unsigned long timeout;
34 spinlock_t hashlock;
35 struct timer_list hashtimer;
38 int ipn_hash_new(struct ipn_hash *vdeh,int size,unsigned long timeout);
39 void ipn_hash_flush(struct ipn_hash *vdeh);
40 void ipn_hash_flush_key(struct ipn_hash *vdeh,u16 *key,u16 *vlan);
41 void ipn_hash_flush_port(struct ipn_hash *vdeh,int port);
42 void ipn_hash_free(struct ipn_hash *vdeh);
43 void ipn_hash_add(struct ipn_hash *vdeh,u16 *key,u16 vlan,int port);
44 int ipn_hash_find(struct ipn_hash *vdeh,u16 *key,u16 vlan);
45 int ipn_hash_init(void);
46 void ipn_hash_fini(void);
47 #endif