8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libpcp / common / libpcp.h
blob3366ef1b503c6d31c0cf68a6272031a4200aa768
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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _LIBPCP_H
28 #define _LIBPCP_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #define PCPL_MAX_TRY_CNT 5
37 #define PCP_CLEANUP_TIMEOUT 3
39 #define PCPL_DEF_MTU_SZ 100
42 #define PCPL_IO_OP_READ (1)
43 #define PCPL_IO_OP_WRITE (2)
44 #define PCPL_IO_OP_PEEK (3)
47 * sleep (seconds) for glvc call failures before
48 * retrying.
50 #define PCPL_GLVC_SLEEP (5)
53 * Error codes for pcp library that are
54 * returned to users applications.
56 #define PCPL_OK 0
57 #define PCPL_ERROR (-1)
58 #define PCPL_INVALID_ARGS (-2)
59 #define PCPL_GLVC_ERROR (-3)
60 #define PCPL_XPORT_ERROR (-4)
61 #define PCPL_MALLOC_FAIL (-5)
62 #define PCPL_GLVC_TIMEOUT (-6)
63 #define PCPL_FRAME_ERROR (-7)
64 #define PCPL_CKSUM_ERROR (-8)
65 #define PCPL_PROT_ERROR (-9)
67 /* common defines */
68 #ifndef MIN
69 #define MIN(x, y) ((x) < (y) ? (x) : (y))
70 #endif
71 #ifndef MAX
72 #define MAX(x, y) ((x) > (y) ? (x) : (y))
73 #endif
74 #ifndef ABS
75 #define ABS(x) ((x) < (0) ? (-(x)) : (x))
76 #endif
79 * PCP user apps message format
81 typedef struct pcp_msg {
82 uint8_t msg_type;
83 uint8_t sub_type;
84 uint16_t rsvd_pad;
85 uint32_t msg_len;
86 void *msg_data;
87 } pcp_msg_t;
89 int pcp_init(char *channel_name);
90 int pcp_send_recv(int channel_fd, pcp_msg_t *req_msg, pcp_msg_t *resp_msg,
91 uint32_t timeout);
92 int pcp_close(int channel_fd);
94 #ifdef __cplusplus
96 #endif
98 #endif /* _LIBPCP_H */