Added the option to set sctp socket "adaptation" parameter.
git-svn-id: http://voip.null.ro/svn/yate@5335 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
6f6c63f66c
commit
f4dc6960c3
|
@ -90,3 +90,7 @@
|
|||
; Ex: sack_freq = 2
|
||||
; Note! If you set this to 1 you will disable the sctp acknowledge algorithm
|
||||
;sack_freq=
|
||||
|
||||
; Set sctp socket adaptation parameter
|
||||
; E.g. : sctp_adaptation=1
|
||||
;sctp_adaptation=
|
||||
|
|
10
configure.in
10
configure.in
|
@ -415,6 +415,16 @@ AC_MSG_RESULT([$sctp_connectx_new])
|
|||
if [[ "x$sctp_connectx_new" = "xyes" ]]; then
|
||||
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SCTP_CONNECTX_4"
|
||||
fi
|
||||
sctp_setadaptation=no
|
||||
AC_MSG_CHECKING([whether sctp_setadaptation struct is present])
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/sctp.h>],[struct sctp_setadaptation sctp_adapt;],[sctp_setadaptation=yes])
|
||||
AC_MSG_RESULT([$sctp_setadaptation])
|
||||
if [[ "x$sctp_setadaptation" = "xyes" ]]; then
|
||||
SCTP_FLAGS="$SCTP_FLAGS -DHAVE_SETADAPTATION_STRUCT"
|
||||
fi
|
||||
sctp_sack_info=no
|
||||
AC_MSG_CHECKING([whether sctp_sack_info struct is present])
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
|
|
|
@ -192,6 +192,7 @@ int LKSocket::recvMsg(void* buf, int length, SocketAddr& addr, int& stream, int&
|
|||
sctp_sndrcvinfo sri;
|
||||
memset(&sri,0,sizeof(sri));
|
||||
struct sockaddr address;
|
||||
memset(&address,0,sizeof(address));
|
||||
socklen_t len = 0;
|
||||
int flag = 0;
|
||||
int r = sctp_recvmsg(handle(),buf,length,&address,&len,&sri,&flag);
|
||||
|
@ -266,6 +267,28 @@ bool LKSocket::setParams(const NamedList& params)
|
|||
if (!aux)
|
||||
Debug(&plugin,DebugNote,"Failed to set SCTP RTO params! Reason: %s",strerror(errno));
|
||||
ret |= aux;
|
||||
|
||||
NamedString* adaptation = params.getParam(YSTRING("sctp_adaptation"));
|
||||
#ifdef HAVE_SETADAPTATION_STRUCT
|
||||
if (adaptation) {
|
||||
struct sctp_setadaptation adapt;
|
||||
bzero(&adapt, sizeof(adapt));
|
||||
|
||||
int val = adaptation->toInteger(-1);
|
||||
if (val >= 0) {
|
||||
adapt.ssb_adaptation_ind = val;
|
||||
|
||||
aux = setOption(IPPROTO_SCTP,SCTP_ADAPTATION_LAYER, &adapt, sizeof(adapt));
|
||||
if (!aux)
|
||||
Debug(&plugin,DebugNote,"Failed to set SCTP adaptation params! Reason: %s",strerror(errno));
|
||||
ret |= aux;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (adaptation)
|
||||
Debug(&plugin,DebugNote,"SCTP struct sctp_setadaptation is not available!");
|
||||
#endif
|
||||
|
||||
struct sctp_paddrparams paddr_params;
|
||||
bzero(&paddr_params, sizeof(paddr_params));
|
||||
|
||||
|
|
Loading…
Reference in New Issue