1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
/*
Copyright (C) 1993, RSNA and Washington University
The software and supporting documentation for the Radiological
Society of North America (RSNA) 1993 Digital Imaging and
Communications in Medicine (DICOM) Demonstration were developed
at the
Electronic Radiology Laboratory
Mallinckrodt Institute of Radiology
Washington University School of Medicine
510 S. Kingshighway Blvd.
St. Louis, MO 63110
as part of the 1993 DICOM Central Test Node project for, and
under contract with, the Radiological Society of North America.
THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR
WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
THE SOFTWARE IS WITH THE USER.
Copyright of the software and supporting documentation is
jointly owned by RSNA and Washington University, and free access
is hereby granted as a license to use this software, copy this
software and prepare derivative works based upon this software.
However, any distribution of this software source code or
supporting documentation or derivative works (source code and
supporting documentation) must include the three paragraphs of
the copyright notice.
*/
/*
+-+-+-+-+-+-+-+-+-
*/
/*
** DICOM 93
** Electronic Radiology Laboratory
** Mallinckrodt Institute of Radiology
** Washington University School of Medicine
**
** Module Name(s):
** Author, Date:
** Intent:
** Last Update: $Author: smm $, $Date: 1999-11-03 16:56:05 $
** Source File: $Source: /home/smm/ctn/ctn/cgi_apps/archive_cgi/dicomServerInterface.c,v $
** Revision: $Revision: 1.1 $
** Status: $State: Exp $
*/
static char rcsid[] = "$Revision: 1.1 $ $RCSfile: dicomServerInterface.c,v $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "dicom.h"
#include "dicom_uids.h"
#include "lst.h"
#include "condition.h"
#include "dulprotocol.h"
#include "dicom_objects.h"
#include "dicom_messages.h"
#include "dicom_services.h"
#include "manage.h"
#include "dicomServerInterface.h"
/* These functions are private to this module */
static CONDITION moveCallback(MSG_C_MOVE_REQ *moveReq,
MSG_C_MOVE_RESP *moveResp, int responseCount,
char *abstractSyntax, char *queryLevel, void *ctx)
{
return SRV_NORMAL;
}
CONDITION
connectToDICOMServer(const char *srcTitle,
const char *dstTitle,
DMAN_HANDLE **handle,
DUL_NETWORKKEY **network,
DUL_ASSOCIATIONKEY ** assoc,
DUL_ASSOCIATESERVICEPARAMETERS * params,
const char *SOPClass)
{
CONDITION cond;
DMAN_APPLICATIONENTITY ae;
char localHost[1024];
DUL_DefaultServiceParameters(params);
memset(&ae, 0, sizeof(ae));
ae.Type = DMAN_K_APPLICATIONENTITY;
cond = DMAN_LookupApplication(handle, dstTitle, &ae);
cond = DUL_InitializeNetwork(DUL_NETWORK_TCP, DUL_AEREQUESTOR,
NULL, DUL_TIMEOUT, DUL_ORDERBIGENDIAN, network);
if (cond != DUL_NORMAL)
return 0;
(void) gethostname(localHost, sizeof(localHost));
sprintf(params->calledPresentationAddress, "%s:%d", localHost, 2100);
strcpy(params->callingPresentationAddress, localHost);
strcpy(params->calledAPTitle, srcTitle);
strcpy(params->callingAPTitle, srcTitle);
cond = SRV_RequestServiceClass(SOPClass, DUL_SC_ROLE_SCU, params);
if (cond != SRV_NORMAL) {
COND_DumpConditions();
return 0;
}
cond = DUL_RequestAssociation(network, params, assoc);
if (cond != DUL_NORMAL) {
if (cond == DUL_ASSOCIATIONREJECTED) {
fprintf(stdout, "Association Rejected\n");
fprintf(stdout, " Result: %2x Source %2x Reason %2x\n",
params->result, params->resultSource,
params->diagnostic);
}
return 0;
}
return 1;
}
CONDITION
releaseDICOMServer(DUL_NETWORKKEY **network, DUL_ASSOCIATIONKEY *assoc)
{
(void) DUL_ReleaseAssociation(assoc);
(void) DUL_DropAssociation(assoc);
(void) DUL_DropNetwork(network);
return 1;
}
CONDITION
sendMoveRequest(DUL_ASSOCIATIONKEY ** association,
DUL_ASSOCIATESERVICEPARAMETERS * params,
const char *destinationAPTitle,
DCM_OBJECT *moveObject, long *successCount, long *warningCount,
long *failureCount)
{
MSG_C_MOVE_REQ moveRequest;
MSG_C_MOVE_RESP moveResponse;
CONDITION cond;
*successCount = 0;
*warningCount = 0;
*failureCount = 0;
memset(&moveRequest, 0, sizeof(moveRequest));
memset(&moveResponse, 0, sizeof(moveResponse));
moveRequest.type = MSG_K_C_MOVE_REQ;
moveRequest.dataSetType = DCM_CMDDATAIDENTIFIER;
moveRequest.messageID = SRV_MessageIDOut();
moveRequest.priority = 0;
strcpy(moveRequest.classUID, DICOM_SOPSTUDYQUERY_MOVE);
strcpy(moveRequest.moveDestination, destinationAPTitle);
moveRequest.identifier = moveObject;
cond = SRV_CMoveRequest(association, params, &moveRequest, &moveResponse,
moveCallback, NULL, "");
*successCount = moveResponse.completedSubOperations;
*warningCount = moveResponse.warningSubOperations;
*failureCount = moveResponse.failedSubOperations;
return 1;
}
|