new ioctl IIOCNETGPN for /dev/isdninfo (get network interface'
peer phone number)
This commit is contained in:
parent
1afd8feb6b
commit
6dcb1f1b10
|
@ -21,6 +21,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.67 1998/06/26 15:12:21 fritz
|
||||
* Added handling of STAT_ICALL with incomplete CPN.
|
||||
* Added AT&L for ttyI emulator.
|
||||
* Added more locking stuff in tty_write.
|
||||
*
|
||||
* Revision 1.66 1998/06/17 19:50:41 he
|
||||
* merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
|
||||
* brute force fix to avoid Ugh's in isdn_tty_write()
|
||||
|
@ -1333,6 +1338,17 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
|
|||
} else
|
||||
return -EINVAL;
|
||||
break;
|
||||
#ifdef CONFIG_NETDEVICES
|
||||
case IIOCNETGPN:
|
||||
/* Get peer phone number of a connected
|
||||
* isdn network interface */
|
||||
if (arg) {
|
||||
if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone)))
|
||||
return -EFAULT;
|
||||
return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg);
|
||||
} else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.74 1998/07/30 11:28:32 paul
|
||||
* printk message only appeared when status is off and interface is rawIP,
|
||||
* which is confusing for people who don't know about "isdnctrl status <if> on".
|
||||
*
|
||||
* Revision 1.73 1998/06/26 22:01:37 keil
|
||||
* tx_queue_len = 5 was too small
|
||||
*
|
||||
|
@ -2905,10 +2909,37 @@ isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones)
|
|||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy a string containing the peer's phone number of a connected interface
|
||||
* to user space.
|
||||
*/
|
||||
int
|
||||
isdn_net_getpeer(isdn_net_ioctl_phone *name, isdn_net_ioctl_phone *peer)
|
||||
{
|
||||
isdn_net_dev *p = isdn_net_findif(name->name);
|
||||
int ch, dv, idx;
|
||||
|
||||
if (!p) return -ENODEV;
|
||||
/*
|
||||
* Theoretical race: while this executes, the remote number might
|
||||
* become invalid (hang up) or change (new connection), resulting
|
||||
* in (partially) wrong number copied to user. This race
|
||||
* currently ignored.
|
||||
*/
|
||||
ch = p->local->isdn_channel;
|
||||
dv = p->local->isdn_device;
|
||||
if(ch<0 && dv<0) return -ENOTCONN;
|
||||
idx = isdn_dc2minor(dv, ch);
|
||||
if (idx<0) return -ENODEV;
|
||||
/* for pre-bound channels, we need this extra check */
|
||||
if ( strncmp(dev->num[idx],"???",3) == 0 ) return -ENOTCONN;
|
||||
if ( copy_to_user(peer->phone,dev->num[idx],ISDN_MSNLEN) )
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Delete a phone-number from an interface.
|
||||
*/
|
||||
|
||||
int
|
||||
isdn_net_delphone(isdn_net_ioctl_phone * phone)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.6 1997/10/09 21:28:54 fritz
|
||||
* New HL<->LL interface:
|
||||
* New BSENT callback with nr. of bytes included.
|
||||
* Sending without ACK.
|
||||
* New L1 error status (not yet in use).
|
||||
* Cleaned up obsolete structures.
|
||||
* Implemented Cisco-SLARP.
|
||||
* Changed local net-interface data to be dynamically allocated.
|
||||
* Removed old 2.0 compatibility stuff.
|
||||
*
|
||||
* Revision 1.5 1997/02/10 20:12:47 fritz
|
||||
* Changed interface for reporting incoming calls.
|
||||
*
|
||||
|
@ -89,6 +99,7 @@ extern int isdn_net_setcfg(isdn_net_ioctl_cfg *);
|
|||
extern int isdn_net_getcfg(isdn_net_ioctl_cfg *);
|
||||
extern int isdn_net_addphone(isdn_net_ioctl_phone *);
|
||||
extern int isdn_net_getphones(isdn_net_ioctl_phone *, char *);
|
||||
extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone *);
|
||||
extern int isdn_net_delphone(isdn_net_ioctl_phone *);
|
||||
extern int isdn_net_find_icall(int, int, int, setup_parm);
|
||||
extern void isdn_net_hangup(struct device *);
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.56 1998/07/26 18:46:52 armin
|
||||
* Added silence detection in voice receive mode.
|
||||
*
|
||||
* Revision 1.55 1998/06/26 15:13:17 fritz
|
||||
* Added handling of STAT_ICALL with incomplete CPN.
|
||||
* Added AT&L for ttyI emulator.
|
||||
|
@ -253,8 +256,8 @@
|
|||
#define IIOCNETANM _IO('I',5)
|
||||
#define IIOCNETDNM _IO('I',6)
|
||||
#define IIOCNETGNM _IO('I',7)
|
||||
#define IIOCGETSET _IO('I',8)
|
||||
#define IIOCSETSET _IO('I',9)
|
||||
#define IIOCGETSET _IO('I',8) /* no longer supported */
|
||||
#define IIOCSETSET _IO('I',9) /* no longer supported */
|
||||
#define IIOCSETVER _IO('I',10)
|
||||
#define IIOCNETHUP _IO('I',11)
|
||||
#define IIOCSETGST _IO('I',12)
|
||||
|
@ -277,6 +280,8 @@
|
|||
#define IIOCNETALN _IO('I',32)
|
||||
#define IIOCNETDLN _IO('I',33)
|
||||
|
||||
#define IIOCNETGPN _IO('I',34)
|
||||
|
||||
#define IIOCDBGVAR _IO('I',127)
|
||||
|
||||
#define IIOCDRVCTL _IO('I',128)
|
||||
|
@ -861,9 +866,5 @@ extern isdn_dev *dev;
|
|||
/* Utility-Macros */
|
||||
#define MIN(a,b) ((a<b)?a:b)
|
||||
#define MAX(a,b) ((a>b)?a:b)
|
||||
|
||||
#if (LINUX_VERSION_CODE < 0x020159) /* 2.1.89 */
|
||||
#define poll_wait(f,wq,w) poll_wait((wq),(w))
|
||||
#endif
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* isdn_h */
|
||||
|
|
Loading…
Reference in New Issue