1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 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 16 #ifndef NSTACKX_STATISTICS_H 17 #define NSTACKX_STATISTICS_H 18 #include <stdint.h> 19 20 typedef enum { 21 STATS_INVALID_OPT_AND_PAYLOAD, 22 STATS_DECODE_FAILED, 23 STATS_ENCODE_FAILED, 24 STATS_CREATE_HEADER_FAILED, 25 STATS_BUILD_PKT_FAILED, 26 STATS_SOCKET_ERROR, 27 STATS_EPOLL_ERROR, 28 STATS_CREATE_SERVER_FAILED, 29 STATS_CREATE_CLIENT_FAILED, 30 STATS_DROP_LOOPBACK_PKT, 31 STATS_SEND_MSG_FAILED, 32 STATS_SEND_REQUEST_FAILED, 33 STATS_DROP_MSG_ID, 34 STATS_HANDLE_SERVICE_MSG_FAILED, 35 STATS_HANDLE_DEVICE_DISCOVER_MSG_FAILED, 36 STATS_INVALID_RESPONSE_MSG, 37 STATS_POST_SD_REQUEST_FAILED, 38 STATS_ABORT_SD, 39 STATS_START_SD_FAILED, 40 STATS_CREATE_SERVICE_MSG_FAILED, 41 STATS_SEND_SD_RESPONSE_FAILED, 42 STATS_BACKUP_DEVICE_DB_FAILED, 43 STATS_UPDATE_DEVICE_DB_FAILED, 44 STATS_CREATE_CONTEX_FAILED, 45 STATS_CREATE_SESSION_FAILED, 46 STATS_PREPARE_SD_MSG_FAILED, 47 STATS_PARSE_SD_MSG_FAILED, 48 STATS_ALLOC_RECORD_FAILED, 49 STATS_FREE_RECORD_FAILED, 50 STATS_OVER_DEVICE_LIMIT, 51 STATS_MAX 52 } StatisticsType; 53 54 void ResetStatistics(void); 55 void IncStatistics(StatisticsType type); 56 const uint64_t *GetStatistics(void); 57 #endif