/*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "timeval.h"
#include "util.h"
#include "vlog.h"
+#include "ovstest.h"
-static struct command all_commands[];
-
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
+static struct command *get_all_commands(void);
-int
-main(int argc, char *argv[])
+static void
+test_jsonrpc_main(int argc, char *argv[])
{
proctitle_init(argc, argv);
set_program_name(argv[0]);
+ service_start(&argc, &argv);
parse_options(argc, argv);
- run_command(argc - optind, argv + optind, all_commands);
- return 0;
+ run_command(argc - optind, argv + optind, get_all_commands());
}
static void
OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1,
DAEMON_OPTION_ENUMS
};
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"verbose", optional_argument, NULL, 'v'},
{"help", no_argument, NULL, 'h'},
DAEMON_LONG_OPTIONS,
}
static struct command all_commands[] = {
- { "listen", 1, 1, do_listen },
- { "request", 3, 3, do_request },
- { "notify", 3, 3, do_notify },
- { "help", 0, INT_MAX, do_help },
- { NULL, 0, 0, NULL },
+ { "listen", NULL, 1, 1, do_listen },
+ { "request", NULL, 3, 3, do_request },
+ { "notify", NULL, 3, 3, do_notify },
+ { "help", NULL, 0, INT_MAX, do_help },
+ { NULL, NULL, 0, 0, NULL },
};
+
+static struct command *
+get_all_commands(void)
+{
+ return all_commands;
+}
+
+OVSTEST_REGISTER("test-jsonrpc", test_jsonrpc_main);