Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add various accessors and helpers to nua. Cleanup header files in packages. #13

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion debian/libsofia-sip-ua-dev.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
usr/include/*/*.h
usr/include/*/*/*.h
usr/include/*/*/*.h.in
usr/lib/libsofia-sip-ua.a
Expand Down
7 changes: 0 additions & 7 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,3 @@ override_dh_auto_configure:
--disable-stun

override_dh_auto_test:

override_dh_auto_install:
dh_auto_install
cp -a libsofia-sip-ua/nua/*.h debian/tmp/usr/include/sofia-sip-1.12/
cp -a ./config.h.in debian/tmp/usr/include/sofia-sip-1.12/sofia-sip/
cp -a ./config.h debian/tmp/usr/include/sofia-sip-1.12/sofia-sip/

63 changes: 62 additions & 1 deletion libsofia-sip-ua/nua/nua.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,14 @@ void nua_destroy(nua_t *nua)
#if HAVE_SMIME /* Start NRC Boston */
sm_destroy(nua->sm);
#endif /* End NRC Boston */
su_home_unref(nua->nua_home);
nua_unref(nua);
}
}

void nua_unref(nua_t *nua) {
if (nua) su_home_unref(nua->nua_home);
}

/** Fetch callback context from nua.
*
* @param nua Pointer to @nua stack object
Expand Down Expand Up @@ -1089,3 +1093,60 @@ nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id)
}
return NULL;
}

/** Get leg from dialog. */
const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh)
{
if (nh && nh->nh_ds)
return nh->nh_ds->ds_leg;
else
return NULL;
}

/** Get su_home_t from nua handle. */
su_home_t *nua_handle_get_home(nua_handle_t *nh)
{
if (nh && nh->nh_home)
return nh->nh_home;
else
return NULL;
}

/** Get su_home_t from nua. */
su_home_t *nua_get_home(nua_t *nua)
{
if (nua && nua->nua_home)
return nua->nua_home;
else
return NULL;
}

/** Get nta_agent_t from nua. */
nta_agent_t *nua_get_agent(nua_t *nua)
{
if (nua && nua->nua_nta)
return nua->nua_nta;
else
return NULL;
}

/** Set has invite of a nua handle */
void nua_handle_set_has_invite(nua_handle_t *nh, unsigned val)
{
if (nh)
nh->nh_has_invite = val;
}

/** Check if nua handle is destroyed */
unsigned nua_handle_is_destroyed(nua_handle_t *nh)
{
assert(nh);
return nh->nh_destroyed;
}

void nua_handle_dialog_usage_set_refresh_range(nua_handle_t *nh,
unsigned min, unsigned max) {
if (nh && nh->nh_ds && nh->nh_ds->ds_usage) {
nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, min, max);
}
}
14 changes: 14 additions & 0 deletions libsofia-sip-ua/nua/sofia-sip/nua.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
#include <sofia-sip/sip.h>
#endif

#ifndef NTA_H
#include <sofia-sip/nta.h>
#endif

#ifndef NUA_TAG_H
#include <sofia-sip/nua_tag.h>
#endif
Expand Down Expand Up @@ -386,6 +390,16 @@ SOFIAPUBFUN nua_handle_t *nua_handle_by_replaces(nua_t *nua,

nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id);

SOFIAPUBFUN const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh);
SOFIAPUBFUN su_home_t *nua_handle_get_home(nua_handle_t *nh);
SOFIAPUBFUN void nua_unref(nua_t *nua);
SOFIAPUBFUN su_home_t *nua_get_home(nua_t *nua);
SOFIAPUBFUN nta_agent_t *nua_get_agent(nua_t *nua);
SOFIAPUBFUN void nua_handle_set_has_invite(nua_handle_t *nh, unsigned val);
SOFIAPUBFUN unsigned nua_handle_is_destroyed(nua_handle_t *nh);
SOFIAPUBFUN void nua_handle_dialog_usage_set_refresh_range(nua_handle_t *nh,
unsigned min, unsigned max);

SOFIA_END_DECLS

#endif
4 changes: 0 additions & 4 deletions sofia-sip.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
cp -a libsofia-sip-ua/nua/*.h %{buildroot}/usr/include/sofia-sip-1.12/
cp -a config.h.in %{buildroot}/usr/include/sofia-sip-1.12/sofia-sip/
cp -a config.h %{buildroot}/usr/include/sofia-sip-1.12/sofia-sip/
find %{buildroot} -name \*.la -delete
find %{buildroot} -name \*.h.in -delete
find . -name installdox -delete
Expand All @@ -67,7 +64,6 @@ find . -name installdox -delete
%dir %{_includedir}/sofia-sip-1.12
%dir %{_includedir}/sofia-sip-1.12/sofia-sip
%{_includedir}/sofia-sip-1.12/sofia-sip/*.h
%{_includedir}/sofia-sip-1.12/*.h
%dir %{_includedir}/sofia-sip-1.12/sofia-resolv
%{_includedir}/sofia-sip-1.12/sofia-resolv/*.h
%{_libdir}/libsofia-sip-ua.so
Expand Down