2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#ifndef _PAYLOADREADER_H
2N/A#define _PAYLOADREADER_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#include "Parser.h"
2N/A
2N/A#define NORMAL_READ 0
2N/A#define ITER_THERE_ONLY 1
2N/A
2N/Astruct PayloadReader
2N/A{
2N/A // will send the data back in (data,dataLen)
2N/A static fru_errno_t readData(PathDef *path, Ancestor *curDef,
2N/A int instWICur,
2N/A uint8_t *payload, size_t payloadLen,
2N/A void **data, size_t *dataLen);
2N/A
2N/A // will update the data in payload which can then be written back.
2N/A static fru_errno_t updateData(PathDef *path, Ancestor *curDef,
2N/A int instWICur,
2N/A uint8_t *payload, size_t payloadLen,
2N/A void *data, size_t dataLen);
2N/A
2N/A // will return the nuber of iterations actually there.
2N/A static fru_errno_t findIterThere(PathDef *path, Ancestor *curDef,
2N/A int instWICur,
2N/A uint8_t *payload, size_t payloadLen,
2N/A int *numThere);
2N/A
2N/Aprivate:
2N/A static int getIterationOffset(uint8_t *iter, int iterLen,
2N/A PathDef *path, int *rcIterThere,
2N/A fru_errno_t *err,
2N/A int onlyFindingIterThereFlag);
2N/A static int calcOffset(int iterType,
2N/A uint8_t head, uint8_t tail,
2N/A uint8_t iterThere, uint8_t iterPoss,
2N/A size_t length, int index,
2N/A fru_errno_t *err);
2N/A
2N/A static fru_errno_t readRecurse(PathDef *path,
2N/A uint8_t *cur, size_t curLen,
2N/A void **data, size_t *dataLen,
2N/A int onlyFindingIterThereFlag);
2N/A
2N/A static fru_errno_t updateRecurse(PathDef *path,
2N/A uint8_t *cur, size_t curLen,
2N/A void *data, size_t dataLen);
2N/A
2N/A static int getOffsetIntoRecord(fru_regdef_t *recDef,
2N/A fru_regdef_t *elemDef);
2N/A
2N/A PayloadReader();
2N/A ~PayloadReader();
2N/A PayloadReader(const PayloadReader&);
2N/A void operator=(const PayloadReader&);
2N/A};
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _PAYLOADREADER_H */