Line data Source code
1 : /* 2 : *------------------------------------------------------------------ 3 : * Copyright (c) 2021 Cisco and/or its affiliates. 4 : * Licensed under the Apache License, Version 2.0 (the "License"); 5 : * you may not use this file except in compliance with the License. 6 : * You may obtain a copy of the License at: 7 : * 8 : * http://www.apache.org/licenses/LICENSE-2.0 9 : * 10 : * Unless required by applicable law or agreed to in writing, software 11 : * distributed under the License is distributed on an "AS IS" BASIS, 12 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 : * See the License for the specific language governing permissions and 14 : * limitations under the License. 15 : *------------------------------------------------------------------ 16 : */ 17 : 18 : #include <vat/vat.h> 19 : #include <vlibapi/api.h> 20 : #include <vlibmemory/api.h> 21 : #include <vppinfra/error.h> 22 : #include <vpp/api/types.h> 23 : 24 : #include <vpp/api/vpe.api_enum.h> 25 : #include <vpp/api/vpe.api_types.h> 26 : 27 : #define __plugin_msg_base vpe_test_main.msg_id_base 28 : #include <vlibapi/vat_helper_macros.h> 29 : 30 : /* Declare message IDs */ 31 : #include <vnet/format_fns.h> 32 : 33 : typedef struct 34 : { 35 : /* API message ID base */ 36 : u16 msg_id_base; 37 : vat_main_t *vat_main; 38 : } vpe_test_main_t; 39 : 40 : vpe_test_main_t vpe_test_main; 41 : 42 : static int 43 0 : api_show_version (vat_main_t *vam) 44 : { 45 : vl_api_show_version_t *mp; 46 : int ret; 47 : 48 0 : M (SHOW_VERSION, mp); 49 : 50 0 : S (mp); 51 0 : W (ret); 52 0 : return ret; 53 : } 54 : 55 : static int 56 0 : api_log_dump (vat_main_t *vam) 57 : { 58 : /* Not yet implemented */ 59 0 : return -1; 60 : } 61 : 62 : static int 63 0 : api_show_vpe_system_time (vat_main_t *vam) 64 : { 65 : /* Not yet implemented */ 66 0 : return -1; 67 : } 68 : 69 : static void 70 0 : vl_api_show_version_reply_t_handler (vl_api_show_version_reply_t *mp) 71 : { 72 0 : vat_main_t *vam = &vat_main; 73 0 : i32 retval = ntohl (mp->retval); 74 : 75 0 : if (retval >= 0) 76 : { 77 0 : errmsg (" program: %s", mp->program); 78 0 : errmsg (" version: %s", mp->version); 79 0 : errmsg (" build date: %s", mp->build_date); 80 0 : errmsg ("build directory: %s", mp->build_directory); 81 : } 82 0 : vam->retval = retval; 83 0 : vam->result_ready = 1; 84 0 : } 85 : 86 : static void 87 0 : vl_api_log_details_t_handler (vl_api_log_details_t *mp) 88 : { 89 : /* Not yet implemented */ 90 0 : } 91 : 92 : static void 93 0 : vl_api_show_vpe_system_time_reply_t_handler ( 94 : vl_api_show_vpe_system_time_reply_t *mp) 95 : { 96 : /* Not yet implemented */ 97 0 : } 98 : 99 : #include <vpp/api/vpe.api_test.c>