📄 igmp.c
字号:
/* nast This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/#include "include/nast.h"void handle_IGMP (FILE *output){ struct libnet_ipv4_hdr *ip; struct libnet_igmp_hdr *igmp; ip = (struct libnet_ipv4_hdr *) (packet + offset); igmp = (struct libnet_igmp_hdr *) (packet + LIBNET_IPV4_H + offset); fprintf(output, "\n---[ IGMP ]----------------------------------------------------------\n"); fprintf(output, "%s -> %s\n", inet_ntoa(ip->ip_src), inet_ntoa(ip->ip_dst)); fprintf(output, "IP Version: %d\t Lenght: %d\t", ip->ip_v, ntohs(ip->ip_len)); fprintf(output, "TTL: %d\t Code: %d\n", ip->ip_ttl, igmp->igmp_code); fprintf(output, "Type: "); switch(igmp->igmp_type) { case 0x11: fprintf(output, "Membreship Query v1 [get address %s]\n", inet_ntoa(igmp->igmp_group)); break; case 0x12: fprintf(output, "Membership Report v1 %s\n", inet_ntoa(igmp->igmp_group)); break; case 0x16: fprintf(output, "Membership Report v2 %s\n", inet_ntoa(igmp->igmp_group)); break; case 0x17: fprintf(output, "Leave %s (v2)\n", inet_ntoa(igmp->igmp_group)); break; default: fprintf(output, "%d\n", igmp->igmp_type); break; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -