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 | |
| 31 | /******************************************************************* |
| 32 | * -mon_server.h |
| 33 | * |
| 34 | * BL framework - remote shell support |
| 35 | * |
| 36 | * This module is a back-end of remote shell support. |
| 37 | * - multiple servers |
| 38 | * - domain and TCP-based connections |
| 39 | * - session access level - per server |
| 40 | *******************************************************************/ |
| 41 | |
| 42 | #ifndef BCMCLI_SERVER_H_ |
| 43 | #define BCMCLI_SERVER_H_ |
| 44 | |
| 45 | #include <bcmos_system.h> |
| 46 | #include <bcmcli_session.h> |
| 47 | #include <bcmcli.h> |
| 48 | |
| 49 | /** Shell server transport type |
| 50 | */ |
| 51 | typedef enum { |
| 52 | BCMCLI_TRANSPORT_DOMAIN_SOCKET, |
| 53 | BCMCLI_TRANSPORT_TCP_SOCKET, |
| 54 | |
| 55 | BCMCLI_TRANSPORT__NUMBER_OF |
| 56 | } bcmclis_transport_type_t; |
| 57 | |
| 58 | /** Shell server parameters |
| 59 | */ |
| 60 | typedef struct bcmclis_parm |
| 61 | { |
| 62 | bcmcli_access_right access; /**< Access rights */ |
| 63 | bcmclis_transport_type_t transport; /**< Transport type */ |
| 64 | char *address; /**< Address in string form: domain socket file in local FS; port for TCP socket */ |
| 65 | int max_clients; /**< Max number of clients */ |
| 66 | } bcmclis_parm_t; |
| 67 | |
| 68 | |
| 69 | /** Create shell server. |
| 70 | * Immediately after creation server is ready to accept client connections |
| 71 | * \param[in] parms Server parameters |
| 72 | * \param[out] hs Server handle |
| 73 | * \return 0 - OK\n |
| 74 | * <0 - error code |
| 75 | */ |
| 76 | bcmos_errno bcmclis_server_create(const bcmclis_parm_t *parms, int *hs); |
| 77 | |
| 78 | /** Destroy shell server. |
| 79 | * All client connections if any are closed |
| 80 | * \param[in] hs Server handle |
| 81 | * \return 0 - OK\n |
| 82 | * <0 - error code |
| 83 | */ |
| 84 | bcmos_errno bcmclis_server_destroy(int hs); |
| 85 | |
| 86 | |
| 87 | /* Create shell_server directory in root_dir |
| 88 | Returns the "shell_server" directory handle |
| 89 | */ |
| 90 | bcmcli_entry *bcmclis_server_mon_init(bcmcli_entry *root_dir); |
| 91 | |
| 92 | |
| 93 | /* Destroy shell_server directory |
| 94 | */ |
| 95 | void bcmclis_server_mon_destroy(void); |
| 96 | |
| 97 | #endif /* BCMCLI_SERVER_H_ */ |