sys/netccitt/llc_subr.c
/*
 * Set sapinfo for SAP address, llcconfig, af, and interface
 */
Set sapinfo for SAP address, llcconfig, af, and interface
Set sapinfo for SAP address llcconfig af and interface
struct npaidbentry *
llc_setsapinfo(struct ifnet *ifp, u_char af, u_char sap, struct dllconfig *llconf)
{
	struct protosw *pp; 
	struct sockaddr_dl *ifdl_addr; 
	struct rtentry *sirt = (struct rtentry *)0; 
	struct npaidbentry *sapinfo; 
	u_char saploc; 
	int size = sizeof(struct npaidbentry);
	USES_AF_LINK_RTS;
	pp = pffindtype (af, SOCK_STREAM); 
	if (pp == 0 || pp->pr_input == 0 || pp->pr_ctlinput == 0) { 	
		printf("network	level protosw error"); 	
		return 0; 
	}
	ifdl_addr = sdl_getaddrif(ifp);
	sdl_copy(ifdl_addr, &sap_saddr); 
	sdl_copy(ifdl_addr, &sap_sgate);
	saploc = LLSAPLOC(&sap_saddr, ifp); 
	sap_saddr.sdl_data[saploc] = sap;
	sap_saddr.sdl_alen++;
	rtrequest(RTM_ADD, (struct sockaddr *)&sap_saddr,
			(struct sockaddr *)&sap_sgate, 0, 0, &sirt); 
	if (sirt == 0) 	
		return 0;
	sirt->rt_llinfo = malloc(size , M_PCB, M_WAITOK); 
	sapinfo = (struct npaidbentry *) sirt->rt_llinfo; 
	if (sapinfo) { 	
		bzero ((caddr_t)sapinfo, size); 	
		sapinfo->si_class = LLC_CLASS_II; 	
		sapinfo->si_window = llconf->dllcfg_window;
		sapinfo->si_trace = llconf->dllcfg_trace; 	
		if (sapinfo->si_trace)
			llc_tracelevel--;
		else llc_tracelevel++;
		sapinfo->si_input = pp->pr_input; 	
		sapinfo->si_ctlinput = (caddr_t (*)())pp->pr_ctlinput;
		return (sapinfo);
	}
	return 0;
}
struct npaidbentry * llc_setsapinfo ( struct ifnet * ifp , u_char af , u_char sap , struct dllconfig * llconf ) { struct protosw * pp ; struct sockaddr_dl * ifdl_addr ; struct rtentry * sirt = ( struct rtentry * ) 0 ; struct npaidbentry * sapinfo ; u_char saploc ; int size = sizeof ( struct npaidbentry ) ; USES_AF_LINK_RTS ; pp = pffindtype ( af , SOCK_STREAM ) ; if ( pp == 0 || pp -> pr_input == 0 || pp -> pr_ctlinput == 0 ) { printf ( " " ) ; return 0 ; } ifdl_addr = sdl_getaddrif ( ifp ) ; sdl_copy ( ifdl_addr , & sap_saddr ) ; sdl_copy ( ifdl_addr , & sap_sgate ) ; saploc = LLSAPLOC ( & sap_saddr , ifp ) ; sap_saddr . sdl_data [ saploc ] = sap ; sap_saddr . sdl_alen ++ ; rtrequest ( RTM_ADD , ( struct sockaddr * ) & sap_saddr , ( struct sockaddr * ) & sap_sgate , 0 , 0 , & sirt ) ; if ( sirt == 0 ) return 0 ; sirt -> rt_llinfo = malloc ( size , M_PCB , M_WAITOK ) ; sapinfo = ( struct npaidbentry * ) sirt -> rt_llinfo ; if ( sapinfo ) { bzero ( ( caddr_t ) sapinfo , size ) ; sapinfo -> si_class = LLC_CLASS_II ; sapinfo -> si_window = llconf -> dllcfg_window ; sapinfo -> si_trace = llconf -> dllcfg_trace ; if ( sapinfo -> si_trace ) llc_tracelevel -- ; else llc_tracelevel ++ ; sapinfo -> si_input = pp -> pr_input ; sapinfo -> si_ctlinput = ( caddr_t ( * ) ( ) ) pp -> pr_ctlinput ; return ( sapinfo ) ; } return 0 ; }
Set sapinfo for SAP address, llcconfig, af, and interface
Set sapinfo for SAP address llcconfig af and interface
/* 
	 * We rely/assume that only STREAM protocols will make use of 
	 * connection oriented LLC2. If this will one day not be the 
	 * case this will obviously fail. 
	 */ /*
	 * We need a way to jot down the LLC2 configuration for
	 * a certain LSAP address. To do this we enter 
	 * a "route" for the SAP.
	 */ /* now enter it */ /* Plug in config information in rt->rt_llinfo */ /* 	 
		 * For the time being we support LLC CLASS II here 	 
		 * only 	 
		 */