00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef DUL_IS_IN
00055 #define DUL_IS_IN 1
00056
00057 #include "dcmtk/config/osconfig.h"
00058 #include "dcmtk/ofstd/ofglobal.h"
00059 #include "dcmtk/ofstd/oftypes.h"
00060 #include "dcmtk/ofstd/ofcast.h"
00061 #include "dcmtk/dcmnet/extneg.h"
00062 #include "dcmtk/dcmnet/dicom.h"
00063
00064 class DcmTransportConnection;
00065 class DcmTransportLayer;
00066 class LST_HEAD;
00067
00074 extern OFGlobal<OFBool> dcmDisableGethostbyaddr;
00075
00079 extern OFGlobal<Sint32> dcmConnectionTimeout;
00080
00085 extern OFGlobal<int> dcmExternalSocketHandle;
00086
00093 extern OFGlobal<const char *> dcmTCPWrapperDaemonName;
00094
00095
00096
00097
00098 extern OFGlobal<unsigned long> dcmEnableBackwardCompatibility;
00099
00100 #ifndef DUL_KEYS
00101 #define DUL_KEYS 1
00102 typedef void DUL_NETWORKKEY;
00103 typedef void DUL_ASSOCIATIONKEY;
00104 typedef unsigned char DUL_PRESENTATIONCONTEXTID;
00105 #endif
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 #define DUL_LEN_TITLE OFstatic_cast(size_t, 16)
00116 #define DUL_LEN_NAME OFstatic_cast(size_t, 64)
00117 #define DUL_LEN_UID OFstatic_cast(size_t, 64)
00118 #define DUL_LEN_NODE OFstatic_cast(size_t, 127)
00119
00120
00121
00122
00123 #define DUL_TYPEASSOCIATERQ OFstatic_cast(unsigned char, 0x01)
00124 #define DUL_TYPEASSOCIATEAC OFstatic_cast(unsigned char, 0x02)
00125 #define DUL_TYPEASSOCIATERJ OFstatic_cast(unsigned char, 0x03)
00126 #define DUL_TYPEDATA OFstatic_cast(unsigned char, 0x04)
00127 #define DUL_TYPERELEASERQ OFstatic_cast(unsigned char, 0x05)
00128 #define DUL_TYPERELEASERP OFstatic_cast(unsigned char, 0x06)
00129 #define DUL_TYPEABORT OFstatic_cast(unsigned char, 0x07)
00130
00131 #define DUL_MAXTYPE OFstatic_cast(unsigned char, 0x07)
00132
00135 class DUL_ModeCallback
00136 {
00137 public:
00138
00140 virtual ~DUL_ModeCallback() {}
00141
00145 virtual void callback(unsigned long mode) = 0;
00146 };
00147
00148 typedef struct {
00149 char applicationContextName[DUL_LEN_NAME + 1];
00150 char callingAPTitle[DUL_LEN_TITLE + 1];
00151 char calledAPTitle[DUL_LEN_TITLE + 1];
00152 char respondingAPTitle[DUL_LEN_TITLE + 1];
00153 unsigned long maxPDU;
00154 unsigned short result;
00155 unsigned short resultSource;
00156 unsigned short diagnostic;
00157 char callingPresentationAddress[64];
00158 char calledPresentationAddress[64];
00159 LST_HEAD *requestedPresentationContext;
00160 LST_HEAD *acceptedPresentationContext;
00161 unsigned short maximumOperationsInvoked;
00162 unsigned short maximumOperationsPerformed;
00163 char callingImplementationClassUID[DICOM_UI_LENGTH + 1];
00164 char callingImplementationVersionName[16 + 1];
00165 char calledImplementationClassUID[DICOM_UI_LENGTH + 1];
00166 char calledImplementationVersionName[16 + 1];
00167 unsigned long peerMaxPDU;
00168 SOPClassExtendedNegotiationSubItemList *requestedExtNegList;
00169 SOPClassExtendedNegotiationSubItemList *acceptedExtNegList;
00170 OFBool useSecureLayer;
00171 } DUL_ASSOCIATESERVICEPARAMETERS;
00172
00173 typedef enum {
00174 DUL_SC_ROLE_DEFAULT,
00175 DUL_SC_ROLE_SCU,
00176 DUL_SC_ROLE_SCP,
00177 DUL_SC_ROLE_SCUSCP
00178 } DUL_SC_ROLE;
00179
00180 #define DUL_PRESENTATION_ACCEPT 0
00181 #define DUL_PRESENTATION_REJECT_USER 1
00182 #define DUL_PRESENTATION_REJECT_NOREASON 2
00183 #define DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX 3
00184 #define DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX 4
00185
00186 typedef OFList<char *> DUL_TRANSFERSYNTAXLIST;
00187
00188 typedef struct {
00189 void *reserved[2];
00190 DUL_PRESENTATIONCONTEXTID presentationContextID;
00191 char abstractSyntax[DUL_LEN_UID + 1];
00192 LST_HEAD *proposedTransferSyntax;
00193 char acceptedTransferSyntax[DUL_LEN_UID + 1];
00194 unsigned char result;
00195 DUL_SC_ROLE proposedSCRole;
00196 DUL_SC_ROLE acceptedSCRole;
00197 } DUL_PRESENTATIONCONTEXT;
00198
00199 typedef struct {
00200 void *reserved[2];
00201 char transferSyntax[DUL_LEN_UID + 1];
00202 } DUL_TRANSFERSYNTAX;
00203
00204 typedef struct dul_abortitems {
00205 unsigned char result;
00206 unsigned char source;
00207 unsigned char reason;
00208 } DUL_ABORTITEMS;
00209
00210 typedef enum {
00211 DUL_COMMANDPDV,
00212 DUL_DATASETPDV
00213 }
00214 DUL_DATAPDV;
00215
00216 typedef enum {
00217 DUL_BLOCK,
00218 DUL_NOBLOCK
00219 }
00220 DUL_BLOCKOPTIONS;
00221
00222 typedef struct {
00223 unsigned long fragmentLength;
00224 unsigned char presentationContextID;
00225 DUL_DATAPDV pdvType;
00226 OFBool lastPDV;
00227 void *data;
00228 } DUL_PDV;
00229
00230 typedef struct {
00231 unsigned long count;
00232 void *scratch;
00233 unsigned long scratchLength;
00234 DUL_ABORTITEMS abort;
00235 DUL_PDV *pdv;
00236 } DUL_PDVLIST;
00237
00238
00239
00240
00241
00242
00243
00244
00245 #define DUL_ORDERMASK 0x03
00246 #define DUL_ORDERLITTLEENDIAN 0x01
00247 #define DUL_ORDERBIGENDIAN 0x02
00248
00249 #define DUL_DOMAINMASK 0x04
00250 #define DUL_FULLDOMAINNAME 0x04
00251
00252 #define DUL_AEREQUESTOR "AE REQUESTOR"
00253 #define DUL_AEACCEPTOR "AE ACCEPTOR"
00254 #define DUL_AEBOTH "AE BOTH"
00255
00256
00257
00258
00259
00260 #define DUL_REJ_RSLTPERMANENT 0x01
00261 #define DUL_REJ_RSLTTRANSIENT 0x02
00262
00263
00264
00265
00266
00267
00268 #define DUL_SCU_INITIATED_ABORT 0x00
00269 #define DUL_SCP_INITIATED_ABORT 0x02
00270
00271 #define DUL_ABORTSERVICEUSER 0x00
00272 #define DUL_ABORTSERVICEPROVIDER 0x02
00273
00274
00275 #define DUL_ABORTNOREASON 0x00
00276 #define DUL_ABORTUNRECOGNIZEDPDU 0x01
00277 #define DUL_ABORTUNEXPECTEDPDU 0x02
00278 #define DUL_ABORTUNRECOGNIZEDPDUPARAM 0x04
00279 #define DUL_ABORTUNEXPECTEDPDUPARAM 0x05
00280 #define DUL_ABORTINVALIDPDUPARAM 0x06
00281
00282
00283
00284
00285
00286 #define DUL_REJECT_PERMANENT 0x01
00287 #define DUL_REJECT_TRANSIENT 0x02
00288
00289 #define DUL_ULSU_REJECT 0x01
00290 #define DUL_ULSP_ACSE_REJECT 0x02
00291 #define DUL_ULSP_PRESENTATION_REJECT 0x03
00292
00293 #define DUL_ULSU_REJ_NOREASON 0x01
00294 #define DUL_ULSU_REJ_UNSUP_APP_CTX_NAME 0x02
00295 #define DUL_ULSU_REJ_UNREC_CALLING_TITLE 0x03
00296 #define DUL_ULSU_REJ_UNREC_CALLED_TITLE 0x07
00297
00298 #define DUL_ULSP_ACSE_REJ_NOREASON 0x01
00299 #define DUL_ULSP_ACSE_UNSUP_PROTOCOL 0x02
00300
00301 #define DUL_ULSP_PRES_REJ_TEMP_CONGEST 0x01
00302 #define DUL_ULSP_PRES_REJ_LIMIT 0x02
00303
00304 #define DUL_ABORTNOREASON 0x00
00305 #define DUL_ABORTUNRECOGNIZEDPDU 0x01
00306 #define DUL_ABORTUNEXPECTEDPDU 0x02
00307 #define DUL_ABORTUNRECOGNIZEDPDUPARAM 0x04
00308 #define DUL_ABORTUNEXPECTEDPDUPARAM 0x05
00309 #define DUL_ABORTINVALIDPDUPARAM 0x06
00310
00311
00312
00313
00314
00315 typedef enum {
00316 DUL_K_INTEGER,
00317 DUL_K_STRING
00318 } DUL_DATA_TYPE;
00319 typedef enum {
00320 DUL_K_MAX_PDV_XMIT
00321 } DUL_ASSOCIATION_PARAMETER;
00322
00323 #define DUL_TIMEOUT 180
00324
00325
00326
00327
00328
00329
00330 #define DUL_DULCOMPAT 2768240730UL
00331 #define DUL_DIMSECOMPAT 262144UL
00332 #define DUL_MAXPDUCOMPAT 4278190335UL
00333
00334
00335
00336
00337
00338
00339 OFCondition
00340 DUL_AcknowledgeAssociationRQ(
00341 DUL_ASSOCIATIONKEY ** association,
00342 DUL_ASSOCIATESERVICEPARAMETERS * params,
00343 int activatePDUStorage);
00344
00345 OFCondition
00346 DUL_InitializeNetwork(
00347 const char *mode,
00348 void *param,
00349 int timeout,
00350 unsigned long
00351 options,
00352 DUL_NETWORKKEY ** network);
00353
00354 OFCondition
00355 DUL_ReceiveAssociationRQ(
00356 DUL_NETWORKKEY ** net,
00357 DUL_BLOCKOPTIONS blk,
00358 int timeout,
00359 DUL_ASSOCIATESERVICEPARAMETERS * parameters,
00360 DUL_ASSOCIATIONKEY ** association,
00361 int activatePDUStorage);
00362
00363 OFCondition
00364 DUL_RejectAssociationRQ(
00365 DUL_ASSOCIATIONKEY ** association,
00366 DUL_ABORTITEMS * params,
00367 int activatePDUStorage);
00368
00369 OFCondition
00370 DUL_RequestAssociation(
00371 DUL_NETWORKKEY ** network,
00372 DUL_ASSOCIATESERVICEPARAMETERS * params,
00373 DUL_ASSOCIATIONKEY ** association,
00374 int activatePDUStorage);
00375
00376
00377
00378 OFCondition DUL_AbortAssociation(DUL_ASSOCIATIONKEY ** association);
00379 OFCondition DUL_DropAssociation(DUL_ASSOCIATIONKEY ** association);
00380 OFCondition DUL_DropNetwork(DUL_NETWORKKEY ** network);
00381 OFCondition DUL_ReleaseAssociation(DUL_ASSOCIATIONKEY ** association);
00382 OFCondition DUL_AcknowledgeRelease(DUL_ASSOCIATIONKEY ** association);
00383
00384
00385
00386 OFCondition
00387 DUL_ReadPDVs(DUL_ASSOCIATIONKEY ** association,
00388 DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, int timeout);
00389 OFCondition
00390 DUL_WritePDVs(DUL_ASSOCIATIONKEY ** association,
00391 DUL_PDVLIST * pdvList);
00392 OFCondition DUL_NextPDV(DUL_ASSOCIATIONKEY ** association, DUL_PDV * pdv);
00393
00394
00395
00396
00397 const char *DUL_Message(OFCondition cond);
00398 void DUL_Debug(OFBool flag);
00399 OFCondition
00400 DUL_AssociationParameter(DUL_ASSOCIATIONKEY ** association,
00401 DUL_ASSOCIATION_PARAMETER param, DUL_DATA_TYPE type,
00402 void *address, size_t length);
00403 OFCondition
00404 DUL_MakePresentationCtx(DUL_PRESENTATIONCONTEXT ** ctx,
00405 DUL_SC_ROLE proposedSCRole, DUL_SC_ROLE acceptedSCRole,
00406 DUL_PRESENTATIONCONTEXTID ctxID, unsigned char reason, const char *abstractSyntax,
00407 const char *transferSyntax,...);
00408 void DUL_DumpParams(DUL_ASSOCIATESERVICEPARAMETERS * params);
00409 void DUL_DumpConnectionParameters(DUL_ASSOCIATIONKEY *association, ostream& outstream);
00410
00411 OFCondition DUL_ClearServiceParameters(DUL_ASSOCIATESERVICEPARAMETERS * params);
00412 void DUL_DefaultServiceParameters(DUL_ASSOCIATESERVICEPARAMETERS * params);
00413 void dumpExtNegList(SOPClassExtendedNegotiationSubItemList& lst);
00414
00415
00416
00417
00418
00419
00420
00421 OFBool
00422 DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, int timeout);
00423 int
00424 DUL_networkSocket(DUL_NETWORKKEY * callerNet);
00425 OFBool
00426 DUL_associationWaiting(DUL_NETWORKKEY * callerNet, int timeout);
00427
00428
00429
00430
00431 void DUL_activateAssociatePDUStorage(DUL_ASSOCIATIONKEY *dulassoc);
00432 void DUL_returnAssociatePDUStorage(DUL_ASSOCIATIONKEY *dulassoc, void *& pdu, unsigned long& pdusize);
00433
00434
00435 DcmTransportConnection *DUL_getTransportConnection(DUL_ASSOCIATIONKEY * callerAssociation);
00436
00437
00438 OFCondition DUL_setTransportLayer(DUL_NETWORKKEY *callerNetworkKey, DcmTransportLayer *newLayer, int takeoverOwnership);
00439
00440
00441 void DUL_activateCompatibilityMode(DUL_ASSOCIATIONKEY *dulassoc, unsigned long mode);
00442 void DUL_activateCallback(DUL_ASSOCIATIONKEY *dulassoc, DUL_ModeCallback *cb);
00443
00444
00445
00446
00447 unsigned long DUL_getPeerCertificateLength(DUL_ASSOCIATIONKEY *dulassoc);
00448 unsigned long DUL_getPeerCertificate(DUL_ASSOCIATIONKEY *dulassoc, void *buf, unsigned long bufLen);
00449
00450
00451
00452
00453
00459 OFBool DUL_processIsForkedChild();
00460
00465 void DUL_markProcessAsForkedChild();
00466
00479 void DUL_requestForkOnTransportConnectionReceipt(int argc, char *argv[]);
00480
00481 #endif
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572