objdb.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (c) 2006 MontaVista Software, Inc.
  3. * Copyright (c) 2007-2008 Red Hat, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Author: Steven Dake (sdake@redhat.com)
  8. *
  9. * This software licensed under BSD license, the text of which follows:
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * - Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. * THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. #ifndef OBJDB_H_DEFINED
  36. #define OBJDB_H_DEFINED
  37. #define OBJECT_PARENT_HANDLE 0
  38. #include <stdio.h>
  39. struct object_valid {
  40. char *object_name;
  41. int object_len;
  42. };
  43. struct object_key_valid {
  44. char *key_name;
  45. int key_len;
  46. int (*validate_callback) (void *key, int key_len, void *value, int value_len);
  47. };
  48. struct objdb_iface_ver0 {
  49. int (*objdb_init) (void);
  50. int (*object_create) (
  51. unsigned int parent_object_handle,
  52. unsigned int *object_handle,
  53. void *object_name,
  54. unsigned int object_name_len);
  55. int (*object_priv_set) (
  56. unsigned int object_handle,
  57. void *priv);
  58. int (*object_key_create) (
  59. unsigned int object_handle,
  60. void *key_name,
  61. int key_len,
  62. void *value,
  63. int value_len);
  64. int (*object_destroy) (
  65. unsigned int object_handle);
  66. int (*object_valid_set) (
  67. unsigned int object_handle,
  68. struct object_valid *object_valid_list,
  69. unsigned int object_valid_list_entries);
  70. int (*object_key_valid_set) (
  71. unsigned int object_handle,
  72. struct object_key_valid *object_key_valid_list,
  73. unsigned int object_key_valid_list_entries);
  74. int (*object_find_create) (
  75. unsigned int parent_object_handle,
  76. void *object_name,
  77. int object_name_len,
  78. unsigned int *object_find_handle);
  79. int (*object_find_next) (
  80. unsigned int object_find_handle,
  81. unsigned int *object_handle);
  82. int (*object_find_destroy) (
  83. unsigned int object_find_handle);
  84. int (*object_key_get) (
  85. unsigned int object_handle,
  86. void *key_name,
  87. int key_len,
  88. void **value,
  89. int *value_len);
  90. int (*object_priv_get) (
  91. unsigned int jobject_handle,
  92. void **priv);
  93. int (*object_key_replace) (
  94. unsigned int object_handle,
  95. void *key_name,
  96. int key_len,
  97. void *old_value,
  98. int old_value_len,
  99. void *new_value,
  100. int new_value_len);
  101. int (*object_key_delete) (
  102. unsigned int object_handle,
  103. void *key_name,
  104. int key_len,
  105. void *value,
  106. int value_len);
  107. int (*object_iter_reset) (
  108. unsigned int parent_object_handle);
  109. int (*object_iter) (
  110. unsigned int parent_object_handle,
  111. void **object_name,
  112. int *name_len,
  113. unsigned int *object_handle);
  114. int (*object_key_iter_reset) (
  115. unsigned int object_handle);
  116. int (*object_key_iter) (
  117. unsigned int parent_object_handle,
  118. void **key_name,
  119. int *key_len,
  120. void **value,
  121. int *value_len);
  122. int (*object_parent_get) (
  123. unsigned int object_handle,
  124. unsigned int *parent_handle);
  125. int (*object_dump) (
  126. unsigned int object_handle,
  127. FILE *file);
  128. int (*object_find_from) (
  129. unsigned int parent_object_handle,
  130. unsigned int start_pos,
  131. void *object_name,
  132. int object_name_len,
  133. unsigned int *object_handle,
  134. unsigned int *next_pos);
  135. int (*object_iter_from) (
  136. unsigned int parent_object_handle,
  137. unsigned int start_pos,
  138. void **object_name,
  139. int *name_len,
  140. unsigned int *object_handle);
  141. int (*object_key_iter_from) (
  142. unsigned int parent_object_handle,
  143. unsigned int start_pos,
  144. void **key_name,
  145. int *key_len,
  146. void **value,
  147. int *value_len);
  148. int (*object_write_config) (char **error_string);
  149. };
  150. #endif /* OBJDB_H_DEFINED */