1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/* $Id$ */
/*
* Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJLIB_UTIL_CLI_TELNET_H__
#define __PJLIB_UTIL_CLI_TELNET_H__
/**
* @file cli_telnet.h
* @brief Command Line Interface Telnet Front End API
*/
#include <pjlib-util/cli_imp.h>
PJ_BEGIN_DECL
/**
* @ingroup PJLIB_UTIL_CLI_IMP
* @{
*
*/
/**
* This structure contains various options to instantiate the telnet daemon.
* Application must call pj_cli_telnet_cfg_default() to initialize
* this structure with its default values.
*/
typedef struct pj_cli_telnet_cfg
{
/**
* Listening port number. The value may be 0 to let the system choose
* the first available port.
*
* Default value: PJ_CLI_TELNET_PORT
*/
pj_uint16_t port;
/**
* Ioqueue instance to be used. If this field is NULL, an internal
* ioqueue and worker thread will be created.
*/
pj_ioqueue_t *ioqueue;
/**
* Default log verbosity level for the session.
*
* Default value: PJ_CLI_TELNET_LOG_LEVEL
*/
int log_level;
/**
* Specify a password to be asked to the end user to access the
* application.
*
* Default: empty (no password)
*/
pj_str_t passwd;
/**
* Specify text message to be displayed to newly connected users.
*
* Default: empty
*/
pj_str_t welcome_msg;
/**
* Specify text message as a prompt string to user.
*
* Default: empty
*/
pj_str_t prompt_str;
} pj_cli_telnet_cfg;
/**
* Initialize pj_cli_telnet_cfg with its default values.
*
* @param param The structure to be initialized.
*/
PJ_DECL(void) pj_cli_telnet_cfg_default(pj_cli_telnet_cfg *param);
/**
* Create, initialize, and start a telnet daemon for the application.
*
* @param cli The CLI application instance.
* @param param Optional parameters for creating the telnet daemon.
* If this value is NULL, default parameters will be used.
* @param p_fe Optional pointer to receive the front-end instance
* of the telnet front-end just created.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_cli_telnet_create(pj_cli_t *cli,
pj_cli_telnet_cfg *param,
pj_cli_front_end **p_fe);
/**
* @}
*/
PJ_END_DECL
#endif /* __PJLIB_UTIL_CLI_TELNET_H__ */
|