Paul Moore | d15c345 | 2006-08-03 16:48:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * NetLabel Domain Hash Table |
| 3 | * |
| 4 | * This file manages the domain hash table that NetLabel uses to determine |
| 5 | * which network labeling protocol to use for a given domain. The NetLabel |
| 6 | * system manages static and dynamic label mappings for network protocols such |
| 7 | * as CIPSO and RIPSO. |
| 8 | * |
| 9 | * Author: Paul Moore <paul.moore@hp.com> |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify |
| 17 | * it under the terms of the GNU General Public License as published by |
| 18 | * the Free Software Foundation; either version 2 of the License, or |
| 19 | * (at your option) any later version. |
| 20 | * |
| 21 | * This program is distributed in the hope that it will be useful, |
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 24 | * the GNU General Public License for more details. |
| 25 | * |
| 26 | * You should have received a copy of the GNU General Public License |
| 27 | * along with this program; if not, write to the Free Software |
| 28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 29 | * |
| 30 | */ |
| 31 | |
| 32 | #ifndef _NETLABEL_DOMAINHASH_H |
| 33 | #define _NETLABEL_DOMAINHASH_H |
| 34 | |
Paul Moore | 7a0e1d6 | 2006-08-29 17:56:04 -0700 | [diff] [blame] | 35 | #include <linux/types.h> |
| 36 | #include <linux/rcupdate.h> |
| 37 | #include <linux/list.h> |
| 38 | |
Paul Moore | d15c345 | 2006-08-03 16:48:37 -0700 | [diff] [blame] | 39 | /* Domain hash table size */ |
| 40 | /* XXX - currently this number is an uneducated guess */ |
| 41 | #define NETLBL_DOMHSH_BITSIZE 7 |
| 42 | |
| 43 | /* Domain mapping definition struct */ |
| 44 | struct netlbl_dom_map { |
| 45 | char *domain; |
| 46 | u32 type; |
| 47 | union { |
| 48 | struct cipso_v4_doi *cipsov4; |
| 49 | } type_def; |
| 50 | |
| 51 | u32 valid; |
| 52 | struct list_head list; |
| 53 | struct rcu_head rcu; |
| 54 | }; |
| 55 | |
| 56 | /* init function */ |
| 57 | int netlbl_domhsh_init(u32 size); |
| 58 | |
| 59 | /* Manipulate the domain hash table */ |
| 60 | int netlbl_domhsh_add(struct netlbl_dom_map *entry); |
| 61 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry); |
| 62 | int netlbl_domhsh_remove_default(void); |
| 63 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); |
Paul Moore | fcd4828 | 2006-09-25 15:56:09 -0700 | [diff] [blame] | 64 | int netlbl_domhsh_walk(u32 *skip_bkt, |
| 65 | u32 *skip_chain, |
| 66 | int (*callback) (struct netlbl_dom_map *entry, void *arg), |
| 67 | void *cb_arg); |
Paul Moore | d15c345 | 2006-08-03 16:48:37 -0700 | [diff] [blame] | 68 | |
| 69 | #endif |