Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | <:copyright-BRCM:2016:DUAL/GPL:standard |
| 3 | |
| 4 | Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Unless you and Broadcom execute a separate written software license |
| 8 | agreement governing use of this software, this software is licensed |
| 9 | to you under the terms of the GNU General Public License version 2 |
| 10 | (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| 11 | with the following added to such license: |
| 12 | |
| 13 | As a special exception, the copyright holders of this software give |
| 14 | you permission to link this software with independent modules, and |
| 15 | to copy and distribute the resulting executable under terms of your |
| 16 | choice, provided that you also meet, for each linked independent |
| 17 | module, the terms and conditions of the license of that module. |
| 18 | An independent module is a module which is not derived from this |
| 19 | software. The special exception does not apply to any modifications |
| 20 | of the software. |
| 21 | |
| 22 | Not withstanding the above, under no circumstances may you combine |
| 23 | this software in any way with any other Broadcom software provided |
| 24 | under a license other than the GPL, without Broadcom's express prior |
| 25 | written consent. |
| 26 | |
| 27 | :> |
| 28 | */ |
| 29 | |
| 30 | #ifndef _BCMOLT_USER_APPL_REMOTE_LOGGER_H_ |
| 31 | #define _BCMOLT_USER_APPL_REMOTE_LOGGER_H_ |
| 32 | |
| 33 | #include <bcmos_system.h> |
| 34 | #include <bcmolt_msg.h> |
| 35 | |
| 36 | #define BCMOLT_REMOTE_LOGGER_FILENAME_MAX_LEN 128 |
| 37 | |
| 38 | /** Possible actions to take when the max log file size is reached. */ |
| 39 | typedef enum |
| 40 | { |
| 41 | BCMOLT_REMOTE_LOGGER_FILE_SIZE_REACHED_BEHAVIOR_STOP, /**< Stop the remote logger application. */ |
| 42 | BCMOLT_REMOTE_LOGGER_FILE_SIZE_REACHED_BEHAVIOR_CLEAR, /**< Clear all content from the file and continue. */ |
| 43 | } bcmolt_remote_logger_file_size_reached_behavior; |
| 44 | |
| 45 | /** Configuration for the remote logger application. */ |
| 46 | typedef struct |
| 47 | { |
| 48 | uint32_t polling_period_ms; /**< Time to wait in between polling API calls. */ |
| 49 | uint32_t subsequent_delay_ms; /**< Minumum required time to wait in between susequent API calls. */ |
| 50 | uint32_t max_file_size; /**< Maximum size for the output file in bytes. */ |
| 51 | |
| 52 | /** Output file full path. */ |
| 53 | char filename[BCMOLT_REMOTE_LOGGER_FILENAME_MAX_LEN]; |
| 54 | |
| 55 | /** Behavior when the max file size is reached. */ |
| 56 | bcmolt_remote_logger_file_size_reached_behavior max_file_size_reached_behavior; |
| 57 | } bcmolt_remote_logger_cfg; |
| 58 | |
| 59 | /** Initialize the remote logger application (this should be called as part of application startup). */ |
| 60 | void bcmolt_remote_logger_appl_init(void); |
| 61 | |
| 62 | /** Start the remote logger application. |
| 63 | * \return BCM_ERR_OK if the application was started successfully, <0 otherwise. |
| 64 | */ |
| 65 | bcmos_errno bcmolt_remote_logger_appl_start(bcmolt_devid device); |
| 66 | |
| 67 | /** Stop the remote logger application. |
| 68 | * \return BCM_ERR_OK if the application was stopped successfully, <0 otherwise. |
| 69 | */ |
| 70 | bcmos_errno bcmolt_remote_logger_appl_stop(bcmolt_devid device); |
| 71 | |
| 72 | /** Query whether the remote logger application is currently running. |
| 73 | * \return BCMOS_TRUE if the application is running, BCMOS_FALSE otherwise. |
| 74 | */ |
| 75 | bcmos_bool bcmolt_remote_logger_appl_is_running(bcmolt_devid device); |
| 76 | |
| 77 | /** Get the configuration of the remote logger application. |
| 78 | * \param[out] cfg Remote logger configuration. |
| 79 | * \return BCM_ERR_OK if the configuration was retrieved successfully, <0 otherwise. |
| 80 | */ |
| 81 | bcmos_errno bcmolt_remote_logger_appl_cfg_get(bcmolt_devid device, bcmolt_remote_logger_cfg *cfg); |
| 82 | |
| 83 | /** Change the configuration of the remote logger application. |
| 84 | * \param[in] cfg Remote logger configuration. |
| 85 | * \return BCM_ERR_OK if the configuration was updated successfully, <0 otherwise. |
| 86 | */ |
| 87 | bcmos_errno bcmolt_remote_logger_appl_cfg_update(bcmolt_devid device, const bcmolt_remote_logger_cfg *cfg); |
| 88 | |
| 89 | #endif |