Lines Matching defs:isns

52 #include "isns.h"
119 struct isns *is, *istmp;
750 struct isns *isns;
752 isns = calloc(1, sizeof(*isns));
753 if (isns == NULL)
755 isns->i_conf = conf;
756 TAILQ_INSERT_TAIL(&conf->conf_isns, isns, i_next);
757 isns->i_addr = checked_strdup(addr);
759 if (parse_addr_port(isns->i_addr, "3205", &isns->i_ai)) {
760 log_warnx("invalid iSNS address %s", isns->i_addr);
761 isns_delete(isns);
774 isns_delete(struct isns *isns)
777 TAILQ_REMOVE(&isns->i_conf->conf_isns, isns, i_next);
778 free(isns->i_addr);
779 if (isns->i_ai != NULL)
780 freeaddrinfo(isns->i_ai);
781 free(isns);
785 isns_do_connect(struct isns *isns)
789 s = socket(isns->i_ai->ai_family, isns->i_ai->ai_socktype,
790 isns->i_ai->ai_protocol);
792 log_warn("socket(2) failed for %s", isns->i_addr);
795 if (connect(s, isns->i_ai->ai_addr, isns->i_ai->ai_addrlen)) {
796 log_warn("connect(2) failed for %s", isns->i_addr);
804 isns_do_register(struct isns *isns, int s, const char *hostname)
806 struct conf *conf = isns->i_conf;
846 log_warn("send(2) failed for %s", isns->i_addr);
851 log_warn("receive(2) failed for %s", isns->i_addr);
856 log_warnx("iSNS register error %d for %s", error, isns->i_addr);
865 isns_do_check(struct isns *isns, int s, const char *hostname)
867 struct conf *conf = isns->i_conf;
879 log_warn("send(2) failed for %s", isns->i_addr);
884 log_warn("receive(2) failed for %s", isns->i_addr);
889 log_warnx("iSNS check error %d for %s", error, isns->i_addr);
898 isns_do_deregister(struct isns *isns, int s, const char *hostname)
900 struct conf *conf = isns->i_conf;
911 log_warn("send(2) failed for %s", isns->i_addr);
916 log_warn("receive(2) failed for %s", isns->i_addr);
921 log_warnx("iSNS deregister error %d for %s", error, isns->i_addr);
930 isns_register(struct isns *isns, struct isns *oldisns)
932 struct conf *conf = isns->i_conf;
940 s = isns_do_connect(isns);
950 oldisns = isns;
952 isns_do_register(isns, s, hostname);
958 isns_check(struct isns *isns)
960 struct conf *conf = isns->i_conf;
968 s = isns_do_connect(isns);
977 res = isns_do_check(isns, s, hostname);
979 isns_do_deregister(isns, s, hostname);
980 isns_do_register(isns, s, hostname);
987 isns_deregister(struct isns *isns)
989 struct conf *conf = isns->i_conf;
997 s = isns_do_connect(isns);
1004 isns_do_deregister(isns, s, hostname);
1908 struct isns *oldns, *newns;
2687 struct isns *newns;