Exemplo n.º 1
0
int init_module(void)
{
	START_TESTS("Translating the Packet");

	if (config_init(&config))
		return false;

	/* Misc single function tests */
	CALL_TEST(test_function_has_unexpired_src_route(), "Unexpired source route querier");
	CALL_TEST(test_function_build_id_field(), "Identification builder");
	CALL_TEST(test_function_icmp6_minimum_mtu(), "ICMP6 Minimum MTU function");
	CALL_TEST(test_function_icmp4_to_icmp6_param_prob(), "Param problem function");

	CALL_TEST(test_function_generate_ipv4_id(), "Generate id function");
	CALL_TEST(test_function_generate_df_flag(), "Generate DF flag function");
	CALL_TEST(test_function_build_protocol_field(), "Build protocol function");
	CALL_TEST(test_function_has_nonzero_segments_left(), "Segments left indicator function");
	CALL_TEST(test_function_icmp4_minimum_mtu(), "ICMP4 Minimum MTU function");

	config_put(config);

	END_TESTS;
}
Exemplo n.º 2
0
int main (int argc, char *argv[])
{
    int ch;
    flux_conf_t cf;
    char *cmd;
    bool vopt = false;
    flux_t h = NULL;
    char *confdir = NULL;

    log_init ("flux-config");

    while ((ch = getopt_long (argc, argv, OPTIONS, longopts, NULL)) != -1) {
        switch (ch) {
            case 'v': /* --verbose */
                vopt=  true;
                break;
            default:
                usage ();
                break;
        }
    }
    if (optind == argc)
        usage ();
    cmd = argv[optind++];

    /* Process config from the KVS if running in a session and not
     * forced to use a config file by the command line.
     */
    cf = flux_conf_create ();
    if ((confdir = getenv ("FLUX_CONF_DIRECTORY")))
        flux_conf_set_directory (cf, confdir);
    if (getenv ("FLUX_CONF_USEFILE")) {
        if (vopt)
            msg ("Loading config from %s", flux_conf_get_directory (cf));
        if (flux_conf_load (cf) < 0)
            err_exit ("%s", flux_conf_get_directory (cf));
    } else if (getenv ("FLUX_URI")) {
        if (vopt)
            msg ("Loading config from KVS");
        if (!(h = flux_open (NULL, 0)))
            err_exit ("flux_open");
        if (kvs_conf_load (h, cf) < 0)
            err_exit ("could not load config from KVS");
    }

    if (!strcmp (cmd, "get"))
        config_get (cf, argc - optind, argv + optind);
    else if (!strcmp (cmd, "dump"))
        config_dump (cf, argc - optind, argv + optind);
    else if (!strcmp (cmd, "put"))
        config_put (cf, h, vopt, argc - optind, argv + optind);
    else if (!strcmp (cmd, "save"))
        config_save (cf, vopt, argc - optind, argv + optind);
    else
        usage ();

    if (h)
        flux_close (h);
    flux_conf_destroy (cf);
    log_fini();
    exit (0);
}