blob: 1837a994ffc44092d358d6ada4e0c47eaa26da93 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001#ifndef BAL_OBJ_MSG_PACK_UNPACK_H_
2#define BAL_OBJ_MSG_PACK_UNPACK_H_
3
4#include "bcmos_system.h"
5#include "bcmos_errno.h"
6#include "bal_model_types.h"
7#include "bal_model_funcs.h"
8
9
10bcmos_errno bcmbal_obj_msg_pack(bal_comm_msg_hdr *unpacked_bal_msg,/* unpacked msg */
11 bcmos_msg **packed_msg); /* packed message */
12
13bcmos_errno bcmbal_obj_msg_unpack(bcmos_msg *packed_msg, /* packed message */
14 bal_comm_msg_hdr **unpacked_bal_msg); /* the unpacked bal msg */
15
16/** Returns the instance number of a given message, as determined by the object key.
17 *
18 * \param msg The message to check.
19 * \return The instance number of the message.
20 */
21uint8_t bcmbal_obj_msg_instance(const bcmbal_obj *msg);
22
23/** Gets a mask of all readonly properties for an object's cfg group.
24 *
25 * \param obj The objecct to check.
26 * \param mask A mask of bits set to 1 per read-only property.
27 * \return An error code or BCM_ERR_OK for success.
28 */
29bcmos_errno bcmbal_get_prop_readonly_mask(bcmbal_obj_id obj, bcmbal_presence_mask *mask);
30
31/** Clones a message by packing it to a buffer then unpacking it into the destination message.
32 * This uses _bcmbal_obj_msg_unpack, so if *dest is NULL, memory will by allocated dynamically using bcmos_calloc.
33 *
34 * \param dest A pointer to the location in memory that will hold the cloned message.
35 * \param src The message that should be copied.
36 * \return An error code or BCM_ERR_OK for success.
37 */
38bcmos_errno bcmbal_obj_msg_clone(bal_comm_msg_hdr **dest, bal_comm_msg_hdr *src);
39
40/** Converts a generic group ID into a specific object type, group and subgroup.
41 *
42 * \param group_id The generic group ID.
43 * \param obj The object type that corresponds to the group ID.
44 * \param group The group type that corresponds to the group ID.
45 * \param subgroup The subgroup index that corresponds to the group ID.
46 * \return An error code or BCM_ERR_OK for success.
47 */
48bcmos_errno _bcmbal_obj_group_id_split(bcmbal_obj_group_id group_id, bcmbal_obj_id *obj, bcmbal_mgt_group *group, uint16_t *subgroup);
49
50
51#endif /* BAL_OBJ_MSG_PACK_UNPACK_H_ */