Ejemplo n.º 1
0
int Config_SetHttp(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	BOOL bIsChange = FALSE;
	unsigned long ulClientIP;
	int i;

	ulClientIP = httpGetClientAddr(hConnection).s_addr;

	switch (iAction)
	{
	case CA_AUTH:
		if (ulClientIP == 0x0100007f) return AUTH_ANY;
		else return AUTH_ADMIN;
		break;
	case CA_CONFIG:
		if (httpIsExistParam(pParamList, "Port"))
		{
			g_ConfigParam.usHttpPort[0] = (unsigned short)httpGetLong(pParamList, "Port");
			g_ConfigParam.usHttpPort[1] = 0;
			bIsChange = TRUE;
		}
		for (i = 0; i < sizeof(g_ConfigParam.usHttpPort) / sizeof(unsigned short); i++)
		{
			char ac[8];
			sprintf(ac, "Port%d", i);
			if (httpIsExistParam(pParamList, ac))
			{
				g_ConfigParam.usHttpPort[i] = (unsigned short)httpGetLong(pParamList, ac);
				bIsChange = TRUE;
			}
		}

		if (bIsChange == TRUE)
		{
			WebCameraLog(CL_PRIVILEGE_COMMON, CL_SET_HTTPPORT, httpGetString(pParamList, "Port"), hConnection);
			WriteFlashMemory(&g_ConfigParam);
		}
		/*Reboot the http server to change*/
#ifndef WLAN	
		WebCameraSIGTERM(0);
		diag_printf("Reboot the wb740!\n");
		wb740reboot(g_StreamServer_Buf, System_BUFFER_LEN);
#else
		WebCameraSIGTERM(0);
		W99802Reboot();
#endif		
		return 0;
		break;
	}
	return -1;
}
Ejemplo n.º 2
0
static int onHttpReboot_Safe (HTTPCONNECTION hConnection, time_t *tLastFill, void *pParam)
{
	request *req = (request *) hConnection;
#ifndef WLAN
	netclose (req->fd, g_StreamServer_Buf, System_BUFFER_LEN);
#else
	close(req->fd);
#endif	
#ifndef WLAN	
	WebCameraSIGTERM(0);
	diag_printf("Reboot the wb740!\n");
	wb740reboot(g_StreamServer_Buf, System_BUFFER_LEN);
#else
	WebCameraSIGTERM(0);
	W99802Reboot();
#endif

	return 0;
}
Ejemplo n.º 3
0
void test_wb740reboot_entry(char *pBuf, int iBufLen)
{
	wb740reboot(pBuf, iBufLen);
	test_printf_success("test_wb740reboot_entry");
}