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

📄 dhcp.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:  

  dhcp.h

Abstract:  

  This contains the dhcp.c specific data structure declarations.
  
Functions:

  
Notes:


Revision History:

--*/
#ifndef DHCP_H
#define DHCP_H

// These structures must be byte aligned so that they can be laid over real data
#include <pshpack1.h>

// This is the format of a the DHCP data contained in the UDP datagram
typedef struct DHCPMsgFormatTag {

    BYTE bOperation;
    BYTE bHardwareAddrType;
    BYTE bHardwareAddrLen;
    BYTE bHops;
    DWORD dwXID;
    WORD wSecs;
    WORD wFlags;
    DWORD dwCIADDR;         // Address to verify previously allocated IP in DHCPREQUEST
    DWORD dwYIADDR;         // Address to use for the client
    DWORD dwSIADDR;         // Address of server to use for next step in boot process
    DWORD dwGIADDR;         // Address of relay agent being used, if any
    UINT16 wCHADDR[8];      // Client hardware address
    char szSNAME[64];       // Optional server host name, NULL terminated string
    char szFILE[128];       // Optional boot file name, NULL terminated string
                            //  "generic" or NULL in DHCP_DISCOVER, fully qualified in DHCP_OFFER
    BYTE bOptions[312];     // Optional parameter fields

} DHCPMsgFormat;

#include <poppack.h>


// Well known DHCP ports for use with UDP
#define DHCP_SERVER_PORT 0x4300
#define DHCP_CLIENT_PORT 0x4400



// These are the various DHCP or BOOTP Option types that are used for DHCP (RFC 1533)
typedef enum {

    DHCP_SUBNET_MASK = 1,    // Client's subnet mask
    DHCP_HOSTNAME = 12,
    DHCP_IP_ADDR_REQ = 50,
    DHCP_LEASE_TIME = 51,
    DHCP_OPTION_OVERLOAD = 52,
    DHCP_MSGTYPE = 53,
    DHCP_SERVER_ID = 54,
    DHCP_CLIENT_ID = 61,
    DHCP_END = 255

} DHCPOptions;



// These are the codes for the various DHCP message types.  They are used with a Option type of 53.
typedef enum {
    DHCP_DISCOVER = 1,
    DHCP_OFFER = 2,
    DHCP_REQUEST = 3,
    DHCP_DECLINE = 4,
    DHCP_ACK = 5,
    DHCP_NAK = 6,
    DHCP_RELEASE = 7
} DHCPMsgTypes;



// These are the states that the DHCP negotiation process can be in.
typedef enum {
    // states when using DHCP
    DHCP_BOUND,
    DHCP_RENEWING,
    DHCP_ACKED,
    // states when using static IP
    DHCP_ARPED,
    DHCP_ARPING
} DHCPStates;

void EdbgDHCPBuildOps (DHCPOptions DHCPOption, DHCPMsgFormat *pDHCPMsg, WORD *pwOpOff, DWORD dwData);
BYTE *EdbgDHCPFindOption (DHCPOptions DHCPOption, DHCPMsgFormat *pDHCPMsg);
BYTE *EdbgDHCPParseField (DHCPOptions DHCPOption, BYTE *pbParse);

#endif

⌨️ 快捷键说明

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