ONLP
Open Network Linux Platform APIs
|
Data Structures | |
struct | onlp_oid_hdr_s |
Macros | |
#define | ONLP_OID_TYPE_GET(_id) ( ( (_id) >> 24) ) |
#define | ONLP_OID_TYPE_CREATE(_type, _id) ( ( (_type) << 24) | (_id)) |
#define | ONLP_OID_IS_TYPE(_type, _id) (ONLP_OID_TYPE_GET((_id)) == _type) |
#define | ONLP_OID_ID_GET(_id) (_id & 0xFFFFFF) |
#define | ONLP_OID_TYPE_VALIDATE(_type, _oid) |
#define | ONLP_OID_TYPE_VALIDATE_NR(_type, _oid) |
#define | ONLP_OID_TYPE_VALIDATE_GET_ID(_type, _oid, _id) |
#define | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(_type, _oid, _id) |
#define | ONLP_OID_IS_TYPE_FLAGS(_flags, _id) ((_flags & (1 << ONLP_OID_TYPE_GET(_id)))) |
#define | ONLP_OID_IS_TYPE_FLAGSZ(_flags, _id) ((_flags == 0) || ONLP_OID_IS_TYPE_FLAGS(_flags, _id)) |
#define | ONLP_CHASSIS_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_CHASSIS, _id) |
#define | ONLP_THERMAL_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_THERMAL, _id) |
#define | ONLP_FAN_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_FAN, _id) |
#define | ONLP_PSU_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_PSU, _id) |
#define | ONLP_LED_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_LED, _id) |
#define | ONLP_SFP_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_SFP, _id) |
#define | ONLP_MODULE_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_MODULE, _id) |
#define | ONLP_GENERIC_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_GENERIC, _id) |
#define | ONLP_OID_IS_CHASSIS(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_CHASSIS, _id) |
#define | ONLP_OID_CHASSIS_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_CHASSIS, _id) |
#define | ONLP_OID_CHASSIS_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_CHASSIS, _id) |
#define | ONLP_OID_IS_THERMAL(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_THERMAL, _id) |
#define | ONLP_OID_THERMAL_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_THERMAL, _id) |
#define | ONLP_OID_THERMAL_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_THERMAL, _id) |
#define | ONLP_OID_THERMAL_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_THERMAL, _oid, _id) |
#define | ONLP_OID_THERMAL_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_THERMAL, _oid, _id) |
#define | ONLP_OID_IS_FAN(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_FAN, _id) |
#define | ONLP_OID_FAN_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_FAN, _id) |
#define | ONLP_OID_FAN_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_FAN, _id) |
#define | ONLP_OID_FAN_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_FAN, _oid, _id) |
#define | ONLP_OID_FAN_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_FAN, _oid, _id) |
#define | ONLP_OID_IS_PSU(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_PSU, _id) |
#define | ONLP_OID_PSU_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_PSU, _id) |
#define | ONLP_OID_PSU_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_PSU, _id) |
#define | ONLP_OID_PSU_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_PSU, _oid, _id) |
#define | ONLP_OID_PSU_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_PSU, _oid, _id) |
#define | ONLP_OID_IS_LED(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_LED, _id) |
#define | ONLP_OID_LED_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_LED, _id) |
#define | ONLP_OID_LED_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_LED, _id) |
#define | ONLP_OID_LED_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_LED, _oid, _id) |
#define | ONLP_OID_LED_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_LED, _oid, _id) |
#define | ONLP_OID_IS_SFP(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_SFP, _id) |
#define | ONLP_OID_SFP_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_SFP, _id) |
#define | ONLP_OID_SFP_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_SFP, _id) |
#define | ONLP_OID_SFP_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_SFP, _oid, _id) |
#define | ONLP_OID_SFP_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_SFP, _oid, _id) |
#define | ONLP_OID_IS_MODULE(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_MODULE, _id) |
#define | ONLP_OID_MODULE_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_MODULE, _id) |
#define | ONLP_OID_MODULE_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_MODULE, _id) |
#define | ONLP_OID_MODULE_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_MODULE, _oid, _id) |
#define | ONLP_OID_MODULE_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_MODULE, _oid, _id) |
#define | ONLP_OID_IS_GENERIC(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_GENERIC, _id) |
#define | ONLP_OID_GENERIC_VALIDATE(_id) ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_GENERIC, _id) |
#define | ONLP_OID_GENERIC_VALIDATE_NR(_id) ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_GENERIC, _id) |
#define | ONLP_OID_GENERIC_VALIDATE_GET_ID(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_GENERIC, _oid, _id) |
#define | ONLP_OID_GENERIC_VALIDATE_GET_ID_NR(_oid, _id) ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_GENERIC, _oid, _id) |
#define | ONLP_OID_ID_VALIDATE_RANGE(_id, _min, _max) ( (_id) >= (_min) && (_id) <= (_max)) ? ONLP_STATUS_OK : ONLP_STATUS_E_INVALID |
#define | ONLP_OID_CHASSIS ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_CHASSIS, 1) |
#define | ONLP_OID_DESC_SIZE 128 |
#define | ONLP_OID_TABLE_SIZE 256 |
#define | ONLP_OID_TABLE_SIZE_BYTES (sizeof(onlp_oid_t)*ONLP_OID_TABLE_SIZE) |
#define | ONLP_OID_TABLE_COPY(_dst, _src) memcpy(_dst, _src, ONLP_OID_TABLE_SIZE_BYTES) |
#define | ONLP_OID_TABLE_CLEAR(_table) memset(_table, 0, ONLP_OID_TABLE_SIZE_BYTES) |
#define | ONLP_OID_THERMAL_ENTRY(_id, _desc, _parent_type, _parent_id) { ONLP_THERMAL_ID_CREATE(_id), _desc, ONLP_OID_TYPE_CREATE(_parent_type, _parent_id) } |
#define | ONLP_OID_STATUS_FLAGS_GET(_ptr) (((onlp_oid_hdr_t*)_ptr)->status) |
#define | ONLP_OID_STATUS_FLAGS_CLR(_ptr) ONLP_OID_STATUS_FLAGS_GET(_ptr) = 0 |
#define | ONLP_OID_STATUS_FLAG_GET_VALUE(_ptr, _name) AIM_FLAG_GET_VALUE(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
#define | ONLP_OID_STATUS_FLAG_SET_VALUE(_ptr, _name, _value) AIM_FLAG_SET_VALUE(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name, _value) |
#define | ONLP_OID_STATUS_FLAG_SET(_ptr, _name) AIM_FLAG_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
#define | ONLP_OID_STATUS_FLAG_CLR(_ptr, _name) AIM_FLAG_CLR(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
#define | ONLP_OID_STATUS_FLAG_IS_SET(_ptr, _name) AIM_FLAG_IS_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
#define | ONLP_OID_STATUS_FLAG_NOT_SET(_ptr, _name) AIM_FLAG_NOT_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
#define | ONLP_OID_PRESENT(_ptr) ONLP_OID_STATUS_FLAG_IS_SET(_ptr, PRESENT) |
#define | ONLP_OID_FAILED(_ptr) ONLP_OID_STATUS_FLAG_IS_SET(_ptr, FAILED) |
#define | ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, _expr) |
Iterate over all OIDS in the given table that match the given expression. More... | |
#define | ONLP_OID_TABLE_ITER(_table, _oidp) ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, 1) |
Iterate over all OIDs in the given table. More... | |
#define | ONLP_OID_TABLE_ITER_TYPE(_table, _oidp, _type) ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, ONLP_OID_IS_TYPE(ONLP_OID_TYPE_##_type, *_oidp)) |
Iterate over all OIDs in the given table of the given type. More... | |
#define | ONLP_OID_JSON_FLAG_VALID(_e) (onlp_oid_json_flag_valid((_e))) |
#define | ONLP_OID_STATUS_FLAG_VALID(_e) (onlp_oid_status_flag_valid((_e))) |
#define | ONLP_OID_TYPE_VALID(_e) (onlp_oid_type_valid((_e))) |
#define | ONLP_OID_TYPE_FLAG_VALID(_e) (onlp_oid_type_flag_valid((_e))) |
Typedefs | |
typedef uint32_t | onlp_oid_t |
typedef uint32_t | onlp_oid_id_t |
typedef enum onlp_oid_json_flag_e | onlp_oid_json_flag_t |
typedef enum onlp_oid_status_flag_e | onlp_oid_status_flag_t |
typedef enum onlp_oid_type_e | onlp_oid_type_t |
typedef enum onlp_oid_type_flag_e | onlp_oid_type_flag_t |
typedef uint32_t | onlp_oid_type_flags_t |
typedef uint32_t | onlp_oid_status_flags_t |
typedef char | onlp_oid_desc_t[ONLP_OID_DESC_SIZE] |
typedef onlp_oid_t | onlp_oid_table_t[ONLP_OID_TABLE_SIZE] |
typedef struct onlp_oid_hdr_s | onlp_oid_hdr_t |
typedef int(* | onlp_oid_iterate_f) (onlp_oid_t oid, void *cookie) |
Enumerations | |
enum | onlp_oid_json_flag_e { ONLP_OID_JSON_FLAG_RECURSIVE = (1 << 0), ONLP_OID_JSON_FLAG_UNSUPPORTED_FIELDS = (1 << 1), ONLP_OID_JSON_FLAG_TO_USER_JSON = (1 << 2) } |
enum | onlp_oid_status_flag_e { ONLP_OID_STATUS_FLAG_PRESENT = (1 << 0), ONLP_OID_STATUS_FLAG_FAILED = (1 << 1), ONLP_OID_STATUS_FLAG_OPERATIONAL = (1 << 2), ONLP_OID_STATUS_FLAG_UNPLUGGED = (1 << 3) } |
enum | onlp_oid_type_e { ONLP_OID_TYPE_CHASSIS = 1, ONLP_OID_TYPE_MODULE = 2, ONLP_OID_TYPE_THERMAL = 3, ONLP_OID_TYPE_FAN = 4, ONLP_OID_TYPE_PSU = 5, ONLP_OID_TYPE_LED = 6, ONLP_OID_TYPE_SFP = 7, ONLP_OID_TYPE_GENERIC = 8 } |
enum | onlp_oid_type_flag_e { ONLP_OID_TYPE_FLAG_CHASSIS = (1 << 1), ONLP_OID_TYPE_FLAG_MODULE = (1 << 2), ONLP_OID_TYPE_FLAG_THERMAL = (1 << 3), ONLP_OID_TYPE_FLAG_FAN = (1 << 4), ONLP_OID_TYPE_FLAG_PSU = (1 << 5), ONLP_OID_TYPE_FLAG_LED = (1 << 6), ONLP_OID_TYPE_FLAG_SFP = (1 << 7), ONLP_OID_TYPE_FLAG_GENERIC = (1 << 8) } |
Functions | |
int | onlp_oid_hdr_get (onlp_oid_t oid, onlp_oid_hdr_t *hdr) |
Get the OID header for a given OID. More... | |
int | onlp_oid_info_get (onlp_oid_t oid, onlp_oid_hdr_t **info) |
Get the information structure for a given OID. More... | |
int | onlp_oid_iterate (onlp_oid_t root, onlp_oid_type_flags_t types, onlp_oid_iterate_f itf, void *cookie) |
Iterate over all platform OIDs. More... | |
int | onlp_oid_info_get_all (onlp_oid_t root, onlp_oid_type_flags_t types, uint32_t flags, biglist_t **list) |
Iterate over all given OID types and return their info structures. More... | |
int | onlp_oid_hdr_get_all (onlp_oid_t root, onlp_oid_type_flags_t types, uint32_t flags, biglist_t **list) |
Iterate over all given OID types and return their hdr structures. More... | |
int | onlp_oid_get_all_free (biglist_t *list) |
Free a list returned by onlp_oid_info_get_all() or onlp_oid_hdr_get_all() More... | |
int | onlp_oid_is_present (onlp_oid_t *oid) |
Return whether an OID is present or not. | |
int | onlp_oid_to_str (onlp_oid_t oid, char *rstr) |
int | onlp_oid_to_user_str (onlp_oid_t oid, char *rstr) |
int | onlp_oid_from_str (char *str, onlp_oid_t *roid) |
String Represenation -> OID. | |
int | onlp_oid_table_to_json (onlp_oid_table_t table, cJSON **cjp) |
OID Table -> JSON. More... | |
int | onlp_oid_table_from_json (cJSON *cj, onlp_oid_table_t table) |
JSON -> OID Table. More... | |
int | onlp_oid_hdr_to_json (onlp_oid_hdr_t *hdr, cJSON **cj, uint32_t flags) |
OID Header -> JSON. More... | |
int | onlp_oid_hdr_from_json (cJSON *cj, onlp_oid_hdr_t *hdr) |
JSON -> OID Header. More... | |
int | onlp_oid_info_to_json (onlp_oid_hdr_t *info, cJSON **cj, uint32_t flags) |
OID Info Structure -> JSON. More... | |
int | onlp_oid_to_user_json (onlp_oid_t oid, cJSON **rv, uint32_t flags) |
OID -> JSON. More... | |
int | onlp_oid_to_json (onlp_oid_t oid, cJSON **rv, uint32_t flags) |
OID -> User JSON. More... | |
int | onlp_oid_from_json (cJSON *cj, onlp_oid_hdr_t **hdr, biglist_t **all, uint32_t flags) |
JSON -> OID Information structures. More... | |
int | onlp_oid_json_verify (onlp_oid_t oid) |
const char * | onlp_oid_json_flag_name (onlp_oid_json_flag_t e) |
int | onlp_oid_json_flag_value (const char *str, onlp_oid_json_flag_t *e, int substr) |
const char * | onlp_oid_json_flag_desc (onlp_oid_json_flag_t e) |
int | onlp_oid_json_flag_valid (onlp_oid_json_flag_t e) |
const char * | onlp_oid_status_flag_name (onlp_oid_status_flag_t e) |
int | onlp_oid_status_flag_value (const char *str, onlp_oid_status_flag_t *e, int substr) |
const char * | onlp_oid_status_flag_desc (onlp_oid_status_flag_t e) |
int | onlp_oid_status_flag_valid (onlp_oid_status_flag_t e) |
const char * | onlp_oid_type_name (onlp_oid_type_t e) |
int | onlp_oid_type_value (const char *str, onlp_oid_type_t *e, int substr) |
const char * | onlp_oid_type_desc (onlp_oid_type_t e) |
int | onlp_oid_type_valid (onlp_oid_type_t e) |
const char * | onlp_oid_type_flag_name (onlp_oid_type_flag_t e) |
int | onlp_oid_type_flag_value (const char *str, onlp_oid_type_flag_t *e, int substr) |
const char * | onlp_oid_type_flag_desc (onlp_oid_type_flag_t e) |
int | onlp_oid_type_flag_valid (onlp_oid_type_flag_t e) |
Variables | |
aim_map_si_t | onlp_oid_json_flag_map [] |
aim_map_si_t | onlp_oid_json_flag_desc_map [] |
aim_map_si_t | onlp_oid_status_flag_map [] |
aim_map_si_t | onlp_oid_status_flag_desc_map [] |
aim_map_si_t | onlp_oid_type_map [] |
aim_map_si_t | onlp_oid_type_desc_map [] |
aim_map_si_t | onlp_oid_type_flag_map [] |
aim_map_si_t | onlp_oid_type_flag_desc_map [] |
#define ONLP_CHASSIS_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_CHASSIS, _id) |
Create a Chassis OID
#define ONLP_FAN_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_FAN, _id) |
Create a Fan OID
#define ONLP_GENERIC_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_GENERIC, _id) |
Create a Generic OID
#define ONLP_LED_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_LED, _id) |
Create an LED OID
#define ONLP_MODULE_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_MODULE, _id) |
Create a Module OID
#define ONLP_OID_CHASSIS ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_CHASSIS, 1) |
There is only one Chassis OID. This value should be used.
#define ONLP_OID_CHASSIS_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_CHASSIS, _id) |
Validate that the given OID is a Chassis
#define ONLP_OID_CHASSIS_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_CHASSIS, _id) |
Validate that the given OID is a Chassis
#define ONLP_OID_DESC_SIZE 128 |
All OIDs have user-level description strings:
#define ONLP_OID_FAILED | ( | _ptr | ) | ONLP_OID_STATUS_FLAG_IS_SET(_ptr, FAILED) |
Shortcut - OID has failed.
#define ONLP_OID_FAN_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_FAN, _id) |
Validate that the given OID is a Fan
#define ONLP_OID_FAN_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_FAN, _oid, _id) |
Validate and retrieve a Fan ID
#define ONLP_OID_FAN_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_FAN, _oid, _id) |
Validate and retrieve a Fan ID
#define ONLP_OID_FAN_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_FAN, _id) |
Validate that the given OID is a Fan
#define ONLP_OID_GENERIC_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_GENERIC, _id) |
Validate that the given OID is a Generic
#define ONLP_OID_GENERIC_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_GENERIC, _oid, _id) |
Validate and retrieve a Generic ID
#define ONLP_OID_GENERIC_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_GENERIC, _oid, _id) |
Validate and retrieve a Generic ID
#define ONLP_OID_GENERIC_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_GENERIC, _id) |
Validate that the given OID is a Generic
#define ONLP_OID_ID_GET | ( | _id | ) | (_id & 0xFFFFFF) |
Get the ID from an OID
#define ONLP_OID_ID_VALIDATE_RANGE | ( | _id, | |
_min, | |||
_max | |||
) | ( (_id) >= (_min) && (_id) <= (_max)) ? ONLP_STATUS_OK : ONLP_STATUS_E_INVALID |
Validate an ID is within a given range.
#define ONLP_OID_IS_CHASSIS | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_CHASSIS, _id) |
Is the given OID a Chassis ?
#define ONLP_OID_IS_FAN | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_FAN, _id) |
Is the given OID a Fan?
#define ONLP_OID_IS_GENERIC | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_GENERIC, _id) |
Is the given OID a Generic?
#define ONLP_OID_IS_LED | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_LED, _id) |
Is the given OID an LED?
#define ONLP_OID_IS_MODULE | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_MODULE, _id) |
Is the given OID a Module?
#define ONLP_OID_IS_PSU | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_PSU, _id) |
Is the given OID a PSU?
#define ONLP_OID_IS_SFP | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_SFP, _id) |
Is the given OID an SFP?
#define ONLP_OID_IS_THERMAL | ( | _id | ) | ONLP_OID_IS_TYPE(ONLP_OID_TYPE_THERMAL, _id) |
Is the given OID a Thermal?
#define ONLP_OID_IS_TYPE | ( | _type, | |
_id | |||
) | (ONLP_OID_TYPE_GET((_id)) == _type) |
Determine if an OID is of the given type
#define ONLP_OID_IS_TYPE_FLAGS | ( | _flags, | |
_id | |||
) | ((_flags & (1 << ONLP_OID_TYPE_GET(_id)))) |
Is the OID type present in the flag bitmap?
#define ONLP_OID_IS_TYPE_FLAGSZ | ( | _flags, | |
_id | |||
) | ((_flags == 0) || ONLP_OID_IS_TYPE_FLAGS(_flags, _id)) |
Is the OID type present in the flag bitmap or are the flags zero?
#define ONLP_OID_JSON_FLAG_VALID | ( | _e | ) | (onlp_oid_json_flag_valid((_e))) |
validator
#define ONLP_OID_LED_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_LED, _id) |
Validate that the given OID is an LED
#define ONLP_OID_LED_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_LED, _oid, _id) |
Validate and retrieve an LED ID
#define ONLP_OID_LED_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_LED, _oid, _id) |
Validate and retrieve an LED ID
#define ONLP_OID_LED_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_LED, _id) |
Validate that the given OID is an LED
#define ONLP_OID_MODULE_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_MODULE, _id) |
Validate that the given OID is a Module
#define ONLP_OID_MODULE_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_MODULE, _oid, _id) |
Validate and retrieve a Module ID
#define ONLP_OID_MODULE_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_MODULE, _oid, _id) |
Validate and retrieve a Module ID
#define ONLP_OID_MODULE_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_MODULE, _id) |
Validate that the given OID is a Module
#define ONLP_OID_PRESENT | ( | _ptr | ) | ONLP_OID_STATUS_FLAG_IS_SET(_ptr, PRESENT) |
Shortcut - OID is present.
#define ONLP_OID_PSU_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_PSU, _id) |
Validate that the given OID is a PSU
#define ONLP_OID_PSU_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_PSU, _oid, _id) |
Validate and retrieve a PSU ID
#define ONLP_OID_PSU_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_PSU, _oid, _id) |
Validate and retrieve a PSU ID
#define ONLP_OID_PSU_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_PSU, _id) |
Validate that the given OID is a PSU
#define ONLP_OID_SFP_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_SFP, _id) |
Validate that the given OID is an SFP
#define ONLP_OID_SFP_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_SFP, _oid, _id) |
Validate and retrieve a SFP ID
#define ONLP_OID_SFP_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_SFP, _oid, _id) |
Validate and retrieve a SFP ID
#define ONLP_OID_SFP_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_SFP, _id) |
Validate that the given OID is an SFP
#define ONLP_OID_STATUS_FLAG_CLR | ( | _ptr, | |
_name | |||
) | AIM_FLAG_CLR(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
Clear a given flag.
#define ONLP_OID_STATUS_FLAG_GET_VALUE | ( | _ptr, | |
_name | |||
) | AIM_FLAG_GET_VALUE(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
Get the value of a given flag.
#define ONLP_OID_STATUS_FLAG_IS_SET | ( | _ptr, | |
_name | |||
) | AIM_FLAG_IS_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
Determine if a flag is set.
#define ONLP_OID_STATUS_FLAG_NOT_SET | ( | _ptr, | |
_name | |||
) | AIM_FLAG_NOT_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
Determine if a flag is cleared.
#define ONLP_OID_STATUS_FLAG_SET | ( | _ptr, | |
_name | |||
) | AIM_FLAG_SET(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name) |
Set a given flag.
#define ONLP_OID_STATUS_FLAG_SET_VALUE | ( | _ptr, | |
_name, | |||
_value | |||
) | AIM_FLAG_SET_VALUE(ONLP_OID_STATUS_FLAGS_GET(_ptr), ONLP_OID_STATUS_FLAG_##_name, _value) |
Set the value of a given flag.
#define ONLP_OID_STATUS_FLAG_VALID | ( | _e | ) | (onlp_oid_status_flag_valid((_e))) |
validator
#define ONLP_OID_STATUS_FLAGS_CLR | ( | _ptr | ) | ONLP_OID_STATUS_FLAGS_GET(_ptr) = 0 |
Clear all status flags
#define ONLP_OID_STATUS_FLAGS_GET | ( | _ptr | ) | (((onlp_oid_hdr_t*)_ptr)->status) |
Manipulating OID Status Flags
#define ONLP_OID_TABLE_CLEAR | ( | _table | ) | memset(_table, 0, ONLP_OID_TABLE_SIZE_BYTES) |
Clear an OID table.
#define ONLP_OID_TABLE_COPY | ( | _dst, | |
_src | |||
) | memcpy(_dst, _src, ONLP_OID_TABLE_SIZE_BYTES) |
Copy an OID table.
#define ONLP_OID_TABLE_ITER | ( | _table, | |
_oidp | |||
) | ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, 1) |
Iterate over all OIDs in the given table.
_table | The OID table |
_oidp | OID pointer iterator |
#define ONLP_OID_TABLE_ITER_EXPR | ( | _table, | |
_oidp, | |||
_expr | |||
) |
Iterate over all OIDS in the given table that match the given expression.
_table | The OID table |
_oidp | OID pointer iterator |
_expr | OID Expression which must be true |
#define ONLP_OID_TABLE_ITER_TYPE | ( | _table, | |
_oidp, | |||
_type | |||
) | ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, ONLP_OID_IS_TYPE(ONLP_OID_TYPE_##_type, *_oidp)) |
Iterate over all OIDs in the given table of the given type.
_table | The OID table |
_oidp | OID pointer iteration. |
_type | The OID Type |
#define ONLP_OID_TABLE_SIZE 256 |
The maximum OID child table size
#define ONLP_OID_TABLE_SIZE_BYTES (sizeof(onlp_oid_t)*ONLP_OID_TABLE_SIZE) |
The size of the current OID table
#define ONLP_OID_THERMAL_ENTRY | ( | _id, | |
_desc, | |||
_parent_type, | |||
_parent_id | |||
) | { ONLP_THERMAL_ID_CREATE(_id), _desc, ONLP_OID_TYPE_CREATE(_parent_type, _parent_id) } |
This macro can be used to construct your OID hdr tables
#define ONLP_OID_THERMAL_VALIDATE | ( | _id | ) | ONLP_OID_TYPE_VALIDATE(ONLP_OID_TYPE_THERMAL, _id) |
Validate that the given OID is a Thermal
#define ONLP_OID_THERMAL_VALIDATE_GET_ID | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID(ONLP_OID_TYPE_THERMAL, _oid, _id) |
Validate and retrieve a Thermal ID
#define ONLP_OID_THERMAL_VALIDATE_GET_ID_NR | ( | _oid, | |
_id | |||
) | ONLP_OID_TYPE_VALIDATE_GET_ID_NR(ONLP_OID_TYPE_THERMAL, _oid, _id) |
Validate and retrieve a Thermal ID
#define ONLP_OID_THERMAL_VALIDATE_NR | ( | _id | ) | ONLP_OID_TYPE_VALIDATE_NR(ONLP_OID_TYPE_THERMAL, _id) |
Validate that the given OID is a Thermal
#define ONLP_OID_TYPE_CREATE | ( | _type, | |
_id | |||
) | ( ( (_type) << 24) | (_id)) |
Create an OID of the given type
#define ONLP_OID_TYPE_FLAG_VALID | ( | _e | ) | (onlp_oid_type_flag_valid((_e))) |
validator
#define ONLP_OID_TYPE_GET | ( | _id | ) | ( ( (_id) >> 24) ) |
Get the type from an OID
#define ONLP_OID_TYPE_VALID | ( | _e | ) | (onlp_oid_type_valid((_e))) |
validator
#define ONLP_OID_TYPE_VALIDATE | ( | _type, | |
_oid | |||
) |
Return an error if the given OID is not of the given type
#define ONLP_OID_TYPE_VALIDATE_GET_ID | ( | _type, | |
_oid, | |||
_id | |||
) |
Validate that the given OID is of the given type and retreive the ID
#define ONLP_OID_TYPE_VALIDATE_GET_ID_NR | ( | _type, | |
_oid, | |||
_id | |||
) |
Validate that the given OID is of the given type and retreive the ID
#define ONLP_OID_TYPE_VALIDATE_NR | ( | _type, | |
_oid | |||
) |
Return if the given OID is not of the given type
#define ONLP_PSU_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_PSU, _id) |
Create a PSU OID
#define ONLP_SFP_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_SFP, _id) |
Create an SFP OID
#define ONLP_THERMAL_ID_CREATE | ( | _id | ) | ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_THERMAL, _id) |
Create a Thermal OID
typedef char onlp_oid_desc_t[ONLP_OID_DESC_SIZE] |
OID description array.
typedef struct onlp_oid_hdr_s onlp_oid_hdr_t |
All OID objects contain this header as the first member.
typedef uint32_t onlp_oid_id_t |
The object id value
typedef int(* onlp_oid_iterate_f) (onlp_oid_t oid, void *cookie) |
Iterator
typedef enum onlp_oid_json_flag_e onlp_oid_json_flag_t |
onlp_oid_json_flag
typedef enum onlp_oid_status_flag_e onlp_oid_status_flag_t |
onlp_oid_status_flag
typedef uint32_t onlp_oid_status_flags_t |
Represents a set of oid_status_flags;
typedef uint32_t onlp_oid_t |
System peripherals are identified by a 32bit OID.
The First byte is the object-class identifier: Thermal sensor object Fan object PSU object LED object MODULE object etc.. The remaining bytes are the object id.
typedef onlp_oid_t onlp_oid_table_t[ONLP_OID_TABLE_SIZE] |
A table of OIDs
typedef enum onlp_oid_type_flag_e onlp_oid_type_flag_t |
onlp_oid_type_flag
typedef uint32_t onlp_oid_type_flags_t |
Represents a set of oid_type_flags.
typedef enum onlp_oid_type_e onlp_oid_type_t |
onlp_oid_type
enum onlp_oid_json_flag_e |
onlp_oid_json_flag
onlp_oid_status_flag
enum onlp_oid_type_e |
onlp_oid_type
enum onlp_oid_type_flag_e |
onlp_oid_type_flag
int onlp_oid_from_json | ( | cJSON * | cj, |
onlp_oid_hdr_t ** | hdr, | ||
biglist_t ** | all, | ||
uint32_t | flags | ||
) |
JSON -> OID Information structures.
cj | The source JSON structure. | |
[out] | hdr | Receives the information structure. |
[out] | all | Receives a list of all structures if not NULL and the JSON contains multiple objects. |
flags | The JSON flags. |
int onlp_oid_get_all_free | ( | biglist_t * | list | ) |
Free a list returned by onlp_oid_info_get_all() or onlp_oid_hdr_get_all()
list | The list to free. |
int onlp_oid_hdr_from_json | ( | cJSON * | cj, |
onlp_oid_hdr_t * | hdr | ||
) |
JSON -> OID Header.
cj | The source json | |
[out] | hdr | receives the header. |
int onlp_oid_hdr_get | ( | onlp_oid_t | oid, |
onlp_oid_hdr_t * | hdr | ||
) |
Get the OID header for a given OID.
oid | The oid | |
[out] | hdr | Receives the header |
int onlp_oid_hdr_get_all | ( | onlp_oid_t | root, |
onlp_oid_type_flags_t | types, | ||
uint32_t | flags, | ||
biglist_t ** | list | ||
) |
Iterate over all given OID types and return their hdr structures.
root | The root OID. | |
types | The OID types filter (optional) | |
flags | The iterator flags. | |
[out] | list | Receives a list of all hdr structures. |
int onlp_oid_hdr_to_json | ( | onlp_oid_hdr_t * | hdr, |
cJSON ** | cj, | ||
uint32_t | flags | ||
) |
OID Header -> JSON.
hdr | The header | |
[out] | cj | Receives the JSON representation. |
flags | The JSON conversion flags. |
int onlp_oid_info_get | ( | onlp_oid_t | oid, |
onlp_oid_hdr_t ** | info | ||
) |
Get the information structure for a given OID.
oid | The oid | |
[out] | info | Receives a pointer to the information structure. |
int onlp_oid_info_get_all | ( | onlp_oid_t | root, |
onlp_oid_type_flags_t | types, | ||
uint32_t | flags, | ||
biglist_t ** | list | ||
) |
Iterate over all given OID types and return their info structures.
root | The root OID. | |
types | The OID types filter (optional) | |
flags | The iterator flags. | |
[out] | list | Receives a list of all info structures. |
int onlp_oid_info_to_json | ( | onlp_oid_hdr_t * | info, |
cJSON ** | cj, | ||
uint32_t | flags | ||
) |
OID Info Structure -> JSON.
info | The pointer to the OID's info structure. | |
[out] | cj | Receives the JSON representation. |
flags | The JSON conversion flags. |
int onlp_oid_iterate | ( | onlp_oid_t | root, |
onlp_oid_type_flags_t | types, | ||
onlp_oid_iterate_f | itf, | ||
void * | cookie | ||
) |
Iterate over all platform OIDs.
root | The root OID. |
types | The OID types filter (optional) |
itf | The iterator function. |
cookie | The cookie. |
const char* onlp_oid_json_flag_desc | ( | onlp_oid_json_flag_t | e | ) |
Enum descriptions.
const char* onlp_oid_json_flag_name | ( | onlp_oid_json_flag_t | e | ) |
Enum names.
int onlp_oid_json_flag_valid | ( | onlp_oid_json_flag_t | e | ) |
Enum validator.
int onlp_oid_json_flag_value | ( | const char * | str, |
onlp_oid_json_flag_t * | e, | ||
int | substr | ||
) |
Enum values.
int onlp_oid_json_verify | ( | onlp_oid_t | oid | ) |
Verify OID <-> JSON conversions for the given OID (testing).
const char* onlp_oid_status_flag_desc | ( | onlp_oid_status_flag_t | e | ) |
Enum descriptions.
const char* onlp_oid_status_flag_name | ( | onlp_oid_status_flag_t | e | ) |
Enum names.
int onlp_oid_status_flag_valid | ( | onlp_oid_status_flag_t | e | ) |
Enum validator.
int onlp_oid_status_flag_value | ( | const char * | str, |
onlp_oid_status_flag_t * | e, | ||
int | substr | ||
) |
Enum values.
int onlp_oid_table_from_json | ( | cJSON * | cj, |
onlp_oid_table_t | table | ||
) |
JSON -> OID Table.
cj | The CJSON array object. | |
[out] | table | The table to populate. |
int onlp_oid_table_to_json | ( | onlp_oid_table_t | table, |
cJSON ** | cjp | ||
) |
OID Table -> JSON.
table | The table. | |
[out] | cjp | Receives the JSON array object. |
int onlp_oid_to_json | ( | onlp_oid_t | oid, |
cJSON ** | rv, | ||
uint32_t | flags | ||
) |
OID -> User JSON.
oid | The OID. | |
[out] | rv | Receives the JSON structure. |
flags | The format flags. |
int onlp_oid_to_str | ( | onlp_oid_t | oid, |
char * | rstr | ||
) |
OID -> String Representation
int onlp_oid_to_user_json | ( | onlp_oid_t | oid, |
cJSON ** | rv, | ||
uint32_t | flags | ||
) |
OID -> JSON.
oid | The OID. | |
[out] | rv | Receives the JSON structure. |
flags | The format flags. |
int onlp_oid_to_user_str | ( | onlp_oid_t | oid, |
char * | rstr | ||
) |
OID -> User representation.
const char* onlp_oid_type_desc | ( | onlp_oid_type_t | e | ) |
Enum descriptions.
const char* onlp_oid_type_flag_desc | ( | onlp_oid_type_flag_t | e | ) |
Enum descriptions.
const char* onlp_oid_type_flag_name | ( | onlp_oid_type_flag_t | e | ) |
Enum names.
int onlp_oid_type_flag_valid | ( | onlp_oid_type_flag_t | e | ) |
Enum validator.
int onlp_oid_type_flag_value | ( | const char * | str, |
onlp_oid_type_flag_t * | e, | ||
int | substr | ||
) |
Enum values.
const char* onlp_oid_type_name | ( | onlp_oid_type_t | e | ) |
Enum names.
int onlp_oid_type_valid | ( | onlp_oid_type_t | e | ) |
Enum validator.
int onlp_oid_type_value | ( | const char * | str, |
onlp_oid_type_t * | e, | ||
int | substr | ||
) |
Enum values.
aim_map_si_t onlp_oid_json_flag_desc_map[] |
onlp_oid_json_flag_desc_map table.
aim_map_si_t onlp_oid_json_flag_map[] |
onlp_oid_json_flag_map table.
aim_map_si_t onlp_oid_status_flag_desc_map[] |
onlp_oid_status_flag_desc_map table.
aim_map_si_t onlp_oid_status_flag_map[] |
onlp_oid_status_flag_map table.
aim_map_si_t onlp_oid_type_desc_map[] |
onlp_oid_type_desc_map table.
aim_map_si_t onlp_oid_type_flag_desc_map[] |
onlp_oid_type_flag_desc_map table.
aim_map_si_t onlp_oid_type_flag_map[] |
onlp_oid_type_flag_map table.
aim_map_si_t onlp_oid_type_map[] |
onlp_oid_type_map table.