ASC_createAssociationParameters(T_ASC_Parameters ** params,
        long maxReceivePDUSize)
{

    *params = (T_ASC_Parameters *) malloc(sizeof(**params));
    if (*params == NULL) return EC_MemoryExhausted;
    memset((char*)*params, 0, sizeof(**params));

    OFStandard::strlcpy((*params)->ourImplementationClassUID,
            OFFIS_IMPLEMENTATION_CLASS_UID,
            sizeof((*params)->ourImplementationClassUID));
    OFStandard::strlcpy((*params)->ourImplementationVersionName,
            OFFIS_DTK_IMPLEMENTATION_VERSION_NAME,
            sizeof((*params)->ourImplementationVersionName));

    if (strlen(OFFIS_DTK_IMPLEMENTATION_VERSION_NAME) > 16)
    {
      DCMNET_WARN("DICOM implementation version name too long: " << OFFIS_DTK_IMPLEMENTATION_VERSION_NAME);
    }

    OFStandard::strlcpy((*params)->DULparams.callingImplementationClassUID,
        (*params)->ourImplementationClassUID, DICOM_UI_LENGTH + 1);
    OFStandard::strlcpy((*params)->DULparams.callingImplementationVersionName,
        (*params)->ourImplementationVersionName, 16+1);

    OFStandard::strlcpy((*params)->DULparams.applicationContextName,
            UID_StandardApplicationContext,
            sizeof((*params)->DULparams.applicationContextName));

    ASC_setAPTitles(*params,
                    "calling AP Title",
                    "called AP Title",
                    "resp. AP Title");

    /* make sure max pdv length is even */
    if ((maxReceivePDUSize % 2) != 0)
    {
      DCMNET_WARN("ASSOC: PDV receive length " << maxReceivePDUSize << " is odd (using " << (maxReceivePDUSize-1) << ")");
      maxReceivePDUSize--;
    }
    if (maxReceivePDUSize < ASC_MINIMUMPDUSIZE)
    {
      DCMNET_WARN("ASC_createAssociationParameters: maxReceivePDUSize "
            << maxReceivePDUSize << " too small (using " << ASC_MINIMUMPDUSIZE << ")");
      maxReceivePDUSize = ASC_MINIMUMPDUSIZE;
    }

    (*params)->ourMaxPDUReceiveSize = maxReceivePDUSize;
    (*params)->DULparams.maxPDU = maxReceivePDUSize;
    (*params)->theirMaxPDUReceiveSize = 0;      /* not yet negotiated */
    (*params)->modeCallback = NULL;

    /* set something unusable */
    ASC_setPresentationAddresses(*params,
                                 "calling Presentation Address",
                                 "called Presentation Address");

    /* presentation context lists will be created as needed */
    (*params)->DULparams.requestedPresentationContext = NULL;
    (*params)->DULparams.acceptedPresentationContext = NULL;

    (*params)->DULparams.useSecureLayer = OFFalse;
    return EC_Normal;
}
ASC_createAssociationParameters(T_ASC_Parameters ** params,
        long maxReceivePDUSize)
{

    *params = (T_ASC_Parameters *) malloc(sizeof(**params));
    if (*params == NULL) return EC_MemoryExhausted;
    memset((char*)*params, 0, sizeof(**params));

    OFStandard::strlcpy((*params)->ourImplementationClassUID,
            OFFIS_IMPLEMENTATION_CLASS_UID,
            sizeof((*params)->ourImplementationClassUID));
    OFStandard::strlcpy((*params)->ourImplementationVersionName,
            OFFIS_DTK_IMPLEMENTATION_VERSION_NAME,
            sizeof((*params)->ourImplementationVersionName));

    if (strlen(OFFIS_DTK_IMPLEMENTATION_VERSION_NAME) > 16)
    {
      DCMNET_WARN("DICOM implementation version name too long: " << OFFIS_DTK_IMPLEMENTATION_VERSION_NAME);
    }

    OFStandard::strlcpy((*params)->DULparams.callingImplementationClassUID,
        (*params)->ourImplementationClassUID, DICOM_UI_LENGTH + 1);
    OFStandard::strlcpy((*params)->DULparams.callingImplementationVersionName,
        (*params)->ourImplementationVersionName, 16+1);

    OFStandard::strlcpy((*params)->DULparams.applicationContextName,
            UID_StandardApplicationContext,
            sizeof((*params)->DULparams.applicationContextName));

    ASC_setAPTitles(*params,
                    "calling AP Title",
                    "called AP Title",
                    "resp. AP Title");

     
    if ((maxReceivePDUSize % 2) != 0)
    {
      DCMNET_WARN("ASSOC: PDV receive length " << maxReceivePDUSize << " is odd (using " << (maxReceivePDUSize-1) << ")");
      maxReceivePDUSize--;
    }
    if (maxReceivePDUSize < ASC_MINIMUMPDUSIZE)
    {
      DCMNET_WARN("ASC_createAssociationParameters: maxReceivePDUSize "
            << maxReceivePDUSize << " too small (using " << ASC_MINIMUMPDUSIZE << ")");
      maxReceivePDUSize = ASC_MINIMUMPDUSIZE;
    }

    (*params)->ourMaxPDUReceiveSize = maxReceivePDUSize;
    (*params)->DULparams.maxPDU = maxReceivePDUSize;
    (*params)->theirMaxPDUReceiveSize = 0;       
    (*params)->modeCallback = NULL;

     
    ASC_setPresentationAddresses(*params,
                                 "calling Presentation Address",
                                 "called Presentation Address");

     
    (*params)->DULparams.requestedPresentationContext = NULL;
    (*params)->DULparams.acceptedPresentationContext = NULL;

    (*params)->DULparams.useSecureLayer = OFFalse;
    return EC_Normal;
}