?? udp.h
字號:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*********************************************************************
*
*
* Module Name: udp.h
*
* Abstract:
* This contains the udp.c specific data structure declarations.
* Used by the ethernet support routines (kernel and ether bootloader).
*
* Author:
*
* History:
*
* Note:
*
********************************************************************/
#ifndef UDP_H
#define UDP_H
#include <halether.h>
// These structures must be byte aligned so that they can be laid over real packet data
#include <pshpack1.h>
// This is the format for the ethernet frame that is transmitted on the wire
typedef struct EthernetFrameHeaderlab {
UINT16 wDestMAC[3];
UINT16 wSrcMAC[3];
UINT16 wFrameType;
// Then the data
// After the data is a 4 byte CRC
} EthernetFrameHeader;
// This is the format for an ARP packet
typedef struct ARPPacketFormatTag {
UINT16 wHardwareType;
UINT16 wProtocolType;
BYTE bHardwareAddrSize;
BYTE bProtocolAddrSize;
UINT16 wOperation;
UINT16 wSrcMAC[3];
DWORD dwSrcIP;
UINT16 wDestMAC[3];
DWORD dwDestIP;
} ARPPacketFormat;
// This is the format for the IP packet header
typedef struct IPHeaderFormatTag {
BYTE bVersionLength;
BYTE bTypeOfService;
UINT16 cwTotalLength;
UINT16 wIdentification;
UINT16 wFragment;
BYTE bTimeToLive;
BYTE bProtocol;
UINT16 wCRC;
DWORD dwSrcIP;
DWORD dwDestIP;
// Options can go in here
// Then comes the data
} IPHeaderFormat;
// This is the format for the UDP packet header
typedef struct UDPHeaderFormatTag {
UINT16 wSrcPort;
UINT16 wDestPort;
UINT16 cwTotalUDPLength;
UINT16 wCRC;
// Then comes the data
} UDPHeaderFormat;
// This is the format for the UDP packet header
typedef struct UDPPseudoHeaderFormatTag {
DWORD dwSrcIP;
DWORD dwDestIP;
BYTE bZero;
BYTE bProtocol;
UINT16 cwTotalUDPLength;
} UDPPseudoHeaderFormat;
#include <poppack.h>
// Since the ethernet, IP, and UDP headers are fixed length, we can use this
// offset to write user data directly into frame buffer, saving a copy.
#define UDP_DATA_FRAME_OFFSET (sizeof(EthernetFrameHeader) + sizeof(IPHeaderFormat) + sizeof(UDPHeaderFormat))
void SrcAddrFromFrame( EDBG_ADDR *pAddr, BYTE *pFrameBuffer );
UINT16 CRC( UINT16 *pwRegion1, UINT16 wLength1, UINT16 *pwRegion2, UINT16 wLength2 );
UINT16 ProcessARP( EDBG_ADDR *pMyAddr, BYTE *pFrameBuffer );
void SetPromiscuousIP( void );
void ClearPromiscuousIP( void );
UINT16 CheckUDP( DWORD dwMyIP, BYTE *pFrameBuffer, UINT16 *wDestPort, UINT16 *wSrcPort, UINT16 **pwData, UINT16 *cwLength );
BOOL EbootCheckIP (EDBG_ADDR *pEdbgAddr);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -