io6Library
WIZnet Dual Stack TCP/IP Ethernet Controller Driver
Macros | Enumerations | Functions
dhcpv4.h File Reference

DHCP APIs Header file. More...

Go to the source code of this file.

Macros

#define MAX_DHCPV4_RETRY   2
 Maximum retry count. More...
 
#define DHCPV4_WAIT_TIME   10
 Wait Time 10s. More...
 
#define DHCPV4_SERVER_PORT   67
 DHCP server port number. More...
 
#define DHCPV4_CLIENT_PORT   68
 DHCP client port number. More...
 
#define MAGIC_COOKIE   0x63825363
 You should not modify it number. More...
 
#define DCHPV4_HOST_NAME   "WIZnet\0"
 

Enumerations

enum  {
  DHCPV4_FAILED = 0, DHCPV4_RUNNING, DHCP_IPV4_ASSIGN, DHCP_IPV4_CHANGED,
  DHCP_IPV4_LEASED, DHCPV4_STOPPED
}
 

Functions

void DHCPv4_init (uint8_t s, uint8_t *buf)
 
void DHCPv4_time_handler (void)
 
void reg_dhcpv4_cbfunc (void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void))
 
uint8_t DHCPv4_run (void)
 
void DHCPv4_stop (void)
 
void getIPfromDHCPv4 (uint8_t *ip)
 
void getGWfromDHCPv4 (uint8_t *ip)
 
void getSNfromDHCPv4 (uint8_t *ip)
 
void getDNSfromDHCPv4 (uint8_t *ip)
 
uint32_t getDHCPv4Leasetime (void)
 

Detailed Description

DHCP APIs Header file.

Processig DHCP protocol as DISCOVER, OFFER, REQUEST, ACK, NACK and DECLINE.

Version
1.1.1
Date
2019/10/08
Revision history
<2019/10/08> compare DHCP server ip address <2013/11/18> 1st Release <2012/12/20> V1.1.0 1. Move unreferenced DEFINE to dhcp.c <2012/12/26> V1.1.1
Author
Eric Jung & MidnightCow

Copyright (c) 2013, WIZnet Co., LTD. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file dhcpv4.h.

Macro Definition Documentation

◆ MAX_DHCPV4_RETRY

#define MAX_DHCPV4_RETRY   2

Maximum retry count.

Definition at line 62 of file dhcpv4.h.

◆ DHCPV4_WAIT_TIME

#define DHCPV4_WAIT_TIME   10

Wait Time 10s.

Definition at line 63 of file dhcpv4.h.

◆ DHCPV4_SERVER_PORT

#define DHCPV4_SERVER_PORT   67

DHCP server port number.

Definition at line 67 of file dhcpv4.h.

◆ DHCPV4_CLIENT_PORT

#define DHCPV4_CLIENT_PORT   68

DHCP client port number.

Definition at line 68 of file dhcpv4.h.

◆ MAGIC_COOKIE

#define MAGIC_COOKIE   0x63825363

You should not modify it number.

Definition at line 71 of file dhcpv4.h.

◆ DCHPV4_HOST_NAME

#define DCHPV4_HOST_NAME   "WIZnet\0"

Definition at line 73 of file dhcpv4.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DHCPV4_FAILED 

Processing Fail.

DHCPV4_RUNNING 

Processing DHCP protocol.

DHCP_IPV4_ASSIGN 

First Occupy IP from DHPC server (if cbfunc == null, act as default default_ip_assign)

DHCP_IPV4_CHANGED 

Change IP address by new ip from DHCP (if cbfunc == null, act as default default_ip_update)

DHCP_IPV4_LEASED 

Stand by.

DHCPV4_STOPPED 

Stop processing DHCP protocol.

Definition at line 78 of file dhcpv4.h.

Function Documentation

◆ DHCPv4_init()

void DHCPv4_init ( uint8_t  s,
uint8_t *  buf 
)

◆ DHCPv4_time_handler()

void DHCPv4_time_handler ( void  )

Definition at line 969 of file dhcpv4.c.

References dhcpv4_tick_1s.

◆ reg_dhcpv4_cbfunc()

void reg_dhcpv4_cbfunc ( void(*)(void)  ip_assign,
void(*)(void)  ip_update,
void(*)(void)  ip_conflict 
)

◆ DHCPv4_run()

uint8_t DHCPv4_run ( void  )

◆ DHCPv4_stop()

void DHCPv4_stop ( void  )

Definition at line 838 of file dhcpv4.c.

References close(), DHCPV4_SOCKET, dhcpv4_state, and STATE_DHCPV4_STOP.

◆ getIPfromDHCPv4()

void getIPfromDHCPv4 ( uint8_t *  ip)

Definition at line 974 of file dhcpv4.c.

References DHCPv4_allocated_ip.

◆ getGWfromDHCPv4()

void getGWfromDHCPv4 ( uint8_t *  ip)

Definition at line 982 of file dhcpv4.c.

References DHCPv4_allocated_gw.

◆ getSNfromDHCPv4()

void getSNfromDHCPv4 ( uint8_t *  ip)

Definition at line 990 of file dhcpv4.c.

References DHCPv4_allocated_sn.

◆ getDNSfromDHCPv4()

void getDNSfromDHCPv4 ( uint8_t *  ip)

Definition at line 998 of file dhcpv4.c.

References DHCPv4_allocated_dns.

◆ getDHCPv4Leasetime()

uint32_t getDHCPv4Leasetime ( void  )

Definition at line 1006 of file dhcpv4.c.

References dhcpv4_lease_time.