patch: add sip_transp_isladdr()
This commit is contained in:
parent
5bc730ef88
commit
386ddff14a
2 changed files with 27 additions and 0 deletions
|
@ -234,6 +234,8 @@ int sip_alloc(struct sip **sipp, struct dnsc *dnsc, uint32_t ctsz,
|
|||
int sip_transp_add(struct sip *sip, enum sip_transp tp,
|
||||
const struct sa *laddr, ...);
|
||||
void sip_transp_flush(struct sip *sip);
|
||||
bool sip_transp_isladdr(const struct sip *sip, enum sip_transp tp,
|
||||
const struct sa *laddr);
|
||||
void sip_close(struct sip *sip, bool force);
|
||||
int sip_listen(struct sip_lsnr **lsnrp, struct sip *sip, bool req,
|
||||
sip_msg_h *msgh, void *arg);
|
||||
|
|
|
@ -771,6 +771,31 @@ bool sip_transp_supported(struct sip *sip, enum sip_transp tp, int af)
|
|||
}
|
||||
|
||||
|
||||
bool sip_transp_isladdr(const struct sip *sip, enum sip_transp tp,
|
||||
const struct sa *laddr)
|
||||
{
|
||||
struct le *le;
|
||||
|
||||
if (!sip || !laddr)
|
||||
return false;
|
||||
|
||||
for (le=sip->transpl.head; le; le=le->next) {
|
||||
|
||||
const struct sip_transport *transp = le->data;
|
||||
|
||||
if (tp != SIP_TRANSP_NONE && transp->tp != tp)
|
||||
continue;
|
||||
|
||||
if (!sa_cmp(&transp->laddr, laddr, SA_ALL))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const char *sip_transp_name(enum sip_transp tp)
|
||||
{
|
||||
switch (tp) {
|
||||
|
|
Loading…
Add table
Reference in a new issue