isns_pdu.h revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _ISNS_PDU_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _ISNS_PDU_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_RCV_TIMEOUT 5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_RCV_SHORT_TIMEOUT 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NEXT_TLV(OP, LEN) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((LEN) >= (8 + (OP)->attr_len)) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t *b1 = (uint8_t *)(OP); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LEN) -= (8 + (OP)->attr_len); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte b1 += (8 + (OP)->attr_len); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (OP) = (isns_tlv_t *)b1; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LEN) = 0; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (OP) = NULL; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesize_t isns_rcv_pdu(int, isns_pdu_t **, size_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint isns_send_pdu(int, isns_pdu_t *, size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pdu_reset_rsp(isns_pdu_t **, size_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pdu_reset_scn(isns_pdu_t **, size_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pdu_reset_esi(isns_pdu_t **, size_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pdu_update_code(isns_pdu_t *, size_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint pdu_add_tlv(isns_pdu_t **, size_t *, size_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t, uint32_t, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteisns_tlv_t *pdu_get_source(isns_pdu_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteisns_tlv_t *pdu_get_key(isns_pdu_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteisns_tlv_t *pdu_get_operand(isns_pdu_t *, size_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISNS_PDU_H */