2005-04-17 02:20:36 +04:00
/* $Id: isdn_divert.h,v 1.5.6.1 2001/09/23 22:24:36 kai Exp $
*
* Header for the diversion supplementary ioctl interface .
*
* Copyright 1998 by Werner Cornelius ( werner @ ikt . de )
2012-02-20 07:52:38 +04:00
*
2005-04-17 02:20:36 +04:00
* This software may be used and distributed according to the terms
* of the GNU General Public License , incorporated herein by reference .
*
*/
# include <linux/ioctl.h>
# include <linux/types.h>
/******************************************/
/* IOCTL codes for interface to user prog */
/******************************************/
# define DIVERT_IIOC_VERSION 0x01 /* actual version */
# define IIOCGETVER _IO('I', 1) /* get version of interface */
# define IIOCGETDRV _IO('I', 2) /* get driver number */
# define IIOCGETNAM _IO('I', 3) /* get driver name */
# define IIOCGETRULE _IO('I', 4) /* read one rule */
2012-02-20 07:52:38 +04:00
# define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */
2005-04-17 02:20:36 +04:00
# define IIOCINSRULE _IO('I', 6) /* insert/append one rule */
# define IIOCDELRULE _IO('I', 7) /* delete a rule */
# define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */
# define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */
2012-02-20 07:52:38 +04:00
# define IIOCDOCFDIS _IO('I', 10) /* deactivate control forwarding in PBX */
# define IIOCDOCFINT _IO('I', 11) /* interrogate control forwarding in PBX */
2005-04-17 02:20:36 +04:00
/*************************************/
/* states reported through interface */
/*************************************/
# define DEFLECT_IGNORE 0 /* ignore incoming call */
# define DEFLECT_REPORT 1 /* only report */
# define DEFLECT_PROCEED 2 /* deflect when externally triggered */
2012-02-20 07:52:38 +04:00
# define DEFLECT_ALERT 3 /* alert and deflect after delay */
2005-04-17 02:20:36 +04:00
# define DEFLECT_REJECT 4 /* reject immediately */
# define DIVERT_ACTIVATE 5 /* diversion activate */
# define DIVERT_DEACTIVATE 6 /* diversion deactivate */
2012-02-20 07:52:38 +04:00
# define DIVERT_REPORT 7 /* interrogation result */
# define DEFLECT_AUTODEL 255 /* only for internal use */
2005-04-17 02:20:36 +04:00
# define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
2013-01-21 15:57:20 +04:00
typedef struct {
ulong drvid ; /* driver ids, bit mapped */
2012-02-20 07:52:38 +04:00
char my_msn [ 35 ] ; /* desired msn, subaddr allowed */
char caller [ 35 ] ; /* caller id, partial string with * + subaddr allowed */
char to_nr [ 35 ] ; /* deflected to number incl. subaddress */
u_char si1 , si2 ; /* service indicators, si1=bitmask, si1+2 0 = all */
u_char screen ; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */
u_char callopt ; /* option for call handling:
0 = all calls
1 = only non waiting calls
2 = only waiting calls */
u_char action ; /* desired action:
0 = don ' t report call - > ignore
1 = report call , do not allow / proceed for deflection
2 = report call , send proceed , wait max waittime secs
3 = report call , alert and deflect after waittime
4 = report call , reject immediately
actions 1 - 2 only take place if interface is opened
*/
u_char waittime ; /* maximum wait time for proceeding */
} divert_rule ;
2005-04-17 02:20:36 +04:00
2013-01-21 15:57:20 +04:00
typedef union {
int drv_version ; /* return of driver version */
struct {
int drvid ; /* id of driver */
2012-02-20 07:52:38 +04:00
char drvnam [ 30 ] ; /* name of driver */
} getid ;
2013-01-21 15:57:20 +04:00
struct {
int ruleidx ; /* index of rule */
2012-02-20 07:52:38 +04:00
divert_rule rule ; /* rule parms */
} getsetrule ;
2013-01-21 15:57:20 +04:00
struct {
u_char subcmd ; /* 0 = hangup/reject,
2012-02-20 07:52:38 +04:00
1 = alert ,
2 = deflect */
ulong callid ; /* id of call delivered by ascii output */
char to_nr [ 35 ] ; /* destination when deflect,
else uus1 string ( maxlen 31 ) ,
data from rule used if empty */
} fwd_ctrl ;
2013-01-21 15:57:20 +04:00
struct {
int drvid ; /* id of driver */
2012-02-20 07:52:38 +04:00
u_char cfproc ; /* cfu = 0, cfb = 1, cfnr = 2 */
ulong procid ; /* process id returned when no error */
u_char service ; /* basically coded service, 0 = all */
char msn [ 25 ] ; /* desired msn, empty = all */
char fwd_nr [ 35 ] ; /* forwarded to number + subaddress */
} cf_ctrl ;
} divert_ioctl ;
2005-04-17 02:20:36 +04:00
# ifdef __KERNEL__
# include <linux/isdnif.h>
# include <linux/isdn_divertif.h>
# define AUTODEL_TIME 30 /* timeout in s to delete internal entries */
/**************************************************/
/* structure keeping ascii info for device output */
/**************************************************/
2013-01-21 15:57:20 +04:00
struct divert_info {
struct divert_info * next ;
2012-02-20 07:52:38 +04:00
ulong usage_cnt ; /* number of files still to work */
char info_start [ 2 ] ; /* info string start */
} ;
2005-04-17 02:20:36 +04:00
/**************/
/* Prototypes */
/**************/
extern spinlock_t divert_lock ;
extern ulong if_used ; /* number of interface users */
extern int divert_dev_deinit ( void ) ;
extern int divert_dev_init ( void ) ;
extern void put_info_buffer ( char * ) ;
extern int ll_callback ( isdn_ctrl * ) ;
extern isdn_divert_if divert_if ;
extern divert_rule * getruleptr ( int ) ;
extern int insertrule ( int , divert_rule * ) ;
extern int deleterule ( int ) ;
extern void deleteprocs ( void ) ;
extern int deflect_extern_action ( u_char , ulong , char * ) ;
extern int cf_command ( int , int , u_char , char * , u_char , char * , ulong * ) ;
# endif /* __KERNEL__ */