~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/pjlib-util/include/pjlib-util/cli_telnet.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id$ */
 
2
/* 
 
3
 * Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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 
 
18
 */
 
19
#ifndef __PJLIB_UTIL_CLI_TELNET_H__
 
20
#define __PJLIB_UTIL_CLI_TELNET_H__
 
21
 
 
22
/**
 
23
 * @file cli_telnet.h
 
24
 * @brief Command Line Interface Telnet Front End API
 
25
 */
 
26
 
 
27
#include <pjlib-util/cli_imp.h>
 
28
 
 
29
PJ_BEGIN_DECL
 
30
 
 
31
/**
 
32
 * @ingroup PJLIB_UTIL_CLI_IMP
 
33
 * @{
 
34
 *
 
35
 */
 
36
 
 
37
 /**
 
38
 * This structure contains the information about the telnet.
 
39
 * Application will get updated information each time the telnet is started/
 
40
 * restarted.
 
41
 */
 
42
typedef struct pj_cli_telnet_info
 
43
{
 
44
    /**
 
45
     * The telnet's ip address.
 
46
     */
 
47
    pj_str_t    ip_address;
 
48
 
 
49
    /**
 
50
     * The telnet's port number.
 
51
     */
 
52
    pj_uint16_t port;
 
53
 
 
54
    /* Internal buffer for IP address */
 
55
    char buf_[32];
 
56
 
 
57
} pj_cli_telnet_info;
 
58
 
 
59
/**
 
60
 * This specifies the callback called when telnet is started
 
61
 *
 
62
 * @param status        The status of telnet startup process.
 
63
 *
 
64
 */
 
65
typedef void (*pj_cli_telnet_on_started)(pj_status_t status);
 
66
 
 
67
/**
 
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.
 
71
 */
 
72
typedef struct pj_cli_telnet_cfg
 
73
{
 
74
    /**
 
75
     * Listening port number. The value may be 0 to let the system choose
 
76
     * the first available port.
 
77
     *
 
78
     * Default value: PJ_CLI_TELNET_PORT
 
79
     */
 
80
    pj_uint16_t port;
 
81
 
 
82
    /**
 
83
     * Ioqueue instance to be used. If this field is NULL, an internal
 
84
     * ioqueue and worker thread will be created.
 
85
     */
 
86
    pj_ioqueue_t *ioqueue;
 
87
 
 
88
    /**
 
89
     * Default log verbosity level for the session.
 
90
     *
 
91
     * Default value: PJ_CLI_TELNET_LOG_LEVEL
 
92
     */
 
93
    int log_level;
 
94
 
 
95
    /**
 
96
     * Specify a password to be asked to the end user to access the
 
97
     * application.
 
98
     *
 
99
     * Default: empty (no password)
 
100
     */
 
101
    pj_str_t passwd;
 
102
 
 
103
    /**
 
104
     * Specify text message to be displayed to newly connected users.
 
105
     *
 
106
     * Default: empty
 
107
     */
 
108
    pj_str_t welcome_msg;
 
109
 
 
110
    /**
 
111
     * Specify text message as a prompt string to user.
 
112
     *
 
113
     * Default: empty
 
114
     */
 
115
    pj_str_t prompt_str;
 
116
 
 
117
    /**
 
118
     * Specify the pj_cli_telnet_on_started callback.
 
119
     *
 
120
     * Default: empty
 
121
     */
 
122
    pj_cli_telnet_on_started on_started;
 
123
 
 
124
} pj_cli_telnet_cfg;
 
125
 
 
126
/**
 
127
 * Initialize pj_cli_telnet_cfg with its default values.
 
128
 *
 
129
 * @param param         The structure to be initialized.
 
130
 */
 
131
PJ_DECL(void) pj_cli_telnet_cfg_default(pj_cli_telnet_cfg *param);
 
132
 
 
133
 
 
134
/**
 
135
 * Create, initialize, and start a telnet daemon for the application.
 
136
 *
 
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.
 
142
 *
 
143
 * @return              PJ_SUCCESS on success, or the appropriate error code.
 
144
 */
 
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);
 
148
 
 
149
 
 
150
/**
 
151
 * Retrieve cli telnet info.
 
152
 *
 
153
 * @param telnet_info   The telnet runtime information.
 
154
 *
 
155
 * @return              PJ_SUCCESS on success.
 
156
 */
 
157
PJ_DECL(pj_status_t) pj_cli_telnet_get_info(pj_cli_front_end *fe, 
 
158
                                            pj_cli_telnet_info *info); 
 
159
 
 
160
/**
 
161
 * @}
 
162
 */
 
163
 
 
164
PJ_END_DECL
 
165
 
 
166
#endif /* __PJLIB_UTIL_CLI_TELNET_H__ */