Lines Matching +full:wire +full:- +full:or

9  * (c) NLnet Labs, 2004-2006
81 data->ss_family = AF_INET; in ldns_rdf2native_sockaddr_storage_port()
84 data_in->sin_port = (in_port_t)htons(port); in ldns_rdf2native_sockaddr_storage_port()
85 memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); in ldns_rdf2native_sockaddr_storage_port()
90 data->ss_family = AF_INET6; in ldns_rdf2native_sockaddr_storage_port()
93 data_in6->sin6_port = (in_port_t)htons(port); in ldns_rdf2native_sockaddr_storage_port()
94 memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); in ldns_rdf2native_sockaddr_storage_port()
117 if((flag = fcntl(sockfd, F_GETFL)) != -1) { in ldns_sock_nonblock()
119 if(fcntl(sockfd, F_SETFL, flag) == -1) { in ldns_sock_nonblock()
137 if((flag = fcntl(sockfd, F_GETFL)) != -1) { in ldns_sock_block()
139 if(fcntl(sockfd, F_SETFL, flag) == -1) { in ldns_sock_block()
184 else if(ret == -1) in ldns_sock_wait()
199 if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM,
201 return -1;
206 return -1;
219 return -1;
225 return -1;
231 /* wait(write) until connected or error */
238 return -1;
259 return -1;
269 return -1;
309 return -1;
346 if (sockfd == -1) {
377 if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM,
392 if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM,
395 return -1;
411 if (sockfd == -1) {
412 return -1;
415 if (from && bind(sockfd, (const struct sockaddr*)from, fromlen) == -1){
417 return -1;
422 return -1;
455 if (sockfd == -1) {
549 if ((ns->ss_family == AF_INET) &&
556 if ((ns->ss_family == AF_INET6) &&
572 for (retries = ldns_resolver_retry(r); retries > 0; retries--) {
584 for (retries = ldns_resolver_retry(r); retries > 0; retries--) {
632 ((tv_e.tv_sec - tv_s.tv_sec) * 1000) +
633 (tv_e.tv_usec - tv_s.tv_usec) / 1000);
698 if (bytes == -1 || (size_t) bytes != ldns_buffer_position(qbin) + 2 ) {
714 if (bytes == -1 || (size_t)bytes != ldns_buffer_position(qbin)) {
724 uint8_t *wire, *wireout; local
727 wire = LDNS_XMALLOC(uint8_t, LDNS_MAX_PACKETLEN);
728 if (!wire) {
733 wire_size = recvfrom(sockfd, (void*)wire, LDNS_MAX_PACKETLEN, 0,
737 if (wire_size == -1 || wire_size == 0) {
739 LDNS_FREE(wire);
744 wireout = LDNS_XREALLOC(wire, uint8_t, (size_t)wire_size);
745 if(!wireout) LDNS_FREE(wire);
753 uint8_t *wire; local
757 wire = LDNS_XMALLOC(uint8_t, 2);
758 if (!wire) {
766 LDNS_FREE(wire);
769 rc = recv(sockfd, (void*) (wire + bytes),
770 (size_t) (2 - bytes), 0);
771 if (rc == -1 || rc == 0) {
773 LDNS_FREE(wire);
779 wire_size = ldns_read_uint16(wire);
781 LDNS_FREE(wire);
782 wire = LDNS_XMALLOC(uint8_t, wire_size);
783 if (!wire) {
792 LDNS_FREE(wire);
795 rc = recv(sockfd, (void*) (wire + bytes),
796 (size_t) (wire_size - bytes), 0);
797 if (rc == -1 || rc == 0) {
798 LDNS_FREE(wire);
806 return wire;
812 uint8_t *wire; local
816 wire = LDNS_XMALLOC(uint8_t, 2);
817 if (!wire) {
823 rc = recv(sockfd, (void*) (wire + bytes),
824 (size_t) (2 - bytes), 0);
825 if (rc == -1 || rc == 0) {
827 LDNS_FREE(wire);
833 wire_size = ldns_read_uint16(wire);
835 LDNS_FREE(wire);
836 wire = LDNS_XMALLOC(uint8_t, wire_size);
837 if (!wire) {
844 rc = recv(sockfd, (void*) (wire + bytes),
845 (size_t) (wire_size - bytes), 0);
846 if (rc == -1 || rc == 0) {
847 LDNS_FREE(wire);
855 return wire;
866 switch(sock->ss_family) {
870 *port = ntohs((uint16_t)data_in->sin_port);
873 LDNS_IP4ADDRLEN, &data_in->sin_addr);
878 *port = ntohs((uint16_t)data_in6->sin6_port);
881 LDNS_IP6ADDRLEN, &data_in6->sin6_addr);
925 resolver->_socket == SOCK_INVALID;
931 resolver->_nameservers[ns_i],
934 if ((ns->ss_family == AF_INET) &&
942 if ((ns->ss_family == AF_INET6) &&
951 resolver->_socket = ldns_tcp_connect_from(
960 if (resolver->_socket == SOCK_INVALID) {
975 close_socket(resolver->_socket);
976 resolver->_socket = 0;
994 close_socket(resolver->_socket);
1006 close_socket(resolver->_socket);
1007 resolver->_socket = 0;
1012 if (ldns_tcp_send_query(query_wire, resolver->_socket, ns,
1022 close_socket(resolver->_socket);
1034 resolver->_axfr_soa_count = 0;