ONLP
Open Network Linux Platform APIs
attribute.h
Go to the documentation of this file.
1 /************************************************************
2  * <bsn.cl fy=2017 v=onl>
3  *
4  * Copyright 2017 Big Switch Networks, Inc.
5  *
6  * Licensed under the Eclipse Public License, Version 1.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.eclipse.org/legal/epl-v10.html
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15  * either express or implied. See the License for the specific
16  * language governing permissions and limitations under the
17  * License.
18  *
19  * </bsn.cl>
20  ********************************************************/
29 #ifndef __ONLP_ATTRIBUTE_H__
30 #define __ONLP_ATTRIBUTE_H__
31 
32 #include <onlp/oids.h>
33 #include <onlp/onlp.h>
34 #include <onlp/stdattrs.h>
35 #include <AIM/aim_pvs.h>
36 
42 int onlp_attribute_sw_init(void);
43 
50 int onlp_attribute_hw_init(uint32_t flags);
51 
58 int onlp_attribute_sw_denit(void);
59 
65 int onlp_attribute_supported(onlp_oid_t oid, const char* attribute);
66 
73 int onlp_attribute_set(onlp_oid_t oid, const char* attribute, void* value);
74 
81 int onlp_attribute_get(onlp_oid_t oid, const char* attribute,
82  void** value);
83 
90 int onlp_attribute_free(onlp_oid_t oid, const char* attribute, void* value);
91 
95 #define ONLP_ATTRIBUTE_EQUALS(_a, _b) (!strcmp(_a, _b))
96 
97 /******************************************************************************
98  *
99  * These functions provide access to standard ONIE and Asset attributes.
100  * These are so common that they have their own interface for
101  * for both the user and the platform implementations.
102  *
103  *****************************************************************************/
110 int onlp_attribute_onie_info_get(onlp_oid_t oid, onlp_onie_info_t** rp);
111 
117 int onlp_attribute_onie_info_free(onlp_oid_t oid, onlp_onie_info_t* p);
118 
125 int onlp_attribute_onie_info_get_json(onlp_oid_t oid, cJSON** rp);
126 
133 int onlp_attribute_onie_info_show(onlp_oid_t oid, aim_pvs_t* pvs);
134 
140 int onlp_attribute_onie_info_show_json(onlp_oid_t oid, aim_pvs_t* pvs);
141 
154 
161 
169 
176 int onlp_attribute_asset_info_show(onlp_oid_t oid, aim_pvs_t* pvs);
177 
183 int onlp_attribute_asset_info_show_json(onlp_oid_t oid, aim_pvs_t* pvs);
184 
185 #endif /* __ONLP_ATTRIBUTE_H__ */
186 /* @} */
int onlp_attribute_onie_info_free(onlp_oid_t oid, onlp_onie_info_t *p)
Free an ONIE attribute pointer.
int onlp_attribute_asset_info_get_json(onlp_oid_t oid, cJSON **rp)
Request the asset attribute in JSON.
int onlp_attribute_onie_info_show(onlp_oid_t oid, aim_pvs_t *pvs)
Show the ONIE attribute.
int onlp_attribute_sw_denit(void)
Deinitialize the attribute subsystem.
Object Identifiers.
uint32_t onlp_oid_t
Definition: oids.h:52
int onlp_attribute_asset_info_show(onlp_oid_t oid, aim_pvs_t *pvs)
Show the asset attribute.
int onlp_attribute_asset_info_show_json(onlp_oid_t oid, aim_pvs_t *pvs)
Show the asset attribute (JSON).
int onlp_attribute_onie_info_get_json(onlp_oid_t oid, cJSON **rp)
Request the ONIE attribute in JSON.
int onlp_attribute_hw_init(uint32_t flags)
Hardware initialization of the attribute subsystem.
int onlp_attribute_onie_info_show_json(onlp_oid_t oid, aim_pvs_t *pvs)
Show the ONIE attribute (JSON)
int onlp_attribute_asset_info_get(onlp_oid_t oid, onlp_asset_info_t **rp)
Determine if the ONIE attribute is supported.
int onlp_attribute_asset_info_free(onlp_oid_t oid, onlp_asset_info_t *p)
Free an asset attribute pointer.
int onlp_attribute_sw_init(void)
Initialize the attribute subsystem.
int onlp_attribute_set(onlp_oid_t oid, const char *attribute, void *value)
Set an attribute on the given OID.
int onlp_attribute_supported(onlp_oid_t oid, const char *attribute)
Determine whether the OID supports the given attribute.
int onlp_attribute_get(onlp_oid_t oid, const char *attribute, void **value)
Get an attribute from the given OID.
int onlp_attribute_onie_info_get(onlp_oid_t oid, onlp_onie_info_t **rp)
Request the ONIE attribute.
Standard OID Attributes.
This structure describes general asset information that may be associated with a particular OID...
Definition: stdattrs.h:40
int onlp_attribute_free(onlp_oid_t oid, const char *attribute, void *value)
Free an attribute value returned from onlp_attribute_get().