PyObject * py_cps_obj_init(PyObject *self, PyObject *args) { cps_api_operation_handle_t handle; cps_api_return_code_t rc; { NonBlockingPythonContext l; rc = cps_api_operation_subsystem_init(&handle,1); } if (rc!=cps_api_ret_code_OK) { py_set_error_string("Failed to initialize the infrastructure."); return nullptr; } return PyByteArray_FromStringAndSize((const char *)&handle,sizeof(handle)); }
static t_std_error _cps_init () { cps_api_operation_handle_t handle; cps_api_return_code_t rc; cps_api_registration_functions_t f; rc = cps_api_operation_subsystem_init (&handle,1); if (rc != cps_api_ret_code_OK) { NAS_ACL_LOG_ERR ("NAS ACL CPS Subsystem Init failed"); return STD_ERR(QOS, FAIL, rc); } memset (&f, 0, sizeof(f)); f.handle = handle; f._read_function = nas_acl_cps_api_read; f._write_function = nas_acl_cps_api_write; f._rollback_function = nas_acl_cps_api_rollback; /* * Register all ACL objects * TODO: Need to check with CPS app teams, if ACL needs to register for * OBSERVED state. */ cps_api_key_init (&f.key, cps_api_qualifier_TARGET, cps_api_obj_CAT_BASE_ACL, 0, /* register all sub-categories */ 0); rc = cps_api_register (&f); if (rc != cps_api_ret_code_OK) { NAS_ACL_LOG_ERR ("NAS ACL CPS object Register failed"); return STD_ERR(QOS, FAIL, rc); } return STD_ERR_OK; }