Beispiel #1
0
//----------------------------------------------------------------------
// HTTPD_OPTION
//----------------------------------------------------------------------
static int httpd_option()
{
    otr(NULL);
    otd("<input type=\"image\" src=\"/buttons/plus.png\"\n\
	    name=\"cfg-httpd\" alt=\"HTTPD\">\n");
    otd("Configure Http Daemon");
    otr("/");
}
Beispiel #2
0
//----------------------------------------------------------------------
// WLAN_OPTION
//----------------------------------------------------------------------
static int wlan_option()
{
    otr(NULL);
    otd("<input type=\"image\" src=\"/buttons/plus.png\"\n\
	    name=\"cfg-wlan\" alt=\"Wireless\">\n");
    otd("Configure Wireless Interfaces");
    otr("/");
}
Beispiel #3
0
//----------------------------------------------------------------------
// NETWORK_OPTION
//----------------------------------------------------------------------
static int network_option()
{
    otr(NULL);
    otd("<input type=\"image\" src=\"/buttons/plus.png\"\n\
	    name=\"cfg-network\" alt=\"Network\">\n");
    otd("Configure Network Interfaces");
    otr("/");
}
Beispiel #4
0
//----------------------------------------------------------------------
// UDHCPD_OPTION
//----------------------------------------------------------------------
static int udhcpd_option()
{
    otr(NULL);
    otd("<input type=\"image\" src=\"/buttons/plus.png\"\n\
	    name=\"cfg-udhcpd\" alt=\"DHCPD\">\n");
    otd("Configure DHCP Server");
    otr("/");

}
    /**
     * @brief Compute the sum of values and the sum of squared values of a patch with dimensions
     * 2*xWindow+1 by 2*yWindow+1 and centered in point p, using the integral image and integral
     * image of squared pixel values.
     * @param[in] p The center of the patch we want to calculate the sum and sum of squared values.
     * @param[in] s The integral image
     * @param[in] ss The integral image of squared values.
     * @param[out] sum The sum of pixels inside the patch.
     * @param[out] ssum The sum of squared values inside the patch.
     * @param [in] xWindow The distance from the central pixel of the patch to the border in x
     * direction.
     * @param [in] yWindow The distance from the central pixel of the patch to the border in y
     * direction.
     * @note Default value for xWindow, yWindow is 1. in this case the patch is 3x3.
     * @note integral images are very useful to sum values of patches in constant time independent
     * of their size. For more information refer to the cv::Integral function OpenCV page.
     */
    void patchSumSum2(const cv::Point2i p, const cv::Mat &sum, const cv::Mat &ssum,
                        float &s, float &ss, const int xWindow=1, const int yWindow=1)
    {
      cv::Point2i otl(p.x-xWindow, p.y-yWindow);
      //outer top right
      cv::Point2i otr(p.x+xWindow+1, p.y-yWindow);
      //outer bottom left
      cv::Point2i obl(p.x-xWindow, p.y+yWindow+1);
      //outer bottom right
      cv::Point2i obr(p.x+xWindow+1, p.y+yWindow+1);

      // sum and squared sum for right window
      s = (float)(sum.at<int>(otl) - sum.at<int>(otr)
          - sum.at<int>(obl) + sum.at<int>(obr));

      ss = (float)(ssum.at<double>(otl) - ssum.at<double>(otr)
           - ssum.at<double>(obl) + ssum.at<double>(obr));
    }
