linphonec.h 5.25 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

49
#undef PARAMS
Ghislain MARY's avatar
Ghislain MARY committed
50 51 52 53

#define INT_TO_VOIDPTR(i) ((void*)(intptr_t)(i))
#define VOIDPTR_TO_INT(p) ((int)(intptr_t)(p))

aymeric's avatar
aymeric committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
/**************************************************************************
 *
 * 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.
 */
74
#define LPC_READLINE_TIMEOUT 10000
aymeric's avatar
aymeric committed
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

/*
 * 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;

104 105
typedef struct {
	int x,y,w,h;
106
	void *wid;
107 108 109 110
	bool_t show;
	bool_t refresh;
} VideoParams;

111 112 113 114

extern VideoParams lpc_video_params;
extern VideoParams lpc_preview_params;

aymeric's avatar
aymeric committed
115 116
/***************************************************************************
 *
Jehan Monnier's avatar
Jehan Monnier committed
117
 *  Forward declarations
aymeric's avatar
aymeric committed
118 119 120 121 122
 *
 ***************************************************************************/

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

133 134
extern bool_t linphonec_camera_enabled;

aymeric's avatar
aymeric committed
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 163 164 165 166
#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).
 *
 *
 ****************************************************************************/