Lines Matching defs:handle

63 smb_smf_instance_create(smb_scfhandle_t *handle, char *serv_prefix,
70 if (handle == NULL)
82 handle->scf_instance = scf_instance_create(handle->scf_handle);
83 if (scf_service_get_instance(handle->scf_service, inst_name,
84 handle->scf_instance) != SCF_SUCCESS) {
85 if (scf_service_add_instance(handle->scf_service,
86 inst_name, handle->scf_instance) != SCF_SUCCESS) {
103 smb_smf_instance_delete(smb_scfhandle_t *handle, char *inst_name)
107 if (handle == NULL)
110 handle->scf_instance = scf_instance_create(handle->scf_handle);
111 if (scf_service_get_instance(handle->scf_service, inst_name,
112 handle->scf_instance) == SCF_SUCCESS) {
113 if (scf_instance_delete(handle->scf_instance) == SCF_SUCCESS) {
126 * smb_smf_create_instance_pgroup(handle, pgroup)
131 smb_smf_create_instance_pgroup(smb_scfhandle_t *handle, char *pgroup)
136 if (handle == NULL)
140 * only create a handle if it doesn't exist. It is ok to exist
141 * since the pg handle will be set as a side effect.
143 if (handle->scf_pg == NULL)
144 handle->scf_pg = scf_pg_create(handle->scf_handle);
150 if (scf_instance_get_pg(handle->scf_instance,
151 pgroup, handle->scf_pg) != 0) {
153 if (scf_instance_add_pg(handle->scf_instance, pgroup,
154 SCF_GROUP_APPLICATION, 0, handle->scf_pg) != 0) {
172 * smb_smf_delete_instance_pgroup(handle, pgroup)
178 smb_smf_delete_instance_pgroup(smb_scfhandle_t *handle, char *pgroup)
183 if (handle == NULL)
187 * only create a handle if it doesn't exist. It is ok to exist
188 * since the pg handle will be set as a side effect.
190 if (handle->scf_pg == NULL)
191 handle->scf_pg = scf_pg_create(handle->scf_handle);
196 if (scf_instance_get_pg(handle->scf_instance, pgroup,
197 handle->scf_pg) == 0) {
199 if (scf_pg_delete(handle->scf_pg) != 0) {
221 * smb_smf_create_service_pgroup(handle, pgroup)
226 smb_smf_create_service_pgroup(smb_scfhandle_t *handle, char *pgroup)
231 if (handle == NULL)
235 * only create a handle if it doesn't exist. It is ok to exist
236 * since the pg handle will be set as a side effect.
238 if (handle->scf_pg == NULL)
239 if ((handle->scf_pg =
240 scf_pg_create(handle->scf_handle)) == NULL)
247 if (scf_service_get_pg(handle->scf_service,
248 pgroup, handle->scf_pg) != 0) {
250 if (scf_service_add_pg(handle->scf_service, pgroup,
251 SCF_GROUP_APPLICATION, 0, handle->scf_pg) != 0) {
269 * Start transaction on current pg in handle.
271 * Must be called after pg handle is obtained
275 smb_smf_start_transaction(smb_scfhandle_t *handle)
279 if (!handle || (!handle->scf_pg))
286 if (handle->scf_state == SCH_STATE_INIT) {
288 handle->scf_trans =
289 scf_transaction_create(handle->scf_handle);
290 if (handle->scf_trans != NULL) {
291 if (scf_transaction_start(handle->scf_trans,
292 handle->scf_pg) != 0) {
295 handle->scf_trans);
296 handle->scf_trans = NULL;
311 * smb_smf_end_transaction(handle)
314 * handle. Do all necessary cleanup.
317 smb_smf_end_transaction(smb_scfhandle_t *handle)
321 if (handle == NULL)
324 if (handle->scf_trans == NULL) {
327 if (scf_transaction_commit(handle->scf_trans) < 0) {
332 scf_transaction_destroy_children(handle->scf_trans);
333 scf_transaction_destroy(handle->scf_trans);
334 handle->scf_trans = NULL;
343 smb_smf_set_string_property(smb_scfhandle_t *handle,
350 if (handle == NULL)
357 value = scf_value_create(handle->scf_handle);
358 entry = scf_entry_create(handle->scf_handle);
360 if (scf_transaction_property_change(handle->scf_trans, entry,
362 scf_transaction_property_new(handle->scf_trans, entry,
407 smb_smf_get_string_property(smb_scfhandle_t *handle, char *propname,
414 if (handle == NULL)
417 value = scf_value_create(handle->scf_handle);
418 prop = scf_property_create(handle->scf_handle);
420 (scf_pg_get_property(handle->scf_pg, propname, prop) == 0)) {
444 smb_smf_set_count_property(smb_scfhandle_t *handle, char *propname,
451 if (handle == NULL)
458 value = scf_value_create(handle->scf_handle);
459 entry = scf_entry_create(handle->scf_handle);
461 if (scf_transaction_property_change(handle->scf_trans, entry,
463 scf_transaction_property_new(handle->scf_trans, entry,
502 smb_smf_set_integer_property(smb_scfhandle_t *handle, char *propname,
509 if (handle == NULL)
516 value = scf_value_create(handle->scf_handle);
517 entry = scf_entry_create(handle->scf_handle);
519 if (scf_transaction_property_change(handle->scf_trans, entry,
521 scf_transaction_property_new(handle->scf_trans, entry,
559 smb_smf_get_count_property(smb_scfhandle_t *handle, char *propname,
566 if (handle == NULL)
569 value = scf_value_create(handle->scf_handle);
570 prop = scf_property_create(handle->scf_handle);
572 (scf_pg_get_property(handle->scf_pg, propname, prop) == 0)) {
596 smb_smf_get_integer_property(smb_scfhandle_t *handle, char *propname,
603 if (handle == NULL)
606 value = scf_value_create(handle->scf_handle);
607 prop = scf_property_create(handle->scf_handle);
609 (scf_pg_get_property(handle->scf_pg, propname, prop) == 0)) {
634 smb_smf_set_boolean_property(smb_scfhandle_t *handle, char *propname,
641 if (handle == NULL)
648 value = scf_value_create(handle->scf_handle);
649 entry = scf_entry_create(handle->scf_handle);
651 if (scf_transaction_property_change(handle->scf_trans, entry,
653 scf_transaction_property_new(handle->scf_trans, entry,
691 smb_smf_get_boolean_property(smb_scfhandle_t *handle, char *propname,
698 if (handle == NULL)
701 value = scf_value_create(handle->scf_handle);
702 prop = scf_property_create(handle->scf_handle);
704 (scf_pg_get_property(handle->scf_pg, propname, prop) == 0)) {
727 smb_smf_set_opaque_property(smb_scfhandle_t *handle, char *propname,
734 if (handle == NULL)
741 value = scf_value_create(handle->scf_handle);
742 entry = scf_entry_create(handle->scf_handle);
744 if (scf_transaction_property_change(handle->scf_trans, entry,
746 scf_transaction_property_new(handle->scf_trans, entry,
790 smb_smf_get_opaque_property(smb_scfhandle_t *handle, char *propname,
797 if (handle == NULL)
800 value = scf_value_create(handle->scf_handle);
801 prop = scf_property_create(handle->scf_handle);
803 (scf_pg_get_property(handle->scf_pg, propname, prop) == 0)) {
825 smb_smf_delete_property(smb_scfhandle_t *handle, char *propname)
830 if (handle == NULL)
837 entry = scf_entry_create(handle->scf_handle);
839 if (scf_transaction_property_delete(handle->scf_trans, entry,
895 smb_scfhandle_t *handle;
897 handle = malloc(sizeof (smb_scfhandle_t));
898 if (handle != NULL) {
899 bzero((char *)handle, sizeof (smb_scfhandle_t));
900 handle->scf_state = SCH_STATE_INITIALIZING;
901 handle->scf_handle = scf_handle_create(SCF_VERSION);
902 if (handle->scf_handle != NULL) {
903 if (scf_handle_bind(handle->scf_handle) == 0) {
904 handle->scf_scope =
905 scf_scope_create(handle->scf_handle);
907 if (handle->scf_scope == NULL)
911 handle->scf_handle, handle->scf_scope) != 0)
914 handle->scf_service =
915 scf_service_create(handle->scf_handle);
917 if (handle->scf_service == NULL)
920 if (scf_scope_get_service(handle->scf_scope,
921 svc_name, handle->scf_service)
925 handle->scf_pg =
926 scf_pg_create(handle->scf_handle);
928 if (handle->scf_pg == NULL)
931 handle->scf_state = SCH_STATE_INIT;
936 free(handle);
937 handle = NULL;
942 return (handle);
946 (void) smb_smf_scf_fini(handle);
952 * smb_smf_scf_fini(handle)
954 * must be called when done. Called with the handle allocated in
959 smb_smf_scf_fini(smb_scfhandle_t *handle)
961 if (handle != NULL) {
963 scf_iter_destroy(handle->scf_pg_iter);
964 handle->scf_pg_iter = NULL;
966 scf_iter_destroy(handle->scf_inst_iter);
967 handle->scf_inst_iter = NULL;
970 scf_scope_destroy(handle->scf_scope);
971 handle->scf_scope = NULL;
973 scf_instance_destroy(handle->scf_instance);
974 handle->scf_instance = NULL;
976 scf_service_destroy(handle->scf_service);
977 handle->scf_service = NULL;
979 scf_pg_destroy(handle->scf_pg);
980 handle->scf_pg = NULL;
982 handle->scf_state = SCH_STATE_UNINIT;
984 (void) scf_handle_unbind(handle->scf_handle);
985 scf_handle_destroy(handle->scf_handle);
986 handle->scf_handle = NULL;
988 free(handle);