Lines Matching refs:hc

55 /* Timer queue for all hc related timers. */
87 * Given a hc object name, return a pointer to hc object if found.
92 ilbd_hc_t *hc;
94 for (hc = list_head(&ilbd_hc_list); hc != NULL;
95 hc = list_next(&ilbd_hc_list, hc)) {
96 if (strcasecmp(hc->ihc_name, name) == 0)
97 return (hc);
196 * Given the ilb_hc_info_t passed in (from the libilb), create a hc object
205 ilbd_hc_t *hc;
228 hc = ilbd_get_hc(hc_info->hci_name);
229 if (hc != NULL) {
262 /* Create and add the hc object */
263 hc = calloc(1, sizeof (ilbd_hc_t));
264 if (hc == NULL) {
269 (void) memcpy(&hc->ihc_info, hc_info, sizeof (ilb_hc_info_t));
270 if (strcasecmp(hc->ihc_test, ILB_HC_STR_TCP) == 0)
271 hc->ihc_test_type = ILBD_HC_TCP;
272 else if (strcasecmp(hc->ihc_test, ILB_HC_STR_UDP) == 0)
273 hc->ihc_test_type = ILBD_HC_UDP;
274 else if (strcasecmp(hc->ihc_test, ILB_HC_STR_PING) == 0)
275 hc->ihc_test_type = ILBD_HC_PING;
277 hc->ihc_test_type = ILBD_HC_USER;
278 list_create(&hc->ihc_rules, sizeof (ilbd_hc_rule_t),
283 if ((ret = ilbd_create_pg(ILBD_SCF_HC, (void *)hc)) !=
287 free(hc);
293 list_insert_tail(&ilbd_hc_list, hc);
299 * Given a name of a hc object, destroy it.
306 ilbd_hc_t *hc;
319 hc = ilbd_get_hc(hc_name);
320 if (hc == NULL) {
328 /* If hc is in use, cannot delete it */
329 if (hc->ihc_rule_cnt > 0) {
346 list_remove(&ilbd_hc_list, hc);
347 free(hc);
353 * Given a hc object name, return its information. Used by libilb to
354 * get hc info.
359 ilbd_hc_t *hc;
363 hc = ilbd_get_hc(hc_name);
364 if (hc == NULL) {
372 (void) strlcpy(hc_info->hci_name, hc->ihc_name, sizeof (hc->ihc_name));
373 (void) strlcpy(hc_info->hci_test, hc->ihc_test, sizeof (hc->ihc_test));
374 hc_info->hci_timeout = hc->ihc_timeout;
375 hc_info->hci_count = hc->ihc_count;
376 hc_info->hci_interval = hc->ihc_interval;
377 hc_info->hci_def_ping = hc->ihc_def_ping;
428 * Given a rule name, return the hc status of its servers.
433 ilbd_hc_t *hc;
436 for (hc = list_head(&ilbd_hc_list); hc != NULL;
437 hc = list_next(&ilbd_hc_list, hc)) {
438 for (hc_rule = list_head(&hc->ihc_rules); hc_rule != NULL;
439 hc_rule = list_next(&hc->ihc_rules, hc_rule)) {
452 * Initialize the hc timer and associate the notification of timeout to
462 logerr("%s: cannot create hc timer queue", __func__);
698 ilbd_hc_restart_timer(ilbd_hc_t *hc, ilbd_hc_srv_t *srv)
703 timeout = MAX((hc->ihc_interval >> 1) + (gethrtime() %
704 (hc->ihc_interval + 1)), 1);
710 if (hc->ihc_def_ping && hc->ihc_test_type != ILBD_HC_PING)
726 /* Helper routine to associate a server with its hc object. */
728 ilbd_hc_srv_add(ilbd_hc_t *hc, ilbd_hc_rule_t *hc_rule,
736 new_srv->shc_hc = hc;
747 ret = ilbd_hc_restart_timer(hc, new_srv);
774 /* Helper routine to dissociate a server from its hc object. */
794 /* Helper routine to dissociate all servers of a rule from its hc object. */
808 /* Associate a rule with its hc object. */
812 ilbd_hc_t *hc;
819 if ((hc = ilbd_get_hc(rule->irl_hcname)) == NULL) {
824 if ((hc->ihc_test_type == ILBD_HC_TCP &&
826 (hc->ihc_test_type == ILBD_HC_UDP &&
843 if ((ret = ilbd_hc_srv_add(hc, hc_rule, &ilbd_srv->isv_srv,
851 list_insert_tail(&hc->ihc_rules, hc_rule);
852 hc->ihc_rule_cnt++;
857 /* Dissociate a rule from its hc object. */
861 ilbd_hc_t *hc;
865 if ((hc = ilbd_get_hc(rule->irl_hcname)) == NULL) {
870 for (hc_rule = list_head(&hc->ihc_rules); hc_rule != NULL;
871 hc_rule = list_next(&hc->ihc_rules, hc_rule)) {
877 "with healtcheck %s", rule->irl_hcname, hc->ihc_name);
881 list_remove(&hc->ihc_rules, hc_rule);
882 hc->ihc_rule_cnt--;
887 * Given a hc object name and a rule, check to see if the rule is associated
888 * with the hc object. If it is, the hc object is returned in **hc and the
893 ilbd_hc_t **hc, ilbd_hc_rule_t **hc_rule)
903 *hc = tmp_hc;
911 /* Associate a server with its hc object. */
916 ilbd_hc_t *hc;
919 if (!ilbd_hc_check_rule(rule->irl_hcname, rule, &hc, &hc_rule))
921 return (ilbd_hc_srv_add(hc, hc_rule, srv, ev_port));
924 /* Dissociate a server from its hc object. */
928 ilbd_hc_t *hc;
931 if (!ilbd_hc_check_rule(rule->irl_hcname, rule, &hc, &hc_rule))
936 /* Helper routine to enable/disable a server's hc probe. */
941 ilbd_hc_t *hc;
946 if (!ilbd_hc_check_rule(rule->irl_hcname, rule, &hc, &hc_rule))
955 ret = ilbd_hc_restart_timer(hc, tmp_srv);
994 * Helper routine to enable/disable a rule's hc probe (including all its
1000 ilbd_hc_t *hc;
1005 if (!ilbd_hc_check_rule(rule->irl_hcname, rule, &hc, &hc_rule))
1018 ret = ilbd_hc_restart_timer(hc, tmp_srv);
1051 (void) ilbd_hc_restart_timer(hc, tmp_srv);
1102 * Create the argument list to be passed to a hc probe command.
1261 /* Spawn a process to run the hc probe on the given server. */