1 /****************************************************************************
3 * $Id: linphonec.h,v 1.3 2006/01/20 14:12:34 strk Exp $
5 * Copyright (C) 2005 Sandro Santilli <strk@keybit.net>
7 ****************************************************************************
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Library General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ****************************************************************************/
33 #ifdef HAVE_READLINE_H
36 #ifdef HAVE_READLINE_READLINE_H
37 #include <readline/readline.h>
43 #ifdef HAVE_READLINE_HISTORY_H
44 #include <readline/history.h>
50 /**************************************************************************
52 * Compile-time defines
54 **************************************************************************/
56 #define HISTSIZE 500 /* how many lines of input history */
57 #define PROMPT_MAX_LEN 256 /* max len of prompt string */
58 #define LINE_MAX_LEN 256 /* really needed ? */
61 * Define this to have your primary contact
62 * as the prompt string
64 /* #define IDENTITY_AS_PROMPT 1 */
67 * Time between calls to linphonec_idle_call during main
68 * input read loop in microseconds.
70 #define LPC_READLINE_TIMEOUT 10000
73 * Filename of linphonec history
75 #define LPC_HIST_FILE "~/.linphonec_history"
78 * Maximum number of pending authentications
80 #define MAX_PENDING_AUTH 8
82 /**************************************************************************
86 **************************************************************************/
89 * A structure which contains information on the commands this program
92 typedef int (*lpc_cmd_handler)(LinphoneCore *, char *);
94 char *name; /* User printable name of the function. */
95 lpc_cmd_handler func; /* Function to call to do the job. */
96 char *help; /* Short help for this function. */
97 char *doc; /* Long description. */
108 extern VideoParams lpc_video_params;
109 extern VideoParams lpc_preview_params;
111 /***************************************************************************
113 * Forward declarations
115 ***************************************************************************/
117 extern int linphonec_parse_command_line(LinphoneCore *lc, char *cl);
118 extern char *linphonec_command_generator(const char *text, int state);
119 void linphonec_main_loop_exit();
120 extern void linphonec_finish(int exit_status);
121 extern char *linphonec_readline(char *prompt);
122 void linphonec_set_autoanswer(bool_t enabled);
123 bool_t linphonec_get_autoanswer();
124 void linphonec_command_finished(void);
125 void linphonec_set_caller(const char *caller);
126 LinphoneCall *linphonec_get_call(long id);
127 void linphonec_call_identify(LinphoneCall* call);
129 extern bool_t linphonec_camera_enabled;
131 #endif /* def LINPHONEC_H */
133 /****************************************************************************
135 * $Log: linphonec.h,v $
136 * Revision 1.3 2006/01/20 14:12:34 strk
137 * Added linphonec_init() and linphonec_finish() functions.
138 * Handled SIGINT and SIGTERM to invoke linphonec_finish().
139 * Handling of auto-termination (-t) moved to linphonec_finish().
140 * Reworked main (input read) loop to not rely on 'terminate'
141 * and 'run' variable (dropped). configfile_name allocated on stack
142 * using PATH_MAX limit. Changed print_usage signature to allow
143 * for an exit_status specification.
145 * Revision 1.2 2006/01/14 13:29:32 strk
146 * Reworked commands interface to use a table structure,
147 * used by command line parser and help function.
148 * Implemented first level of completion (commands).
149 * Added notification of invalid "answer" and "terminate"
150 * commands (no incoming call, no active call).
151 * Forbidden "call" intialization when a call is already active.
152 * Cleaned up all commands, adding more feedback and error checks.
154 * Revision 1.1 2006/01/13 13:00:29 strk
155 * Added linphonec.h. Code layout change (added comments, forward decl,
156 * globals on top, copyright notices and Logs). Handled out-of-memory
157 * condition on history management. Removed assumption on sizeof(char).
158 * Fixed bug in authentication prompt (introduced by readline).
159 * Added support for multiple authentication requests (up to MAX_PENDING_AUTH).
162 ****************************************************************************/