1 /*	$Id: module_db_mi.h 20800 2012-01-19 05:13:45Z m-oki $	*/
2 
3 /*
4  * Copyright (c) 2012, Internet Initiative Japan, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef _MODULE_DB_MI_H__
31 #define _MODULE_DB_MI_H__
32 
33 struct module_cb_tbl {
34 	int (*get_module_cb)(const char *, void *);
35 	int (*purge_module_cb)(uint32_t, const char *, void *);
36 	void *udata;
37 };
38 typedef struct module_cb_tbl module_cb_tbl_t;
39 
40 int init_module_cb(module_cb_tbl_t *);
41 
42 /*
43  * DB operation
44  */
45 int add_module(int, const char *, const char *);
46 int sync_module(void);
47 int purge_all_modules(void);
48 
49 char *lookup_module_ver(uint32_t);
50 char *lookup_module_location(uint32_t);
51 
52 int arms_count_module(void);
53 int arms_get_module_id(uint32_t *, int);
54 
55 /* XML utility functions */
56 uint32_t get_module_id(AXP *, int);
57 uint32_t get_module_order(AXP *, int);
58 const char *get_module_ver(AXP *, int);
59 
60 int arms_dump_module(char *, int);
61 int arms_module_is_added(int32_t id);
62 int arms_module_is_exist(int32_t id);
63 
64 #endif /* _MODULE_DB_MI_H__ */
65