Lines Matching refs:registration

205 #define NETAGENT_LOCK_EXCLUSIVE(registration) lck_rw_lock_exclusive(&registration->agent_lock)  argument
206 #define NETAGENT_LOCK_SHARED(registration) lck_rw_lock_shared(&registration->agent_lock) argument
207 #define NETAGENT_LOCK_SHARED_TO_EXCLUSIVE(registration) lck_rw_lock_shared_to_exclusive(&registrati… argument
208 #define NETAGENT_UNLOCK(registration) lck_rw_done(&registration->agent_lock) argument
209 #define NETAGENT_ASSERT_LOCKED(registration) LCK_RW_ASSERT(&registration->agent_lock, LCK_RW_ASSERT… argument
422 netagent_send_trigger(struct netagent_registration *registration, struct proc *p, u_int32_t flags, … in netagent_send_trigger() argument
426 const bool session_mode = registration->allow_multiple_registrations; in netagent_send_trigger()
436 …(void)netagent_buffer_write_session_message_header(trigger, trigger_type, 0, 0, 0, registration->n… in netagent_send_trigger()
451 if ((error = netagent_send_ctl_data(registration->control_unit, trigger, trigger_size))) { in netagent_send_trigger()
452 …NETAGENTLOG(LOG_ERR, "Failed to send trigger message on control unit %d", registration->control_un… in netagent_send_trigger()
460 netagent_send_client_message(struct netagent_registration *registration, uuid_t client_id, u_int8_t… in netagent_send_client_message() argument
464 const bool session_mode = registration->allow_multiple_registrations; in netagent_send_client_message()
475 …(void)netagent_buffer_write_session_message_header(message, message_type, 0, 0, 0, registration->n… in netagent_send_client_message()
483 if ((error = netagent_send_ctl_data(registration->control_unit, message, message_size))) { in netagent_send_client_message()
484 …, "Failed to send client message %d on control unit %d", message_type, registration->control_unit); in netagent_send_client_message()
492 netagent_send_error_message(struct netagent_registration *registration, uuid_t client_id, u_int8_t … in netagent_send_error_message() argument
496 const bool session_mode = registration->allow_multiple_registrations; in netagent_send_error_message()
507 …(void)netagent_buffer_write_session_message_header(message, message_type, 0, 0, 0, registration->n… in netagent_send_error_message()
516 if ((error = netagent_send_ctl_data(registration->control_unit, message, message_size))) { in netagent_send_error_message()
517 …, "Failed to send client message %d on control unit %d", message_type, registration->control_unit); in netagent_send_error_message()
525 netagent_send_group_message(struct netagent_registration *registration, uuid_t client_id, u_int8_t … in netagent_send_group_message() argument
529 const bool session_mode = registration->allow_multiple_registrations; in netagent_send_group_message()
540 …(void)netagent_buffer_write_session_message_header(message, message_type, 0, 0, 0, registration->n… in netagent_send_group_message()
549 if ((error = netagent_send_ctl_data(registration->control_unit, message, message_size))) { in netagent_send_group_message()
550 …led to send client group message %d on control unit %d", message_type, registration->control_unit); in netagent_send_group_message()
558 netagent_send_tokens_needed(struct netagent_registration *registration) in netagent_send_tokens_needed() argument
563 const bool session_mode = registration->allow_multiple_registrations; in netagent_send_tokens_needed()
573 …(void)netagent_buffer_write_session_message_header(message, message_type, 0, 0, 0, registration->n… in netagent_send_tokens_needed()
578 if ((error = netagent_send_ctl_data(registration->control_unit, message, message_size))) { in netagent_send_tokens_needed()
579 …ERR, "Failed to send client tokens needed message on control unit %d", registration->control_unit); in netagent_send_tokens_needed()
894 netagent_free_registration_memory(struct netagent_registration *registration) in netagent_free_registration_memory() argument
906 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_free_registration_memory()
907 NETAGENT_UNLOCK(registration); in netagent_free_registration_memory()
908 lck_rw_destroy(&registration->agent_lock, &netagent_mtx_grp); in netagent_free_registration_memory()
910 kfree_data_sized_by(registration->netagent, registration->netagent_alloc_size); in netagent_free_registration_memory()
911 kfree_type(struct netagent_registration, registration); in netagent_free_registration_memory()
915 netagent_free_registration(struct netagent_registration *registration) in netagent_free_registration() argument
920 TAILQ_FOREACH_SAFE(search_token, &registration->token_list, token_chain, temp_token) { in netagent_free_registration()
921 TAILQ_REMOVE(&registration->token_list, search_token, token_chain); in netagent_free_registration()
928 LIST_FOREACH_SAFE(search_client, &registration->pending_triggers_list, client_chain, temp_client) { in netagent_free_registration()
934 netagent_free_registration_memory(registration); in netagent_free_registration()
945 struct netagent_registration *registration = NULL; in netagent_unregister_all_session_registrations() local
947 TAILQ_FOREACH_SAFE(registration, &session->registrations, session_chain, temp_registration) { in netagent_unregister_all_session_registrations()
951 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) && in netagent_unregister_all_session_registrations()
956 LIST_REMOVE(registration, global_chain); in netagent_unregister_all_session_registrations()
957 TAILQ_REMOVE(&session->registrations, registration, session_chain); in netagent_unregister_all_session_registrations()
958 TAILQ_INSERT_TAIL(&deleting_registrations, registration, session_chain); in netagent_unregister_all_session_registrations()
965 struct netagent_registration *registration = NULL; in netagent_unregister_all_session_registrations() local
967 TAILQ_FOREACH_SAFE(registration, &deleting_registrations, session_chain, temp_registration) { in netagent_unregister_all_session_registrations()
968 TAILQ_REMOVE(&deleting_registrations, registration, session_chain); in netagent_unregister_all_session_registrations()
970 ifnet_clear_netagent(registration->netagent->netagent_uuid); in netagent_unregister_all_session_registrations()
971 …netagent_post_event(registration->netagent->netagent_uuid, KEV_NETAGENT_UNREGISTERED, TRUE, false); in netagent_unregister_all_session_registrations()
973 netagent_free_registration(registration); in netagent_unregister_all_session_registrations()
984 struct netagent_registration *registration = NULL; in netagent_unregister_one_session_registration() local
986 TAILQ_FOREACH_SAFE(registration, &session->registrations, session_chain, temp_registration) { in netagent_unregister_one_session_registration()
987 if (uuid_compare(agent_id, registration->netagent->netagent_uuid) != 0) { in netagent_unregister_one_session_registration()
995 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) && in netagent_unregister_one_session_registration()
1000 LIST_REMOVE(registration, global_chain); in netagent_unregister_one_session_registration()
1001 TAILQ_REMOVE(&session->registrations, registration, session_chain); in netagent_unregister_one_session_registration()
1004 netagent_free_registration(registration); in netagent_unregister_one_session_registration()
1361 netagent_send_cellular_failed_event(struct netagent_registration *registration, in netagent_send_cellular_failed_event() argument
1364 if (strlcmp(registration->netagent->netagent_domain, "Cellular", NETAGENT_DOMAINSIZE) != 0) { in netagent_send_cellular_failed_event()
1393 struct netagent_registration *registration = NULL; in netagent_handle_update_inner() local
1395registration = netagent_session_find_agent_with_uuid_and_lock(session, new_registration->netagent-… in netagent_handle_update_inner()
1397 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_update_inner()
1400 if (registration == NULL) { in netagent_handle_update_inner()
1407 …if (uuid_compare(registration->netagent->netagent_uuid, new_registration->netagent->netagent_uuid)… in netagent_handle_update_inner()
1408 memcmp(&registration->netagent->netagent_domain, &new_registration->netagent->netagent_domain, in netagent_handle_update_inner()
1410 memcmp(&registration->netagent->netagent_type, &new_registration->netagent->netagent_type, in netagent_handle_update_inner()
1412 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1425 if (registration->netagent->netagent_data_size == new_registration->netagent->netagent_data_size && in netagent_handle_update_inner()
1426 memcmp(registration->netagent, new_registration->netagent, sizeof(struct netagent)) == 0 && in netagent_handle_update_inner()
1427 …memcmp(netagent_get_data(registration->netagent), netagent_get_data(new_registration->netagent), d… in netagent_handle_update_inner()
1435 …LIST_FOREACH_SAFE(search_client, &registration->pending_triggers_list, client_chain, temp_client) { in netagent_handle_update_inner()
1439 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1447 …necp_force_update_client(search_client->client_id, registration->netagent->netagent_uuid, registra… in netagent_handle_update_inner()
1458 new_registration->use_count = registration->use_count; in netagent_handle_update_inner()
1461 TAILQ_CONCAT(&new_registration->token_list, &registration->token_list, token_chain); in netagent_handle_update_inner()
1462 new_registration->token_count = registration->token_count; in netagent_handle_update_inner()
1463 new_registration->token_low_water = registration->token_low_water; in netagent_handle_update_inner()
1464 new_registration->last_client_error = registration->last_client_error; in netagent_handle_update_inner()
1465 new_registration->client_error_count = registration->client_error_count; in netagent_handle_update_inner()
1466 new_registration->allow_multiple_registrations = registration->allow_multiple_registrations; in netagent_handle_update_inner()
1469 !(registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_handle_update_inner()
1472 (registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) && in netagent_handle_update_inner()
1477 TAILQ_REMOVE(&session->registrations, registration, session_chain); in netagent_handle_update_inner()
1478 LIST_REMOVE(registration, global_chain); in netagent_handle_update_inner()
1479 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1480 netagent_free_registration(registration); in netagent_handle_update_inner()
1691 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_assign_nexus() local
1692 if (registration == NULL) { in netagent_assign_nexus()
1697 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_assign_nexus()
1698 NETAGENT_UNLOCK(registration); in netagent_assign_nexus()
1728 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_update_flow_protoctl_event() local
1729 if (registration == NULL) { in netagent_update_flow_protoctl_event()
1734 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_update_flow_protoctl_event()
1735 NETAGENT_UNLOCK(registration); in netagent_update_flow_protoctl_event()
1777 struct netagent_registration *registration = NULL; in netagent_handle_assign_nexus_setopt() local
1781 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_assign_nexus_setopt()
1783 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_assign_nexus_setopt()
1786 if (registration == NULL) { in netagent_handle_assign_nexus_setopt()
1793 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_nexus_setopt()
1794 NETAGENT_UNLOCK(registration); in netagent_handle_assign_nexus_setopt()
1849 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_handle_assign_nexus_message() local
1850 if (registration == NULL) { in netagent_handle_assign_nexus_message()
1856 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_nexus_message()
1857 NETAGENT_UNLOCK(registration); in netagent_handle_assign_nexus_message()
1940 struct netagent_registration *registration = NULL; in netagent_handle_assign_group_setopt() local
1944 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_assign_group_setopt()
1946 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_assign_group_setopt()
1949 if (registration == NULL) { in netagent_handle_assign_group_setopt()
1956 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_group_setopt()
1957 NETAGENT_UNLOCK(registration); in netagent_handle_assign_group_setopt()
2025 struct netagent_registration *registration = NULL; in netagent_handle_use_count_setopt() local
2029 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_use_count_setopt()
2031 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_use_count_setopt()
2034 if (registration == NULL) { in netagent_handle_use_count_setopt()
2041 registration->use_count = use_count; in netagent_handle_use_count_setopt()
2042 NETAGENT_UNLOCK(registration); in netagent_handle_use_count_setopt()
2077 struct netagent_registration *registration = NULL; in netagent_handle_use_count_getopt() local
2081 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_use_count_getopt()
2083 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_use_count_getopt()
2086 if (registration == NULL) { in netagent_handle_use_count_getopt()
2093 use_count = registration->use_count; in netagent_handle_use_count_getopt()
2094 NETAGENT_UNLOCK(registration); in netagent_handle_use_count_getopt()
2131 struct netagent_registration *registration = NULL; in netagent_handle_add_token_setopt() local
2135 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_add_token_setopt()
2137 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_add_token_setopt()
2140 if (registration == NULL) { in netagent_handle_add_token_setopt()
2147 if (registration->token_count >= NETAGENT_MAX_TOKEN_COUNT) { in netagent_handle_add_token_setopt()
2148 NETAGENT_UNLOCK(registration); in netagent_handle_add_token_setopt()
2162 TAILQ_INSERT_TAIL(&registration->token_list, token_struct, token_chain); in netagent_handle_add_token_setopt()
2164 registration->token_count++; in netagent_handle_add_token_setopt()
2167 registration->need_tokens_event_deadline = 0; in netagent_handle_add_token_setopt()
2169 NETAGENT_UNLOCK(registration); in netagent_handle_add_token_setopt()
2187 struct netagent_registration *registration = NULL; in netagent_handle_flush_tokens_setopt() local
2198 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_flush_tokens_setopt()
2200 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_flush_tokens_setopt()
2203 if (registration == NULL) { in netagent_handle_flush_tokens_setopt()
2212 TAILQ_FOREACH_SAFE(search_token, &registration->token_list, token_chain, temp_token) { in netagent_handle_flush_tokens_setopt()
2213 TAILQ_REMOVE(&registration->token_list, search_token, token_chain); in netagent_handle_flush_tokens_setopt()
2216 registration->token_count = 0; in netagent_handle_flush_tokens_setopt()
2217 NETAGENT_UNLOCK(registration); in netagent_handle_flush_tokens_setopt()
2251 struct netagent_registration *registration = NULL; in netagent_handle_token_count_getopt() local
2255 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_token_count_getopt()
2257 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_token_count_getopt()
2260 if (registration == NULL) { in netagent_handle_token_count_getopt()
2267 token_count = registration->token_count; in netagent_handle_token_count_getopt()
2268 NETAGENT_UNLOCK(registration); in netagent_handle_token_count_getopt()
2308 struct netagent_registration *registration = NULL; in netagent_handle_token_low_water_setopt() local
2312 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_token_low_water_setopt()
2314 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_token_low_water_setopt()
2317 if (registration == NULL) { in netagent_handle_token_low_water_setopt()
2324 registration->token_low_water = token_low_water; in netagent_handle_token_low_water_setopt()
2325 NETAGENT_UNLOCK(registration); in netagent_handle_token_low_water_setopt()
2360 struct netagent_registration *registration = NULL; in netagent_handle_token_low_water_getopt() local
2364 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_token_low_water_getopt()
2366 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_token_low_water_getopt()
2369 if (registration == NULL) { in netagent_handle_token_low_water_getopt()
2376 token_low_water = registration->token_low_water; in netagent_handle_token_low_water_getopt()
2377 NETAGENT_UNLOCK(registration); in netagent_handle_token_low_water_getopt()
2399 struct netagent_registration *registration = NULL; in netagent_handle_reset_client_error_setopt() local
2410 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_reset_client_error_setopt()
2412 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_reset_client_error_setopt()
2415 if (registration == NULL) { in netagent_handle_reset_client_error_setopt()
2424 TAILQ_FOREACH_SAFE(search_token, &registration->token_list, token_chain, temp_token) { in netagent_handle_reset_client_error_setopt()
2425 TAILQ_REMOVE(&registration->token_list, search_token, token_chain); in netagent_handle_reset_client_error_setopt()
2428 registration->last_client_error = 0; in netagent_handle_reset_client_error_setopt()
2429 registration->client_error_count = 0; in netagent_handle_reset_client_error_setopt()
2431 NETAGENT_UNLOCK(registration); in netagent_handle_reset_client_error_setopt()
2467 struct netagent_registration *registration = NULL; in netagent_find_agent_with_uuid_and_lock() local
2468 LIST_FOREACH(registration, &shared_netagent_list, global_chain) { in netagent_find_agent_with_uuid_and_lock()
2469 if (uuid_compare(registration->netagent->netagent_uuid, uuid) == 0) { in netagent_find_agent_with_uuid_and_lock()
2472 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_find_agent_with_uuid_and_lock()
2474 NETAGENT_LOCK_SHARED(registration); in netagent_find_agent_with_uuid_and_lock()
2477 return registration; in netagent_find_agent_with_uuid_and_lock()
2489 struct netagent_registration *registration = NULL; in netagent_session_find_agent_with_uuid_and_lock() local
2490 TAILQ_FOREACH(registration, &session->registrations, session_chain) { in netagent_session_find_agent_with_uuid_and_lock()
2491 if (uuid_compare(registration->netagent->netagent_uuid, uuid) == 0) { in netagent_session_find_agent_with_uuid_and_lock()
2494 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_session_find_agent_with_uuid_and_lock()
2496 NETAGENT_LOCK_SHARED(registration); in netagent_session_find_agent_with_uuid_and_lock()
2499 return registration; in netagent_session_find_agent_with_uuid_and_lock()
2511 struct netagent_registration *registration = TAILQ_FIRST(&session->registrations); in netagent_session_access_agent_with_lock() local
2512 if (registration != NULL) { in netagent_session_access_agent_with_lock()
2515 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_session_access_agent_with_lock()
2517 NETAGENT_LOCK_SHARED(registration); in netagent_session_access_agent_with_lock()
2522 return registration; in netagent_session_access_agent_with_lock()
2590 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(ifsir32->netag… in netagent_ioctl() local
2591 if (registration == NULL) { in netagent_ioctl()
2595 uuid_copy(ifsir32->netagent_uuid, registration->netagent->netagent_uuid); in netagent_ioctl()
2596 …memcpy(ifsir32->netagent_domain, registration->netagent->netagent_domain, sizeof(ifsir32->netagent… in netagent_ioctl()
2597 …memcpy(ifsir32->netagent_type, registration->netagent->netagent_type, sizeof(ifsir32->netagent_typ… in netagent_ioctl()
2598 …memcpy(ifsir32->netagent_desc, registration->netagent->netagent_desc, sizeof(ifsir32->netagent_des… in netagent_ioctl()
2599 ifsir32->netagent_flags = registration->netagent->netagent_flags; in netagent_ioctl()
2602 ifsir32->netagent_data_size = registration->netagent->netagent_data_size; in netagent_ioctl()
2604 ifsir32->netagent_data_size == registration->netagent->netagent_data_size) { in netagent_ioctl()
2606 …error = copyout(netagent_get_data(registration->netagent), ifsir32->netagent_data, registration->n… in netagent_ioctl()
2610 NETAGENT_UNLOCK(registration); in netagent_ioctl()
2615 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(ifsir64->netag… in netagent_ioctl() local
2616 if (registration == NULL) { in netagent_ioctl()
2620 uuid_copy(ifsir64->netagent_uuid, registration->netagent->netagent_uuid); in netagent_ioctl()
2621 …memcpy(ifsir64->netagent_domain, registration->netagent->netagent_domain, sizeof(ifsir64->netagent… in netagent_ioctl()
2622 …memcpy(ifsir64->netagent_type, registration->netagent->netagent_type, sizeof(ifsir64->netagent_typ… in netagent_ioctl()
2623 …memcpy(ifsir64->netagent_desc, registration->netagent->netagent_desc, sizeof(ifsir64->netagent_des… in netagent_ioctl()
2624 ifsir64->netagent_flags = registration->netagent->netagent_flags; in netagent_ioctl()
2627 ifsir64->netagent_data_size = registration->netagent->netagent_data_size; in netagent_ioctl()
2629 ifsir64->netagent_data_size == registration->netagent->netagent_data_size) { in netagent_ioctl()
2631 …error = copyout(netagent_get_data(registration->netagent), ifsir64->netagent_data, registration->n… in netagent_ioctl()
2635 NETAGENT_UNLOCK(registration); in netagent_ioctl()
2700 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_flags() local
2701 if (registration != NULL) { in netagent_get_flags()
2702 flags = registration->netagent->netagent_flags; in netagent_get_flags()
2703 NETAGENT_UNLOCK(registration); in netagent_get_flags()
2719 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, true, fa… in netagent_set_flags() local
2720 if (registration != NULL) { in netagent_set_flags()
2724 registration->netagent->netagent_flags & NETAGENT_FLAG_REGISTERED; in netagent_set_flags()
2726 if (registration->netagent->netagent_flags != flags) { in netagent_set_flags()
2727 registration->netagent->netagent_flags = flags; in netagent_set_flags()
2728 registration->generation = g_next_generation++; in netagent_set_flags()
2731 NETAGENT_UNLOCK(registration); in netagent_set_flags()
2750 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_generation() local
2751 if (registration != NULL) { in netagent_get_generation()
2752 generation = registration->generation; in netagent_get_generation()
2753 NETAGENT_UNLOCK(registration); in netagent_get_generation()
2772 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_agent_domain_and_type() local
2773 if (registration != NULL) { in netagent_get_agent_domain_and_type()
2775 memcpy(domain, registration->netagent->netagent_domain, NETAGENT_DOMAINSIZE); in netagent_get_agent_domain_and_type()
2776 memcpy(type, registration->netagent->netagent_type, NETAGENT_TYPESIZE); in netagent_get_agent_domain_and_type()
2777 NETAGENT_UNLOCK(registration); in netagent_get_agent_domain_and_type()
2792 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_kernel_trigger() local
2793 if (registration == NULL) { in netagent_kernel_trigger()
2799 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_KERNEL_ACTIVATED) == 0) { in netagent_kernel_trigger()
2806 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_kernel_trigger()
2813 …error = netagent_send_trigger(registration, current_proc(), NETAGENT_TRIGGER_FLAG_KERNEL, NETAGENT… in netagent_kernel_trigger()
2816 if (registration != NULL) { in netagent_kernel_trigger()
2817 NETAGENT_UNLOCK(registration); in netagent_kernel_trigger()
2851 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_client_message_with_params() local
2852 if (registration == NULL) { in netagent_client_message_with_params()
2859 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_USER_ACTIVATED) == 0) { in netagent_client_message_with_params()
2877 netagent_send_cellular_failed_event(registration, report_pid, report_proc_uuid); in netagent_client_message_with_params()
2883 bool is_nexus_agent = ((registration->netagent->netagent_flags & in netagent_client_message_with_params()
2896 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) == 0) { in netagent_client_message_with_params()
2904 …bool is_group_agent = ((registration->netagent->netagent_flags & (NETAGENT_FLAG_SUPPORTS_GROUPS)) … in netagent_client_message_with_params()
2911 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) == 0) { in netagent_client_message_with_params()
2919 if (registration->control_unit == 0) { in netagent_client_message_with_params()
2920 if (registration->event_handler == NULL) { in netagent_client_message_with_params()
2931 error = registration->event_handler(message_type, necp_client_uuid, pid, handle, in netagent_client_message_with_params()
2932 registration->event_context, parameters, in netagent_client_message_with_params()
2948 if (registration->last_client_error != client_error || // Always notify for an error change in netagent_client_message_with_params()
2950 … (client_error == 0 && registration->client_error_count == 0) || // Only notify once for no-error in netagent_client_message_with_params()
2951 (client_error != 0 && registration->client_error_count < NETAGENT_MAX_CLIENT_ERROR_COUNT)) { in netagent_client_message_with_params()
2952 if (NETAGENT_LOCK_SHARED_TO_EXCLUSIVE(registration)) { in netagent_client_message_with_params()
2953 if (registration->last_client_error != client_error) { in netagent_client_message_with_params()
2954 registration->last_client_error = client_error; in netagent_client_message_with_params()
2955 registration->client_error_count = 1; in netagent_client_message_with_params()
2957 registration->client_error_count++; in netagent_client_message_with_params()
2959 … error = netagent_send_error_message(registration, necp_client_uuid, message_type, client_error); in netagent_client_message_with_params()
2967 …error = netagent_send_group_message(registration, necp_client_uuid, message_type, &parameters->u.g… in netagent_client_message_with_params()
2969 error = netagent_send_client_message(registration, necp_client_uuid, message_type); in netagent_client_message_with_params()
2972 if (NETAGENT_LOCK_SHARED_TO_EXCLUSIVE(registration)) { in netagent_client_message_with_params()
2990 LIST_INSERT_HEAD(&registration->pending_triggers_list, new_pending_client, client_chain); in netagent_client_message_with_params()
3005 if (should_unlock_registration && registration != NULL) { in netagent_client_message_with_params()
3006 NETAGENT_UNLOCK(registration); in netagent_client_message_with_params()
3029 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, tr… in netagent_use() local
3030 if (registration == NULL) { in netagent_use()
3036 uint64_t current_count = registration->use_count; in netagent_use()
3037 registration->use_count++; in netagent_use()
3044 if (registration != NULL) { in netagent_use()
3045 NETAGENT_UNLOCK(registration); in netagent_use()
3057 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_copyout() local
3058 if (registration == NULL) { in netagent_copyout()
3064 u_int32_t total_size = (sizeof(struct netagent) + registration->netagent->netagent_data_size); in netagent_copyout()
3071 u_int8_t *ptr = __unsafe_forge_bidi_indexable(u_int8_t *, registration->netagent, total_size); in netagent_copyout()
3076 if (registration != NULL) { in netagent_copyout()
3077 NETAGENT_UNLOCK(registration); in netagent_copyout()
3091 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, tr… in netagent_acquire_token() local
3092 if (registration == NULL) { in netagent_acquire_token()
3098 struct netagent_token *token = TAILQ_FIRST(&registration->token_list); in netagent_acquire_token()
3101 if (registration->token_low_water != 0) { in netagent_acquire_token()
3103 if (mach_absolute_time() >= registration->need_tokens_event_deadline) { in netagent_acquire_token()
3104 int event_error = netagent_send_tokens_needed(registration); in netagent_acquire_token()
3110 registration->need_tokens_event_deadline = deadline; in netagent_acquire_token()
3131 TAILQ_REMOVE(&registration->token_list, token, token_chain); in netagent_acquire_token()
3133 if (registration->token_count > 0) { in netagent_acquire_token()
3134 registration->token_count--; in netagent_acquire_token()
3136 if (registration->token_count < registration->token_low_water) { in netagent_acquire_token()
3137 (void)netagent_send_tokens_needed(registration); in netagent_acquire_token()
3140 if (registration != NULL) { in netagent_acquire_token()
3141 NETAGENT_UNLOCK(registration); in netagent_acquire_token()
3179 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_trigger() local
3180 if (registration == NULL) { in netagent_trigger()
3186 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_USER_ACTIVATED) == 0) { in netagent_trigger()
3193 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_trigger()
3200 …error = netagent_send_trigger(registration, p, NETAGENT_TRIGGER_FLAG_USER, NETAGENT_MESSAGE_TYPE_T… in netagent_trigger()
3203 if (registration != NULL) { in netagent_trigger()
3204 NETAGENT_UNLOCK(registration); in netagent_trigger()