netlabel_domainhash.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  23. * the GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  28. *
  29. */
  30. #ifndef _NETLABEL_DOMAINHASH_H
  31. #define _NETLABEL_DOMAINHASH_H
  32. #include <linux/types.h>
  33. #include <linux/rcupdate.h>
  34. #include <linux/list.h>
  35. /* Domain hash table size */
  36. /* XXX - currently this number is an uneducated guess */
  37. #define NETLBL_DOMHSH_BITSIZE 7
  38. /* Domain mapping definition struct */
  39. struct netlbl_dom_map {
  40. char *domain;
  41. u32 type;
  42. union {
  43. struct cipso_v4_doi *cipsov4;
  44. } type_def;
  45. u32 valid;
  46. struct list_head list;
  47. struct rcu_head rcu;
  48. };
  49. /* init function */
  50. int netlbl_domhsh_init(u32 size);
  51. /* Manipulate the domain hash table */
  52. int netlbl_domhsh_add(struct netlbl_dom_map *entry,
  53. struct netlbl_audit *audit_info);
  54. int netlbl_domhsh_add_default(struct netlbl_dom_map *entry,
  55. struct netlbl_audit *audit_info);
  56. int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info);
  57. struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain);
  58. int netlbl_domhsh_walk(u32 *skip_bkt,
  59. u32 *skip_chain,
  60. int (*callback) (struct netlbl_dom_map *entry, void *arg),
  61. void *cb_arg);
  62. #endif