inj.h (7c478bd9) inj.h (7aec1d6e)
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 *

--- 6 unchanged lines hidden (view full) ---

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/*
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 *

--- 6 unchanged lines hidden (view full) ---

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 2004 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _INJ_H
28#define _INJ_H
29
30#pragma ident "%Z%%M% %I% %E% SMI"
31

--- 10 unchanged lines hidden (view full) ---

42
43#include <fm/fmd_log.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/*
24 * Use is subject to license terms.
25 */
26
27#ifndef _INJ_H
28#define _INJ_H
29
30#pragma ident "%Z%%M% %I% %E% SMI"
31

--- 10 unchanged lines hidden (view full) ---

42
43#include <fm/fmd_log.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/*
50 * The injector allows for the declaration, definition, and injection of three
51 * types of things - Events, FMRIs, and Authorities. While each has a different
52 * function within the FMA framework, their internal composition is similar
53 * enough to allow for the use of a single struct to represent all three. The
54 * inj_itemtype_t enum is used to describe which of the three types is being
55 * represented by a given object.
50 * The injector allows for the declaration, definition, and injection of four
51 * types of things - Events, FMRIs, Authorities, and lists. The first three
52 * are essentially lists with extra membership requirements (FMRIs, for
53 * example, must include a member called `scheme'). So while each has a
54 * different function within the FMA framework, we can use a single struct to
55 * store all three. The inj_itemtype_t enum is used to describe which of the
56 * four types is being represented by a given object.
56 */
57typedef enum inj_itemtype {
58 ITEMTYPE_EVENT,
59 ITEMTYPE_FMRI,
57 */
58typedef enum inj_itemtype {
59 ITEMTYPE_EVENT,
60 ITEMTYPE_FMRI,
60 ITEMTYPE_AUTH
61 ITEMTYPE_AUTH,
62 ITEMTYPE_LIST
61} inj_itemtype_t;
62
63} inj_itemtype_t;
64
65#define ITEMTYPE_NITEMS 4
66
63/*
64 * The member name-value pairs of Events, FMRIs, and Authorities are typed.
65 */
66typedef enum inj_memtype {
67 MEMTYPE_UNKNOWN,
68 MEMTYPE_INT8,
69 MEMTYPE_INT16,
70 MEMTYPE_INT32,
71 MEMTYPE_INT64,
72 MEMTYPE_UINT8,
73 MEMTYPE_UINT16,
74 MEMTYPE_UINT32,
75 MEMTYPE_UINT64,
76 MEMTYPE_BOOL,
77 MEMTYPE_STRING,
78 MEMTYPE_ENUM,
79 MEMTYPE_EVENT,
80 MEMTYPE_FMRI,
67/*
68 * The member name-value pairs of Events, FMRIs, and Authorities are typed.
69 */
70typedef enum inj_memtype {
71 MEMTYPE_UNKNOWN,
72 MEMTYPE_INT8,
73 MEMTYPE_INT16,
74 MEMTYPE_INT32,
75 MEMTYPE_INT64,
76 MEMTYPE_UINT8,
77 MEMTYPE_UINT16,
78 MEMTYPE_UINT32,
79 MEMTYPE_UINT64,
80 MEMTYPE_BOOL,
81 MEMTYPE_STRING,
82 MEMTYPE_ENUM,
83 MEMTYPE_EVENT,
84 MEMTYPE_FMRI,
81 MEMTYPE_AUTH
85 MEMTYPE_AUTH,
86 MEMTYPE_LIST
82} inj_memtype_t;
83
84/*
85 * Declarations
86 *
87 * Each declared item, be it an event, an fmri, or an authority, consists of
88 * an inj_decl_t and a string of inj_declmem_t's, one of the latter for each
89 * declared member.

--- 62 unchanged lines hidden (view full) ---

152typedef enum inj_defnmemtype {
153 DEFNMEM_IMM,
154 DEFNMEM_IDENT,
155 DEFNMEM_QSTRING,
156 DEFNMEM_EVENT,
157 DEFNMEM_FMRI,
158 DEFNMEM_AUTH,
159 DEFNMEM_ARRAY,
87} inj_memtype_t;
88
89/*
90 * Declarations
91 *
92 * Each declared item, be it an event, an fmri, or an authority, consists of
93 * an inj_decl_t and a string of inj_declmem_t's, one of the latter for each
94 * declared member.

--- 62 unchanged lines hidden (view full) ---

157typedef enum inj_defnmemtype {
158 DEFNMEM_IMM,
159 DEFNMEM_IDENT,
160 DEFNMEM_QSTRING,
161 DEFNMEM_EVENT,
162 DEFNMEM_FMRI,
163 DEFNMEM_AUTH,
164 DEFNMEM_ARRAY,
160 DEFNMEM_SUBLIST
165 DEFNMEM_LIST
161} inj_defnmemtype_t;
162
163typedef struct inj_defnmem {
164 inj_list_t dfm_memlist; /* List of defined members */
165
166 inj_defnmemtype_t dfm_type; /* Type of this member, from parser */
167 uint_t dfm_lineno; /* Last line of this member's defn */
168
169 union {
170 const char *_dfm_str; /* String value of member */
166} inj_defnmemtype_t;
167
168typedef struct inj_defnmem {
169 inj_list_t dfm_memlist; /* List of defined members */
170
171 inj_defnmemtype_t dfm_type; /* Type of this member, from parser */
172 uint_t dfm_lineno; /* Last line of this member's defn */
173
174 union {
175 const char *_dfm_str; /* String value of member */
171 inj_list_t _dfm_list; /* Enum, evt, auth, arr, sublist vals */
176 inj_list_t _dfm_list; /* Enum, evt, auth, arr, list vals */
172 } _dfm_u;
173} inj_defnmem_t;
174
175#define dfm_str _dfm_u._dfm_str
176#define dfm_list _dfm_u._dfm_list
177
178/*
179 * Operations performed by the injector (aside from declarations and

--- 66 unchanged lines hidden ---
177 } _dfm_u;
178} inj_defnmem_t;
179
180#define dfm_str _dfm_u._dfm_str
181#define dfm_list _dfm_u._dfm_list
182
183/*
184 * Operations performed by the injector (aside from declarations and

--- 66 unchanged lines hidden ---