/* hgjoin.c - hgjoin */
#include <conf.h>
#include <kernel.h>
#include <network.h>
#include <sleep.h>
#include <igmp.h>
/*------------------------------------------------------------------------
* hgjoin - handle application request to join a host group
*------------------------------------------------------------------------
*/
int
hgjoin(unsigned ifnum, IPaddr ipa, Bool islocal)
{
struct hg *phg;
int i;
if (!IP_CLASSD(ipa))
return SYSERR;
/* restrict multicast in multi-homed host to primary interface */
if (ifnum != NI_PRIMARY)
return SYSERR;
wait(HostGroup.hi_mutex);
if (phg = hglookup(ifnum, ipa)) {
phg->hg_refs++;
signal(HostGroup.hi_mutex);
return OK; /* already in it */
}
signal(HostGroup.hi_mutex);
/* add to host group and routing tables */
if (hgadd(ifnum, ipa, islocal) == SYSERR)
return SYSERR;
rtadd(ipa, ip_maskall, ipa, 0, NI_LOCAL, RT_INF);
/*
* advertise membership to multicast router(s); don't advertise
* 224.0.0.1 (all multicast hosts) membership.
*/
if (ipa != ig_allhosts)
for (i=0; i < IG_NSEND; ++i) {
igmp(IGT_HREPORT, ifnum, ipa);
sleep10(IG_DELAY);
}
return OK;
}
igmp.rar_IGMP Linux_igmp
版权申诉
26 浏览量
2022-09-24
16:07:55
上传
评论
收藏 14KB RAR 举报
御道御小黑
- 粉丝: 61
- 资源: 1万+
最新资源
- 基于matlab LVQ神经网络的预测-人脸朝向识别源代码+详细教程
- 医院电子病历管理系统 JAVA+Spring+SpringMVC+MyBatis
- 基于matlab LVQ神经网络的分类-乳腺肿瘤诊断源代码+详细教程
- 【C#/.NET/.NET Core学习、工作、面试指南】记录、收集和总结
- matlab 基于MIV的神经网络变量筛选-基于BP神经网络的变量筛选源代码+详细教程
- 基于matlab 概率神经网络的分类预测-基于PNN的变压器故障诊断源代码+详细教程
- IMG_2779.PNG
- 基于matlab Elman神经网络的数据预测-电力负荷预测模型研究源代码+详细教程
- 架构师软考知识点整理2
- 基于matlab SOM神经网络的数据分类-柴油机故障诊断源代码+详细教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