xref: /titanic_51/usr/src/lib/libfru/include/libfrup.h (revision fd845fc0cb4fbc8e85f974e2e4eaacca1cc26e81)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2000-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_LIBFRUP_H
28 #define	_LIBFRUP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdarg.h>
37 
38 #include "libfru.h"
39 #include "../../libfruutils/fru_tag.h"
40 
41 typedef uint64_t fru_seghdl_t;
42 typedef enum {FRU_ENCRYPT, FRU_DECRYPT} fru_encrypt_t;
43 typedef fru_errno_t
44 (*fru_encrypt_func_t)(fru_encrypt_t en_dec, unsigned char *buf, size_t buf_len);
45 
46 /*
47  * Type for pointers to functions for terminating the processing of a node
48  * (after its children have been processed)
49  */
50 typedef void	(*end_node_fp_t)(fru_nodehdl_t node, const char *path,
51 					const char *name, void *args);
52 
53 /*
54  * Project-private exported symbols
55  */
56 fru_encrypt_func_t encrypt_func;
57 
58 fru_errno_t fru_encryption_supported(void);
59 
60 fru_errno_t
61 fru_walk_tree(fru_nodehdl_t node, const char *prior_path,
62 		fru_errno_t (*process_node)(fru_nodehdl_t node,
63 						const char *path,
64 						const char *name, void *args,
65 						end_node_fp_t *end_node,
66 						void **end_args),
67 		void *args);
68 
69 int fru_pathmatch(const char *path, const char *searchpath);
70 
71 fru_errno_t fru_for_each_segment(fru_nodehdl_t node,
72 					int (*function)(fru_seghdl_t segment,
73 						void *args),
74 					void *args);
75 fru_errno_t fru_get_segment_name(fru_seghdl_t segment, char **name);
76 fru_errno_t fru_for_each_packet(fru_seghdl_t segment,
77 				int (*function)(fru_tag_t *tag,
78 						uint8_t *payload,
79 						size_t length, void *args),
80 				void *args);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* _LIBFRUP_H */
87