3
* Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#ifndef __PJLIB_UTIL_CLI_TELNET_H__
20
#define __PJLIB_UTIL_CLI_TELNET_H__
24
* @brief Command Line Interface Telnet Front End API
27
#include <pjlib-util/cli_imp.h>
32
* @ingroup PJLIB_UTIL_CLI_IMP
38
* This structure contains the information about the telnet.
39
* Application will get updated information each time the telnet is started/
42
typedef struct pj_cli_telnet_info
45
* The telnet's ip address.
50
* The telnet's port number.
54
/* Internal buffer for IP address */
60
* This specifies the callback called when telnet is started
62
* @param status The status of telnet startup process.
65
typedef void (*pj_cli_telnet_on_started)(pj_status_t status);
68
* This structure contains various options to instantiate the telnet daemon.
69
* Application must call pj_cli_telnet_cfg_default() to initialize
70
* this structure with its default values.
72
typedef struct pj_cli_telnet_cfg
75
* Listening port number. The value may be 0 to let the system choose
76
* the first available port.
78
* Default value: PJ_CLI_TELNET_PORT
83
* Ioqueue instance to be used. If this field is NULL, an internal
84
* ioqueue and worker thread will be created.
86
pj_ioqueue_t *ioqueue;
89
* Default log verbosity level for the session.
91
* Default value: PJ_CLI_TELNET_LOG_LEVEL
96
* Specify a password to be asked to the end user to access the
99
* Default: empty (no password)
104
* Specify text message to be displayed to newly connected users.
108
pj_str_t welcome_msg;
111
* Specify text message as a prompt string to user.
118
* Specify the pj_cli_telnet_on_started callback.
122
pj_cli_telnet_on_started on_started;
127
* Initialize pj_cli_telnet_cfg with its default values.
129
* @param param The structure to be initialized.
131
PJ_DECL(void) pj_cli_telnet_cfg_default(pj_cli_telnet_cfg *param);
135
* Create, initialize, and start a telnet daemon for the application.
137
* @param cli The CLI application instance.
138
* @param param Optional parameters for creating the telnet daemon.
139
* If this value is NULL, default parameters will be used.
140
* @param p_fe Optional pointer to receive the front-end instance
141
* of the telnet front-end just created.
143
* @return PJ_SUCCESS on success, or the appropriate error code.
145
PJ_DECL(pj_status_t) pj_cli_telnet_create(pj_cli_t *cli,
146
pj_cli_telnet_cfg *param,
147
pj_cli_front_end **p_fe);
151
* Retrieve cli telnet info.
153
* @param telnet_info The telnet runtime information.
155
* @return PJ_SUCCESS on success.
157
PJ_DECL(pj_status_t) pj_cli_telnet_get_info(pj_cli_front_end *fe,
158
pj_cli_telnet_info *info);
166
#endif /* __PJLIB_UTIL_CLI_TELNET_H__ */