new version handling
[vpp.git] / vpp / app / version.c
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <vlib/vlib.h>
16 #include <app/version.h>
17
18 static char * vpe_version_string = 
19 "vpp v" VPP_BUILD_VER " built by " VPP_BUILD_USER " on " VPP_BUILD_HOST " at " VPP_BUILD_DATE;
20 static char * vpe_dir_string = "workspace is " VPP_BUILD_TOPDIR;
21
22 static clib_error_t *
23 show_vpe_version_command_fn (vlib_main_t * vm,
24                  unformat_input_t * input,
25                  vlib_cli_command_t * cmd)
26 {
27   vlib_cli_output (vm, "%s", vpe_version_string);
28   if (unformat (input, "verbose")){
29      vlib_cli_output (vm, "%s", vpe_dir_string);
30   }
31   return 0;
32 }
33
34 VLIB_CLI_COMMAND (show_vpe_version_command, static) = {
35   .path = "show version",
36   .short_help = "show version information",
37   .function = show_vpe_version_command_fn,
38 };
39
40 char * vpe_api_get_build_directory (void) 
41 {
42   return VPP_BUILD_TOPDIR;
43 }
44
45 char * vpe_api_get_version (void) 
46 {
47   return VPP_BUILD_VER;
48 }
49 char * vpe_api_get_build_date (void) 
50 {
51   return VPP_BUILD_DATE;
52 }