📄 dhcp.h
字号:
/**
* \addtogroup dhcp
* @{
*/
/**
* \file
* \brief DHCP client implementation header file
* \author glyin <glyin@fameg.com>
*/
/*
******************************************************************************
*
Copyright (c) 2006 FameG Shanghai, Inc. All rights reserved.
*
This is unpublished proprietary source code of FameG Shanghai, Inc.
*
The copyright notice above does not evidence any actual or intended
*
publication of such source code.
******************************************************************************
*/
/*
******************************************************************************
*
Project: T4 L4MCU FPGA verification
*
Filename: bootp.h
*
Date: 29/03/06
*
Purpose: DHCP functions for L4MCU (Keil C Compiler)
*
Author: Guanglei Yin
******************************************************************************
*/
#ifndef __DHCP_H__
#define __DHCP_H__
#include "kernel/system.h"
/*****************************************************************************
* CONSTANT DEFINES *
*****************************************************************************/
/*!\brief send dhcp message with broadcast address.
*/
#define DHCP_FLAGSBROADCAST 0x8000
/*!\brief dhcp server port.
*/
#define DHCP_SERVER_PORT 67
/*!\brief dhcp client port.
*/
#define DHCP_CLIENT_PORT 68
/// \cond DOXYGEN_SKIP
#define BOOT_REQUEST 1
#define BOOT_REPLY 2
#define DHCP_HTYPE10MB 1
#define DHCP_HTYPE100MB 2
#define DHCP_HLENETHERNET 6
#define DHCP_HOPS 0
#define DHCP_SECS 100
#define MAGIC_COOKIE 0x63825363
/* DHCP client states */
#define DHCP_STATE_INIT_REBOOT 0
#define DHCP_STATE_REBOOTING 1
#define DHCP_STATE_INIT 2
#define DHCP_STATE_SELECTING 3
#define DHCP_STATE_REQUESTING 4
#define DHCP_STATE_BOUND 5
#define DHCP_STATE_RENEWING 6
#define DHCP_STATE_REBINDING 7
/* DHCP messages */
#define DHCP_DISCOVER 1
#define DHCP_OFFER 2
#define DHCP_REQUEST 3
#define DHCP_DECLINE 4
#define DHCP_ACK 5
#define DHCP_NAK 6
#define DHCP_RELEASE 7
#define DHCP_INFORM 8
/* DHCP options */
#define DHCP_OPT_PAD 0
#define DHCP_OPT_END 255
#define DHCP_OPT_SUBNET_MASK 1
#define DHCP_OPT_TIME_OFFSET 2
#define DHCP_OPT_ROUTER 3
#define DHCP_OPT_TIME_SERVER 4
#define DHCP_OPT_NAME_SERVER 5
#define DHCP_OPT_DNS_SERVER 6
#define DHCP_OPT_HOST_NAME 12
#define DHCP_OPT_POP3_SERVER 70
#define DHCP_OPT_REQUESTED_IP 50
#define DHCP_OPT_LEASE_TIME 51
#define DHCP_OPT_OVERLOAD 52
#define DHCP_OPT_MSG_TYPE 53
#define DHCP_OPT_SERV_IDENT 54
#define DHCP_OPT_PARAM_REQUEST 55
#define DHCP_OPT_T1_VALUE 58
#define DHCP_OPT_T2_VALUE 59
/// \endcond
/*****************************************************************************
* MACROS *
*****************************************************************************/
/*****************************************************************************
* DATA TYPES *
*****************************************************************************/
/*!\brief Record some information about dhcp client.
*/
struct dhcp_t
{
UINT8 state; //!< This variable holds dhcp clients' current state information
UINT8 timer_handle; //!< dhcp client timer handle.
INT8 soc_handle; //!< dhcp client handle.
};
/*!\brief Record dhcp packet field information.
*/
struct DHCP_MSG
{
UINT8 op;
UINT8 htype;
UINT8 hlen;
UINT8 hops;
UINT32 xid;
UINT16 secs;
UINT16 flags;
UINT32 ciaddr;
UINT32 yiaddr;
UINT32 siaddr;
UINT32 giaddr;
UINT8 chaddr[16];
UINT8 sname[64];
UINT8 file[128];
UINT8 OPT[312];
};
/*****************************************************************************
* FUNCTIONS DECLARATION *
*****************************************************************************/
extern INT8 dhcpc_init(void);
extern void dhcpc_run(void);
extern void dhcpc_exit(void);
/*****************************************************************************
* GLOBAL VARIABLES DECLARATION *
*****************************************************************************/
#endif /*__DHCP_H__*/
/** @} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -