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 2005 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _LIBPCP_H
2N/A#define _LIBPCP_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#define PCPL_MAX_TRY_CNT 5
2N/A#define PCP_CLEANUP_TIMEOUT 3
2N/A
2N/A#define PCPL_DEF_MTU_SZ 100
2N/A
2N/A
2N/A#define PCPL_IO_OP_READ (1)
2N/A#define PCPL_IO_OP_WRITE (2)
2N/A#define PCPL_IO_OP_PEEK (3)
2N/A
2N/A/*
2N/A * sleep (seconds) for glvc call failures before
2N/A * retrying.
2N/A */
2N/A#define PCPL_GLVC_SLEEP (5)
2N/A
2N/A/*
2N/A * Error codes for pcp library that are
2N/A * returned to users applications.
2N/A */
2N/A#define PCPL_OK 0
2N/A#define PCPL_ERROR (-1)
2N/A#define PCPL_INVALID_ARGS (-2)
2N/A#define PCPL_GLVC_ERROR (-3)
2N/A#define PCPL_XPORT_ERROR (-4)
2N/A#define PCPL_MALLOC_FAIL (-5)
2N/A#define PCPL_GLVC_TIMEOUT (-6)
2N/A#define PCPL_FRAME_ERROR (-7)
2N/A#define PCPL_CKSUM_ERROR (-8)
2N/A#define PCPL_PROT_ERROR (-9)
2N/A
2N/A/* common defines */
2N/A#ifndef MIN
2N/A#define MIN(x, y) ((x) < (y) ? (x) : (y))
2N/A#endif
2N/A#ifndef MAX
2N/A#define MAX(x, y) ((x) > (y) ? (x) : (y))
2N/A#endif
2N/A#ifndef ABS
2N/A#define ABS(x) ((x) < (0) ? (-(x)) : (x))
2N/A#endif
2N/A
2N/A/*
2N/A * PCP user apps message format
2N/A */
2N/Atypedef struct pcp_msg {
2N/A uint8_t msg_type;
2N/A uint8_t sub_type;
2N/A uint16_t rsvd_pad;
2N/A uint32_t msg_len;
2N/A void *msg_data;
2N/A} pcp_msg_t;
2N/A
2N/Aint pcp_init(char *channel_name);
2N/Aint pcp_send_recv(int channel_fd, pcp_msg_t *req_msg, pcp_msg_t *resp_msg,
2N/A uint32_t timeout);
2N/Aint pcp_close(int channel_fd);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBPCP_H */