xnu-4903.241.1/bsd/net/if_llatbl.c
/*
 * Helper function used to pre-compute full/partial link-layer
 * header data suitable for feeding into if_output().
 */
Helper function used to pre-compute full/partial link-layer
header data suitable for feeding into if_output().
Helper function used to pre - compute full / partial link - layer header data suitable for feeding into if_output () .
int
lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr,
    char *buf, size_t *bufsize, int *lladdr_off)
{
	struct if_encap_req ereq;
	int error;
	bzero(buf, *bufsize);
	bzero(&ereq, sizeof(ereq));
	ereq.buf = buf;
	ereq.bufsize = *bufsize;
	ereq.rtype = IFENCAP_LL;
	ereq.family = family;
	ereq.lladdr = lladdr;
	ereq.lladdr_len = ifp->if_addrlen;
	error = ifp->if_requestencap(ifp, &ereq);
	if (error == 0) {
		*bufsize = ereq.bufsize;
		*lladdr_off = ereq.lladdr_off;
	}
	return (error);
}
int lltable_calc_llheader ( struct ifnet * ifp , int family , char * lladdr , char * buf , size_t * bufsize , int * lladdr_off ) { struct if_encap_req ereq ; int error ; bzero ( buf , * bufsize ) ; bzero ( & ereq , sizeof ( ereq ) ) ; ereq . buf = buf ; ereq . bufsize = * bufsize ; ereq . rtype = IFENCAP_LL ; ereq . family = family ; ereq . lladdr = lladdr ; ereq . lladdr_len = ifp -> if_addrlen ; error = ifp -> if_requestencap ( ifp , & ereq ) ; if ( error == 0 ) { * bufsize = ereq . bufsize ; * lladdr_off = ereq . lladdr_off ; } return ( error ) ; }
Helper function used to pre-compute full/partial link-layer
 header data suitable for feeding into if_output().
Helper function used to pre - compute full / partial link - layer header data suitable for feeding into if_output () .