ethmcast.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 59 行

C,V
59
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	97.09.21.19.26.05;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* ethmcast.c - ethmcast */

#include <conf.h>
#include <kernel.h>
#include <network.h>

Eaddr	template = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 };

/*------------------------------------------------------------------------
 *  ethmcast -  generate & set an IP multicast hardware address
 *------------------------------------------------------------------------
 */
int ethmcast(op, dev, hwa, ipa)
int		op;
int		dev;
Eaddr		hwa;
IPaddr		ipa;
{
	blkcopy(hwa, template, EP_ALEN);
	/* add in low-order 23 bits of IP multicast address */
	hwa[3] = ipa[1] & 0x7;
	hwa[4] = ipa[2];
	hwa[5] = ipa[3];

	switch (op) {
	case NI_MADD:
		return control(dev, EPC_MADD, hwa);
		break;
	case NI_MDEL:
		return control(dev, EPC_MDEL, hwa);
		break;
	}
	return OK;
}
@

⌨️ 快捷键说明

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