Exemplo n.º 1
0
int main(int argc, char **argv)
{
	struct NET_CONFIG netcfg;
	int i;
	
	if (argc < 3) {
		net_get_info("eth0", &netcfg);
		return 0;
	}
	
	for (i=1; i<argc; i++)
		printf("arg[%d]=%s\n", i, argv[i]);
	
	if (!strcmp(argv[2], "up"))
		net_set_flag(argv[1], (IFF_UP | IFF_RUNNING));
	else if (!strcmp(argv[2], "down"))
		net_clr_flag(argv[1], IFF_UP);
	else if (!strcmp(argv[2], "ip")) {
		net_set_ifaddr(argv[1], inet_addr(argv[3]));
	}
	else if (!strcmp(argv[2], "netmask")) {
		net_set_netmask(argv[1], inet_addr(argv[3]));
	}
	else if (!strcmp(argv[2], "gateway")) {
		if (!strcmp(argv[1], "add")) 
			net_add_gateway(inet_addr(argv[3]));
		else
			net_del_gateway(inet_addr(argv[3]));
	}
	else if (!strcmp(argv[2], "dhcpcd")) {
		if (!strcmp(argv[3], "enable")) 
			net_enable_dhcpcd(argv[1]);
		else
			net_disable_dhcpcd(argv[1]);
	}
	else if (!strcmp(argv[1], "dns"))
		net_set_dns(argv[2]);
	else
		printf("unknown argument!\n");
	return 0;
}
Exemplo n.º 2
0
void TestNetStatus(void)
{
	struct net_device *dev;
	unsigned char LinkStatus;
	//char str[100];
	UINT16 STRID;
	
	dev = (struct net_device *)dev_get_by_type(NULL, HLD_DEV_TYPE_NET);
	net_get_info(dev, NET_GET_LINK_STATUS, &LinkStatus);

	if(LinkStatus==0)
		//sprintf(str,"%s","Network is connected");
		STRID = RS_NET_CONNECT;
	else
		//sprintf(str,"%s","Network is disconnect");
		STRID = RS_NET_DISCONNECT;

	//memset(str_status,0,sizeof(str_status));
	//OSD_SetTextFieldStrPoint(&txt_netstatus,str_status);
	//OSD_SetTextFieldContent(&txt_netstatus,STRING_ANSI,(UINT32)str);
	OSD_SetTextFieldContent(&txt_netstatus,STRING_ID,STRID);

	OSD_DrawObject((POBJECT_HEAD)&txt_netstatus,C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL);
}