Use common find_interface_by_plci() function, no duplicates.

This commit is contained in:
MelwareDE 2007-04-19 20:31:42 +00:00
parent e9d1bbe5c5
commit 92f26bd38b
4 changed files with 39 additions and 60 deletions

View File

@ -2302,46 +2302,6 @@ static void capi_handle_dtmf_fax(struct capi_pvt *i)
return;
}
/*
* find the interface (pvt) the PLCI belongs to
*/
static struct capi_pvt *find_interface_by_plci(unsigned int plci)
{
struct capi_pvt *i;
if (plci == 0)
return NULL;
cc_mutex_lock(&iflock);
for (i = iflist; i; i = i->next) {
if (i->PLCI == plci)
break;
}
cc_mutex_unlock(&iflock);
return i;
}
/*
* find the interface (pvt) the messagenumber belongs to
*/
static struct capi_pvt *find_interface_by_msgnum(unsigned short msgnum)
{
struct capi_pvt *i;
if (msgnum == 0x0000)
return NULL;
cc_mutex_lock(&iflock);
for (i = iflist; i; i = i->next) {
if ((i->PLCI == 0) && (i->MessageNumber == msgnum))
break;
}
cc_mutex_unlock(&iflock);
return i;
}
/*
* see if did matches
*/

View File

@ -957,25 +957,6 @@ void interface_cleanup_qsig(struct capi_pvt *i)
}
}
/*
* find the interface (pvt) the PLCI belongs to
*/
static struct capi_pvt *find_interface_by_plci(unsigned int plci)
{
struct capi_pvt *i;
if (plci == 0)
return NULL;
for (i = iflist; i; i = i->next) {
if (i->PLCI == plci)
break;
}
return i;
}
/*
* CAPI INFO_IND (QSIG part)
*/

View File

@ -76,7 +76,43 @@ _cword get_capi_MessageNumber(void)
}
/*
*
* find the interface (pvt) the PLCI belongs to
*/
struct capi_pvt *find_interface_by_plci(unsigned int plci)
{
struct capi_pvt *i;
if (plci == 0)
return NULL;
for (i = iflist; i; i = i->next) {
if (i->PLCI == plci)
break;
}
return i;
}
/*
* find the interface (pvt) the messagenumber belongs to
*/
struct capi_pvt *find_interface_by_msgnum(unsigned short msgnum)
{
struct capi_pvt *i;
if (msgnum == 0x0000)
return NULL;
for (i = iflist; i; i = i->next) {
if ((i->PLCI == 0) && (i->MessageNumber == msgnum))
break;
}
return i;
}
/*
* log verbose a capi message
*/
static void log_capi_message(MESSAGE_EXCHANGE_ERROR err, _cmsg *CMSG)
{

View File

@ -22,6 +22,8 @@ extern char *emptyid;
extern void cc_verbose(int o_v, int c_d, char *text, ...);
extern _cword get_capi_MessageNumber(void);
extern struct capi_pvt *find_interface_by_msgnum(unsigned short msgnum);
extern struct capi_pvt *find_interface_by_plci(unsigned int plci);
extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
extern MESSAGE_EXCHANGE_ERROR capidev_check_wait_get_cmsg(_cmsg *CMSG);
extern char *capi_info_string(unsigned int info);