lib: remove unused libnvfru
[unleashed.git] / usr / src / lib / libfru / libfru / PayloadReader.h
blob510cf25d2ffdb9dc4adbb8e6e2829c7cdc52916f
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _PAYLOADREADER_H
28 #define _PAYLOADREADER_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifdef __cplusplus
38 #endif
40 #include "Parser.h"
42 #define NORMAL_READ 0
43 #define ITER_THERE_ONLY 1
45 struct PayloadReader
47 // will send the data back in (data,dataLen)
48 static fru_errno_t readData(PathDef *path, Ancestor *curDef,
49 int instWICur,
50 uint8_t *payload, size_t payloadLen,
51 void **data, size_t *dataLen);
53 // will update the data in payload which can then be written back.
54 static fru_errno_t updateData(PathDef *path, Ancestor *curDef,
55 int instWICur,
56 uint8_t *payload, size_t payloadLen,
57 void *data, size_t dataLen);
59 // will return the nuber of iterations actually there.
60 static fru_errno_t findIterThere(PathDef *path, Ancestor *curDef,
61 int instWICur,
62 uint8_t *payload, size_t payloadLen,
63 int *numThere);
65 private:
66 static int getIterationOffset(uint8_t *iter, int iterLen,
67 PathDef *path, int *rcIterThere,
68 fru_errno_t *err,
69 int onlyFindingIterThereFlag);
70 static int calcOffset(int iterType,
71 uint8_t head, uint8_t tail,
72 uint8_t iterThere, uint8_t iterPoss,
73 size_t length, int index,
74 fru_errno_t *err);
76 static fru_errno_t readRecurse(PathDef *path,
77 uint8_t *cur, size_t curLen,
78 void **data, size_t *dataLen,
79 int onlyFindingIterThereFlag);
81 static fru_errno_t updateRecurse(PathDef *path,
82 uint8_t *cur, size_t curLen,
83 void *data, size_t dataLen);
85 static int getOffsetIntoRecord(fru_regdef_t *recDef,
86 fru_regdef_t *elemDef);
88 PayloadReader();
89 ~PayloadReader();
90 PayloadReader(const PayloadReader&);
91 void operator=(const PayloadReader&);
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
98 #ifdef __cplusplus
100 #endif
102 #endif /* _PAYLOADREADER_H */