4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * etm_etm_proto.h FMA ETM-to-ETM Protocol header
31 * const/type defns for protocol used between two event transport
35 #ifndef _ETM_ETM_PROTO_H
36 #define _ETM_ETM_PROTO_H
38 #pragma ident "%Z%%M% %I% %E% SMI"
45 * --------------------------------- includes --------------------------------
48 #include <sys/types.h>
51 * ------------------------ etm protocol all versions ------------------------
54 /* magic number for ETM protocol (start of msg hdr) */
56 #define ETM_PROTO_MAGIC_NUM (0xADB8A5A0)
58 /* protocol version numbers 1, 2, ... */
60 #define ETM_PROTO_V1 (1)
61 #define ETM_PROTO_V2 (2)
62 #define ETM_PROTO_V3 (3)
65 * Design_Note: Protocol V2 uses the same headers and constants as V1.
66 * The V1 and V2 protocols differ from each other only in the
67 * support of response messages for FMA event messages with
68 * non-NONE timeout fields. In V1 it is invalid to supply a
69 * timeout value that is non-NONE when sending an ETM message
70 * containing an FMA event; in V2 it is valid. In both V1 and
71 * V2 it is valid to supply a non-NONE timeout when sending an
72 * ETM control message. V1 is the initial bootup protocol version;
73 * from there version is negotiated upward.
77 * Design_Note: Protocol V3 introduces a new message type for
78 * syslog alerting. It uses the same protocols and preambles.
82 * Design_Note: Care should be taken for any future V4 protocol, particularly
83 * if the size of the protocol preamble shrinks vs the current
84 * size, so that if ETM is implemented to receive each message
85 * header as a whole, it won't pend indefinitely when sent a
90 * ------------------------ etm protocol versions 1,2 ----------------------
95 ETM_MSG_TYPE_TOO_LOW
= 0, /* range check place holder */
96 ETM_MSG_TYPE_FMA_EVENT
, /* pp_msg_type: FMA event */
97 ETM_MSG_TYPE_CONTROL
, /* pp_msg_type: ETM control */
98 ETM_MSG_TYPE_RESPONSE
, /* pp_msg_type: ETM response */
99 ETM_MSG_TYPE_ALERT
, /* pp_msg_type: Syslog alert */
100 ETM_MSG_TYPE_TOO_BIG
/* range check place holder */
102 } etm_proto_v3_msg_type_t
; /* 8-bit pp_msg_type ETM message types */
104 #define ETM_PROTO_V1_TIMEOUT_NONE ((uint32_t)(-1))
105 #define ETM_PROTO_V1_TIMEOUT_FOREVER ((uint32_t)(-2))
107 typedef struct etm_proto_v1_pp
{
109 uint32_t pp_magic_num
; /* magic number */
110 uint8_t pp_proto_ver
; /* version of ETM protocol */
111 uint8_t pp_msg_type
; /* type of ETM msg */
112 uint8_t pp_sub_type
; /* sub type within pp_msg_type */
113 uint8_t pp_rsvd_pad
; /* reserved/padding/alignment */
114 uint32_t pp_xid
; /* transaction id */
115 uint32_t pp_timeout
; /* timeout (in sec) for response */
117 } etm_proto_v1_pp_t
; /* protocol preamble for all v1 msg hdrs */
119 typedef struct etm_proto_v1_ev_hdr
{
121 etm_proto_v1_pp_t ev_pp
; /* protocol preamble */
122 uint32_t ev_lens
[1]; /* 0-termed lengths vector */
124 /* uint8_t ev_bodies[]; contig packed FMA events */
126 } etm_proto_v1_ev_hdr_t
; /* header for FMA_EVENT msgs */
129 * V3 addition: Syslog Alert. Uses the same protocol preamble as V1/V2
132 typedef struct etm_proto_v3_sa_hdr
{
134 etm_proto_v1_pp_t sa_pp
; /* protocol preamble */
135 uint32_t sa_priority
; /* priority for syslog */
136 uint32_t sa_len
; /* message string length */
138 /* uint8_t sa_message[]; contig message string */
140 } etm_proto_v3_sa_hdr_t
; /* header for ALERT msgs */
144 ETM_CTL_SEL_TOO_LOW
= 16, /* range check place holder */
145 ETM_CTL_SEL_PING_REQ
, /* ping request */
146 ETM_CTL_SEL_VER_NEGOT_REQ
, /* negotiate proto version request */
147 ETM_CTL_SEL_TOO_BIG
/* range check place holder */
149 } etm_proto_v1_ctl_sel_t
; /* 8-bit pp_sub_type control selectors */
151 typedef struct etm_proto_v1_ctl_hdr
{
153 etm_proto_v1_pp_t ctl_pp
; /* protocol preamble */
154 uint32_t ctl_len
; /* length of control body */
156 /* uint8_t ctl_body[]; contig accompanying control data */
158 } etm_proto_v1_ctl_hdr_t
; /* header for CONTROL msgs */
160 typedef struct etm_proto_v1_resp_hdr
{
162 etm_proto_v1_pp_t resp_pp
; /* protocol preamble */
163 int32_t resp_code
; /* -errno or success code */
164 uint32_t resp_len
; /* length of response body */
166 /* uint8_t resp_body[]; contig accompanying response data */
168 } etm_proto_v1_resp_hdr_t
;
171 * --------------------------------- prolog ----------------------------------
178 #endif /* _ETM_ETM_PROTO_H */