⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rrmask.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
字号:
/**            Copyright (c) 1998-2001 by NETsilicon Inc.**  This software is copyrighted by and is the sole property of*  NETsilicon.  All rights, title, ownership, or other interests*  in the software remain the property of NETsilicon.  This*  software may only be used in accordance with the corresponding*  license agreement.  Any unauthorized use, duplication, transmission,*  distribution, or disclosure of this software is expressly forbidden.**  This Copyright notice may not be removed or modified without prior*  written consent of NETsilicon.**  NETsilicon, reserves the right to modify this software*  without notice.**  NETsilicon*  411 Waverley Oaks Road                  USA 781.647.1234*  Suite 227                               http://www.netsilicon.com*  Waltham, MA 02452                       AmericaSales@netsilicon.com***************************************************************************  $Name: Fusion 6.52 Fusion 6.51 $*  $Date: 2001/09/20 10:32:09 $*  $Source: M:/psisrc/routing/incl/rcs/rrmask.h $*  $Revision: 1.2 $**************************************************************************  File Description: definitions for anything that uses port masks  *************************************************************************/#include "ipport.h"/****************************************if single, port number is encoded in m:ie, port 1 is 1 port 2 is 2, etc.else bit number equals port number, ie. bit 1 (not 0)refers to port 1, ports 1&2 has mask of 6.****************************************//* used for mcast forwarding circuit mask */typedef struct	rrforward_mask{	union{		int		pid;		rrbyte		m[(RR_MAX_INTF >>3)+1];	}u;	rrbyte		single;}rrfwd_mask;#define RRMSK_CSET(xm,xcid) {\  (xm)->u.m[xcid >>3] |= 1 << (xcid & 7);\}#define RRMSK_CCLR(xm,xcid) {\  (xm)->u.m[xcid >>3] &= ~(1<<(xcid & 7));\}#define RRMSK_ALLCLR(xm)	 {\	int xx; \	for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++)(xm)->u.m[xx] = 0; \}#define RRMSK_CIS_SET(xm,xcid) ((xm)->u.m[xcid >>3] & (1<<(xcid & 7)) )/* for each bit set in mb, clear matching bit in ma */#define RRMSK_MASK_CLRBITS(xma,xmb)	 {\	int xx; \	for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++){\		(xma)->u.m[xx] = (xma)->u.m[xx] & ~(xmb)->u.m[xx]; \	}\}/* ma is and of ma,mb */#define RRMSK_MASK_AND(xma,xmb)	 {\	int xx; \	for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++){\		(xma)->u.m[xx] = (xma)->u.m[xx] & (xmb)->u.m[xx]; \	}\}/* ma is or of ma,mb */#define RRMSK_MASK_OR(xma,xmb)	 {\	int xx; \	for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++){\		(xma)->u.m[xx] = (xma)->u.m[xx] | (xmb)->u.m[xx]; \	}\}/* copy b to a */#define RRMSK_COPY(xma,xmb)	 {\	rrCopyMem(xma,xmb,sizeof(rrfwd_mask));\}/* test for empty mask, sets nonempty flag */#define RRMSK_EMPTY_TEST(xm,xnonempty)	{\	int xx; \	xnonempty = 0; \	for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++){\		if((xm)->u.m[xx]) {\			xnonempty = 1;\			break;\		}\	}\}	/* find first port with member set */#define RRMSK_FIRST(xm,xfirst) {\	int xx,yy; \	xfirst = -1;\	if((xm)->single)\		xfirst = (xm)->u.pid;\	else for(xx = 0; xx <= (RR_MAX_INTF >>3);xx++){\		if((xm)->u.m[xx]) {\			for(yy = 0; yy <8;yy++){\				if((xm)->u.m[xx] & (1<<yy)){\					xfirst = (xx <<3) +yy;\					break;\				}\			}\			break;\		}\	}\}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -