blob: 8ef0f76c7f4b07cbd3c5c0f1bd5928afb95cda6c [file] [log] [blame]
Andrew Jeffery9c766792022-08-10 23:12:49 +09301#ifndef PLATFORM_H
2#define PLATFORM_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include "base.h"
12#include "pdr.h"
13
14/* Maximum size for request */
15#define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19
16#define PLDM_GET_STATE_SENSOR_READINGS_REQ_BYTES 4
17#define PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES 2
18#define PLDM_GET_SENSOR_READING_REQ_BYTES 3
19#define PLDM_SET_EVENT_RECEIVER_REQ_BYTES 5
20/* Response lengths are inclusive of completion code */
21#define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1
22
23#define PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES 1
24#define PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES 4
25
26#define PLDM_GET_PDR_REQ_BYTES 13
27
28#define PLDM_SET_EVENT_RECEIVER_RESP_BYTES 1
29/* Minimum response length */
30#define PLDM_GET_PDR_MIN_RESP_BYTES 12
31#define PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES 5
32#define PLDM_GET_SENSOR_READING_MIN_RESP_BYTES 8
33#define PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES 2
34#define PLDM_GET_PDR_REPOSITORY_INFO_RESP_BYTES 41
35
36/* Minimum length for PLDM PlatformEventMessage request */
37#define PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES 3
38#define PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES 6
39#define PLDM_PLATFORM_EVENT_MESSAGE_RESP_BYTES 2
40#define PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION 1
41
42/* Minumum length of senson event data */
43#define PLDM_SENSOR_EVENT_DATA_MIN_LENGTH 5
44#define PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH 2
45#define PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH 3
46#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MIN_DATA_LENGTH 4
47#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH 7
48#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_8BIT_DATA_LENGTH 4
49#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH 5
50#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_32BIT_DATA_LENGTH 7
51
52/* Minimum length of data for pldmPDRRepositoryChgEvent */
53#define PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH 2
54#define PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH 2
55
56#define PLDM_INVALID_EFFECTER_ID 0xFFFF
57#define PLDM_TID_RESERVED 0xFF
58
59enum pldm_effecter_data_size {
60 PLDM_EFFECTER_DATA_SIZE_UINT8,
61 PLDM_EFFECTER_DATA_SIZE_SINT8,
62 PLDM_EFFECTER_DATA_SIZE_UINT16,
63 PLDM_EFFECTER_DATA_SIZE_SINT16,
64 PLDM_EFFECTER_DATA_SIZE_UINT32,
65 PLDM_EFFECTER_DATA_SIZE_SINT32
66};
67
68enum pldm_range_field_format {
69 PLDM_RANGE_FIELD_FORMAT_UINT8,
70 PLDM_RANGE_FIELD_FORMAT_SINT8,
71 PLDM_RANGE_FIELD_FORMAT_UINT16,
72 PLDM_RANGE_FIELD_FORMAT_SINT16,
73 PLDM_RANGE_FIELD_FORMAT_UINT32,
74 PLDM_RANGE_FIELD_FORMAT_SINT32,
75 PLDM_RANGE_FIELD_FORMAT_REAL32
76};
77
78enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 };
79
80enum effecter_state { PLDM_INVALID_VALUE = 0xFF };
81
82enum pldm_sensor_present_state {
83 PLDM_SENSOR_UNKNOWN = 0x0,
84 PLDM_SENSOR_NORMAL = 0x01,
85 PLDM_SENSOR_WARNING = 0x02,
86 PLDM_SENSOR_CRITICAL = 0x03,
87 PLDM_SENSOR_FATAL = 0x04,
88 PLDM_SENSOR_LOWERWARNING = 0x05,
89 PLDM_SENSOR_LOWERCRITICAL = 0x06,
90 PLDM_SENSOR_LOWERFATAL = 0x07,
91 PLDM_SENSOR_UPPERWARNING = 0x08,
92 PLDM_SENSOR_UPPERCRITICAL = 0x09,
93 PLDM_SENSOR_UPPERFATAL = 0x0a
94};
95
96enum pldm_sensor_event_message_enable {
97 PLDM_NO_EVENT_GENERATION,
98 PLDM_EVENTS_DISABLED,
99 PLDM_EVENTS_ENABLED,
100 PLDM_OP_EVENTS_ONLY_ENABLED,
101 PLDM_STATE_EVENTS_ONLY_ENABLED
102};
103
104enum pldm_effecter_oper_state {
105 EFFECTER_OPER_STATE_ENABLED_UPDATEPENDING,
106 EFFECTER_OPER_STATE_ENABLED_NOUPDATEPENDING,
107 EFFECTER_OPER_STATE_DISABLED,
108 EFFECTER_OPER_STATE_UNAVAILABLE,
109 EFFECTER_OPER_STATE_STATUSUNKNOWN,
110 EFFECTER_OPER_STATE_FAILED,
111 EFFECTER_OPER_STATE_INITIALIZING,
112 EFFECTER_OPER_STATE_SHUTTINGDOWN,
113 EFFECTER_OPER_STATE_INTEST
114};
115
116enum pldm_platform_commands {
117 PLDM_SET_EVENT_RECEIVER = 0x04,
118 PLDM_GET_SENSOR_READING = 0x11,
119 PLDM_GET_STATE_SENSOR_READINGS = 0x21,
120 PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31,
121 PLDM_GET_NUMERIC_EFFECTER_VALUE = 0x32,
122 PLDM_SET_STATE_EFFECTER_STATES = 0x39,
123 PLDM_GET_PDR_REPOSITORY_INFO = 0x50,
124 PLDM_GET_PDR = 0x51,
125 PLDM_PLATFORM_EVENT_MESSAGE = 0x0A
126};
127
128/** @brief PLDM PDR types
129 */
130enum pldm_pdr_types {
131 PLDM_TERMINUS_LOCATOR_PDR = 1,
132 PLDM_NUMERIC_SENSOR_PDR = 2,
133 PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR = 3,
134 PLDM_STATE_SENSOR_PDR = 4,
135 PLDM_STATE_SENSOR_INITIALIZATION_PDR = 5,
136 PLDM_SENSOR_AUXILIARY_NAMES_PDR = 6,
137 PLDM_OEM_UNIT_PDR = 7,
138 PLDM_OEM_STATE_SET_PDR = 8,
139 PLDM_NUMERIC_EFFECTER_PDR = 9,
140 PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR = 10,
141 PLDM_STATE_EFFECTER_PDR = 11,
142 PLDM_STATE_EFFECTER_INITIALIZATION_PDR = 12,
143 PLDM_EFFECTER_AUXILIARY_NAMES_PDR = 13,
144 PLDM_EFFECTER_OEM_SEMANTIC_PDR = 14,
145 PLDM_PDR_ENTITY_ASSOCIATION = 15,
146 PLDM_ENTITY_AUXILIARY_NAMES_PDR = 16,
147 PLDM_OEM_ENTITY_ID_PDR = 17,
148 PLDM_INTERRUPT_ASSOCIATION_PDR = 18,
149 PLDM_EVENT_LOG_PDR = 19,
150 PLDM_PDR_FRU_RECORD_SET = 20,
Thu Nguyen02476112022-11-02 09:52:54 +0700151 PLDM_COMPACT_NUMERIC_SENSOR_PDR = 21,
Andrew Jeffery9c766792022-08-10 23:12:49 +0930152 PLDM_OEM_DEVICE_PDR = 126,
153 PLDM_OEM_PDR = 127,
154};
155
156/** @brief PLDM effecter initialization schemes
157 */
158enum pldm_effecter_init {
159 PLDM_NO_INIT,
160 PLDM_USE_INIT_PDR,
161 PLDM_ENABLE_EFFECTER,
162 PLDM_DISABLE_EFECTER
163};
164
165/** @brief PLDM Platform M&C completion codes
166 */
167enum pldm_platform_completion_codes {
168 PLDM_PLATFORM_INVALID_SENSOR_ID = 0x80,
169 PLDM_PLATFORM_REARM_UNAVAILABLE_IN_PRESENT_STATE = 0x81,
170
171 PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80,
172 PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81,
173
174 PLDM_PLATFORM_INVALID_DATA_TRANSFER_HANDLE = 0x80,
175 PLDM_PLATFORM_INVALID_TRANSFER_OPERATION_FLAG = 0x81,
176 PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82,
177 PLDM_PLATFORM_INVALID_RECORD_CHANGE_NUMBER = 0x83,
178 PLDM_PLATFORM_TRANSFER_TIMEOUT = 0x84,
179
180 PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82,
181
182 PLDM_PLATFORM_INVALID_PROTOCOL_TYPE = 0x80,
183 PLDM_PLATFORM_ENABLE_METHOD_NOT_SUPPORTED = 0x81,
184 PLDM_PLATFORM_HEARTBEAT_FREQUENCY_TOO_HIGH = 0x82,
185};
186
187/** @brief PLDM Event types
188 */
189enum pldm_event_types {
190 PLDM_SENSOR_EVENT = 0x00,
191 PLDM_EFFECTER_EVENT = 0x01,
192 PLDM_REDFISH_TASK_EXECUTED_EVENT = 0x02,
193 PLDM_REDFISH_MESSAGE_EVENT = 0x03,
194 PLDM_PDR_REPOSITORY_CHG_EVENT = 0x04,
195 PLDM_MESSAGE_POLL_EVENT = 0x05,
196 PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT = 0x06
197};
198
199/** @brief PLDM sensorEventClass states
200 */
201enum sensor_event_class_states {
202 PLDM_SENSOR_OP_STATE,
203 PLDM_STATE_SENSOR_STATE,
204 PLDM_NUMERIC_SENSOR_STATE
205};
206
207/** @brief PLDM sensor supported states
208 */
209enum pldm_sensor_operational_state {
210 PLDM_SENSOR_ENABLED,
211 PLDM_SENSOR_DISABLED,
212 PLDM_SENSOR_UNAVAILABLE,
213 PLDM_SENSOR_STATUSUNKOWN,
214 PLDM_SENSOR_FAILED,
215 PLDM_SENSOR_INITIALIZING,
216 PLDM_SENSOR_SHUTTINGDOWN,
217 PLDM_SENSOR_INTEST
218};
219
220/** @brief PLDM pldmPDRRepositoryChgEvent class eventData format
221 */
222enum pldm_pdr_repository_chg_event_data_format {
223 REFRESH_ENTIRE_REPOSITORY,
224 FORMAT_IS_PDR_TYPES,
225 FORMAT_IS_PDR_HANDLES
226};
227
228/** @brief PLDM pldmPDRRepositoryChgEvent class changeRecord format
229 * eventDataOperation
230 */
231enum pldm_pdr_repository_chg_event_change_record_event_data_operation {
232 PLDM_REFRESH_ALL_RECORDS,
233 PLDM_RECORDS_DELETED,
234 PLDM_RECORDS_ADDED,
235 PLDM_RECORDS_MODIFIED
236};
237
238/** @brief PLDM NumericSensorStatePresentReading data type
239 */
240enum pldm_sensor_readings_data_type {
241 PLDM_SENSOR_DATA_SIZE_UINT8,
242 PLDM_SENSOR_DATA_SIZE_SINT8,
243 PLDM_SENSOR_DATA_SIZE_UINT16,
244 PLDM_SENSOR_DATA_SIZE_SINT16,
245 PLDM_SENSOR_DATA_SIZE_UINT32,
246 PLDM_SENSOR_DATA_SIZE_SINT32
247};
248
249/** @brief PLDM PlatformEventMessage response status
250 */
251enum pldm_platform_event_status {
252 PLDM_EVENT_NO_LOGGING = 0x00,
253 PLDM_EVENT_LOGGING_DISABLED = 0x01,
254 PLDM_EVENT_LOG_FULL = 0x02,
255 PLDM_EVENT_ACCEPTED_FOR_LOGGING = 0x03,
256 PLDM_EVENT_LOGGED = 0x04,
257 PLDM_EVENT_LOGGING_REJECTED = 0x05
258};
259
260/** @brief PLDM Terminus Locator PDR validity
261 */
262enum pldm_terminus_locator_pdr_validity {
263 PLDM_TL_PDR_NOT_VALID,
264 PLDM_TL_PDR_VALID
265};
266
267/** @brief PLDM Terminus Locator type
268 */
269enum pldm_terminus_locator_type {
270 PLDM_TERMINUS_LOCATOR_TYPE_UID,
271 PLDM_TERMINUS_LOCATOR_TYPE_MCTP_EID,
272 PLDM_TERMINUS_LOCATOR_TYPE_SMBUS_RELATIVE,
273 PLDM_TERMINUS_LOCATOR_TYPE_SYS_SW
274};
275
276/** @brief PLDM event message global enable for
277 * SetEventReceiver command
278 */
279enum pldm_event_message_global_enable {
280 PLDM_EVENT_MESSAGE_GLOBAL_DISABLE,
281 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC,
282 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_POLLING,
283 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC_KEEP_ALIVE
284};
285
Thu Nguyen02476112022-11-02 09:52:54 +0700286/** @brief PLDM DSP0248 1.2.1 table 74 sensorUnits enumeration
287 */
288enum pldm_sensor_units {
289 PLDM_SENSOR_UNIT_NONE = 0x00,
290 PLDM_SENSOR_UNIT_UNSPECIFIED,
291 PLDM_SENSOR_UNIT_DEGRESS_C,
292 PLDM_SENSOR_UNIT_DEGRESS_F,
293 PLDM_SENSOR_UNIT_KELVINS,
294 PLDM_SENSOR_UNIT_VOLTS,
295 PLDM_SENSOR_UNIT_AMPS,
296 PLDM_SENSOR_UNIT_WATTS,
297 PLDM_SENSOR_UNIT_JOULES,
298 PLDM_SENSOR_UNIT_COULOMBS,
299 PLDM_SENSOR_UNIT_VA,
300 PLDM_SENSOR_UNIT_NITS,
301 PLDM_SENSOR_UNIT_LUMENS,
302 PLDM_SENSOR_UNIT_LUX,
303 PLDM_SENSOR_UNIT_CANDELAS,
304 PLDM_SENSOR_UNIT_KPA,
305 PLDM_SENSOR_UNIT_PSI,
306 PLDM_SENSOR_UNIT_NEWTONS,
307 PLDM_SENSOR_UNIT_CFM,
308 PLDM_SENSOR_UNIT_RPM,
309 PLDM_SENSOR_UNIT_HERTZ,
310 PLDM_SENSOR_UNIT_SECONDS,
311 PLDM_SENSOR_UNIT_MINUTES,
312 PLDM_SENSOR_UNIT_HOURS,
313 PLDM_SENSOR_UNIT_DAYS,
314 PLDM_SENSOR_UNIT_WEEKS,
315 PLDM_SENSOR_UNIT_MILS,
316 PLDM_SENSOR_UNIT_INCHES,
317 PLDM_SENSOR_UNIT_FEET,
318 PLDM_SENSOR_UNIT_CUBIC_INCHES,
319 PLDM_SENSOR_UNIT_CUBIC_FEET,
320 PLDM_SENSOR_UNIT_METERS,
321 PLDM_SENSOR_UNIT_CUBIC_CENTERMETERS,
322 PLDM_SENSOR_UNIT_CUBIC_METERS,
323 PLDM_SENSOR_UNIT_LITERS,
324 PLDM_SENSOR_UNIT_FLUID_OUNCES,
325 PLDM_SENSOR_UNIT_RADIANS,
326 PLDM_SENSOR_UNIT_STERADIANS,
327 PLDM_SENSOR_UNIT_REVOLUTIONS,
328 PLDM_SENSOR_UNIT_CYCLES,
329 PLDM_SENSOR_UNIT_GRAVITIES,
330 PLDM_SENSOR_UNIT_OUNCES,
331 PLDM_SENSOR_UNIT_POUNDS,
332 PLDM_SENSOR_UNIT_FOOT_POUNDS,
333 PLDM_SENSOR_UNIT_OUNCE_INCHES,
334 PLDM_SENSOR_UNIT_GUESS,
335 PLDM_SENSOR_UNIT_GILBERTS,
336 PLDM_SENSOR_UNIT_HENRIES,
337 PLDM_SENSOR_UNIT_FARADS,
338 PLDM_SENSOR_UNIT_OHMS,
339 PLDM_SENSOR_UNIT_SIEMENS,
340 PLDM_SENSOR_UNIT_MOLES,
341 PLDM_SENSOR_UNIT_BECQUERELS,
342 PLDM_SENSOR_UNIT_PPM,
343 PLDM_SENSOR_UNIT_DECIBELS,
344 PLDM_SENSOR_UNIT_DBA,
345 PLDM_SENSOR_UNIT_DBC,
346 PLDM_SENSOR_UNIT_GRAYS,
347 PLDM_SENSOR_UNIT_SIEVERTS,
348 PLDM_SENSOR_UNIT_COLOR_TEMPERATURE_DEGRESS_K,
349 PLDM_SENSOR_UNIT_BITS,
350 PLDM_SENSOR_UNIT_BYTES,
351 PLDM_SENSOR_UNIT_WORDS,
352 PLDM_SENSOR_UNIT_DOUBLE_WORDS,
353 PLDM_SENSOR_UNIT_QUAD_WORDS,
354 PLDM_SENSOR_UNIT_PERCENTAGE,
355 PLDM_SENSOR_UNIT_PASCALS,
356 PLDM_SENSOR_UNIT_COUNTS,
357 PLDM_SENSOR_UNIT_GRAMS,
358 PLDM_SENSOR_UNIT_NEWTON_METERS,
359 PLDM_SENSOR_UNIT_HITS,
360 PLDM_SENSOR_UNIT_MISSES,
361 PLDM_SENSOR_UNIT_RETRIES,
362 PLDM_SENSOR_UNIT_OVERRUNS_OVERFLOWS,
363 PLDM_SENSOR_UNIT_UNDERRUNS,
364 PLDM_SENSOR_UNIT_COLLISIONS,
365 PLDM_SENSOR_UNIT_PACKETS,
366 PLDM_SENSOR_UNIT_MESSAGES,
367 PLDM_SENSOR_UNIT_CHARATERS,
368 PLDM_SENSOR_UNIT_ERRORS,
369 PLDM_SENSOR_UNIT_CORRECTED_ERRORS,
370 PLDM_SENSOR_UNIT_UNCORRECTABLE_ERRORS,
371 PLDM_SENSOR_UNIT_SQUARE_MILS,
372 PLDM_SENSOR_UNIT_SQUARE_INCHES,
373 PLDM_SENSOR_UNIT_SQUARE_FEET,
374 PLDM_SENSOR_UNIT_SQUARE_CENTIMETERS,
375 PLDM_SENSOR_UNIT_SQUARE_METERS,
376 PLDM_SENSOR_UNIT_OEMUNIT = 255
377};
378
379enum pldm_occurrence_rate {
380 PLDM_RATE_UNIT_NONE = 0x0,
381 PLDM_RATE_UNIT_PER_MICRO_SECOND,
382 PLDM_RATE_UNIT_PER_MILLI_SECOND,
383 PLDM_RATE_UNIT_PER_SECOND,
384 PLDM_RATE_UNIT_PER_MINUTE,
385 PLDM_RATE_UNIT_PER_HOUR
386};
387
Andrew Jeffery9c766792022-08-10 23:12:49 +0930388/** @brief PLDM respository state */
389enum pldm_repository_state {
390 PLDM_AVAILABLE,
391 PLDM_UPDATE_IN_PROGRESS,
392 PLDM_FAILED
393};
394
395/** @brief PLDM respository data transfer handler timeout */
396enum pldm_repository_data_transfer_handler_timeout {
397 PLDM_NO_TIMEOUT,
398 PLDM_DEFALUT_MINIMUM_TIMEOUT
399};
400
401/** @struct pldm_pdr_hdr
402 *
403 * Structure representing PLDM common PDR header
404 */
405struct pldm_pdr_hdr {
406 uint32_t record_handle;
407 uint8_t version;
408 uint8_t type;
409 uint16_t record_change_num;
410 uint16_t length;
411} __attribute__((packed));
412
413/** @struct pldm_terminus_locator_pdr
414 *
415 * Structure representing PLDM terminus locator PDR
416 */
417struct pldm_terminus_locator_pdr {
418 struct pldm_pdr_hdr hdr;
419 uint16_t terminus_handle;
420 uint8_t validity;
421 uint8_t tid;
422 uint16_t container_id;
423 uint8_t terminus_locator_type;
424 uint8_t terminus_locator_value_size;
425 uint8_t terminus_locator_value[1];
426} __attribute__((packed));
427
428/** @struct pldm_terminus_locator_type_mctp_eid
429 *
430 * Structure representing terminus locator value for
431 * terminus locator type MCTP_EID
432 */
433struct pldm_terminus_locator_type_mctp_eid {
434 uint8_t eid;
435} __attribute__((packed));
436
437/** @struct pldm_pdr_entity_association
438 *
439 * Structure representing PLDM Entity Association PDR
440 */
441struct pldm_pdr_entity_association {
442 uint16_t container_id;
443 uint8_t association_type;
444 pldm_entity container;
445 uint8_t num_children;
446 pldm_entity children[1];
447} __attribute__((packed));
448
449/** @struct pldm_pdr_fru_record_set
450 *
451 * Structure representing PLDM FRU record set PDR
452 */
453struct pldm_pdr_fru_record_set {
454 uint16_t terminus_handle;
455 uint16_t fru_rsi;
456 uint16_t entity_type;
457 uint16_t entity_instance_num;
458 uint16_t container_id;
459} __attribute__((packed));
460
461/** @struct pldm_state_sensor_pdr
462 *
463 * Structure representing PLDM state sensor PDR
464 */
465struct pldm_state_sensor_pdr {
466 struct pldm_pdr_hdr hdr;
467 uint16_t terminus_handle;
468 uint16_t sensor_id;
469 uint16_t entity_type;
470 uint16_t entity_instance;
471 uint16_t container_id;
472 uint8_t sensor_init;
473 bool8_t sensor_auxiliary_names_pdr;
474 uint8_t composite_sensor_count;
475 uint8_t possible_states[1];
476} __attribute__((packed));
477
478/** @struct state_sensor_possible_states
479 *
480 * Structure representing state enums for state sensor
481 */
482struct state_sensor_possible_states {
483 uint16_t state_set_id;
484 uint8_t possible_states_size;
485 bitfield8_t states[1];
486} __attribute__((packed));
487
488/** @struct pldm_state_effecter_pdr
489 *
490 * Structure representing PLDM state effecter PDR
491 */
492struct pldm_state_effecter_pdr {
493 struct pldm_pdr_hdr hdr;
494 uint16_t terminus_handle;
495 uint16_t effecter_id;
496 uint16_t entity_type;
497 uint16_t entity_instance;
498 uint16_t container_id;
499 uint16_t effecter_semantic_id;
500 uint8_t effecter_init;
501 bool8_t has_description_pdr;
502 uint8_t composite_effecter_count;
503 uint8_t possible_states[1];
504} __attribute__((packed));
505
Thu Nguyen02476112022-11-02 09:52:54 +0700506/** @struct pldm_compact_nummeric_sensor_pdr
507 *
508 * Structure representing PLDM compact nummeric sensor PDR
509 */
510struct pldm_compact_nummeric_sensor_pdr {
511 struct pldm_pdr_hdr hdr;
512 uint16_t terminus_handle;
513 uint16_t sensor_id;
514 uint16_t entity_type;
515 uint16_t entity_instance;
516 uint16_t container_id;
517 uint8_t sensor_name_length;
518 uint8_t base_unit;
519 int8_t unit_modifier;
520 uint8_t occurrence_rate;
521 bitfield8_t range_field_support;
522 int32_t warning_high;
523 int32_t warning_low;
524 int32_t critical_high;
525 int32_t critical_low;
526 int32_t fatal_high;
527 int32_t fatal_low;
528 uint8_t sensor_name[1];
529} __attribute__((packed));
530
Andrew Jeffery9c766792022-08-10 23:12:49 +0930531/** @brief Encode PLDM state sensor PDR
532 *
533 * @param[in/out] sensor Structure to encode. All members of
534 * sensor, except those mentioned in the @note below, should be initialized by
535 * the caller.
536 * @param[in] allocation_size Size of sensor allocation in bytes
537 * @param[in] possible_states Possible sensor states
538 * @param[in] possible_states_size Size of possible sensor states in bytes
539 * @param[out] actual_size Size of sensor PDR. Set to 0 on error.
540 * @return int pldm_completion_codes
541 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH
542 *
543 * @note The sensor parameter will be encoded in place.
544 * @note Caller is responsible for allocation of the sensor parameter. Caller
545 * must allocate enough space for the base structure and the
546 * sensor->possible_states array, otherwise the function will fail.
547 * @note sensor->hdr.length, .type, and .version will be set appropriately.
548 */
549int encode_state_sensor_pdr(
550 struct pldm_state_sensor_pdr *sensor, size_t allocation_size,
551 const struct state_sensor_possible_states *possible_states,
552 size_t possible_states_size, size_t *actual_size);
553
554/** @union union_effecter_data_size
555 *
556 * The bit width and format of reading and threshold values that the effecter
557 * returns.
558 * Refer to: DSP0248_1.2.0: 28.11 Table 87
559 */
560typedef union {
561 uint8_t value_u8;
562 int8_t value_s8;
563 uint16_t value_u16;
564 int16_t value_s16;
565 uint32_t value_u32;
566 int32_t value_s32;
567} union_effecter_data_size;
568
569/** @union union_range_field_format
570 *
571 * Indicates the format used for the nominalValue, normalMax, and normalMin
572 * fields.
573 * Refer to: DSP0248_1.2.0: 28.11 Table 87
574 */
575typedef union {
576 uint8_t value_u8;
577 int8_t value_s8;
578 uint16_t value_u16;
579 int16_t value_s16;
580 uint32_t value_u32;
581 int32_t value_s32;
582 real32_t value_f32;
583} union_range_field_format;
584
585/** @struct pldm_numeric_effecter_value_pdr
586 *
587 * Structure representing PLDM numeric effecter value PDR
588 */
589struct pldm_numeric_effecter_value_pdr {
590 struct pldm_pdr_hdr hdr;
591 uint16_t terminus_handle;
592 uint16_t effecter_id;
593 uint16_t entity_type;
594 uint16_t entity_instance;
595 uint16_t container_id;
596 uint16_t effecter_semantic_id;
597 uint8_t effecter_init;
598 bool8_t effecter_auxiliary_names;
599 uint8_t base_unit;
600 int8_t unit_modifier;
601 uint8_t rate_unit;
602 uint8_t base_oem_unit_handle;
603 uint8_t aux_unit;
604 int8_t aux_unit_modifier;
605 uint8_t aux_rate_unit;
606 uint8_t aux_oem_unit_handle;
607 bool8_t is_linear;
608 uint8_t effecter_data_size;
609 real32_t resolution;
610 real32_t offset;
611 uint16_t accuracy;
612 uint8_t plus_tolerance;
613 uint8_t minus_tolerance;
614 real32_t state_transition_interval;
615 real32_t transition_interval;
616 union_effecter_data_size max_settable;
617 union_effecter_data_size min_settable;
618 uint8_t range_field_format;
619 bitfield8_t range_field_support;
620 union_range_field_format nominal_value;
621 union_range_field_format normal_max;
622 union_range_field_format normal_min;
623 union_range_field_format rated_max;
624 union_range_field_format rated_min;
625} __attribute__((packed));
626
627/** @struct state_effecter_possible_states
628 *
629 * Structure representing state enums for state effecter
630 */
631struct state_effecter_possible_states {
632 uint16_t state_set_id;
633 uint8_t possible_states_size;
634 bitfield8_t states[1];
635} __attribute__((packed));
636
637/** @brief Encode PLDM state effecter PDR
638 *
639 * @param[in/out] effecter Structure to encode. All members of
640 * effecter, except those mentioned in
641 * the @note below, should be initialized
642 * by the caller.
643 * @param[in] allocation_size Size of effecter allocation in bytes
644 * @param[in] possible_states Possible effecter states
645 * @param[in] possible_states_size Size of possible effecter states in
646 * bytes
647 * @param[out] actual_size Size of effecter PDR. Set to 0 on
648 * error.
649 * @return int pldm_completion_codes
650 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH
651 *
652 * @note The effecter parameter will be encoded in place.
653 * @note Caller is responsible for allocation of the effecter parameter. Caller
654 * must allocate enough space for the base structure and the
655 * effecter->possible_states array, otherwise the function will fail.
656 * @note effecter->hdr.length, .type, and .version will be set appropriately.
657 */
658int encode_state_effecter_pdr(
659 struct pldm_state_effecter_pdr *effecter, size_t allocation_size,
660 const struct state_effecter_possible_states *possible_states,
661 size_t possible_states_size, size_t *actual_size);
662
663/** @struct set_effecter_state_field
664 *
665 * Structure representing a stateField in SetStateEffecterStates command */
666
667typedef struct state_field_for_state_effecter_set {
668 uint8_t set_request; //!< Whether to change the state
669 uint8_t effecter_state; //!< Expected state of the effecter
670} __attribute__((packed)) set_effecter_state_field;
671
672/** @struct get_sensor_readings_field
673 *
674 * Structure representing a stateField in GetStateSensorReadings command */
675
676typedef struct state_field_for_get_state_sensor_readings {
677 uint8_t sensor_op_state; //!< The state of the sensor itself
678 uint8_t present_state; //!< Return a state value
679 uint8_t previous_state; //!< The state that the presentState was entered
680 //! from. This must be different from the
681 //! present state
682 uint8_t event_state; //!< Return a state value from a PLDM State Set
683 //! that is associated with the sensor
684} __attribute__((packed)) get_sensor_state_field;
685
686/** @struct PLDM_SetStateEffecterStates_Request
687 *
688 * Structure representing PLDM set state effecter states request.
689 */
690struct pldm_set_state_effecter_states_req {
691 uint16_t effecter_id;
692 uint8_t comp_effecter_count;
693 set_effecter_state_field field[8];
694} __attribute__((packed));
695
696/** @struct pldm_get_pdr_repository_info_resp
697 *
698 * Structure representing GetPDRRepositoryInfo response packet
699 */
700struct pldm_pdr_repository_info_resp {
701 uint8_t completion_code;
702 uint8_t repository_state;
703 uint8_t update_time[PLDM_TIMESTAMP104_SIZE];
704 uint8_t oem_update_time[PLDM_TIMESTAMP104_SIZE];
705 uint32_t record_count;
706 uint32_t repository_size;
707 uint32_t largest_record_size;
708 uint8_t data_transfer_handle_timeout;
709} __attribute__((packed));
710
711/** @struct pldm_get_pdr_resp
712 *
713 * structure representing GetPDR response packet
714 * transfer CRC is not part of the structure and will be
715 * added at the end of last packet in multipart transfer
716 */
717struct pldm_get_pdr_resp {
718 uint8_t completion_code;
719 uint32_t next_record_handle;
720 uint32_t next_data_transfer_handle;
721 uint8_t transfer_flag;
722 uint16_t response_count;
723 uint8_t record_data[1];
724} __attribute__((packed));
725
726/** @struct pldm_get_pdr_req
727 *
728 * structure representing GetPDR request packet
729 */
730struct pldm_get_pdr_req {
731 uint32_t record_handle;
732 uint32_t data_transfer_handle;
733 uint8_t transfer_op_flag;
734 uint16_t request_count;
735 uint16_t record_change_number;
736} __attribute__((packed));
737
738/** @struct pldm_set_event_receiver_req
739 *
740 * Structure representing SetEventReceiver command.
741 * This structure applies only for MCTP as a transport type.
742 */
743struct pldm_set_event_receiver_req {
744 uint8_t event_message_global_enable;
745 uint8_t transport_protocol_type;
746 uint8_t event_receiver_address_info;
747 uint16_t heartbeat_timer;
748} __attribute__((packed));
749
750/** @struct pldm_set_numeric_effecter_value_req
751 *
752 * structure representing SetNumericEffecterValue request packet
753 */
754struct pldm_set_numeric_effecter_value_req {
755 uint16_t effecter_id;
756 uint8_t effecter_data_size;
757 uint8_t effecter_value[1];
758} __attribute__((packed));
759
760/** @struct pldm_get_state_sensor_readings_req
761 *
762 * Structure representing PLDM get state sensor readings request.
763 */
764struct pldm_get_state_sensor_readings_req {
765 uint16_t sensor_id;
766 bitfield8_t sensor_rearm;
767 uint8_t reserved;
768} __attribute__((packed));
769
770/** @struct pldm_get_state_sensor_readings_resp
771 *
772 * Structure representing PLDM get state sensor readings response.
773 */
774struct pldm_get_state_sensor_readings_resp {
775 uint8_t completion_code;
776 uint8_t comp_sensor_count;
777 get_sensor_state_field field[1];
778} __attribute__((packed));
779
780/** @struct pldm_sensor_event
781 *
782 * structure representing sensorEventClass
783 */
784struct pldm_sensor_event_data {
785 uint16_t sensor_id;
786 uint8_t sensor_event_class_type;
787 uint8_t event_class[1];
788} __attribute__((packed));
789
790/** @struct pldm_state_sensor_state
791 *
792 * structure representing sensorEventClass for stateSensorState
793 */
794struct pldm_sensor_event_state_sensor_state {
795 uint8_t sensor_offset;
796 uint8_t event_state;
797 uint8_t previous_event_state;
798} __attribute__((packed));
799
800/** @struct pldm_sensor_event_numeric_sensor_state
801 *
802 * structure representing sensorEventClass for stateSensorState
803 */
804struct pldm_sensor_event_numeric_sensor_state {
805 uint8_t event_state;
806 uint8_t previous_event_state;
807 uint8_t sensor_data_size;
808 uint8_t present_reading[1];
809} __attribute__((packed));
810
811/** @struct pldm_sensor_event_sensor_op_state
812 *
813 * structure representing sensorEventClass for SensorOpState
814 */
815struct pldm_sensor_event_sensor_op_state {
816 uint8_t present_op_state;
817 uint8_t previous_op_state;
818} __attribute__((packed));
819
820/** @struct pldm_platform_event_message_req
821 *
822 * structure representing PlatformEventMessage command request data
823 */
824struct pldm_platform_event_message_req {
825 uint8_t format_version;
826 uint8_t tid;
827 uint8_t event_class;
828 uint8_t event_data[1];
829} __attribute__((packed));
830
831/** @struct pldm_platform_event_message_response
832 *
833 * structure representing PlatformEventMessage command response data
834 */
835struct pldm_platform_event_message_resp {
836 uint8_t completion_code;
837 uint8_t platform_event_status;
838} __attribute__((packed));
839
840/** @struct pldm_pdr_repository_chg_event_data
841 *
842 * structure representing pldmPDRRepositoryChgEvent class eventData
843 */
844struct pldm_pdr_repository_chg_event_data {
845 uint8_t event_data_format;
846 uint8_t number_of_change_records;
847 uint8_t change_records[1];
848} __attribute__((packed));
849
850/** @struct pldm_pdr_repository_chg_event_change_record_data
851 *
852 * structure representing pldmPDRRepositoryChgEvent class eventData's change
853 * record data
854 */
855struct pldm_pdr_repository_change_record_data {
856 uint8_t event_data_operation;
857 uint8_t number_of_change_entries;
858 uint32_t change_entry[1];
859} __attribute__((packed));
860
861/** @struct pldm_get_numeric_effecter_value_req
862 *
863 * structure representing GetNumericEffecterValue request packet
864 */
865struct pldm_get_numeric_effecter_value_req {
866 uint16_t effecter_id;
867} __attribute__((packed));
868
869/** @struct pldm_get_numeric_effecter_value_resp
870 *
871 * structure representing GetNumericEffecterValue response packet
872 */
873struct pldm_get_numeric_effecter_value_resp {
874 uint8_t completion_code;
875 uint8_t effecter_data_size;
876 uint8_t effecter_oper_state;
877 uint8_t pending_and_present_values[1];
878} __attribute__((packed));
879
880/** @struct pldm_get_sensor_reading_req
881 *
882 * Structure representing PLDM get sensor reading request
883 */
884struct pldm_get_sensor_reading_req {
885 uint16_t sensor_id;
886 bool8_t rearm_event_state;
887} __attribute__((packed));
888
889/** @struct pldm_get_sensor_reading_resp
890 *
891 * Structure representing PLDM get sensor reading response
892 */
893struct pldm_get_sensor_reading_resp {
894 uint8_t completion_code;
895 uint8_t sensor_data_size;
896 uint8_t sensor_operational_state;
897 uint8_t sensor_event_message_enable;
898 uint8_t present_state;
899 uint8_t previous_state;
900 uint8_t event_state;
901 uint8_t present_reading[1];
902} __attribute__((packed));
903
904/* Responder */
905
906/* SetNumericEffecterValue */
907
908/** @brief Decode SetNumericEffecterValue request data
909 *
910 * @param[in] msg - Request message
911 * @param[in] payload_length - Length of request message payload
912 * @param[out] effecter_id - used to identify and access the effecter
913 * @param[out] effecter_data_size - The bit width and format of the setting
914 * value for the effecter.
915 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
916 * @param[out] effecter_value - The setting value of numeric effecter being
917 * requested.
918 * @return pldm_completion_codes
919 */
920int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg,
921 size_t payload_length,
922 uint16_t *effecter_id,
923 uint8_t *effecter_data_size,
924 uint8_t *effecter_value);
925
926/** @brief Create a PLDM response message for SetNumericEffecterValue
927 *
928 * @param[in] instance_id - Message's instance id
929 * @param[in] completion_code - PLDM completion code
930 * @param[out] msg - Message will be written to this
931 * @param[in] payload_length - Length of request message payload
932 * @return pldm_completion_codes
933 * @note Caller is responsible for memory alloc and dealloc of param
934 * 'msg.body.payload'
935 */
936int encode_set_numeric_effecter_value_resp(uint8_t instance_id,
937 uint8_t completion_code,
938 struct pldm_msg *msg,
939 size_t payload_length);
940
941/* SetStateEffecterStates */
942
943/** @brief Create a PLDM response message for SetStateEffecterStates
944 *
945 * @param[in] instance_id - Message's instance id
946 * @param[in] completion_code - PLDM completion code
947 * @param[out] msg - Message will be written to this
948 * @return pldm_completion_codes
949 * @note Caller is responsible for memory alloc and dealloc of param
950 * 'msg.body.payload'
951 */
952
953int encode_set_state_effecter_states_resp(uint8_t instance_id,
954 uint8_t completion_code,
955 struct pldm_msg *msg);
956
957/** @brief Decode SetStateEffecterStates request data
958 *
959 * @param[in] msg - Request message
960 * @param[in] payload_length - Length of request message payload
961 * @param[out] effecter_id - used to identify and access the effecter
962 * @param[out] comp_effecter_count - number of individual sets of effecter
963 * information. Upto eight sets of state effecter info can be accessed
964 * for a given effecter.
965 * @param[out] field - each unit is an instance of the stateFileld structure
966 * that is used to set the requested state for a particular effecter
967 * within the state effecter. This field holds the starting address of
968 * the stateField values. The user is responsible to allocate the
969 * memory prior to calling this command. Since the state field count is
970 * not known in advance, the user should allocate the maximum size
971 * always, which is 8 in number.
972 * @return pldm_completion_codes
973 */
974
975int decode_set_state_effecter_states_req(const struct pldm_msg *msg,
976 size_t payload_length,
977 uint16_t *effecter_id,
978 uint8_t *comp_effecter_count,
979 set_effecter_state_field *field);
980
981/* GetPDR */
982
983/** @brief Create a PLDM response message for GetPDR
984 *
985 * @param[in] instance_id - Message's instance id
986 * @param[in] completion_code - PLDM completion code
987 * @param[in] next_record_hndl - The recordHandle for the PDR that is next in
988 * the PDR Repository
989 * @param[in] next_data_transfer_hndl - A handle that identifies the next
990 * portion of the PDR data to be transferred, if any
991 * @param[in] transfer_flag - Indicates the portion of PDR data being
992 * transferred
993 * @param[in] resp_cnt - The number of recordData bytes returned in this
994 * response
995 * @param[in] record_data - PDR data bytes of length resp_cnt
996 * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only
997 * in the last part of a PDR being transferred
998 * @param[out] msg - Message will be written to this
999 * @return pldm_completion_codes
1000 * @note Caller is responsible for memory alloc and dealloc of param
1001 * 'msg.payload'
1002 */
1003int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code,
1004 uint32_t next_record_hndl,
1005 uint32_t next_data_transfer_hndl, uint8_t transfer_flag,
1006 uint16_t resp_cnt, const uint8_t *record_data,
1007 uint8_t transfer_crc, struct pldm_msg *msg);
1008
1009/** @brief Decode GetPDR request data
1010 *
1011 * @param[in] msg - Request message
1012 * @param[in] payload_length - Length of request message payload
1013 * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved
1014 * @param[out] data_transfer_hndl - Handle used to identify a particular
1015 * multipart PDR data transfer operation
1016 * @param[out] transfer_op_flag - Flag to indicate the first or subsequent
1017 * portion of transfer
1018 * @param[out] request_cnt - The maximum number of record bytes requested
1019 * @param[out] record_chg_num - Used to determine whether the PDR has changed
1020 * while PDR transfer is going on
1021 * @return pldm_completion_codes
1022 */
1023
1024int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length,
1025 uint32_t *record_hndl, uint32_t *data_transfer_hndl,
1026 uint8_t *transfer_op_flag, uint16_t *request_cnt,
1027 uint16_t *record_chg_num);
1028
1029/* GetStateSensorReadings */
1030
1031/** @brief Decode GetStateSensorReadings request data
1032 *
1033 * @param[in] msg - Request message
1034 * @param[in] payload_length - Length of request message payload
1035 * @param[out] sensor_id - used to identify and access the simple or composite
1036 * sensor
1037 * @param[out] sensor_rearm - Each bit location in this field corresponds to a
1038 * particular sensor within the state sensor, where bit [0] corresponds
1039 * to the first state sensor (sensor offset 0) and bit [7] corresponds
1040 * to the eighth sensor (sensor offset 7), sequentially.
1041 * @param[out] reserved - value: 0x00
1042 * @return pldm_completion_codes
1043 */
1044
1045int decode_get_state_sensor_readings_req(const struct pldm_msg *msg,
1046 size_t payload_length,
1047 uint16_t *sensor_id,
1048 bitfield8_t *sensor_rearm,
1049 uint8_t *reserved);
1050
1051/** @brief Encode GetStateSensorReadings response data
1052 *
1053 * @param[in] instance_id - Message's instance id
1054 * @param[in] completion_code - PLDM completion code
1055 * @param[out] comp_sensor_count - The number of individual sets of sensor
1056 * information that this command accesses
1057 * @param[out] field - Each stateField is an instance of a stateField structure
1058 * that is used to return the present operational state setting and the
1059 * present state and event state for a particular set of sensor
1060 * information contained within the state sensor
1061 * @param[out] msg - Message will be written to this
1062 * @return pldm_completion_codes
1063 */
1064
1065int encode_get_state_sensor_readings_resp(uint8_t instance_id,
1066 uint8_t completion_code,
1067 uint8_t comp_sensor_count,
1068 get_sensor_state_field *field,
1069 struct pldm_msg *msg);
1070
1071/* GetNumericEffecterValue */
1072
1073/** @brief Decode GetNumericEffecterValue request data
1074 *
1075 * @param[in] msg - Request message
1076 * @param[in] payload_length - Length of request message payload
1077 * @param[out] effecter_id - used to identify and access the effecter
1078 * @return pldm_completion_codes
1079 */
1080int decode_get_numeric_effecter_value_req(const struct pldm_msg *msg,
1081 size_t payload_length,
1082 uint16_t *effecter_id);
1083
1084/** @brief Create a PLDM response message for GetNumericEffecterValue
1085 *
1086 * @param[in] instance_id - Message's instance id
1087 * @param[in] completion_code - PLDM completion code
1088 * @param[in] effecter_data_size - The bit width and format of the setting
1089 * value for the effecter.
1090 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
1091 * @param[in] effecter_oper_state - The state of the effecter itself
1092 * @param[in] pending_value - The pending numeric value setting of the
1093 * effecter. The effecterDataSize field indicates the number of
1094 * bits used for this field
1095 * @param[in] present_value - The present numeric value setting of the
1096 * effecter. The effecterDataSize indicates the number of bits
1097 * used for this field
1098 * @param[out] msg - Message will be written to this
1099 * @param[in] payload_length - Length of request message payload
1100 * @return pldm_completion_codes
1101 * @note Caller is responsible for memory alloc and dealloc of param
1102 * 'msg.payload'
1103 */
1104int encode_get_numeric_effecter_value_resp(
1105 uint8_t instance_id, uint8_t completion_code, uint8_t effecter_data_size,
1106 uint8_t effecter_oper_state, uint8_t *pending_value, uint8_t *present_value,
1107 struct pldm_msg *msg, size_t payload_length);
1108
1109/* GetSensorReading */
1110
1111/** @brief Decode GetSensorReading request data
1112 *
1113 * @param[in] msg - Request message
1114 * @param[in] payload_length - Length of request message payload
1115 * @param[out] sensor_id - A handle that is used to identify and access
1116 * the sensor
1117 * @param[out] rearm_event_state - true = manually re-arm EventState after
1118 * responding to this request, false = no manual re-arm
1119 * @return pldm_completion_codes
1120 */
1121
1122int decode_get_sensor_reading_req(const struct pldm_msg *msg,
1123 size_t payload_length, uint16_t *sensor_id,
1124 bool8_t *rearm_event_state);
1125
1126/** @brief Encode GetSensorReading response data
1127 *
1128 * @param[in] instance_id - Message's instance id
1129 * @param[in] completion_code - PLDM completion code
1130 * @param[out] sensor_data_size - The bit width and format of reading and
1131 * threshold values
1132 * @param[out] sensor_operational_state - The state of the sensor itself
1133 * @param[out] sensor_event_message_enable - value: { noEventGeneration,
1134 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled,
1135 * stateEventsOnlyEnabled }
1136 * @param[out] present_state - The most recently assessed state value monitored
1137 * by the sensor
1138 * @param[out] previous_state - The state that the presentState was entered
1139 * from
1140 * @param[out] event_state - Indicates which threshold crossing assertion
1141 * events have been detected
1142 * @param[out] present_reading - The present value indicated by the sensor
1143 * @param[out] msg - Message will be written to this
1144 * @param[in] payload_length - Length of request message payload
1145 * @return pldm_completion_codes
1146 */
1147
1148int encode_get_sensor_reading_resp(
1149 uint8_t instance_id, uint8_t completion_code, uint8_t sensor_data_size,
1150 uint8_t sensor_operational_state, uint8_t sensor_event_message_enable,
1151 uint8_t present_state, uint8_t previous_state, uint8_t event_state,
1152 uint8_t *present_reading, struct pldm_msg *msg, size_t payload_length);
1153
1154/* Requester */
1155
1156/*GetPDRRepositoryInfo*/
1157
1158/** @brief Encode GetPDRRepositoryInfo response data
1159 *
1160 * @param[in] instance_id - Message's instance id
1161 * @param[in] completion_code - PLDM completion code
1162 * @param[in] repository_state - PLDM repository state
1163 * @param[in] update_time - When the standard PDR repository data was
1164 * originally created
1165 * @param[in] oem_update_time - when OEM PDRs in the PDR Repository were
1166 * originally created
1167 * @param[in] record_count - Total number of PDRs in this repository
1168 * @param[in] repository_size - Size of the PDR Repository in bytes
1169 * @param[in] largest_record_size - Size of the largest record in the PDR
1170 * Repository in bytes
1171 * @param[in] data_transfer_handle_timeout - Data transmission timeout
1172 * @param[out] msg - Message will be written to this
1173 * @return pldm_completion_codes
1174 */
1175int encode_get_pdr_repository_info_resp(
1176 uint8_t instance_id, uint8_t completion_code, uint8_t repository_state,
1177 const uint8_t *update_time, const uint8_t *oem_update_time,
1178 uint32_t record_count, uint32_t repository_size,
1179 uint32_t largest_record_size, uint8_t data_transfer_handle_timeout,
1180 struct pldm_msg *msg);
1181
1182/* GetPDR */
1183
1184/** @brief Create a PLDM request message for GetPDR
1185 *
1186 * @param[in] instance_id - Message's instance id
1187 * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved
1188 * @param[in] data_transfer_hndl - Handle used to identify a particular
1189 * multipart PDR data transfer operation
1190 * @param[in] transfer_op_flag - Flag to indicate the first or subsequent
1191 * portion of transfer
1192 * @param[in] request_cnt - The maximum number of record bytes requested
1193 * @param[in] record_chg_num - Used to determine whether the PDR has changed
1194 * while PDR transfer is going on
1195 * @param[out] msg - Message will be written to this
1196 * @param[in] payload_length - Length of request message payload
1197 * @return pldm_completion_codes
1198 * @note Caller is responsible for memory alloc and dealloc of param
1199 * 'msg.payload'
1200 */
1201int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl,
1202 uint32_t data_transfer_hndl, uint8_t transfer_op_flag,
1203 uint16_t request_cnt, uint16_t record_chg_num,
1204 struct pldm_msg *msg, size_t payload_length);
1205
1206/** @brief Decode GetPDR response data
1207 *
1208 * Note:
1209 * * If the return value is not PLDM_SUCCESS, it represents a
1210 * transport layer error.
1211 * * If the completion_code value is not PLDM_SUCCESS, it represents a
1212 * protocol layer error and all the out-parameters are invalid.
1213 *
1214 * @param[in] msg - Request message
1215 * @param[in] payload_length - Length of request message payload
1216 * @param[out] completion_code - PLDM completion code
1217 * @param[out] next_record_hndl - The recordHandle for the PDR that is next in
1218 * the PDR Repository
1219 * @param[out] next_data_transfer_hndl - A handle that identifies the next
1220 * portion of the PDR data to be transferred, if any
1221 * @param[out] transfer_flag - Indicates the portion of PDR data being
1222 * transferred
1223 * @param[out] resp_cnt - The number of recordData bytes returned in this
1224 * response
1225 * @param[out] record_data - PDR data bytes of length resp_cnt, or NULL to
1226 * skip the copy and place the actual length in resp_cnt.
1227 * @param[in] record_data_length - Length of record_data
1228 * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only
1229 * in the last part of a PDR being transferred
1230 * @return pldm_completion_codes
1231 */
1232int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length,
1233 uint8_t *completion_code, uint32_t *next_record_hndl,
1234 uint32_t *next_data_transfer_hndl,
1235 uint8_t *transfer_flag, uint16_t *resp_cnt,
1236 uint8_t *record_data, size_t record_data_length,
1237 uint8_t *transfer_crc);
1238
1239/* SetStateEffecterStates */
1240
1241/** @brief Create a PLDM request message for SetStateEffecterStates
1242 *
1243 * @param[in] instance_id - Message's instance id
1244 * @param[in] effecter_id - used to identify and access the effecter
1245 * @param[in] comp_effecter_count - number of individual sets of effecter
1246 * information. Upto eight sets of state effecter info can be accessed
1247 * for a given effecter.
1248 * @param[in] field - each unit is an instance of the stateField structure
1249 * that is used to set the requested state for a particular effecter
1250 * within the state effecter. This field holds the starting address of
1251 * the stateField values. The user is responsible to allocate the
1252 * memory prior to calling this command. The user has to allocate the
1253 * field parameter as sizeof(set_effecter_state_field) *
1254 * comp_effecter_count
1255 * @param[out] msg - Message will be written to this
1256 * @return pldm_completion_codes
1257 * @note Caller is responsible for memory alloc and dealloc of param
1258 * 'msg.payload'
1259 */
1260
1261int encode_set_state_effecter_states_req(uint8_t instance_id,
1262 uint16_t effecter_id,
1263 uint8_t comp_effecter_count,
1264 set_effecter_state_field *field,
1265 struct pldm_msg *msg);
1266
1267/** @brief Decode SetStateEffecterStates response data
1268 *
1269 * Note:
1270 * * If the return value is not PLDM_SUCCESS, it represents a
1271 * transport layer error.
1272 * * If the completion_code value is not PLDM_SUCCESS, it represents a
1273 * protocol layer error and all the out-parameters are invalid.
1274 *
1275 * @param[in] msg - Request message
1276 * @param[in] payload_length - Length of response message payload
1277 * @param[out] completion_code - PLDM completion code
1278 * @return pldm_completion_codes
1279 */
1280int decode_set_state_effecter_states_resp(const struct pldm_msg *msg,
1281 size_t payload_length,
1282 uint8_t *completion_code);
1283
1284/* SetNumericEffecterValue */
1285
1286/** @brief Create a PLDM request message for SetNumericEffecterValue
1287 *
1288 * @param[in] instance_id - Message's instance id
1289 * @param[in] effecter_id - used to identify and access the effecter
1290 * @param[in] effecter_data_size - The bit width and format of the setting
1291 * value for the effecter.
1292 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
1293 * @param[in] effecter_value - The setting value of numeric effecter being
1294 * requested.
1295 * @param[in] payload_length - Length of request message payload
1296 * @param[out] msg - Message will be written to this
1297 * @return pldm_completion_codes
1298 * @note Caller is responsible for memory alloc and dealloc of param
1299 * 'msg.payload'
1300 */
1301int encode_set_numeric_effecter_value_req(
1302 uint8_t instance_id, uint16_t effecter_id, uint8_t effecter_data_size,
1303 uint8_t *effecter_value, struct pldm_msg *msg, size_t payload_length);
1304
1305/** @brief Decode SetNumericEffecterValue response data
1306 * @param[in] msg - Request message
1307 * @param[in] payload_length - Length of response message payload
1308 * @param[out] completion_code - PLDM completion code
1309 * @return pldm_completion_codes
1310 */
1311int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg,
1312 size_t payload_length,
1313 uint8_t *completion_code);
1314
1315/** @brief Create a PLDM request message for GetStateSensorReadings
1316 *
1317 * @param[in] instance_id - Message's instance id
1318 * @param[in] sensor_id - used to identify and access the simple or composite
1319 * sensor
1320 * @param[in] sensorRearm - Each bit location in this field corresponds to a
1321 * particular sensor within the state sensor, where bit [0] corresponds
1322 * to the first state sensor (sensor offset 0) and bit [7] corresponds
1323 * to the eighth sensor (sensor offset 7), sequentially
1324 * @param[in] reserved - value: 0x00
1325 * @param[out] msg - Message will be written to this
1326 * @return pldm_completion_codes
1327 * @note Caller is responsible for memory alloc and dealloc of param
1328 * 'msg.payload'
1329 */
1330int encode_get_state_sensor_readings_req(uint8_t instance_id,
1331 uint16_t sensor_id,
1332 bitfield8_t sensor_rearm,
1333 uint8_t reserved,
1334 struct pldm_msg *msg);
1335
1336/** @brief Decode GetStateSensorReadings response data
1337 *
1338 * @param[in] msg - Request message
1339 * @param[in] payload_length - Length of response message payload
1340 * @param[out] completion_code - PLDM completion code
1341 * @param[in,out] comp_sensor_count - The number of individual sets of sensor
1342 * information that this command accesses
1343 * @param[out] field - Each stateField is an instance of a stateField structure
1344 * that is used to return the present operational state setting and the
1345 * present state and event state for a particular set of sensor
1346 * information contained within the state sensor
1347 * @return pldm_completion_codes
1348 */
1349
1350int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg,
1351 size_t payload_length,
1352 uint8_t *completion_code,
1353 uint8_t *comp_sensor_count,
1354 get_sensor_state_field *field);
1355
1356/* PlatformEventMessage */
1357
1358/** @brief Decode PlatformEventMessage request data
1359 * @param[in] msg - Request message
1360 * @param[in] payload_length - Length of response message payload
1361 * @param[out] format_version - Version of the event format
1362 * @param[out] tid - Terminus ID for the terminus that originated the event
1363 * message
1364 * @param[out] event_class - The class of event being sent
1365 * @param[out] event_data_offset - Offset where the event data should be read
1366 * from pldm msg
1367 * @return pldm_completion_codes
1368 */
1369int decode_platform_event_message_req(const struct pldm_msg *msg,
1370 size_t payload_length,
1371 uint8_t *format_version, uint8_t *tid,
1372 uint8_t *event_class,
1373 size_t *event_data_offset);
1374
1375/** @brief Encode PlatformEventMessage response data
1376 * @param[in] instance_id - Message's instance id
1377 * @param[in] completion_code - PLDM completion code
1378 * @param[in] platform_event_status - Response status of the event message
1379 * command
1380 * @param[out] msg - Message will be written to this
1381 * @return pldm_completion_codes
1382 * @note Caller is responsible for memory alloc and dealloc of param
1383 * 'msg.payload'
1384 */
1385int encode_platform_event_message_resp(uint8_t instance_id,
1386 uint8_t completion_code,
1387 uint8_t platform_event_status,
1388 struct pldm_msg *msg);
1389
1390/** @brief Encode PlatformEventMessage request data
1391 * @param[in] instance_id - Message's instance id
1392 * @param[in] format_version - Version of the event format
1393 * @param[in] tid - Terminus ID for the terminus that originated the event
1394 * message
1395 * @param[in] event_class - The class of event being sent
1396 * @param[in] event_data - the event data should be read from pldm msg
1397 * @param[in] event_data_length - Length of the event data
1398 * @param[out] msg - Request message
1399 * @return pldm_completion_codes
1400 * @note Caller is responsible for memory alloc and dealloc of param
1401 * 'msg.payload'
1402 */
1403int encode_platform_event_message_req(
1404 uint8_t instance_id, uint8_t format_version, uint8_t tid,
1405 uint8_t event_class, const uint8_t *event_data, size_t event_data_length,
1406 struct pldm_msg *msg, size_t payload_length);
1407
1408/** @brief Decode PlatformEventMessage response data
1409 * @param[in] msg - Request message
1410 * @param[in] payload_length - Length of Response message payload
1411 * @param[out] completion_code - PLDM completion code
1412 * @param[out] platform_event_status - Response status of the event message
1413 * command
1414 * @return pldm_completion_codes
1415 */
1416int decode_platform_event_message_resp(const struct pldm_msg *msg,
1417 size_t payload_length,
1418 uint8_t *completion_code,
1419 uint8_t *platform_event_status);
1420
1421/** @brief Decode sensorEventData response data
1422 *
1423 * @param[in] event_data - event data from the response message
1424 * @param[in] event_data_length - length of the event data
1425 * @param[out] sensor_id - sensorID value of the sensor
1426 * @param[out] sensor_event_class_type - Type of sensor event class
1427 * @param[out] event_class_data_offset - Offset where the event class data
1428 * should be read from event data
1429 * @return pldm_completion_codes
1430 * @note Caller is responsible for memory alloc and dealloc of param
1431 * 'event_data'
1432 */
1433int decode_sensor_event_data(const uint8_t *event_data,
1434 size_t event_data_length, uint16_t *sensor_id,
1435 uint8_t *sensor_event_class_type,
1436 size_t *event_class_data_offset);
1437
1438/** @brief Decode sensorOpState response data
1439 *
1440 * @param[in] sensor_data - sensor_data for sensorEventClass = sensorOpState
1441 * @param[in] sensor_data_length - Length of sensor_data
1442 * @param[out] present_op_state - The sensorOperationalState value from the
1443 * state change that triggered the event message
1444 * @param[out] previous_op_state - The sensorOperationalState value for the
1445 * state from which the present state was entered
1446 * @return pldm_completion_codes
1447 * @note Caller is responsible for memory alloc and dealloc of param
1448 * 'sensor_data'
1449 */
1450int decode_sensor_op_data(const uint8_t *sensor_data, size_t sensor_data_length,
1451 uint8_t *present_op_state,
1452 uint8_t *previous_op_state);
1453
1454/** @brief Decode stateSensorState response data
1455 *
1456 * @param[in] sensor_data - sensor_data for sensorEventClass = stateSensorState
1457 * @param[in] sensor_data_length - Length of sensor_data
1458 * @param[out] sensor_offset - Identifies which state sensor within a composite
1459 * state sensor the event is being returned for
1460 * @param[out] event_state - The event state value from the state change that
1461 * triggered the event message
1462 * @param[out] previous_event_state - The event state value for the state from
1463 * which the present event state was entered
1464 * @return pldm_completion_codes
1465 * @note Caller is responsible for memory alloc and dealloc of param
1466 * 'sensor_data'
1467 */
1468int decode_state_sensor_data(const uint8_t *sensor_data,
1469 size_t sensor_data_length, uint8_t *sensor_offset,
1470 uint8_t *event_state,
1471 uint8_t *previous_event_state);
1472
1473/** @brief Decode numericSensorState response data
1474 *
1475 * @param[in] sensor_data - sensor_data for sensorEventClass =
1476 * numericSensorState
1477 * @param[in] sensor_data_length - Length of sensor_data
1478 * @param[out] event_state - The eventState value from the state change that
1479 * triggered the event message
1480 * @param[out] previous_event_state - The eventState value for the state from
1481 * which the present state was entered
1482 * @param[out] sensor_data_size - The bit width and format of reading and
1483 * threshold values that the sensor returns
1484 * @param[out] present_reading - The present value indicated by the sensor
1485 * @return pldm_completion_codes
1486 * @note Caller is responsible for memory alloc and dealloc of param
1487 * 'sensor_data'
1488 */
1489int decode_numeric_sensor_data(const uint8_t *sensor_data,
1490 size_t sensor_data_length, uint8_t *event_state,
1491 uint8_t *previous_event_state,
1492 uint8_t *sensor_data_size,
1493 uint32_t *present_reading);
1494
1495/* GetNumericEffecterValue */
1496
1497/** @brief Create a PLDM request message for GetNumericEffecterValue
1498 *
1499 * @param[in] instance_id - Message's instance id
1500 * @param[in] effecter_id - used to identify and access the effecter
1501 * @param[out] msg - Message will be written to this
1502 * @return pldm_completion_codes
1503 * @note Caller is responsible for memory alloc and dealloc of param
1504 * 'msg.payload'
1505 */
1506int encode_get_numeric_effecter_value_req(uint8_t instance_id,
1507 uint16_t effecter_id,
1508 struct pldm_msg *msg);
1509
1510/** @brief Create a PLDM response message for GetNumericEffecterValue
1511 *
1512 * @param[in] msg - Request message
1513 * @param[in] payload_length - Length of request message payload
1514 * @param[out] completion_code - PLDM completion code
1515 * @param[out] effecter_data_size - The bit width and format of the setting
1516 * value for the effecter.
1517 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
1518 * @param[out] effecter_oper_state - The state of the effecter itself
1519 * @param[out] pending_value - The pending numeric value setting of the
1520 * effecter. The effecterDataSize field indicates the number of
1521 * bits used for this field
1522 * @param[out] present_value - The present numeric value setting of the
1523 * effecter. The effecterDataSize indicates the number of bits
1524 * used for this field
1525 * @return pldm_completion_codes
1526 */
1527int decode_get_numeric_effecter_value_resp(
1528 const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code,
1529 uint8_t *effecter_data_size, uint8_t *effecter_oper_state,
1530 uint8_t *pending_value, uint8_t *present_value);
1531
1532/** @brief Decode pldmPDRRepositoryChgEvent response data
1533 *
1534 * @param[in] event_data - eventData for pldmPDRRepositoryChgEvent
1535 * @param[in] event_data_size - Length of event_data
1536 * @param[out] event_data_format - This field indicates if the changedRecords
1537 * are of PDR Types or PDR Record Handles
1538 * @param[out] number_of_change_records - The number of changeRecords following
1539 * this field
1540 * @param[out] change_record_data_offset - Identifies where changeRecord data
1541 * is located within event_data
1542 * @return pldm_completion_codes
1543 * @note Caller is responsible for memory alloc and dealloc of param
1544 * 'event_data'
1545 */
1546int decode_pldm_pdr_repository_chg_event_data(
1547 const uint8_t *event_data, size_t event_data_size,
1548 uint8_t *event_data_format, uint8_t *number_of_change_records,
1549 size_t *change_record_data_offset);
1550
1551/** @brief Encode PLDM PDR Repository Change eventData
1552 * @param[in] event_data_format - Format of this event data (e.g.
1553 * FORMAT_IS_PDR_HANDLES)
1554 * @param[in] number_of_change_records - Number of changeRecords in this
1555 * eventData
1556 * @param[in] event_data_operations - Array of eventDataOperations
1557 * (e.g. RECORDS_ADDED) for each changeRecord in this eventData. This array
1558 * should contain number_of_change_records elements.
1559 * @param[in] numbers_of_change_entries - Array of numbers of changeEntrys
1560 * for each changeRecord in this eventData. This array should contain
1561 * number_of_change_records elements.
1562 * @param[in] change_entries - 2-dimensional array of arrays of changeEntrys,
1563 * one array per changeRecord in this eventData. The toplevel array should
1564 * contain number_of_change_records elements. Each subarray [i] should
1565 * contain numbers_of_change_entries[i] elements.
1566 * @param[in] event_data - The eventData will be encoded into this. This entire
1567 * structure must be max_change_records_size long. It must be large enough
1568 * to accomodate the data to be encoded. The caller is responsible for
1569 * allocating and deallocating it, including the variable-size
1570 * 'event_data.change_records' field. If this parameter is NULL,
1571 * PLDM_SUCCESS will be returned and actual_change_records_size will be set
1572 * to reflect the required size of the structure.
1573 * @param[out] actual_change_records_size - The actual number of meaningful
1574 * encoded bytes in event_data. The caller can over-allocate memory and use
1575 * this output to determine the real size of the structure.
1576 * @param[in] max_change_records_size - The size of event_data in bytes. If the
1577 * encoded message would be larger than this value, an error is returned.
1578 * @return pldm_completion_codes
1579 * @note Caller is responsible for memory alloc and dealloc of param
1580 * 'event_data.change_records'
1581 */
1582int encode_pldm_pdr_repository_chg_event_data(
1583 uint8_t event_data_format, uint8_t number_of_change_records,
1584 const uint8_t *event_data_operations,
1585 const uint8_t *numbers_of_change_entries,
1586 const uint32_t *const *change_entries,
1587 struct pldm_pdr_repository_chg_event_data *event_data,
1588 size_t *actual_change_records_size, size_t max_change_records_size);
1589
1590/** @brief Encode event data for a PLDM Sensor Event
1591 *
1592 * @param[out] event_data The object to store the encoded event in
1593 * @param[in] event_data_size Size of the allocation for event_data
1594 * @param[in] sensor_id Sensor ID
1595 * @param[in] sensor_event_class Sensor event class
1596 * @param[in] sensor_offset Offset
1597 * @param[in] event_state Event state
1598 * @param[in] previous_event_state Previous event state
1599 * @param[out] actual_event_data_size The real size in bytes of the event_data
1600 * @return int pldm_completion_codes PLDM_SUCCESS/PLDM_ERROR_INVALID_LENGTH
1601 * @note If event_data is NULL, then *actual_event_data_size will be set to
1602 * reflect the size of the event data, and PLDM_SUCCESS will be returned.
1603 * @note The caller is responsible for allocating and deallocating the
1604 * event_data
1605 */
1606int encode_sensor_event_data(struct pldm_sensor_event_data *event_data,
1607 size_t event_data_size, uint16_t sensor_id,
1608 enum sensor_event_class_states sensor_event_class,
1609 uint8_t sensor_offset, uint8_t event_state,
1610 uint8_t previous_event_state,
1611 size_t *actual_event_data_size);
1612
1613/** @brief Decode PldmPDRRepositoryChangeRecord response data
1614 *
1615 * @param[in] change_record_data - changeRecordData for
1616 * pldmPDRRepositoryChgEvent
1617 * @param[in] change_record_data_size - Length of change_record_data
1618 * @param[out] event_data_operation - This field indicates the changeEntries
1619 * operation types
1620 * @param[out] number_of_change_entries - The number of changeEntries following
1621 * this field
1622 * @param[out] change_entry_data_offset - Identifies where changeEntries data
1623 * is located within change_record_data
1624 * @return pldm_completion_codes
1625 * @note Caller is responsible for memory alloc and dealloc of param
1626 * 'change_record_data'
1627 */
1628int decode_pldm_pdr_repository_change_record_data(
1629 const uint8_t *change_record_data, size_t change_record_data_size,
1630 uint8_t *event_data_operation, uint8_t *number_of_change_entries,
1631 size_t *change_entry_data_offset);
1632
1633/* GetSensorReading */
1634
1635/** @brief Encode GetSensorReading request data
1636 *
1637 * @param[in] instance_id - Message's instance id
1638 * @param[in] sensor_id - A handle that is used to identify and access the
1639 * sensor
1640 * @param[in] rearm_event_state - true = manually re-arm EventState after
1641 * responding to this request, false = no manual re-arm
1642 * @param[out] msg - Message will be written to this
1643 * @return pldm_completion_codes
1644 * @note Caller is responsible for memory alloc and dealloc of param
1645 * 'msg.payload'
1646 */
1647int encode_get_sensor_reading_req(uint8_t instance_id, uint16_t sensor_id,
1648 bool8_t rearm_event_state,
1649 struct pldm_msg *msg);
1650
1651/** @brief Decode GetSensorReading response data
1652 *
1653 * @param[in] msg - Request message
1654 * @param[in] payload_length - Length of response message payload
1655 * @param[out] completion_code - PLDM completion code
1656 * @param[out] sensor_data_size - The bit width and format of reading and
1657 * threshold values
1658 * @param[out] sensor_operational_state - The state of the sensor itself
1659 * @param[out] sensor_event_message_enable - value: { noEventGeneration,
1660 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled,
1661 * stateEventsOnlyEnabled }
1662 * @param[out] present_state - The most recently assessed state value monitored
1663 * by the sensor
1664 * @param[out] previous_state - The state that the presentState was entered
1665 * from
1666 * @param[out] event_state - Indicates which threshold crossing assertion
1667 * events have been detected
1668 * @param[out] present_reading - The present value indicated by the sensor
1669 * @return pldm_completion_codes
1670 */
1671
1672int decode_get_sensor_reading_resp(
1673 const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code,
1674 uint8_t *sensor_data_size, uint8_t *sensor_operational_state,
1675 uint8_t *sensor_event_message_enable, uint8_t *present_state,
1676 uint8_t *previous_state, uint8_t *event_state, uint8_t *present_reading);
1677
1678/** @brief Encode the SetEventReceiver request message
1679 *
1680 * @param[in] instance_id - Message's instance id
1681 * @param[in] event_message_global_enable - This value is used to enable or
1682 * disable event message generation from the terminus value: {
1683 * disable, enableAsync, enablePolling, enableAsyncKeepAlive }
1684 * @param[in] transport_protocol_type - This value is provided in the request
1685 * to help the responder verify that the content of the
1686 * eventReceiverAddressInfo field used in this request is correct for
1687 * the messaging protocol supported by the terminus.
1688 * @param[in] event_receiver_address_info - this value is a medium and
1689 * protocol-specific address that the responder should use when
1690 * transmitting event messages using the indicated protocol
1691 * @param[in] heartbeat_timer - Amount of time in seconds after each elapsing
1692 * of which the terminus shall emit a heartbeat event to the receiver
1693 * @param[out] msg - Argument to capture the Message
1694 * @return pldm_completion_codes
1695 */
1696int encode_set_event_receiver_req(uint8_t instance_id,
1697 uint8_t event_message_global_enable,
1698 uint8_t transport_protocol_type,
1699 uint8_t event_receiver_address_info,
1700 uint16_t heartbeat_timer,
1701 struct pldm_msg *msg);
1702
1703/** @brief Decode the SetEventReceiver response message
1704 *
1705 * @param[in] msg - Request message
1706 * @param[in] payload_length - Length of response message payload
1707 * @param[out] completion_code - PLDM completion code
1708 * @return pldm_completion_codes
1709 */
1710int decode_set_event_receiver_resp(const struct pldm_msg *msg,
1711 size_t payload_length,
1712 uint8_t *completion_code);
1713
1714/** @brief Decode the SetEventReceiver request message
1715 *
1716 * @param[in] msg - Request message
1717 * @param[in] payload_length - Length of request message payload
1718 * @param[out] event_message_global_enable - This value is used to enable or
1719 * disable event message generation from the terminus value: {
1720 * disable, enableAsync, enablePolling, enableAsyncKeepAlive }
1721 * @param[out] transport_protocol_type - This value is provided in the request
1722 * to help the responder verify that the content of the
1723 * eventReceiverAddressInfo field used in this request is correct for
1724 * the messaging protocol supported by the terminus.
1725 * @param[out] event_receiver_address_info - This value is a medium and
1726 * protocol-specific address that the responder should use when
1727 * transmitting event messages using the indicated protocol
1728 * @param[out] heartbeat_timer - Amount of time in seconds after each elapsing
1729 * of which the terminus shall emit a heartbeat event to the receiver
1730 * @return pldm_completion_codes
1731 */
1732int decode_set_event_receiver_req(const struct pldm_msg *msg,
1733 size_t payload_length,
1734 uint8_t *event_message_global_enable,
1735 uint8_t *transport_protocol_type,
1736 uint8_t *event_receiver_address_info,
1737 uint16_t *heartbeat_timer);
1738
1739/** @brief Encode the SetEventReceiver response message
1740 *
1741 * @param[in] instance_id - Message's instance id
1742 * @param[in] completion_code - PLDM completion code
1743 * @param[out] msg - Argument to capture the Message
1744 * @return pldm_completion_codes
1745 */
1746int encode_set_event_receiver_resp(uint8_t instance_id, uint8_t completion_code,
1747 struct pldm_msg *msg);
1748
1749#ifdef __cplusplus
1750}
1751#endif
1752
1753#endif /* PLATFORM_H */