FreeBSD/sys/netinet/in_mcast.c
/*
 * Graft a source entry into an existing socket-layer filter set,
 * maintaining any required invariants and checking allocations.
 *
 * The source is marked as being in the new filter mode at t1.
 *
 * Return the pointer to the new node, otherwise return NULL.
 */
Graft a source entry into an existing socket-layer filter set,
maintaining any required invariants and checking allocations.

The source is marked as being in the new filter mode at t1.

Return the pointer to the new node, otherwise return NULL.
Graft a source entry into an existing socket - layer filter set maintaining any required invariants and checking allocations . The source is marked as being in the new filter mode at t1 . Return the pointer to the new node otherwise return NULL .
static struct in_msource *
imf_graft(struct in_mfilter *imf, const uint8_t st1,
    const struct sockaddr_in *psin)
{
	struct ip_msource	*nims;
	struct in_msource	*lims;
	nims = malloc(sizeof(struct in_msource), M_INMFILTER,
	    M_NOWAIT | M_ZERO);
	if (nims == NULL)
		return (NULL);
	lims = (struct in_msource *)nims;
	lims->ims_haddr = ntohl(psin->sin_addr.s_addr);
	lims->imsl_st[0] = MCAST_UNDEFINED;
	lims->imsl_st[1] = st1;
	RB_INSERT(ip_msource_tree, &imf->imf_sources, nims);
	++imf->imf_nsrc;
	return (lims);
}
static struct in_msource * imf_graft ( struct in_mfilter * imf , const uint8_t st1 , const struct sockaddr_in * psin ) { struct ip_msource * nims ; struct in_msource * lims ; nims = malloc ( sizeof ( struct in_msource ) , M_INMFILTER , M_NOWAIT | M_ZERO ) ; if ( nims == NULL ) return ( NULL ) ; lims = ( struct in_msource * ) nims ; lims -> ims_haddr = ntohl ( psin -> sin_addr . s_addr ) ; lims -> imsl_st [ 0 ] = MCAST_UNDEFINED ; lims -> imsl_st [ 1 ] = st1 ; RB_INSERT ( ip_msource_tree , & imf -> imf_sources , nims ) ; ++ imf -> imf_nsrc ; return ( lims ) ; }
Graft a source entry into an existing socket-layer filter set,
 maintaining any required invariants and checking allocations.
Graft a source entry into an existing socket - layer filter set maintaining any required invariants and checking allocations .