Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nwk_stats_api.h Source File

nwk_stats_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef NWK_STATS_API_H
00018 #define NWK_STATS_API_H
00019 /**
00020  * \file nwk_stats_api.h
00021  * \brief 6LowPAN library network stats API
00022  *
00023  * - protocol_stats_start(), Enable stats update.
00024  * - protocol_stats_stop(), Stop stack stats update.
00025  * - protocol_stats_reset(), Reset all stats information to null.
00026  *
00027  *
00028  */
00029 
00030 #include "ns_types.h"
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00036 /**
00037  * /struct nwk_stats_t
00038  * /brief Struct for network stats buffer structure.
00039  */
00040 typedef struct nwk_stats_t {
00041     /* 6Lowpan */
00042     uint32_t ip_rx_count;           /**< IP RX packet count. */
00043     uint32_t ip_tx_count;           /**< IP TX packet count. */
00044     uint32_t ip_rx_drop;            /**< IP RX packet drops count. */
00045     uint32_t ip_cksum_error;        /**< IP checksum error count. */
00046     /* IP Payload Flow */
00047     uint32_t ip_tx_bytes;           /**< IP TX bytes count. */
00048     uint32_t ip_rx_bytes;           /**< IP RX bytes count. */
00049     uint32_t ip_routed_up;          /**< IP routed UP bytes count. */
00050     uint32_t ip_no_route;           /**< IP no route count. */
00051     /* Fragments */
00052     uint32_t frag_rx_errors;        /**< Fragmentation RX error count. */
00053     uint32_t frag_tx_errors;        /**< Fragmentation TX error count. */
00054     /*RPL stats*/
00055     uint32_t rpl_route_routecost_better_change; /**< RPL parent change count. */
00056     uint32_t ip_routeloop_detect;               /**< RPL route loop detection count. */
00057     uint32_t rpl_memory_overflow;   /**< RPL memory overflow count. */
00058     uint32_t rpl_parent_tx_fail;    /**< RPL transmit errors to DODAG parents. */
00059     uint32_t rpl_unknown_instance;  /**< RPL unknown instance ID count. */
00060     uint32_t rpl_local_repair;      /**< RPL local repair count. */
00061     uint32_t rpl_global_repair;     /**< RPL global repair count. */
00062     uint32_t rpl_malformed_message; /**< RPL malformed message count. */
00063     uint32_t rpl_time_no_next_hop;  /**< RPL seconds without a next hop. */
00064     uint32_t rpl_total_memory;      /**< RPL current memory usage total. */
00065     /* Buffers */
00066     uint32_t buf_alloc;             /**< Buffer allocation count. */
00067     uint32_t buf_headroom_realloc;  /**< Buffer headroom realloc count. */
00068     uint32_t buf_headroom_shuffle;  /**< Buffer headroom shuffle count. */
00069     uint32_t buf_headroom_fail;     /**< Buffer headroom failure count. */
00070     /* ETX */
00071     uint16_t etx_1st_parent;        /**< Primary parent ETX. */
00072     uint16_t etx_2nd_parent;        /**< Secondary parent ETX. */
00073     /* MAC */
00074     uint16_t adapt_layer_tx_queue_size; /**< Adaptation layer direct TX queue size. */
00075     uint16_t adapt_layer_tx_queue_peak; /**< Adaptation layer direct TX queue size peak. */
00076 } nwk_stats_t;
00077 
00078 /**
00079   *  \brief Enable stats collection.
00080   *
00081   * \param stats_ptr A static pointer to stack update.
00082   *
00083   */
00084 extern void protocol_stats_start(nwk_stats_t *stats_ptr);
00085 /**
00086   *  \brief Disable stats collection.
00087   *
00088   */
00089 extern void protocol_stats_stop(void);
00090 /**
00091   *  \brief Reset stats info fiels.
00092   *
00093   */
00094 extern void protocol_stats_reset(void);
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098 #endif