例如:
script_tcpip_setting.sct文件中的函数 SET_LOCAL_IPCFG(……);
1、通过这个函数名在所有文件中搜索得到:------------------------>
2、得到文件Action_id.nsp:在这个文件中包含有UI与maicode之间的函数一一映射如:
#map APP_SET_LOCAL_IPCFG_ID "SET_LOCAL_IPCFG"
maincode 中的函数 UI中的函数
3、搜索maincode中的函数APP_SET_LOCAL_IPCFG_ID得到:--------------->
4、得到文件Action_id.h: 在这个文件中有
#define APP_SET_LOCAL_IPCFG_ID ((ACTION_TYPE_APP<<16) | APP_SET_LOCAL_IPCFG)
5、在搜索APP_SET_LOCAL_IPCFG得到:
6、得到文件Gw_action_list.c :在这个文件中有:
{APP_SET_LOCAL_IPCFG, GW_set_local_ipcfg_hdl},
7、又找到相对应的函数,我们在搜索GW_set_local_ipcfg_hdl函数得到:
8、得到文件Hdl_list.c
在这个文件中有函数
UINT8 GW_set_local_ipcfg_hdl(void ** const para, INT32 * ret)
{
#ifdef NETWORK_SUPPORT
if( set_local_ip_address( *((UINT8*)para[0]), *((UINT32*)para[1])) == SUCCESS)
{
return SUCCESS;
}
return ERROR;
#else
return ERROR;
#endif
}
在这个函数里调用了函数set_local_ip_address,再找到函数set_local_ip_address的定义,
在文件App_network_ipcfg.c中;
UINT8 set_local_ip_address (UINT8 iptype, UINT32 addr)
{
stInAddr.s_addr = addr;
switch(iptype)
{
case IP_LOCAL_CFG_IP_ADDR:
cur_local_ipcfg.ip_addr = addr;
stInAddr.s_addr = addr;
ip_addr = inet_ntoa(stInAddr);
libc_printf("set inet_ntoa(stInAddr) = %s\n",inet_ntoa(stInAddr));
libc_printf("ip_addr = %s\n",ip_addr);
libc_printf("set addr = %d\n",addr);
strcpy(ip_addrshuzu,ip_addr);
libc_printf("ip_addrshuzu = %s\n",ip_addrshuzu);
break;
case IP_LOCAL_CFG_SUBNET_MASK:
cur_local_ipcfg.subnet_mask= addr;
break;
case IP_LOCAL_CFG_GATEWAY:
cur_local_ipcfg.gateway= addr;
break;
case IP_LOCAL_CFG_DNS:
cur_local_ipcfg.dns= addr;
break;
case IP_LOCAL_CFG_DNS2:
cur_local_ipcfg.dns2= addr;
break;
default:
break;
}
return SUCCESS;
}