Lines Matching defs:intf
217 mDNSlocal void SocketDataReady(mDNS *const m, PosixNetworkInterface *intf, int skt)
229 const mDNSInterfaceID InterfaceID = intf ? intf->coreIntf.InterfaceID : NULL;
276 if (!intf)
283 if (packetInfo.ipi_ifname[0] != 0) reject = (strcmp(packetInfo.ipi_ifname, intf->intfName) != 0);
284 else if (packetInfo.ipi_ifindex != -1) reject = (packetInfo.ipi_ifindex != intf->index);
290 &intf->coreIntf.ip, intf->intfName, intf->index, skt);
305 &senderAddr, &destAddr, &intf->coreIntf.ip, intf->intfName, intf->index, skt);
524 PosixNetworkInterface *intf;
529 intf = (PosixNetworkInterface*)(m->HostInterfaces);
530 while ((intf != NULL) && (strcmp(intf->intfName, intfName) != 0))
531 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
533 return intf;
538 PosixNetworkInterface *intf;
546 intf = (PosixNetworkInterface*)(m->HostInterfaces);
547 while ((intf != NULL) && (mDNSu32) intf->index != index)
548 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
550 return (mDNSInterfaceID) intf;
555 PosixNetworkInterface *intf;
564 intf = (PosixNetworkInterface*)(m->HostInterfaces);
565 while ((intf != NULL) && (mDNSInterfaceID) intf != id)
566 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
568 if (intf) return intf->index;
571 intf = gRecentInterfaces;
572 while ((intf != NULL) && (mDNSInterfaceID) intf != id)
573 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
575 return intf ? intf->index : 0;
580 mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
583 assert(intf != NULL);
584 if (intf->intfName != NULL) free((void *)intf->intfName);
585 if (intf->multicastSocket4 != -1)
587 rv = close(intf->multicastSocket4);
591 if (intf->multicastSocket6 != -1)
593 rv = close(intf->multicastSocket6);
599 intf->LastSeen = mDNSPlatformUTC();
600 intf->coreIntf.next = &gRecentInterfaces->coreIntf;
601 gRecentInterfaces = intf;
611 PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
612 mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation);
613 if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
614 FreePosixNetworkInterface(intf);
880 PosixNetworkInterface *intf;
889 intf = (PosixNetworkInterface*)calloc(1, sizeof(*intf));
890 if (intf == NULL) { assert(0); err = ENOMEM; }
895 intf->intfName = strdup(intfName);
896 if (intf->intfName == NULL) { assert(0); err = ENOMEM; }
902 SockAddrTomDNSAddr(intfAddr, &intf->coreIntf.ip, NULL);
903 SockAddrTomDNSAddr(intfMask, &intf->coreIntf.mask, NULL);
905 //LogMsg("SetupOneInterface: %#a %#a", &intf->coreIntf.ip, &intf->coreIntf.mask);
906 strncpy(intf->coreIntf.ifname, intfName, sizeof(intf->coreIntf.ifname));
907 intf->coreIntf.ifname[sizeof(intf->coreIntf.ifname)-1] = 0;
908 intf->coreIntf.Advertise = m->AdvertiseLocalAddresses;
909 intf->coreIntf.McastTxRx = mDNStrue;
912 assert(intf->intfName != NULL); // intf->intfName already set up above
913 intf->index = intfIndex;
914 intf->multicastSocket4 = -1;
916 intf->multicastSocket6 = -1;
918 alias = SearchForInterfaceByName(m, intf->intfName);
919 if (alias == NULL) alias = intf;
920 intf->coreIntf.InterfaceID = (mDNSInterfaceID)alias;
922 if (alias != intf)
923 debugf("SetupOneInterface: %s %#a is an alias of %#a", intfName, &intf->coreIntf.ip, &alias->coreIntf.ip);
930 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket4);
933 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket6);
939 intf->coreIntf.DirectLink = mDNSfalse;
942 intf->coreIntf.DirectLink = mDNStrue;
944 intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue;
948 err = mDNS_RegisterInterface(m, &intf->coreIntf, NormalActivation);
954 debugf("SetupOneInterface: %s %#a Registered", intf->intfName, &intf->coreIntf.ip);
956 fprintf(stderr, "Registered interface %s\n", intf->intfName);
960 // Use intfName instead of intf->intfName in the next line to avoid dereferencing NULL.
961 debugf("SetupOneInterface: %s %#a failed to register %d", intfName, &intf->coreIntf.ip, err);
962 if (intf) { FreePosixNetworkInterface(intf); intf = NULL; }
965 assert((err == 0) == (intf != NULL));
1610 mDNSexport mDNSBool mDNSPlatformValidQuestionForInterface(DNSQuestion *q, const NetworkInterfaceInfo *intf)
1613 (void) intf;