亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? skcsum.c

?? 移植好的楊創utu2440F ARM9 的uboot1.1.4代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************** * * Name:	skcsum.c * Project:	GEnesis, PCI Gigabit Ethernet Adapter * Version:	$Revision: 1.10 $ * Date:	$Date: 2002/04/11 10:02:04 $ * Purpose:	Store/verify Internet checksum in send/receive packets. * ******************************************************************************//****************************************************************************** * *	(C)Copyright 1998-2001 SysKonnect GmbH. * *	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. * *	The information in this file is provided "AS IS" without warranty. * ******************************************************************************//****************************************************************************** * * History: * *	$Log: skcsum.c,v $ *	Revision 1.10  2002/04/11 10:02:04  rwahl *	Fix in SkCsGetSendInfo(): *	- function did not return ProtocolFlags in every case. *	- pseudo header csum calculated wrong for big endian. * *	Revision 1.9  2001/06/13 07:42:08  gklug *	fix: NetNumber was wrong in CLEAR_STAT event *	add: check for good NetNumber in Clear STAT * *	Revision 1.8  2001/02/06 11:15:36  rassmann *	Supporting two nets on dual-port adapters. * *	Revision 1.7  2000/06/29 13:17:05  rassmann *	Corrected reception of a packet with UDP checksum == 0 (which means there *	is no UDP checksum). * *	Revision 1.6  2000/02/21 12:35:10  cgoos *	Fixed license header comment. * *	Revision 1.5  2000/02/21 11:05:19  cgoos *	Merged changes back to common source. *	Fixed rx path for BIG ENDIAN architecture. * *	Revision 1.1  1999/07/26 15:28:12  mkarl *	added return SKCS_STATUS_IP_CSUM_ERROR_UDP and *	SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester *	changed from common source to windows specific source *	therefore restarting with v1.0 * *	Revision 1.3  1999/05/10 08:39:33  mkarl *	prevent overflows in SKCS_HTON16 *	fixed a bug in pseudo header checksum calculation *	added some comments * *	Revision 1.2  1998/10/22 11:53:28  swolf *	Now using SK_DBG_MSG. * *	Revision 1.1  1998/09/01 15:35:41  swolf *	initial revision * *	13-May-1998 sw	Created. * ******************************************************************************/#include <config.h>#ifdef CONFIG_SK98#ifdef SK_USE_CSUM	/* Check if CSUM is to be used. */#ifndef lintstatic const char SysKonnectFileId[] = "@(#)"	"$Id: skcsum.c,v 1.10 2002/04/11 10:02:04 rwahl Exp $"	" (C) SysKonnect.";#endif	/* !lint *//****************************************************************************** * * Description: * * This is the "GEnesis" common module "CSUM". * * This module contains the code necessary to calculate, store, and verify the * Internet Checksum of IP, TCP, and UDP frames. * * "GEnesis" is an abbreviation of "Gigabit Ethernet Network System in Silicon" * and is the code name of this SysKonnect project. * * Compilation Options: * *	SK_USE_CSUM - Define if CSUM is to be used. Otherwise, CSUM will be an *	empty module. * *	SKCS_OVERWRITE_PROTO - Define to overwrite the default protocol id *	definitions. In this case, all SKCS_PROTO_xxx definitions must be made *	external. * *	SKCS_OVERWRITE_STATUS - Define to overwrite the default return status *	definitions. In this case, all SKCS_STATUS_xxx definitions must be made *	external. * * Include File Hierarchy: * *	"h/skdrv1st.h" *	"h/skcsum.h" *	 "h/sktypes.h" *	 "h/skqueue.h" *	"h/skdrv2nd.h" * ******************************************************************************/#include "h/skdrv1st.h"#include "h/skcsum.h"#include "h/skdrv2nd.h"/* defines ********************************************************************//* The size of an Ethernet MAC header. */#define SKCS_ETHERNET_MAC_HEADER_SIZE			(6+6+2)/* The size of the used topology's MAC header. */#define	SKCS_MAC_HEADER_SIZE	SKCS_ETHERNET_MAC_HEADER_SIZE/* The size of the IP header without any option fields. */#define SKCS_IP_HEADER_SIZE						20/* * Field offsets within the IP header. *//* "Internet Header Version" and "Length". */#define SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH	0/* "Total Length". */#define SKCS_OFS_IP_TOTAL_LENGTH				2/* "Flags" "Fragment Offset". */#define SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET	6/* "Next Level Protocol" identifier. */#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL			9/* Source IP address. */#define SKCS_OFS_IP_SOURCE_ADDRESS				12/* Destination IP address. */#define SKCS_OFS_IP_DESTINATION_ADDRESS			16/* * Field offsets within the UDP header. *//* UDP checksum. */#define SKCS_OFS_UDP_CHECKSUM					6/* IP "Next Level Protocol" identifiers (see RFC 790). */#define SKCS_PROTO_ID_TCP		6	/* Transport Control Protocol */#define SKCS_PROTO_ID_UDP		17	/* User Datagram Protocol *//* IP "Don't Fragment" bit. */#define SKCS_IP_DONT_FRAGMENT	SKCS_HTON16(0x4000)/* Add a byte offset to a pointer. */#define SKCS_IDX(pPtr, Ofs)	((void *) ((char *) (pPtr) + (Ofs)))/* * Macros that convert host to network representation and vice versa, i.e. * little/big endian conversion on little endian machines only. */#ifdef SK_LITTLE_ENDIAN#define SKCS_HTON16(Val16)	(((unsigned) (Val16) >> 8) | (((Val16) & 0xFF) << 8))#endif	/* SK_LITTLE_ENDIAN */#ifdef SK_BIG_ENDIAN#define SKCS_HTON16(Val16)	(Val16)#endif	/* SK_BIG_ENDIAN */#define SKCS_NTOH16(Val16)	SKCS_HTON16(Val16)/* typedefs *******************************************************************//* function prototypes ********************************************************//****************************************************************************** * *	SkCsGetSendInfo - get checksum information for a send packet * * Description: *	Get all checksum information necessary to send a TCP or UDP packet. The *	function checks the IP header passed to it. If the high-level protocol *	is either TCP or UDP the pseudo header checksum is calculated and *	returned. * *	The function returns the total length of the IP header (including any *	IP option fields), which is the same as the start offset of the IP data *	which in turn is the start offset of the TCP or UDP header. * *	The function also returns the TCP or UDP pseudo header checksum, which *	should be used as the start value for the hardware checksum calculation. *	(Note that any actual pseudo header checksum can never calculate to *	zero.) * * Note: *	There is a bug in the ASIC which may lead to wrong checksums. * * Arguments: *	pAc - A pointer to the adapter context struct. * *	pIpHeader - Pointer to IP header. Must be at least the IP header *not* *	including any option fields, i.e. at least 20 bytes. * *	Note: This pointer will be used to address 8-, 16-, and 32-bit *	variables with the respective alignment offsets relative to the pointer. *	Thus, the pointer should point to a 32-bit aligned address. If the *	target system cannot address 32-bit variables on non 32-bit aligned *	addresses, then the pointer *must* point to a 32-bit aligned address. * *	pPacketInfo - A pointer to the packet information structure for this *	packet. Before calling this SkCsGetSendInfo(), the following field must *	be initialized: * *		ProtocolFlags - Initialize with any combination of *		SKCS_PROTO_XXX bit flags. SkCsGetSendInfo() will only work on *		the protocols specified here. Any protocol(s) not specified *		here will be ignored. * *		Note: Only one checksum can be calculated in hardware. Thus, if *		SKCS_PROTO_IP is specified in the 'ProtocolFlags', *		SkCsGetSendInfo() must calculate the IP header checksum in *		software. It might be a better idea to have the calling *		protocol stack calculate the IP header checksum. * * Returns: N/A *	On return, the following fields in 'pPacketInfo' may or may not have *	been filled with information, depending on the protocol(s) found in the *	packet: * *	ProtocolFlags - Returns the SKCS_PROTO_XXX bit flags of the protocol(s) *	that were both requested by the caller and actually found in the packet. *	Protocol(s) not specified by the caller and/or not found in the packet *	will have their respective SKCS_PROTO_XXX bit flags reset. * *	Note: For IP fragments, TCP and UDP packet information is ignored. * *	IpHeaderLength - The total length in bytes of the complete IP header *	including any option fields is returned here. This is the start offset *	of the IP data, i.e. the TCP or UDP header if present. * *	IpHeaderChecksum - If IP has been specified in the 'ProtocolFlags', the *	16-bit Internet Checksum of the IP header is returned here. This value *	is to be stored into the packet's 'IP Header Checksum' field. * *	PseudoHeaderChecksum - If this is a TCP or UDP packet and if TCP or UDP *	has been specified in the 'ProtocolFlags', the 16-bit Internet Checksum *	of the TCP or UDP pseudo header is returned here. */#if 0void SkCsGetSendInfo(SK_AC				*pAc,			/* Adapter context struct. */void				*pIpHeader,		/* IP header. */SKCS_PACKET_INFO	*pPacketInfo,	/* Packet information struct. */int					NetNumber)		/* Net number */{	/* Internet Header Version found in IP header. */	unsigned InternetHeaderVersion;	/* Length of the IP header as found in IP header. */	unsigned IpHeaderLength;	/* Bit field specifiying the desired/found protocols. */	unsigned ProtocolFlags;	/* Next level protocol identifier found in IP header. */	unsigned NextLevelProtocol;	/* Length of IP data portion. */	unsigned IpDataLength;	/* TCP/UDP pseudo header checksum. */	unsigned long PseudoHeaderChecksum;	/* Pointer to next level protocol statistics structure. */	SKCS_PROTO_STATS *NextLevelProtoStats;	/* Temporary variable. */	unsigned Tmp;	Tmp = *(SK_U8 *)		SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH);	/* Get the Internet Header Version (IHV). */	/* Note: The IHV is stored in the upper four bits. */	InternetHeaderVersion = Tmp >> 4;	/* Check the Internet Header Version. */	/* Note: We currently only support IP version 4. */	if (InternetHeaderVersion != 4) {	/* IPv4? */		SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX,			("Tx: Unknown Internet Header Version %u.\n",			InternetHeaderVersion));		pPacketInfo->ProtocolFlags = 0;		pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++;		return;	}	/* Get the IP header length (IHL). */	/*	 * Note: The IHL is stored in the lower four bits as the number of	 * 4-byte words.	 */	IpHeaderLength = (Tmp & 0xf) * 4;	pPacketInfo->IpHeaderLength = IpHeaderLength;	/* Check the IP header length. */	/* 04-Aug-1998 sw - Really check the IHL? Necessary? */	if (IpHeaderLength < 5*4) {		SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX,			("Tx: Invalid IP Header Length %u.\n", IpHeaderLength));		pPacketInfo->ProtocolFlags = 0;		pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++;		return;	}	/* This is an IPv4 frame with a header of valid length. */	pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxOkCts++;	/* Check if we should calculate the IP header checksum. */	ProtocolFlags = pPacketInfo->ProtocolFlags;	if (ProtocolFlags & SKCS_PROTO_IP) {		pPacketInfo->IpHeaderChecksum =			SkCsCalculateChecksum(pIpHeader, IpHeaderLength);	}	/* Get the next level protocol identifier. */	NextLevelProtocol =		*(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL);	/*	 * Check if this is a TCP or UDP frame and if we should calculate the	 * TCP/UDP pseudo header checksum.	 *	 * Also clear all protocol bit flags of protocols not present in the	 * frame.	 */	if ((ProtocolFlags & SKCS_PROTO_TCP) != 0 &&		NextLevelProtocol == SKCS_PROTO_ID_TCP) {		/* TCP/IP frame. */		ProtocolFlags &= SKCS_PROTO_TCP | SKCS_PROTO_IP;		NextLevelProtoStats =			&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_TCP];	}	else if ((ProtocolFlags & SKCS_PROTO_UDP) != 0 &&		NextLevelProtocol == SKCS_PROTO_ID_UDP) {		/* UDP/IP frame. */		ProtocolFlags &= SKCS_PROTO_UDP | SKCS_PROTO_IP;		NextLevelProtoStats =			&pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_UDP];	}	else {		/*		 * Either not a TCP or UDP frame and/or TCP/UDP processing not		 * specified.		 */		pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP;		return;	}	/* Check if this is an IP fragment. */	/*	 * Note: An IP fragment has a non-zero "Fragment Offset" field and/or	 * the "More Fragments" bit set. Thus, if both the "Fragment Offset"	 * and the "More Fragments" are zero, it is *not* a fragment. We can	 * easily check both at the same time since they are in the same 16-bit	 * word.	 */	if ((*(SK_U16 *)		SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) &		~SKCS_IP_DONT_FRAGMENT) != 0) {		/* IP fragment; ignore all other protocols. */		pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP;		NextLevelProtoStats->TxUnableCts++;		return;	}	/*	 * Calculate the TCP/UDP pseudo header checksum.	 */	/* Get total length of IP header and data. */	IpDataLength =		*(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH);	/* Get length of IP data portion. */	IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength;	/* Calculate the sum of all pseudo header fields (16-bit). */	PseudoHeaderChecksum =		(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,			SKCS_OFS_IP_SOURCE_ADDRESS + 0) +		(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,			SKCS_OFS_IP_SOURCE_ADDRESS + 2) +		(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,			SKCS_OFS_IP_DESTINATION_ADDRESS + 0) +		(unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader,			SKCS_OFS_IP_DESTINATION_ADDRESS + 2) +		(unsigned long) SKCS_HTON16(NextLevelProtocol) +		(unsigned long) SKCS_HTON16(IpDataLength);	/* Add-in any carries. */	SKCS_OC_ADD(PseudoHeaderChecksum, PseudoHeaderChecksum, 0);	/* Add-in any new carry. */	SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0);	pPacketInfo->ProtocolFlags = ProtocolFlags;	NextLevelProtoStats->TxOkCts++;	/* Success. */}	/* SkCsGetSendInfo *//****************************************************************************** * *	SkCsGetReceiveInfo - verify checksum information for a received packet * * Description: *	Verify a received frame's checksum. The function returns a status code *	reflecting the result of the verification. * * Note: *	Before calling this function you have to verify that the frame is *	not padded and Checksum1 and Checksum2 are bigger than 1. * * Arguments: *	pAc - Pointer to adapter context struct. * *	pIpHeader - Pointer to IP header. Must be at least the length in bytes *	of the received IP header including any option fields. For UDP packets, *	8 additional bytes are needed to access the UDP checksum. * *	Note: The actual length of the IP header is stored in the lower four *	bits of the first octet of the IP header as the number of 4-byte words, *	so it must be multiplied by four to get the length in bytes. Thus, the

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看日韩一区| 精品国产污污免费网站入口 | 亚洲一区二区三区精品在线| 午夜精品免费在线观看| 国产一区二区三区黄视频| 一本在线高清不卡dvd| 久久美女艺术照精彩视频福利播放| 一区二区成人在线观看| 国产精品一区二区三区四区| 欧美日韩中文另类| 国产精品女人毛片| 久久精品国产澳门| 7777精品伊人久久久大香线蕉| 国产精品嫩草久久久久| 韩国成人精品a∨在线观看| 欧美日韩一区二区三区在线看| 久久久99精品免费观看| 理论片日本一区| 这里只有精品视频在线观看| 自拍av一区二区三区| 国产在线精品免费av| 日韩欧美视频在线| 美女一区二区视频| 91精品国产免费| 午夜国产精品一区| 91精品办公室少妇高潮对白| 国产精品日韩成人| 成人午夜伦理影院| 欧美国产一区二区| 成人av电影在线观看| 日本一区二区在线不卡| 国产高清在线精品| 一区二区三区91| 在线视频一区二区免费| 一区二区三区免费网站| 色噜噜狠狠成人网p站| 1024精品合集| 91视频免费播放| 亚洲男同1069视频| 在线观看日韩精品| 亚洲国产日韩综合久久精品| 色婷婷久久99综合精品jk白丝| 亚洲免费在线观看视频| 欧美性受极品xxxx喷水| 亚洲国产va精品久久久不卡综合| 欧美伊人精品成人久久综合97 | 日韩福利视频导航| 欧美一区二区三区男人的天堂| 蜜桃久久av一区| 久久青草国产手机看片福利盒子| 国产成人免费9x9x人网站视频| 国产精品毛片无遮挡高清| 99久精品国产| 夜夜嗨av一区二区三区| 69堂精品视频| 激情成人综合网| 中文字幕一区二区三| 色妞www精品视频| 丝袜美腿亚洲色图| 有坂深雪av一区二区精品| 在线观看91视频| 免费观看在线综合| 国产精品久久久久一区| 91在线视频网址| 日本免费新一区视频| 日韩欧美成人激情| 成人av综合一区| 日韩国产在线观看| 国产精品少妇自拍| 欧美日韩国产首页| 成人免费高清视频在线观看| 亚洲综合一二区| 久久久www成人免费毛片麻豆| 色婷婷av一区二区三区大白胸 | 欧美电影免费提供在线观看| 国产成+人+日韩+欧美+亚洲| 午夜一区二区三区在线观看| ww亚洲ww在线观看国产| 在线观看成人小视频| 国产一区二区福利视频| 日韩理论在线观看| 欧美精品一区二| 日本韩国精品一区二区在线观看| 国产一区二区三区免费| 亚洲福中文字幕伊人影院| 国产欧美日韩中文久久| 欧美一级黄色录像| 欧美在线观看视频一区二区三区| 国产又黄又大久久| 天天色天天操综合| 亚洲欧美激情一区二区| 欧美国产激情一区二区三区蜜月| 在线不卡免费av| 一本色道久久综合精品竹菊| 国产91精品露脸国语对白| 美女一区二区视频| 视频一区视频二区中文| 亚洲欧美经典视频| 国产精品久久免费看| 久久精品人人爽人人爽| 日韩欧美的一区二区| 色老头久久综合| 99精品视频在线观看免费| 国产盗摄一区二区| 狂野欧美性猛交blacked| 午夜视频在线观看一区| 亚洲欧美日韩在线播放| 亚洲视频香蕉人妖| 中文字幕高清不卡| 亚洲国产精品成人综合| 国产欧美综合色| 日韩久久精品一区| 欧美一级在线观看| 91麻豆精品国产91久久久久久久久 | 国产真实乱偷精品视频免| 日本欧美一区二区三区乱码| 三级影片在线观看欧美日韩一区二区| 一区二区三区不卡视频在线观看| 一区二区三区国产| 一区二区三区.www| 亚洲成人动漫一区| 日日夜夜一区二区| 热久久免费视频| 久久国产精品99久久人人澡| 激情综合色综合久久| 国产一区二区三区四区五区美女| 国产伦理精品不卡| av网站免费线看精品| 91女神在线视频| 欧美视频三区在线播放| 51精品久久久久久久蜜臀| 精品va天堂亚洲国产| 国产亚洲女人久久久久毛片| 中文久久乱码一区二区| 亚洲美女少妇撒尿| 午夜精品久久久久影视| 久久疯狂做爰流白浆xx| 风间由美中文字幕在线看视频国产欧美| 国产成人精品一区二区三区四区| av一区二区三区在线| 欧美中文字幕亚洲一区二区va在线| 欧美性色黄大片手机版| 日韩欧美成人激情| 国产精品青草久久| 亚洲主播在线播放| 久久精品国产亚洲一区二区三区| 精品制服美女丁香| 色综合久久六月婷婷中文字幕| 欧美日韩高清一区二区不卡| 亚洲图片另类小说| 奇米精品一区二区三区四区 | 国产欧美精品区一区二区三区| 中文字幕永久在线不卡| 亚洲一区二区在线免费看| 日韩成人av影视| 成人午夜精品在线| 这里只有精品视频在线观看| 亚洲国产精品成人综合| 日一区二区三区| av中文一区二区三区| 日韩欧美在线123| 亚洲色图.com| 久久精品国产亚洲高清剧情介绍| 91视频一区二区| 久久精品网站免费观看| 亚洲国产日韩一区二区| 成人午夜视频在线观看| 欧美一级淫片007| 亚洲午夜久久久久| 成人午夜又粗又硬又大| 日韩视频一区二区| 亚洲一区二区三区四区的| 成人黄色小视频在线观看| 欧美一区二区视频网站| 一区二区在线电影| 国产成人aaa| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 亚洲图片激情小说| 国产美女精品一区二区三区| 91麻豆精品国产91久久久久久| 亚洲激情综合网| www.激情成人| 欧美国产日本视频| 国产美女久久久久| 精品国产伦一区二区三区免费| 亚洲国产一区二区在线播放| 91色在线porny| 国产精品久久三区| 国产丶欧美丶日本不卡视频| 精品久久久久一区| 蜜臀a∨国产成人精品| 欧美日韩国产在线播放网站| 一区二区三区精品视频| 99久久99精品久久久久久| 国产精品网曝门| zzijzzij亚洲日本少妇熟睡| 国产无遮挡一区二区三区毛片日本| 国产在线观看一区二区| 久久久久久久久久电影| 久久99国产精品尤物|