コード例 #1
0
ファイル: dhcp_cb.c プロジェクト: ADTL/WIZ550web
void w5500_dhcp_assign()
{
	S2E_Packet *value = get_S2E_Packet_pointer();
	wiz_NetInfo gWIZNETINFO;

	getIPfromDHCP(gWIZNETINFO.ip);
	getGWfromDHCP(gWIZNETINFO.gw);
	getSNfromDHCP(gWIZNETINFO.sn);
	getDNSfromDHCP(gWIZNETINFO.dns);

	get_S2E_Packet_value(gWIZNETINFO.mac, value->network_info_common.mac, sizeof(gWIZNETINFO.mac[0]) * 6);
	set_S2E_Packet_value(value->network_info_common.local_ip, gWIZNETINFO.ip, sizeof(value->network_info_common.local_ip));
	set_S2E_Packet_value(value->network_info_common.gateway, gWIZNETINFO.gw, sizeof(value->network_info_common.gateway));
	set_S2E_Packet_value(value->network_info_common.subnet, gWIZNETINFO.sn, sizeof(value->network_info_common.subnet));
	set_S2E_Packet_value(value->options.dns_server_ip, gWIZNETINFO.dns, sizeof(value->options.dns_server_ip));
	if(value->options.dhcp_use)
		gWIZNETINFO.dhcp = NETINFO_DHCP;
	else
		gWIZNETINFO.dhcp = NETINFO_STATIC;

	ctlnetwork(CN_SET_NETINFO, (void*) &gWIZNETINFO);

//	display_Net_Info();
//	printf("DHCP LEASED TIME : %d sec. \r\n", getDHCPLeasetime());
}
コード例 #2
0
ファイル: W5500-EVB_DNS.c プロジェクト: ScottJeong/DNS
int main(void) {

#if defined (__USE_LPCOPEN)
#if !defined(NO_BOARD_LIB)
    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
    // Set up and initialize all required blocks and
    // functions related to the board hardware
    Board_Init();
    // Set the LED to the state of "On"
    Board_LED_Set(0, true);
#endif
#endif
    uint8_t ip[4] = {0,};
    uint8_t gw[4] = {0,};
    uint8_t sn[4] = {0,};
    uint8_t dns[4] = {0,};

    SPI_Init();
    W5500_Init();
    //Net_Conf();

//    if ( SOCK_TCPS0 == socket(SOCK_TCPS1,Sn_MR_UDP,DHCP_CLIENT_PORT,0) ){
//    	printf("%d Socket open\n\r", SOCK_TCPS1);
//    }

    DHCP_init(SOCK_TCPS0, gDATABUF);
    while (DHCP_run() != DHCP_IP_LEASED)	printf("."),delay_cnt(10000);
    printf("\r\n");
    Board_LED_Set(0, false);
    Board_LED_Set(1, true);
    getIPfromDHCP(ip);
    getGWfromDHCP(gw);
	getSNfromDHCP(sn);
	getDNSfromDHCP(dns);

	printf("< DHCP IP Leased!! >\r\n");
	//printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", DHCP_CHADDR[0], DHCP_CHADDR[1], DHCP_CHADDR[2],  DHCP_CHADDR[3], DHCP_CHADDR[4], DHCP_CHADDR[0]);
	printf("IP	: %3d.%3d.%3d.%3d\r\n", ip[0], ip[1], ip[2], ip[3]);
	printf("GW	: %3d.%3d.%3d.%3d\r\n", gw[0], gw[1], gw[2], gw[3]);
	printf("SN	: %3d.%3d.%3d.%3d\r\n", sn[0], sn[1], sn[2], sn[3]);
	printf("DNS	: %3d.%3d.%3d.%3d\r\n", dns[0], dns[1], dns[2], dns[3]);
	DHCP_stop();

	DNS_Query();
    while(1) {

    }
    return 0 ;
}
コード例 #3
0
ファイル: main.c プロジェクト: Maxim-DE/W5500_EVB
/*******************************************************
 * @ brief Call back for ip assing & ip update from DHCP
 *******************************************************/
void my_ip_assign(void)
{
   getIPfromDHCP(gWIZNETINFO.ip);
   getGWfromDHCP(gWIZNETINFO.gw);
   getSNfromDHCP(gWIZNETINFO.sn);
   getDNSfromDHCP(gWIZNETINFO.dns);
   gWIZNETINFO.dhcp = NETINFO_DHCP;
   /* Network initialization */
   Net_Conf();      // apply from DHCP
#ifdef _MAIN_DEBUG_
   Display_Net_Conf();
   printf("DHCP LEASED TIME : %ld Sec.\r\n", getDHCPLeasetime());
   printf("\r\n");
#endif
}