资源简介
防火墙与入侵检测系统(课程设计)的C++工程文件,已经建立好了!可以直接编译运行!
代码片段和文件信息
/* $Id: checksum.cv 1.2 2001/01/02 08:06:00 roesch Exp $ */
/*
** Copyright (C) 1998199920002001 Martin Roesch
**
** 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 “checksum.h“
/*
* Function: checksum(u_int16_t * u_int32_t u_int16_t * u_int32_t)
*
* Purpose: Huh huh math....
*
* Arguments: b1 => pointer to data set one
* len1 => length of data set one
* b2 => pointer to data set two
* len2 => length of data set two
*
* Returns: csum => the calculated checksum for the given data
*/
u_int16_t checksum(u_int16_t *b1 u_int32_t len1 u_int16_t *b2 u_int32_t len2)
{
u_int32_t sum = 0;
if(b1 != (u_int16_t *)NULL)
{
while(len1 > 1)
{
sum += *((u_int16_t *)b1 ++);
if(sum & 0x80000000)
{
sum = (sum & 0xffff) + (sum >> 16);
}
len1 -= 2;
}
/* we‘ll have problems if b2 exists and len1 is odd */
if(len1)
{
sum += (u_int16_t) * (u_int8_t*) b1;
}
}
if(b2 != (u_int16_t*)NULL)
{
while(len2 > 1)
{
sum += *((u_int16_t*)b2 ++);
if(sum & 0x80000000)
{
sum = (sum & 0xffff) + (sum >> 16);
}
len2 -= 2;
}
if(len2)
{
sum += (u_int16_t) * (u_int8_t*) b2;
}
}
while(sum >> 16)
sum = (sum & 0xffff) + (sum >> 16);
return ~sum;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 269 2000-10-29 01:23 200622115475135\网络入侵检测系统\AUTHORS
文件 3124 2000-11-20 00:41 200622115475135\网络入侵检测系统\backdoor-lib
文件 1005 2001-01-18 05:40 200622115475135\网络入侵检测系统\BUGS
文件 30111 2001-01-18 08:30 200622115475135\网络入侵检测系统\ChangeLog
文件 109328 2001-01-30 20:53 200622115475135\网络入侵检测系统\configure
文件 18329 2000-10-29 01:23 200622115475135\网络入侵检测系统\COPYING
文件 6631 2000-08-30 20:46 200622115475135\网络入侵检测系统\contrib\create_mysql
文件 5357 2001-01-03 21:26 200622115475135\网络入侵检测系统\contrib\create_oracle
文件 5318 2000-08-30 20:46 200622115475135\网络入侵检测系统\contrib\create_postgresql
文件 6830 2001-01-02 10:14 200622115475135\网络入侵检测系统\CREDITS
文件 3881 2000-11-20 00:41 200622115475135\网络入侵检测系统\ddos-lib
..AD... 0 2001-01-12 08:43 200622115475135\网络入侵检测系统\WIN32-Code\Debug
..AD... 0 2001-01-17 08:23 200622115475135\网络入侵检测系统\WIN32-Includes\Debug
文件 1236 2000-11-20 00:41 200622115475135\网络入侵检测系统\finger-lib
文件 2298 2000-11-20 00:41 200622115475135\网络入侵检测系统\ftp-lib
文件 13064 2001-01-02 17:35 200622115475135\网络入侵检测系统\INSTALL
文件 5834 2000-10-29 01:23 200622115475135\网络入侵检测系统\install-sh
..AD... 0 2001-01-19 08:03 200622115475135\网络入侵检测系统\WIN32-Prj\Installer PRJ
..AD... 0 2001-01-17 08:37 200622115475135\网络入侵检测系统\WIN32-Includes\libnet
..AD... 0 2001-01-17 08:25 200622115475135\网络入侵检测系统\WIN32-Libraries\libnet
文件 18329 2001-01-02 01:37 200622115475135\网络入侵检测系统\LICENSE
文件 35252 2001-01-19 06:54 200622115475135\网络入侵检测系统\WIN32-Prj\Makefile
文件 6232 2000-11-20 00:41 200622115475135\网络入侵检测系统\misc-lib
文件 6462 2000-10-29 01:23 200622115475135\网络入侵检测系统\missing
文件 773 2000-10-29 01:23 200622115475135\网络入侵检测系统\mkinstalldirs
..AD... 0 2001-01-17 07:37 200622115475135\网络入侵检测系统\WIN32-Includes\mysql
..AD... 0 2001-01-17 07:36 200622115475135\网络入侵检测系统\WIN32-Libraries\mysql
..AD... 0 2001-01-11 09:21 200622115475135\网络入侵检测系统\WIN32-Includes\NET
文件 1255 2000-11-20 00:41 200622115475135\网络入侵检测系统\netbios-lib
..AD... 0 2001-01-11 09:21 200622115475135\网络入侵检测系统\WIN32-Includes\NETINET
............此处省略245个文件信息
评论
共有 条评论