Check if set delayed acknowledge timer struct exists.

git-svn-id: http://voip.null.ro/svn/yate@4578 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
andrei 2011-08-30 09:42:26 +00:00
parent 695de94a2b
commit 4557d1d974
2 changed files with 40 additions and 1 deletions

View File

@ -343,6 +343,25 @@ AC_MSG_RESULT([$sctp_connectx_new])
if [[ "x$sctp_connectx_new" = "xyes" ]]; then
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SCTP_CONNECTX_4"
fi
AC_MSG_CHECKING([whether sctp_sack_info struct is present])
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>],[struct sctp_sack_info assoc_value;],[sctp_sack_info=yes])
AC_MSG_RESULT([$sctp_sack_info])
if [[ "x$sctp_sack_info" = "xyes" ]]; then
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SACK_INFO_STRUCT"
else
AC_MSG_CHECKING([whether sctp_assoc_value struct is present])
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>],[struct sctp_assoc_value assoc_value;],[sctp_assoc_value=yes])
AC_MSG_RESULT([$sctp_assoc_value])
if [[ "x$sctp_assoc_value" = "xyes" ]]; then
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_ASSOC_VALUE_STRUCT"
fi
fi
else
if [[ "x$HAVE_SCTP" != "xno" ]]; then
SCTP_FLAGS="-DHAVE_SCTP"

View File

@ -257,8 +257,9 @@ bool LKSocket::setParams(const NamedList& params)
if (!aux)
Debug(&plugin,DebugNote,"Failed to set SCTP paddr params! Reason: %s",strerror(errno));
#ifdef SCTP_DELAYED_ACK_TIME
#ifdef HAVE_SACK_INFO_STRUCT
struct sctp_sack_info sack_info;
bzero(&paddr_params, sizeof(paddr_params));
bzero(&sack_info, sizeof(sack_info));
if (params.getParam(YSTRING("sack_delay"))) {
sack_info.sack_delay = params.getIntValue(YSTRING("sack_delay"));
if (sack_info.sack_delay > 500)
@ -270,6 +271,25 @@ bool LKSocket::setParams(const NamedList& params)
ret |= aux;
if (!aux)
Debug(&plugin,DebugNote,"Failed to set SCTP sack params! Reason: %s",strerror(errno));
#elif HAVE_ASSOC_VALUE_STRUCT
struct sctp_assoc_value sassoc_value;
bzero(&sassoc_value, sizeof(sassoc_value));
if (params.getParam(YSTRING("sack_delay"))) {
sassoc_value.assoc_value = params.getIntValue(YSTRING("sack_delay"));
if (sassoc_value.assoc_value > 500)
sassoc_value.assoc_value = 500;
}
if (params.getParam(YSTRING("sack_freq")))
Debug(&plugin,DebugConf,"Unable to set sack_freq param! sack_info struct is missing!");
aux = setOption(IPPROTO_SCTP,SCTP_DELAYED_ACK_TIME, &sassoc_value, sizeof(sassoc_value));
ret |= aux;
if (!aux)
Debug(&plugin,DebugNote,"Failed to set SCTP sack params! Reason: %s",strerror(errno));
#else // HAVE_SACK_INFO_STRUCT
Debug(&plugin,DebugConf,"SCTP delayed ack time is unavailable no struct present!!");
#endif
#else // SCTP_DELAYED_ACK_TIME
Debug(&plugin,DebugConf,"SCTP delayed ack time is unavailable");
#endif
aux = Socket::setParams(params);
return ret || aux;