1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 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 #define TLOG_TAG "metrics-srv" 18 19 #include "consumer.h" 20 #include "client.h" 21 22 #include <lib/tipc/tipc_srv.h> 23 #include <lk/err_ptr.h> 24 #include <stdio.h> 25 #include <trusty_log.h> 26 27 static struct srv_state state; 28 main(void)29int main(void) { 30 int rc; 31 struct tipc_hset* hset; 32 33 hset = tipc_hset_create(); 34 if (IS_ERR(hset)) { 35 TLOGE("failed (%d) to create handle set\n", PTR_ERR(hset)); 36 return PTR_ERR(hset); 37 } 38 39 state.ns_handle = INVALID_IPC_HANDLE; 40 41 rc = add_metrics_consumer_service(hset, &state); 42 if (rc != NO_ERROR) { 43 TLOGE("failed (%d) to add metrics consumer service\n", rc); 44 return rc; 45 } 46 47 return tipc_run_event_loop(hset); 48 } 49