?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*********************************************************************
2 *
3 * DHCP Defs for Microchip TCP/IP Stack
4 *
5 *********************************************************************
6 * FileName: DHCP.h
7 * Dependencies: TCPIPStack.h
8 * UDP.h
9 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
10 * Compiler: Microchip C32 v1.05 or higher
11 * Microchip C30 v3.12 or higher
12 * Microchip C18 v3.30 or higher
13 * HI-TECH PICC-18 PRO 9.63PL2 or higher
14 * Company: Microchip Technology, Inc.
15 *
16 * Software License Agreement
17 *
18 * Copyright (C) 2002-2009 Microchip Technology Inc. All rights
19 * reserved.
20 *
21 * Microchip licenses to you the right to use, modify, copy, and
22 * distribute:
23 * (i) the Software when embedded on a Microchip microcontroller or
24 * digital signal controller product ("Device") which is
25 * integrated into Licensee's product; or
26 * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
27 * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
28 * used in conjunction with a Microchip ethernet controller for
29 * the sole purpose of interfacing with the ethernet controller.
30 *
31 * You should refer to the license agreement accompanying this
32 * Software for additional information regarding your rights and
33 * obligations.
34 *
35 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
36 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
37 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
38 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
40 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
41 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
42 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
43 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
44 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
45 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
46 *
47 *
48 * Author Date Comment
49 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50 * Nilesh Rajbharti 3/21/01 Original (Rev 1.0)
51 ********************************************************************/
52 #ifndef __DHCP_H
53 #define __DHCP_H
54  
55 // UDP client port for DHCP Client transactions
56 #define DHCP_CLIENT_PORT (68u)
57 // UDP listening port for DHCP Server messages
58 #define DHCP_SERVER_PORT (67u)
59  
60 #define BOOT_REQUEST (1u) // BOOT_REQUEST DHCP type
61 #define BOOT_REPLY (2u) // BOOT_REPLY DHCP type
62 #define BOOT_HW_TYPE (1u) // BOOT_HW_TYPE DHCP type
63 #define BOOT_LEN_OF_HW_TYPE (6u) // BOOT_LEN_OF_HW_TYPE DHCP type
64  
65 #define DHCP_MESSAGE_TYPE (53u) // DHCP Message Type constant
66 #define DHCP_MESSAGE_TYPE_LEN (1u) // Length of DHCP Message Type
67  
68 #define DHCP_UNKNOWN_MESSAGE (0u) // Code for unknown DHCP message
69  
70 #define DHCP_DISCOVER_MESSAGE (1u) // DCHP Discover Message
71 #define DHCP_OFFER_MESSAGE (2u) // DHCP Offer Message
72 #define DHCP_REQUEST_MESSAGE (3u) // DHCP Request message
73 #define DHCP_DECLINE_MESSAGE (4u) // DHCP Decline Message
74 #define DHCP_ACK_MESSAGE (5u) // DHCP ACK Message
75 #define DHCP_NAK_MESSAGE (6u) // DHCP NAK Message
76 #define DHCP_RELEASE_MESSAGE (7u) // DCHP Release message
77  
78 #define DHCP_SERVER_IDENTIFIER (54u) // DHCP Server Identifier
79 #define DHCP_SERVER_IDENTIFIER_LEN (4u) // DHCP Server Identifier length
80  
81 #define DHCP_OPTION_ACK_MESSAGE (53u) // DHCP_OPTION_ACK_MESSAGE Type
82 #define DHCP_PARAM_REQUEST_LIST (55u) // DHCP_PARAM_REQUEST_LIST Type
83 #define DHCP_PARAM_REQUEST_LIST_LEN (4u) // DHCP_PARAM_REQUEST_LIST_LEN Type
84 #define DHCP_PARAM_REQUEST_IP_ADDRESS (50u) // DHCP_PARAM_REQUEST_IP_ADDRESS Type
85 #define DHCP_PARAM_REQUEST_IP_ADDRESS_LEN (4u) // DHCP_PARAM_REQUEST_IP_ADDRESS_LEN Type
86 #define DHCP_SUBNET_MASK (1u) // DHCP_SUBNET_MASK Type
87 #define DHCP_ROUTER (3u) // DHCP_ROUTER Type
88 #define DHCP_DNS (6u) // DHCP_DNS Type
89 #define DHCP_HOST_NAME (12u) // DHCP_HOST_NAME Type
90 #define DHCP_IP_LEASE_TIME (51u) // DHCP_IP_LEASE_TIME Type
91 #define DHCP_END_OPTION (255u) // DHCP_END_OPTION Type
92  
93 // DHCP or BOOTP Header structure
94 typedef struct __attribute__((aligned(2), packed))
95 {
96 BYTE MessageType; // Message type for this message
97 BYTE HardwareType; // Hardware type for this message
98 BYTE HardwareLen; // Length of hardware type
99 BYTE Hops; // Number of hops
100 DWORD TransactionID; // DHCP Transaction ID
101 WORD SecondsElapsed; // Number of elapsed seconds
102 WORD BootpFlags; // BOOTP Flags
103 IP_ADDR ClientIP; // Client IP
104 IP_ADDR YourIP; // Your IP
105 IP_ADDR NextServerIP; // Next Server IP
106 IP_ADDR RelayAgentIP; // Relay Agent IP
107 MAC_ADDR ClientMAC; // Client MAC Address
108 } BOOTP_HEADER;
109  
110 // DHCP State Machine
111 typedef enum
112 {
113 SM_DHCP_DISABLED = 0, // DHCP is not currently enabled
114 SM_DHCP_GET_SOCKET, // DHCP is trying to obtain a socket
115 SM_DHCP_SEND_DISCOVERY, // DHCP is sending a DHCP Discover message
116 SM_DHCP_GET_OFFER, // DHCP is waiting for a DHCP Offer
117 SM_DHCP_SEND_REQUEST, // DHCP is sending a DHCP Send Reequest message
118 SM_DHCP_GET_REQUEST_ACK, // DCHP is waiting for a Request ACK message
119 SM_DHCP_BOUND, // DHCP is bound
120 SM_DHCP_SEND_RENEW, // DHCP is sending a DHCP renew message (first try)
121 SM_DHCP_GET_RENEW_ACK, // DHCP is waiting for a renew ACK
122 SM_DHCP_SEND_RENEW2, // DHCP is sending a DHCP renew message (second try)
123 SM_DHCP_GET_RENEW_ACK2, // DHCP is waiting for a renew ACK
124 SM_DHCP_SEND_RENEW3, // DHCP is sending a DHCP renew message (third try)
125 SM_DHCP_GET_RENEW_ACK3 // DHCP is waiting for a renew ACK
126 } SM_DHCP;
127  
128  
129 void DHCPInit(BYTE vInterface);
130 void DHCPTask(void);
131 void DHCPServerTask(void);
132 void DHCPDisable(BYTE vInterface);
133 void DHCPEnable(BYTE vInterface);
134 BOOL DHCPIsEnabled(BYTE vInterface);
135 BOOL DHCPIsBound(BYTE vInterface);
136 BOOL DHCPStateChanged(BYTE vInterface);
137 BOOL DHCPIsServerDetected(BYTE vInterface);
138  
139 extern BOOL bDHCPServerEnabled;
140  
141 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3