⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kitlethp.h

📁 三星2410的BSP开发包
💻 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.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name:   kitlethp.h

Abstract:  
    This contains the declarations of the private edbg routines for kitl support.
Functions:


Notes: 

--*/
#ifndef _KITL_ETHER_P_
#define _KITL_ETHER_P_

#define ARP_FRAME       0x0806
#define IP_FRAME        0x0800

#define UDP_PROTOCOL    17

// These structures must be byte aligned so that they can be laid over real packet data
#pragma pack( push, 1 )


// 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;

#pragma pack( pop )

// 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 HandleARPPacket (EDBG_ADDR *pMyAddr, LPBYTE pbFrame);
BOOL HandleDHCPPacket (EDBG_ADDR *pMyAddr, UDPHeaderFormat *pUdpHdr);
BOOL EdbgInitDHCP (EDBG_ADDR *pMyAddr, DWORD dwDHCPLeaseTime);
BOOL EncodeUDP (LPBYTE pbFrame, USHORT cbData, EDBG_ADDR *pSrcAddr, EDBG_ADDR *pDestAddr);

#endif // _KITL_ETHER_P_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -