Lines Matching defs:sockfd
119 #define DNSServiceRefValid(X) (dnssd_SocketValid((X)->sockfd) && (((X)->sockfd ^ (X)->validator) == ValidatorBits))
131 dnssd_sock_t sockfd; // Connected socket between client and daemon
385 // then sockfd could legitimately contain a failing value (e.g. dnssd_InvalidSocket)
386 if ((x->sockfd ^ x->validator) != ValidatorBits)
387 syslog(LOG_WARNING, "dnssd_clientstub attempt to dispose invalid DNSServiceRef %p %08X %08X", x, x->sockfd, x->validator);
392 x->sockfd = dnssd_InvalidSocket;
438 (*ref), (*ref)->sockfd, (*ref)->validator);
459 sdr->sockfd = dnssd_InvalidSocket;
460 sdr->validator = sdr->sockfd ^ ValidatorBits;
484 sdr->sockfd = (*ref)->sockfd; // Inherit primary's socket
487 //printf("ConnectToServer sharing socket %d\n", sdr->sockfd);
495 sdr->sockfd = socket(AF_DNSSD, SOCK_STREAM, 0);
496 sdr->validator = sdr->sockfd ^ ValidatorBits;
497 if (!dnssd_SocketValid(sdr->sockfd))
505 if (setsockopt(sdr->sockfd, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval)) < 0)
518 if (setsockopt(sdr->sockfd, SOL_SOCKET, SO_DEFUNCTOK, &defunct, sizeof(defunct)) < 0)
526 int err = connect(sdr->sockfd, (struct sockaddr *) &saddr, sizeof(saddr));
534 else { dnssd_close(sdr->sockfd); FreeDNSServiceOp(sdr); return kDNSServiceErr_ServiceNotRunning; }
536 //printf("ConnectToServer opened socket %d\n", sdr->sockfd);
566 syslog(LOG_WARNING, "dnssd_clientstub deliver_request: invalid DNSServiceRef %p %08X %08X", sdr, sdr->sockfd, sdr->validator);
652 if (write_all(sdr->sockfd, ((char *)hdr)+i, 1) < 0)
657 if (write_all(sdr->sockfd, (char *)hdr, datalen + sizeof(ipc_msg_hdr)) < 0)
663 sdr->sockfd, (unsigned long)(datalen + sizeof(ipc_msg_hdr)));
668 if (!MakeSeparateReturnSocket) errsd = sdr->sockfd;
738 if (sendmsg(sdr->sockfd, &msg, 0) < 0)
796 sdRef, sdRef->sockfd, sdRef->validator);
806 return (int) sdRef->sockfd;
885 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceProcessResult called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);
912 int result = read_all(sdRef->sockfd, (void *)&cbh.ipc_hdr, sizeof(cbh.ipc_hdr));
953 if (read_all(sdRef->sockfd, data, cbh.ipc_hdr.datalen) < 0) // On error, read_all will write a message to syslog for us
984 morebytes = more_bytes(sdRef->sockfd);
1011 if (!DNSServiceRefValid(sdRef)) // Also verifies dnssd_SocketValid(sdRef->sockfd) for us too
1013 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceRefDeallocate called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);
1032 write_all(sdRef->sockfd, (char *)hdr, len);
1060 else if (!sdRef->disp_queue) dnssd_close(sdRef->sockfd);
1062 dnssd_close(sdRef->sockfd);
1091 if (read_all(tmp->sockfd, (char*)&actualsize, (int)sizeof(actualsize)) < 0)
1095 if (read_all(tmp->sockfd, (char*)result, actualsize < *size ? actualsize : *size) < 0)
1634 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceRegisterRecord called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);
1710 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceAddRecord called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);
1765 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceUpdateRecord called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);
1804 syslog(LOG_WARNING, "dnssd_clientstub DNSServiceRemoveRecord called with invalid DNSServiceRef %p %08X %08X", sdRef, sdRef->sockfd, sdRef->validator);