Required to have reasonable logging messages.
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
openvswitchincludedir = $(includedir)/openvswitch
openvswitchinclude_HEADERS = \
include/openvswitch/types.h \
+ include/openvswitch/util.h \
include/openvswitch/version.h
--- /dev/null
+/*
+ * Copyright (c) 2008, 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.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OPENVSWITCH_UTIL_H
+#define OPENVSWITCH_UTIL_H 1
+
+#include <openvswitch/version.h>
+
+void ovs_set_program_name__(const char *name, const char *version,
+ const char *date, const char *time);
+
+#define ovs_set_program_name(name, version) \
+ ovs_set_program_name__(name, version, __DATE__, __TIME__)
+
+const char *ovs_get_program_name(void);
+const char *ovs_get_program_version(void);
+
+#endif
unixctl_version(struct unixctl_conn *conn, int argc OVS_UNUSED,
const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
{
- unixctl_command_reply(conn, get_program_version());
+ unixctl_command_reply(conn, ovs_get_program_version());
}
/* Registers a unixctl command with the given 'name'. 'usage' describes the
*
* The 'date' and 'time' arguments should likely be called with
* "__DATE__" and "__TIME__" to use the time the binary was built.
- * Alternatively, the "set_program_name" macro may be called to do this
+ * Alternatively, the "ovs_set_program_name" macro may be called to do this
* automatically.
*/
void
-set_program_name__(const char *argv0, const char *version, const char *date,
- const char *time)
+ovs_set_program_name__(const char *argv0, const char *version, const char *date,
+ const char *time)
{
char *basename;
#ifdef _WIN32
* caller must not modify or free the returned string.
*/
const char *
-get_program_version(void)
+ovs_get_program_version(void)
{
return program_version;
}
+/* Returns a pointer to a string describing the program name. The
+ * caller must not modify or free the returned string.
+ */
+const char *
+ovs_get_program_name(void)
+{
+ return program_name;
+}
+
/* Print the version information for the program. */
void
ovs_print_version(uint8_t min_ofp, uint8_t max_ofp)
#include "byte-order.h"
#include "compiler.h"
#include "openvswitch/types.h"
+#include "openvswitch/util.h"
#ifndef va_copy
#ifdef __va_copy
extern "C" {
#endif
-void set_program_name__(const char *name, const char *version,
- const char *date, const char *time);
#define set_program_name(name) \
- set_program_name__(name, VERSION, __DATE__, __TIME__)
+ ovs_set_program_name(name, OVS_PACKAGE_VERSION)
const char *get_subprogram_name(void);
void set_subprogram_name(const char *format, ...) PRINTF_FORMAT(1, 2);
-const char *get_program_version(void);
void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp);
NO_RETURN void out_of_memory(void);