Ejemplo n.º 1
0
int
raop_start(raop_t *raop, unsigned short *port, const char *hwaddr, int hwaddrlen, const char *password)
{
    assert(raop);
    assert(port);
    assert(hwaddr);

    /* Validate hardware address */
    if (hwaddrlen > MAX_HWADDR_LEN) {
        return -1;
    }

    memset(raop->password, 0, sizeof(raop->password));
    if (password) {
        /* Validate password */
        if (strlen(password) > MAX_PASSWORD_LEN) {
            return -1;
        }

        /* Copy password to the raop structure */
        strncpy(raop->password, password, MAX_PASSWORD_LEN);
    }

    /* Copy hwaddr to the raop structure */
    memcpy(raop->hwaddr, hwaddr, hwaddrlen);
    raop->hwaddrlen = hwaddrlen;

    return httpd_start(raop->httpd, port);
}
Ejemplo n.º 2
0
/* normally this is the main() function entry, but if OpenOCD is linked
 * into application, then this fn will not be invoked, but rather that
 * application will have it's own implementation of main(). */
int openocd_main(int argc, char *argv[])
{
	int ret;

	/* initialize commandline interface */
	command_context_t *cmd_ctx;

	cmd_ctx = setup_command_handler();

#if BUILD_IOUTIL
	if (ioutil_init(cmd_ctx) != ERROR_OK)
	{
		return EXIT_FAILURE;
	}
#endif

	LOG_OUTPUT("\n\nBUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS\n\n\n");

	print_version();

	command_context_mode(cmd_ctx, COMMAND_CONFIG);
	command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);

	if (parse_cmdline_args(cmd_ctx, argc, argv) != ERROR_OK)
		return EXIT_FAILURE;

	ret = parse_config_file(cmd_ctx);
	if ( (ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION) )
		return EXIT_FAILURE;

#if BUILD_HTTPD
	if (httpd_start()!=ERROR_OK)
		return EXIT_FAILURE;
#endif

	if (ret != ERROR_COMMAND_CLOSE_CONNECTION)
	{
		command_context_mode(cmd_ctx, COMMAND_EXEC);
		if (command_run_line(cmd_ctx, "init")!=ERROR_OK)
			return EXIT_FAILURE;

		/* handle network connections */
		server_loop(cmd_ctx);
	}

	/* shut server down */
	server_quit();

#if BUILD_HTTPD
	httpd_stop();
#endif

	unregister_all_commands(cmd_ctx);

	/* free commandline interface */
	command_done(cmd_ctx);


	return EXIT_SUCCESS;
}
Ejemplo n.º 3
0
void http_thread() {
	screenshot_buffer = malloc(SCREEN_BUFFER_SIZE);
	network_init();
	network_print_config();
	httpd_start();
	while(1) {
		network_poll();
	}
}
Ejemplo n.º 4
0
httpd_handle_t start_webserver(void)
{
    httpd_handle_t server = NULL;
    httpd_config_t config = HTTPD_DEFAULT_CONFIG();

    // Start the httpd server
    ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port);
    if (httpd_start(&server, &config) == ESP_OK) {
        // Set URI handlers
        ESP_LOGI(TAG, "Registering URI handlers");
        httpd_register_uri_handler(server, &hello);
        httpd_register_uri_handler(server, &echo);
        httpd_register_uri_handler(server, &ctrl);
        return server;
    }

    ESP_LOGI(TAG, "Error starting server!");
    return NULL;
}
static int _app_httpd_start()
{
  OSStatus err = kNoErr;
  app_httpd_log("initializing web-services");
  
  /*Initialize HTTPD*/
  if(is_http_init == false) {
    err = httpd_init();
    require_noerr_action( err, exit, app_httpd_log("failed to initialize httpd") );
    is_http_init = true;
  }
  
  /*Start http thread*/
  err = httpd_start();
  if(err != kNoErr) {
    app_httpd_log("failed to start httpd thread");
    httpd_shutdown();
  }
exit:
  return err;
}
Ejemplo n.º 6
0
void ActionStartHttpd(void * unused) {
    httpd_start();
}