Home | History | Annotate | Download | only in mDNSPosix

Lines Matching refs:intf

223 mDNSlocal void SocketDataReady(mDNS *const m, PosixNetworkInterface *intf, int skt)
235 const mDNSInterfaceID InterfaceID = intf ? intf->coreIntf.InterfaceID : NULL;
282 if (!intf)
289 if (packetInfo.ipi_ifname[0] != 0) reject = (strcmp(packetInfo.ipi_ifname, intf->intfName) != 0);
290 else if (packetInfo.ipi_ifindex != -1) reject = (packetInfo.ipi_ifindex != intf->index);
296 &intf->coreIntf.ip, intf->intfName, intf->index, skt);
311 &senderAddr, &destAddr, &intf->coreIntf.ip, intf->intfName, intf->index, skt);
527 PosixNetworkInterface *intf;
532 intf = (PosixNetworkInterface*)(m->HostInterfaces);
533 while ((intf != NULL) && (strcmp(intf->intfName, intfName) != 0))
534 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
536 return intf;
541 PosixNetworkInterface *intf;
549 intf = (PosixNetworkInterface*)(m->HostInterfaces);
550 while ((intf != NULL) && (mDNSu32) intf->index != index)
551 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
553 return (mDNSInterfaceID) intf;
558 PosixNetworkInterface *intf;
567 intf = (PosixNetworkInterface*)(m->HostInterfaces);
568 while ((intf != NULL) && (mDNSInterfaceID) intf != id)
569 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
571 return intf ? intf->index : 0;
576 mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
578 assert(intf != NULL);
579 if (intf->intfName != NULL) free((void *)intf->intfName);
580 if (intf->multicastSocket4 != -1) assert(close(intf->multicastSocket4) == 0);
582 if (intf->multicastSocket6 != -1) assert(close(intf->multicastSocket6) == 0);
584 free(intf);
594 PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
595 mDNS_DeregisterInterface(m, &intf->coreIntf, mDNSfalse);
596 if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
597 FreePosixNetworkInterface(intf);
830 PosixNetworkInterface *intf;
839 intf = (PosixNetworkInterface*)malloc(sizeof(*intf));
840 if (intf == NULL) { assert(0); err = ENOMEM; }
845 intf->intfName = strdup(intfName);
846 if (intf->intfName == NULL) { assert(0); err = ENOMEM; }
852 SockAddrTomDNSAddr(intfAddr, &intf->coreIntf.ip, NULL);
853 SockAddrTomDNSAddr(intfMask, &intf->coreIntf.mask, NULL);
855 //LogMsg("SetupOneInterface: %#a %#a", &intf->coreIntf.ip, &intf->coreIntf.mask);
856 strncpy(intf->coreIntf.ifname, intfName, sizeof(intf->coreIntf.ifname));
857 intf->coreIntf.ifname[sizeof(intf->coreIntf.ifname)-1] = 0;
858 intf->coreIntf.Advertise = m->AdvertiseLocalAddresses;
859 intf->coreIntf.McastTxRx = mDNStrue;
862 assert(intf->intfName != NULL); // intf->intfName already set up above
863 intf->index = intfIndex;
864 intf->multicastSocket4 = -1;
866 intf->multicastSocket6 = -1;
868 alias = SearchForInterfaceByName(m, intf->intfName);
869 if (alias == NULL) alias = intf;
870 intf->coreIntf.InterfaceID = (mDNSInterfaceID)alias;
872 if (alias != intf)
873 debugf("SetupOneInterface: %s %#a is an alias of %#a", intfName, &intf->coreIntf.ip, &alias->coreIntf.ip);
880 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket4);
883 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket6);
889 err = mDNS_RegisterInterface(m, &intf->coreIntf, mDNSfalse);
895 debugf("SetupOneInterface: %s %#a Registered", intf->intfName, &intf->coreIntf.ip);
897 fprintf(stderr, "Registered interface %s\n", intf->intfName);
901 // Use intfName instead of intf->intfName in the next line to avoid dereferencing NULL.
902 debugf("SetupOneInterface: %s %#a failed to register %d", intfName, &intf->coreIntf.ip, err);
903 if (intf) { FreePosixNetworkInterface(intf); intf = NULL; }
906 assert((err == 0) == (intf != NULL));
1403 mDNSexport mDNSBool mDNSPlatformValidRecordForInterface(AuthRecord *rr, const NetworkInterfaceInfo *intf)
1406 (void) intf;