Skip to content

Commit

Permalink
Re-added old ASC_createAssociationParameters().
Browse files Browse the repository at this point in the history
Starting with commit d468490, function ASC_createAssociationParameters()
expects the value for the TCP connection timeout as a third parameter.
For reasons of backward compatibilty, the old function (with only two
parameters) that uses the global setting for the TCP connection timeout
is re-introduced.

Please note, however, that this old function is deprecated and will be
(finally) removed in the future. See compiler warnings for details.
  • Loading branch information
jriesmeier committed Jul 4, 2022
1 parent c4ce544 commit dcc61f1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
13 changes: 12 additions & 1 deletion dcmnet/include/dcmtk/dcmnet/assoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
/*
** Required Include Files
*/
#include "dcmtk/ofstd/ofdeprec.h"
#include "dcmtk/dcmnet/dicom.h"
#include "dcmtk/dcmnet/lst.h"
#include "dcmtk/dcmnet/dul.h"
Expand Down Expand Up @@ -294,7 +295,17 @@ ASC_createAssociationParameters(
long maxReceivePDUSize,
Sint32 tcpConnectTimeout);

/*
/*
* same as before, but uses value of the global dcmConnectionTimeout variable.
* Please note that this function is deprecated and will be removed in a future
* release. Use the previous function with the timeout parameter instead.
*/
DCMTK_DCMNET_EXPORT OFdeprecated OFCondition
ASC_createAssociationParameters(
T_ASC_Parameters ** params,
long maxReceivePDUSize);

/*
* Free an association parameters structure and embedded information.
* You do not usually need to do this since the parameters structure will
* be noted in the association structure and automatically freed when an
Expand Down
2 changes: 2 additions & 0 deletions dcmnet/include/dcmtk/dcmnet/dul.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ extern DCMTK_DCMNET_EXPORT OFGlobal<OFBool> dcmDisableGethostbyaddr; /* defaul

/** Global timeout in seconds for connecting to remote hosts.
* Default value is -1, which selects infinite timeout, i.e. blocking connect().
* @deprecated The use of this global variable is deprecated. Please pass the TCP
* connection timeout to ASC_createAssociationParameters() as a parameter.
*/
extern DCMTK_DCMNET_EXPORT OFGlobal<Sint32> dcmConnectionTimeout; /* default: -1 */

Expand Down
25 changes: 18 additions & 7 deletions dcmnet/libsrc/assoc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ ASC_dropNetwork(T_ASC_Network ** network)

OFCondition
ASC_createAssociationParameters(T_ASC_Parameters ** params,
long maxReceivePDUSize, Sint32 tcpConnectTimeout)
long maxReceivePDUSize,
Sint32 tcpConnectTimeout)
{

*params = (T_ASC_Parameters *) malloc(sizeof(**params));
Expand Down Expand Up @@ -339,6 +340,16 @@ ASC_createAssociationParameters(T_ASC_Parameters ** params,
}



OFCondition
ASC_createAssociationParameters(T_ASC_Parameters ** params,
long maxReceivePDUSize)
{
/* pass global TCP connection timeout to the real function */
return ASC_createAssociationParameters(params, maxReceivePDUSize, dcmConnectionTimeout.get());
}


OFCondition
ASC_destroyAssociationParameters(T_ASC_Parameters ** params)
{
Expand Down Expand Up @@ -381,12 +392,12 @@ ASC_setAPTitles(T_ASC_Parameters * params,

OFCondition
ASC_getAPTitles(T_ASC_Parameters * params,
char* callingAPTitle,
size_t callingAPTitleSize,
char* calledAPTitle,
size_t calledAPTitleSize,
char* respondingAPTitle,
size_t respondingAPTitleSize)
char* callingAPTitle,
size_t callingAPTitleSize,
char* calledAPTitle,
size_t calledAPTitleSize,
char* respondingAPTitle,
size_t respondingAPTitleSize)
{
if (callingAPTitle)
OFStandard::strlcpy(callingAPTitle, params->DULparams.callingAPTitle, callingAPTitleSize);
Expand Down

0 comments on commit dcc61f1

Please sign in to comment.