linphonec.h 5.15 KB
Newer Older
aymeric's avatar
aymeric committed
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
/****************************************************************************
 *
 *  $Id: linphonec.h,v 1.3 2006/01/20 14:12:34 strk Exp $
 *
 *  Copyright (C) 2005  Sandro Santilli <strk@keybit.net>
 *
 ****************************************************************************
 *
 *  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 Library 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 LINPHONEC_H
#define LINPHONEC_H 1

strk's avatar
strk committed
28 29 30 31
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

Yann Diorcet's avatar
Yann Diorcet committed
32
#ifdef HAVE_READLINE
aymeric's avatar
aymeric committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46
#ifdef HAVE_READLINE_H
#include <readline.h>
#else
#ifdef HAVE_READLINE_READLINE_H
#include <readline/readline.h>
#endif
#endif
#ifdef HAVE_HISTORY_H
#include <history.h>
#else
#ifdef HAVE_READLINE_HISTORY_H
#include <readline/history.h>
#endif
#endif
Yann Diorcet's avatar
Yann Diorcet committed
47
#endif
aymeric's avatar
aymeric committed
48

smorlat's avatar
smorlat committed
49
#undef PARAMS
aymeric's avatar
aymeric committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
/**************************************************************************
 *
 * Compile-time defines
 *
 **************************************************************************/

#define HISTSIZE 500		/* how many lines of input history */
#define PROMPT_MAX_LEN 256	/* max len of prompt string */
#define LINE_MAX_LEN 256	/* really needed ? */

/*
 * Define this to have your primary contact
 * as the prompt string
 */
/* #define IDENTITY_AS_PROMPT 1 */

/*
 * Time between calls to linphonec_idle_call during main
 * input read loop in microseconds.
 */
70
#define LPC_READLINE_TIMEOUT 10000
aymeric's avatar
aymeric committed
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

/*
 * Filename of linphonec history
 */
#define LPC_HIST_FILE "~/.linphonec_history"

/*
 * Maximum number of pending authentications
 */
#define MAX_PENDING_AUTH 8

/**************************************************************************
 *
 *  Types
 *
 **************************************************************************/

/*
 * A structure which contains information on the commands this program
 * can understand.
 */
typedef int (*lpc_cmd_handler)(LinphoneCore *, char *);
typedef struct {
	char *name;		/* User printable name of the function. */
	lpc_cmd_handler func;	/* Function to call to do the job. */
	char *help;		/* Short help for this function.  */
	char *doc;		/* Long description.  */
} LPC_COMMAND;

100 101
typedef struct {
	int x,y,w,h;
102
	unsigned long wid;
103 104 105 106
	bool_t show;
	bool_t refresh;
} VideoParams;

107 108 109 110

extern VideoParams lpc_video_params;
extern VideoParams lpc_preview_params;

aymeric's avatar
aymeric committed
111 112
/***************************************************************************
 *
Jehan Monnier's avatar
Jehan Monnier committed
113
 *  Forward declarations
aymeric's avatar
aymeric committed
114 115 116 117 118
 *
 ***************************************************************************/

extern int linphonec_parse_command_line(LinphoneCore *lc, char *cl);
extern char *linphonec_command_generator(const char *text, int state);
smorlat's avatar
smorlat committed
119
void linphonec_main_loop_exit();
aymeric's avatar
aymeric committed
120
extern void linphonec_finish(int exit_status);
121
extern char *linphonec_readline(char *prompt);
smorlat's avatar
smorlat committed
122 123
void linphonec_set_autoanswer(bool_t enabled);
bool_t linphonec_get_autoanswer();
smorlat's avatar
smorlat committed
124
void linphonec_command_finished(void);
125
void linphonec_set_caller(const char *caller);
126 127
LinphoneCall *linphonec_get_call(long id);
void linphonec_call_identify(LinphoneCall* call);
aymeric's avatar
aymeric committed
128

129 130
extern bool_t linphonec_camera_enabled;

aymeric's avatar
aymeric committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
#endif /* def LINPHONEC_H */

/****************************************************************************
 *
 * $Log: linphonec.h,v $
 * Revision 1.3  2006/01/20 14:12:34  strk
 * Added linphonec_init() and linphonec_finish() functions.
 * Handled SIGINT and SIGTERM to invoke linphonec_finish().
 * Handling of auto-termination (-t) moved to linphonec_finish().
 * Reworked main (input read) loop to not rely on 'terminate'
 * and 'run' variable (dropped). configfile_name allocated on stack
 * using PATH_MAX limit. Changed print_usage signature to allow
 * for an exit_status specification.
 *
 * Revision 1.2  2006/01/14 13:29:32  strk
 * Reworked commands interface to use a table structure,
 * used by command line parser and help function.
 * Implemented first level of completion (commands).
 * Added notification of invalid "answer" and "terminate"
 * commands (no incoming call, no active call).
 * Forbidden "call" intialization when a call is already active.
 * Cleaned up all commands, adding more feedback and error checks.
 *
 * Revision 1.1  2006/01/13 13:00:29  strk
 * Added linphonec.h. Code layout change (added comments, forward decl,
 * globals on top, copyright notices and Logs). Handled out-of-memory
 * condition on history management. Removed assumption on sizeof(char).
 * Fixed bug in authentication prompt (introduced by readline).
 * Added support for multiple authentication requests (up to MAX_PENDING_AUTH).
 *
 *
 ****************************************************************************/