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()
1363 netagent_send_cellular_failed_event(struct netagent_registration *registration, in netagent_send_cellular_failed_event() argument
1366 if (strlcmp(registration->netagent->netagent_domain, "Cellular", NETAGENT_DOMAINSIZE) != 0) { in netagent_send_cellular_failed_event()
1395 struct netagent_registration *registration = NULL; in netagent_handle_update_inner() local
1397registration = netagent_session_find_agent_with_uuid_and_lock(session, new_registration->netagent-… in netagent_handle_update_inner()
1399 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_update_inner()
1402 if (registration == NULL) { in netagent_handle_update_inner()
1409 …if (uuid_compare(registration->netagent->netagent_uuid, new_registration->netagent->netagent_uuid)… in netagent_handle_update_inner()
1410 memcmp(&registration->netagent->netagent_domain, &new_registration->netagent->netagent_domain, in netagent_handle_update_inner()
1412 memcmp(&registration->netagent->netagent_type, &new_registration->netagent->netagent_type, in netagent_handle_update_inner()
1414 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1427 if (registration->netagent->netagent_data_size == new_registration->netagent->netagent_data_size && in netagent_handle_update_inner()
1428 memcmp(registration->netagent, new_registration->netagent, sizeof(struct netagent)) == 0 && in netagent_handle_update_inner()
1429 …memcmp(netagent_get_data(registration->netagent), netagent_get_data(new_registration->netagent), d… in netagent_handle_update_inner()
1437 …LIST_FOREACH_SAFE(search_client, &registration->pending_triggers_list, client_chain, temp_client) { in netagent_handle_update_inner()
1441 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1449 …necp_force_update_client(search_client->client_id, registration->netagent->netagent_uuid, registra… in netagent_handle_update_inner()
1460 new_registration->use_count = registration->use_count; in netagent_handle_update_inner()
1463 TAILQ_CONCAT(&new_registration->token_list, &registration->token_list, token_chain); in netagent_handle_update_inner()
1464 new_registration->token_count = registration->token_count; in netagent_handle_update_inner()
1465 new_registration->token_low_water = registration->token_low_water; in netagent_handle_update_inner()
1466 new_registration->last_client_error = registration->last_client_error; in netagent_handle_update_inner()
1467 new_registration->client_error_count = registration->client_error_count; in netagent_handle_update_inner()
1468 new_registration->allow_multiple_registrations = registration->allow_multiple_registrations; in netagent_handle_update_inner()
1471 !(registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_handle_update_inner()
1474 (registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) && in netagent_handle_update_inner()
1479 TAILQ_REMOVE(&session->registrations, registration, session_chain); in netagent_handle_update_inner()
1480 LIST_REMOVE(registration, global_chain); in netagent_handle_update_inner()
1481 NETAGENT_UNLOCK(registration); in netagent_handle_update_inner()
1482 netagent_free_registration(registration); in netagent_handle_update_inner()
1693 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_assign_nexus() local
1694 if (registration == NULL) { in netagent_assign_nexus()
1699 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_assign_nexus()
1700 NETAGENT_UNLOCK(registration); in netagent_assign_nexus()
1730 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_update_flow_protoctl_event() local
1731 if (registration == NULL) { in netagent_update_flow_protoctl_event()
1736 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_update_flow_protoctl_event()
1737 NETAGENT_UNLOCK(registration); in netagent_update_flow_protoctl_event()
1779 struct netagent_registration *registration = NULL; in netagent_handle_assign_nexus_setopt() local
1783 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_assign_nexus_setopt()
1785 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_assign_nexus_setopt()
1788 if (registration == NULL) { in netagent_handle_assign_nexus_setopt()
1795 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_nexus_setopt()
1796 NETAGENT_UNLOCK(registration); in netagent_handle_assign_nexus_setopt()
1851 …struct netagent_registration *registration = netagent_session_access_agent_with_lock(session, fals… in netagent_handle_assign_nexus_message() local
1852 if (registration == NULL) { in netagent_handle_assign_nexus_message()
1858 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_nexus_message()
1859 NETAGENT_UNLOCK(registration); in netagent_handle_assign_nexus_message()
1942 struct netagent_registration *registration = NULL; in netagent_handle_assign_group_setopt() local
1946 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_assign_group_setopt()
1948 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_assign_group_setopt()
1951 if (registration == NULL) { in netagent_handle_assign_group_setopt()
1958 uuid_copy(netagent_uuid, registration->netagent->netagent_uuid); in netagent_handle_assign_group_setopt()
1959 NETAGENT_UNLOCK(registration); in netagent_handle_assign_group_setopt()
2027 struct netagent_registration *registration = NULL; in netagent_handle_use_count_setopt() local
2031 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_use_count_setopt()
2033 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_use_count_setopt()
2036 if (registration == NULL) { in netagent_handle_use_count_setopt()
2043 registration->use_count = use_count; in netagent_handle_use_count_setopt()
2044 NETAGENT_UNLOCK(registration); in netagent_handle_use_count_setopt()
2079 struct netagent_registration *registration = NULL; in netagent_handle_use_count_getopt() local
2083 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_use_count_getopt()
2085 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_use_count_getopt()
2088 if (registration == NULL) { in netagent_handle_use_count_getopt()
2095 use_count = registration->use_count; in netagent_handle_use_count_getopt()
2096 NETAGENT_UNLOCK(registration); in netagent_handle_use_count_getopt()
2133 struct netagent_registration *registration = NULL; in netagent_handle_add_token_setopt() local
2137 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_add_token_setopt()
2139 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_add_token_setopt()
2142 if (registration == NULL) { in netagent_handle_add_token_setopt()
2149 if (registration->token_count >= NETAGENT_MAX_TOKEN_COUNT) { in netagent_handle_add_token_setopt()
2150 NETAGENT_UNLOCK(registration); in netagent_handle_add_token_setopt()
2164 TAILQ_INSERT_TAIL(&registration->token_list, token_struct, token_chain); in netagent_handle_add_token_setopt()
2166 registration->token_count++; in netagent_handle_add_token_setopt()
2169 registration->need_tokens_event_deadline = 0; in netagent_handle_add_token_setopt()
2171 NETAGENT_UNLOCK(registration); in netagent_handle_add_token_setopt()
2189 struct netagent_registration *registration = NULL; in netagent_handle_flush_tokens_setopt() local
2200 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_flush_tokens_setopt()
2202 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_flush_tokens_setopt()
2205 if (registration == NULL) { in netagent_handle_flush_tokens_setopt()
2214 TAILQ_FOREACH_SAFE(search_token, &registration->token_list, token_chain, temp_token) { in netagent_handle_flush_tokens_setopt()
2215 TAILQ_REMOVE(&registration->token_list, search_token, token_chain); in netagent_handle_flush_tokens_setopt()
2218 registration->token_count = 0; in netagent_handle_flush_tokens_setopt()
2219 NETAGENT_UNLOCK(registration); in netagent_handle_flush_tokens_setopt()
2253 struct netagent_registration *registration = NULL; in netagent_handle_token_count_getopt() local
2257 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_token_count_getopt()
2259 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_token_count_getopt()
2262 if (registration == NULL) { in netagent_handle_token_count_getopt()
2269 token_count = registration->token_count; in netagent_handle_token_count_getopt()
2270 NETAGENT_UNLOCK(registration); in netagent_handle_token_count_getopt()
2310 struct netagent_registration *registration = NULL; in netagent_handle_token_low_water_setopt() local
2314 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_token_low_water_setopt()
2316 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_token_low_water_setopt()
2319 if (registration == NULL) { in netagent_handle_token_low_water_setopt()
2326 registration->token_low_water = token_low_water; in netagent_handle_token_low_water_setopt()
2327 NETAGENT_UNLOCK(registration); in netagent_handle_token_low_water_setopt()
2362 struct netagent_registration *registration = NULL; in netagent_handle_token_low_water_getopt() local
2366 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, false, false); in netagent_handle_token_low_water_getopt()
2368 registration = netagent_session_access_agent_with_lock(session, false, false); in netagent_handle_token_low_water_getopt()
2371 if (registration == NULL) { in netagent_handle_token_low_water_getopt()
2378 token_low_water = registration->token_low_water; in netagent_handle_token_low_water_getopt()
2379 NETAGENT_UNLOCK(registration); in netagent_handle_token_low_water_getopt()
2401 struct netagent_registration *registration = NULL; in netagent_handle_reset_client_error_setopt() local
2412 registration = netagent_session_find_agent_with_uuid_and_lock(session, agent_uuid, true, false); in netagent_handle_reset_client_error_setopt()
2414 registration = netagent_session_access_agent_with_lock(session, true, false); in netagent_handle_reset_client_error_setopt()
2417 if (registration == NULL) { in netagent_handle_reset_client_error_setopt()
2426 TAILQ_FOREACH_SAFE(search_token, &registration->token_list, token_chain, temp_token) { in netagent_handle_reset_client_error_setopt()
2427 TAILQ_REMOVE(&registration->token_list, search_token, token_chain); in netagent_handle_reset_client_error_setopt()
2430 registration->last_client_error = 0; in netagent_handle_reset_client_error_setopt()
2431 registration->client_error_count = 0; in netagent_handle_reset_client_error_setopt()
2433 NETAGENT_UNLOCK(registration); in netagent_handle_reset_client_error_setopt()
2469 struct netagent_registration *registration = NULL; in netagent_find_agent_with_uuid_and_lock() local
2470 LIST_FOREACH(registration, &shared_netagent_list, global_chain) { in netagent_find_agent_with_uuid_and_lock()
2471 if (uuid_compare(registration->netagent->netagent_uuid, uuid) == 0) { in netagent_find_agent_with_uuid_and_lock()
2474 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_find_agent_with_uuid_and_lock()
2476 NETAGENT_LOCK_SHARED(registration); in netagent_find_agent_with_uuid_and_lock()
2479 return registration; in netagent_find_agent_with_uuid_and_lock()
2491 struct netagent_registration *registration = NULL; in netagent_session_find_agent_with_uuid_and_lock() local
2492 TAILQ_FOREACH(registration, &session->registrations, session_chain) { in netagent_session_find_agent_with_uuid_and_lock()
2493 if (uuid_compare(registration->netagent->netagent_uuid, uuid) == 0) { in netagent_session_find_agent_with_uuid_and_lock()
2496 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_session_find_agent_with_uuid_and_lock()
2498 NETAGENT_LOCK_SHARED(registration); in netagent_session_find_agent_with_uuid_and_lock()
2501 return registration; in netagent_session_find_agent_with_uuid_and_lock()
2513 struct netagent_registration *registration = TAILQ_FIRST(&session->registrations); in netagent_session_access_agent_with_lock() local
2514 if (registration != NULL) { in netagent_session_access_agent_with_lock()
2517 NETAGENT_LOCK_EXCLUSIVE(registration); in netagent_session_access_agent_with_lock()
2519 NETAGENT_LOCK_SHARED(registration); in netagent_session_access_agent_with_lock()
2524 return registration; in netagent_session_access_agent_with_lock()
2592 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(ifsir32->netag… in netagent_ioctl() local
2593 if (registration == NULL) { in netagent_ioctl()
2597 uuid_copy(ifsir32->netagent_uuid, registration->netagent->netagent_uuid); in netagent_ioctl()
2598 …memcpy(ifsir32->netagent_domain, registration->netagent->netagent_domain, sizeof(ifsir32->netagent… in netagent_ioctl()
2599 …memcpy(ifsir32->netagent_type, registration->netagent->netagent_type, sizeof(ifsir32->netagent_typ… in netagent_ioctl()
2600 …memcpy(ifsir32->netagent_desc, registration->netagent->netagent_desc, sizeof(ifsir32->netagent_des… in netagent_ioctl()
2601 ifsir32->netagent_flags = registration->netagent->netagent_flags; in netagent_ioctl()
2604 ifsir32->netagent_data_size = registration->netagent->netagent_data_size; in netagent_ioctl()
2606 ifsir32->netagent_data_size == registration->netagent->netagent_data_size) { in netagent_ioctl()
2608 …error = copyout(netagent_get_data(registration->netagent), ifsir32->netagent_data, registration->n… in netagent_ioctl()
2612 NETAGENT_UNLOCK(registration); in netagent_ioctl()
2617 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(ifsir64->netag… in netagent_ioctl() local
2618 if (registration == NULL) { in netagent_ioctl()
2622 uuid_copy(ifsir64->netagent_uuid, registration->netagent->netagent_uuid); in netagent_ioctl()
2623 …memcpy(ifsir64->netagent_domain, registration->netagent->netagent_domain, sizeof(ifsir64->netagent… in netagent_ioctl()
2624 …memcpy(ifsir64->netagent_type, registration->netagent->netagent_type, sizeof(ifsir64->netagent_typ… in netagent_ioctl()
2625 …memcpy(ifsir64->netagent_desc, registration->netagent->netagent_desc, sizeof(ifsir64->netagent_des… in netagent_ioctl()
2626 ifsir64->netagent_flags = registration->netagent->netagent_flags; in netagent_ioctl()
2629 ifsir64->netagent_data_size = registration->netagent->netagent_data_size; in netagent_ioctl()
2631 ifsir64->netagent_data_size == registration->netagent->netagent_data_size) { in netagent_ioctl()
2633 …error = copyout(netagent_get_data(registration->netagent), ifsir64->netagent_data, registration->n… in netagent_ioctl()
2637 NETAGENT_UNLOCK(registration); in netagent_ioctl()
2702 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_flags() local
2703 if (registration != NULL) { in netagent_get_flags()
2704 flags = registration->netagent->netagent_flags; in netagent_get_flags()
2705 NETAGENT_UNLOCK(registration); in netagent_get_flags()
2721 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, true, fa… in netagent_set_flags() local
2722 if (registration != NULL) { in netagent_set_flags()
2726 registration->netagent->netagent_flags & NETAGENT_FLAG_REGISTERED; in netagent_set_flags()
2728 if (registration->netagent->netagent_flags != flags) { in netagent_set_flags()
2729 registration->netagent->netagent_flags = flags; in netagent_set_flags()
2730 registration->generation = g_next_generation++; in netagent_set_flags()
2733 NETAGENT_UNLOCK(registration); in netagent_set_flags()
2752 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_generation() local
2753 if (registration != NULL) { in netagent_get_generation()
2754 generation = registration->generation; in netagent_get_generation()
2755 NETAGENT_UNLOCK(registration); in netagent_get_generation()
2774 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_get_agent_domain_and_type() local
2775 if (registration != NULL) { in netagent_get_agent_domain_and_type()
2777 memcpy(domain, registration->netagent->netagent_domain, NETAGENT_DOMAINSIZE); in netagent_get_agent_domain_and_type()
2778 memcpy(type, registration->netagent->netagent_type, NETAGENT_TYPESIZE); in netagent_get_agent_domain_and_type()
2779 NETAGENT_UNLOCK(registration); in netagent_get_agent_domain_and_type()
2794 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(uuid, false, f… in netagent_kernel_trigger() local
2795 if (registration == NULL) { in netagent_kernel_trigger()
2801 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_KERNEL_ACTIVATED) == 0) { in netagent_kernel_trigger()
2808 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_kernel_trigger()
2815 …error = netagent_send_trigger(registration, current_proc(), NETAGENT_TRIGGER_FLAG_KERNEL, NETAGENT… in netagent_kernel_trigger()
2818 if (registration != NULL) { in netagent_kernel_trigger()
2819 NETAGENT_UNLOCK(registration); in netagent_kernel_trigger()
2853 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_client_message_with_params() local
2854 if (registration == NULL) { in netagent_client_message_with_params()
2861 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_USER_ACTIVATED) == 0) { in netagent_client_message_with_params()
2879 netagent_send_cellular_failed_event(registration, report_pid, report_proc_uuid); in netagent_client_message_with_params()
2885 bool is_nexus_agent = ((registration->netagent->netagent_flags & in netagent_client_message_with_params()
2898 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) == 0) { in netagent_client_message_with_params()
2906 …bool is_group_agent = ((registration->netagent->netagent_flags & (NETAGENT_FLAG_SUPPORTS_GROUPS)) … in netagent_client_message_with_params()
2913 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE) == 0) { in netagent_client_message_with_params()
2921 if (registration->control_unit == 0) { in netagent_client_message_with_params()
2922 if (registration->event_handler == NULL) { in netagent_client_message_with_params()
2933 error = registration->event_handler(message_type, necp_client_uuid, pid, handle, in netagent_client_message_with_params()
2934 registration->event_context, parameters, in netagent_client_message_with_params()
2950 if (registration->last_client_error != client_error || // Always notify for an error change in netagent_client_message_with_params()
2952 … (client_error == 0 && registration->client_error_count == 0) || // Only notify once for no-error in netagent_client_message_with_params()
2953 (client_error != 0 && registration->client_error_count < NETAGENT_MAX_CLIENT_ERROR_COUNT)) { in netagent_client_message_with_params()
2954 if (NETAGENT_LOCK_SHARED_TO_EXCLUSIVE(registration)) { in netagent_client_message_with_params()
2955 if (registration->last_client_error != client_error) { in netagent_client_message_with_params()
2956 registration->last_client_error = client_error; in netagent_client_message_with_params()
2957 registration->client_error_count = 1; in netagent_client_message_with_params()
2959 registration->client_error_count++; in netagent_client_message_with_params()
2961 … error = netagent_send_error_message(registration, necp_client_uuid, message_type, client_error); in netagent_client_message_with_params()
2969 …error = netagent_send_group_message(registration, necp_client_uuid, message_type, &parameters->u.g… in netagent_client_message_with_params()
2971 error = netagent_send_client_message(registration, necp_client_uuid, message_type); in netagent_client_message_with_params()
2974 if (NETAGENT_LOCK_SHARED_TO_EXCLUSIVE(registration)) { in netagent_client_message_with_params()
2992 LIST_INSERT_HEAD(&registration->pending_triggers_list, new_pending_client, client_chain); in netagent_client_message_with_params()
3007 if (should_unlock_registration && registration != NULL) { in netagent_client_message_with_params()
3008 NETAGENT_UNLOCK(registration); in netagent_client_message_with_params()
3031 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, tr… in netagent_use() local
3032 if (registration == NULL) { in netagent_use()
3038 uint64_t current_count = registration->use_count; in netagent_use()
3039 registration->use_count++; in netagent_use()
3046 if (registration != NULL) { in netagent_use()
3047 NETAGENT_UNLOCK(registration); in netagent_use()
3059 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_copyout() local
3060 if (registration == NULL) { in netagent_copyout()
3066 u_int32_t total_size = (sizeof(struct netagent) + registration->netagent->netagent_data_size); in netagent_copyout()
3073 u_int8_t *ptr = __unsafe_forge_bidi_indexable(u_int8_t *, registration->netagent, total_size); in netagent_copyout()
3078 if (registration != NULL) { in netagent_copyout()
3079 NETAGENT_UNLOCK(registration); in netagent_copyout()
3093 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, tr… in netagent_acquire_token() local
3094 if (registration == NULL) { in netagent_acquire_token()
3100 struct netagent_token *token = TAILQ_FIRST(&registration->token_list); in netagent_acquire_token()
3103 if (registration->token_low_water != 0) { in netagent_acquire_token()
3105 if (mach_absolute_time() >= registration->need_tokens_event_deadline) { in netagent_acquire_token()
3106 int event_error = netagent_send_tokens_needed(registration); in netagent_acquire_token()
3112 registration->need_tokens_event_deadline = deadline; in netagent_acquire_token()
3133 TAILQ_REMOVE(&registration->token_list, token, token_chain); in netagent_acquire_token()
3135 if (registration->token_count > 0) { in netagent_acquire_token()
3136 registration->token_count--; in netagent_acquire_token()
3138 if (registration->token_count < registration->token_low_water) { in netagent_acquire_token()
3139 (void)netagent_send_tokens_needed(registration); in netagent_acquire_token()
3142 if (registration != NULL) { in netagent_acquire_token()
3143 NETAGENT_UNLOCK(registration); in netagent_acquire_token()
3181 …struct netagent_registration *registration = netagent_find_agent_with_uuid_and_lock(agent_uuid, fa… in netagent_trigger() local
3182 if (registration == NULL) { in netagent_trigger()
3188 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_USER_ACTIVATED) == 0) { in netagent_trigger()
3195 if ((registration->netagent->netagent_flags & NETAGENT_FLAG_ACTIVE)) { in netagent_trigger()
3202 …error = netagent_send_trigger(registration, p, NETAGENT_TRIGGER_FLAG_USER, NETAGENT_MESSAGE_TYPE_T… in netagent_trigger()
3205 if (registration != NULL) { in netagent_trigger()
3206 NETAGENT_UNLOCK(registration); in netagent_trigger()