Beispiel #6
0
//----------------------------------------------------------------------
// WLAN_MENU
//----------------------------------------------------------------------
static int wlan_menu() {
    char **interface_list;
    char *filename;

    sprintf(bigbuf,"%s/wlan", globs.cfgdir);
    interface_sel = getenv("CGI_interface_sel");
    interface_list = get_file_chooser(bigbuf,interface_sel,"interface_sel","New Interface");
    if(interface_sel == NULL) {
	interface_sel = strdup(interface_list[1]);
    }

    sprintf(bigbuf,"wlan/%s", interface_sel);
    filename = strdup(bigbuf);
    read_cfg(filename,wkw,SEP,wv);
    free(filename);


    header("wlan");

    out_refresh_script();

    oform(("POST", "/cgi-bin/setup", "formw"));
    ohid("last_menu","wlan");
    ohid("j_click", "IGNORE");

    printf("<h3>Wireless Configuration Options</h3>\n");

    otbl(NULL);

    otr(NULL);
    oth("Wireless Interface");
    if (interface_sel[0] == 0 || strcmp(interface_sel,"__new") == 0) {
	otd(itext("interface_sel", "New Interface", 15, 15));
    } else {	
	otd(sel("onchange=\"send()\"", interface_list));
    }
    otr("/");

    otr(NULL);
    oth("Station ID (ESSID)");
    otd(itext(wkw[WLK_ESSID], wv[WLK_ESSID], 15, 12));
    otr("/");

    otr(NULL);
    oth("Security options (*)");
    {
	char *sec_sel[] = {
	    wkw[WLK_SECURITY], wv[WLK_SECURITY],
	    "None",                             "0",
	    "Hide SSID in beacon frames",       "1",
	    "Ignore clients with \"ANY\" SSID", "2",
	    "Both",                             "3",
	    NULL };
	    otd(sel("",sec_sel));
    }
    otr("/");

    otr(NULL);
    oth("Channel");
    {
	char *chan_sel[] = {
	    wkw[WLK_CHANNEL], wv[WLK_CHANNEL],
	    "Chan 1", "1",
	    "Chan 2", "2",
	    "Chan 3", "3",
	    "Chan 4", "4",
	    "Chan 5", "5",
	    "Chan 6", "6",
	    "Chan 7", "7",
	    "Chan 8", "8",
	    "Chan 9", "9",
	    "Chan 10", "10",
	    "Chan 11", "11",
	    "Chan 12", "12",
	    "Chan 13", "13",
	    NULL };
	    otd(sel("",chan_sel));
    }
    otr("/");

    otr(NULL);
    oth("Antenna Select RX");
    {
	char *aslr_list[] = {
	    wkw[WLK_ANTSEL_RX], wv[WLK_ANTSEL_RX],
	    "Default", "0", "Diversity", "1", "Low", "2", "High", "3",
	    NULL };
	    otd(sel("",aslr_list));
    }
    otr("/");

    otr(NULL);
    oth("TX");
    {
	char *aslt_list[] = {
	    wkw[WLK_ANTSEL_TX], wv[WLK_ANTSEL_TX],
	    "Default", "0", "Diversity", "1", "Low", "2", "High", "3",
	    NULL };
	    otd(sel("",aslt_list));
    }
    otr("/");

    otr(NULL);
    oth("Data Rate");
    {
	char *rate_list[] = {
	    wkw[WLK_RATE], wv[WLK_RATE],
	    "auto", "auto", "11Mb", "11Mb", "5Mb", "5Mb", "2Mb", "2Mb", "1Mb", "1Mb",
	    NULL };
	    otd(sel("",rate_list));
    }
    otr("/");

    otr(NULL);
    oth("Transmit Power");
    otd(itext(wkw[WLK_TXPOWER], wv[WLK_TXPOWER], 5, 4));
    otr("/");

    otr(NULL);
    oth("WEP Key<br>0x0x-0x0x-0x0x-0x0x-0x0x-0x0x-0x");
    otd(itext(wkw[WLK_WEP], wv[WLK_WEP], 40, 32));
    otr("/");

    otr(NULL);
    oth("Number of WDS Entries (AP Mode)");
    otd(itext(wkw[WLK_NWDS], wv[WLK_NWDS], 4, 2));
    otr("/");

    otbl("/");

    printf("(*) This option requires STA f/w ver 1.6.3 or newer\n");

    printf("<br><br>\n");
    ohid("menu","main");
    osub("f_click","OK");
    printf("&nbsp;&nbsp;&nbsp;\n");
    osub("f_click","CANCEL");
    oform(("/"));
}
Beispiel #7
0
//----------------------------------------------------------------------
// UDHCPD_MENU
//----------------------------------------------------------------------
static int udhcpd_menu()
{
    read_cfg("udhcpd.conf",uckw,uv);

    header("udhcpd");

    oform(("POST", "/cgi-bin/setup", NULL));
    ohid("last_menu","udhcpd");
    printf("<h3>DHCPD Configuration Options</h3>\n");

    otbl(NULL);

    otr(NULL);
    oth("Status");
    {
	char *stat_vals[] = {
	    ukw[UVK_ENABLE], uv[UVK_ENABLE],
	    "Enabled", "yes",
	    "Disabled", "no",
	    NULL };
	    otd(sel("",stat_vals));
    }
    otr("/");

    // This should be dynamically allocated
    otr(NULL);
    oth("Network Interface");
    {
	char *ifaces[] = {
	    ukw[UVK_INTERFACE], uv[UVK_INTERFACE],
	    "Ethernet 0 (eth0)", "eth0", 
	    "Ethernet 1 (eth1)", "eth1",
	    "Wireless 0 (wlan0)", "wlan0",
	    NULL };
	    otd(sel("",ifaces));
    }
    otr("/");

    otr(NULL);
    oth("Starting Address");
    otd(itext(ukw[UVK_START],uv[UVK_START], 18, 15));
    otr("/");

    otr(NULL);
    oth("Ending Address");
    otd(itext(ukw[UVK_END],uv[UVK_END], 18, 15));
    otr("/");

    otr(NULL);
    oth("Subnet Mask");
    otd(itext(ukw[UVK_SUBNET],uv[UVK_SUBNET], 18, 15));
    otr("/");

    otr(NULL);
    oth("Default Router");
    otd(itext(ukw[UVK_ROUTER],uv[UVK_ROUTER], 18, 15));
    otr("/");

    otr(NULL);
    oth("Domain Name Server(DNS)");
    otd(itext(ukw[UVK_DNS],uv[UVK_DNS], 18, 15));
    otr("/");

    otr(NULL);
    oth("Domain Name");
    otd(itext(ukw[UVK_DOMAIN],uv[UVK_DOMAIN], 18, 15));
    otr("/");

    otr(NULL);
    oth("Lease Time (in seconds)");
    otd(itext(ukw[UVK_LEASE], uv[UVK_LEASE], 18, 15));
    otr("/");

    otbl("/");

    printf("<br>\n");
    ohid("lease_file","/var/run/udhcpd.leases");
    ohid("menu","main");
    osub("f_click","OK");
    printf("&nbsp;&nbsp;&nbsp;\n");
    osub("f_click", "CANCEL");

    oform(("/"));
    printf("</body></html>\n");
}
Beispiel #8
0
//----------------------------------------------------------------------
// NETWORK_MENU
//----------------------------------------------------------------------
static int network_menu()
{
    read_cfg("netcfg",nkw,SEP,nv);

    header("menu");
    oform(("POST ","/cgi-bin/setup", NULL));
    ohid("last_menu","network");
    printf("<h3>Primary Network Interface (R/L 2=wlan0 3=br0 4=eth0)</h3>");

    otbl(NULL);
    otr(NULL);
    oth("Use DHCP");
    {
	char *dhcp_sel[] = {
	    nkw[NV_P_DHCP], nv[NV_P_DHCP],
	    "Enabled", "enabled", "Disabled", "disabled",
	    NULL };
	    otd(sel("",dhcp_sel));
    }
    otr("/");

    otr(NULL);
    oth("Network Address");
    otd(itext(nkw[NV_P_ADDRESS],nv[NV_P_ADDRESS], 18, 15));
    otr("/");

    otr(NULL);
    oth("Mask Address");
    otd(itext(nkw[NV_P_NETMASK],nv[NV_P_NETMASK], 18, 15));
    otr("/");

    otr(NULL);
    oth("Broadcast Address");
    otd(itext(nkw[NV_P_BROADCAST],nv[NV_P_BROADCAST], 18, 15));
    otr("/");

    otbl("/");
    printf("<br>\n");
    printf("<h3>Secondary Network Interface (R/L 2=eth0 4=wlan0 3=N/A)</h3>\n");

    otbl(NULL);

    otr(NULL);
    oth("Use DHCP");
    {
	char *dhcp_sel[] = {
	    nkw[NV_S_DHCP], nv[NV_S_DHCP],
	    "Enabled", "enabled", "Disabled", "disabled",
	    NULL };
	    otd(sel("",dhcp_sel));
    }
    otr("/");

    otr(NULL);
    oth("Network Address");
    otd(itext(nkw[NV_S_ADDRESS],nv[NV_S_ADDRESS], 18, 15));
    otr("/");

    otr(NULL);
    oth("Mask Address");
    otd(itext(nkw[NV_S_NETMASK],nv[NV_S_NETMASK], 18, 15));
    otr("/");

    otr(NULL);
    oth("Broadcast Address");
    otd(itext(nkw[NV_S_BROADCAST],nv[NV_S_BROADCAST], 18, 15));
    otr("/");

    otbl("/");

    printf("<br>\n");
    printf("<h3>Miscellaneous Configuration Data</h3>\n");

    otbl(NULL);

    otr(NULL);
    oth("TFTP Host");
    otd(itext(nkw[NV_TFTPHOST], nv[NV_TFTPHOST], 18,15));
    otr("/");

    otr(NULL);
    oth("Log (syslog) Server");
    otd(itext(nkw[NV_LOGSVR], nv[NV_LOGSVR], 18,15));
    otr("/");

    otr(NULL);
    oth("Watchdog interfaces (sepparated with spaces)");
    otd(itext(nkw[NV_IW_WATCHDOG_IF], nv[NV_IW_WATCHDOG_IF], 18,15));
    otr("/");

    otr(NULL);
    oth("Watchdog time interval (sec)");
    otd(itext(nkw[NV_IW_WATCHDOG_TIME], nv[NV_IW_WATCHDOG_TIME], 18,15));
    otr("/");

    otr(NULL);
    oth("Remote Date Host");
    otd(itext(nkw[NV_TIMESVR], nv[NV_TIMESVR], 18,15));
    otr("/");

    otr(NULL);
    oth("Default Router");
    otd(itext(nkw[NV_ROUTER], nv[NV_ROUTER], 18,15));
    otr("/");

    otr(NULL);
    oth("SWAP (NBD) Server");
    otd(itext(nkw[NV_SWAPSVR], nv[NV_SWAPSVR], 18,15));
    otr("/");

    otr(NULL);
    oth("SWAP (NBD) Port");
    otd(itext(nkw[NV_SWAPPORT], nv[NV_SWAPPORT], 18,15));
    otr("/");

    otr(NULL);
    oth("Masquerade Network");
    otd(itext(nkw[NV_MASQ_NET], nv[NV_MASQ_NET], 18,15));
    otr("/");

    otbl("/");

    printf("<br>\n");
    ohid("menu","main");
    osub("f_click","OK");
    printf("&nbsp;&nbsp;&nbsp;\n");
    osub("f_click", "CANCEL");

    oform(("/"));
    printf("</body></html>\n");
}