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 "osconfig.h"
00058 #include "ofglobal.h"
00059 #include "oftypes.h"
00060 #include "ofcast.h"
00061 #include "extneg.h"
00062
00063 class DcmTransportConnection;
00064 class DcmTransportLayer;
00065
00072 extern OFGlobal<OFBool> dcmDisableGethostbyaddr;
00073
00077 extern OFGlobal<Sint32> dcmConnectionTimeout;
00078
00083 extern OFGlobal<int> dcmExternalSocketHandle;
00084
00091 extern OFGlobal<const char *> dcmTCPWrapperDaemonName;
00092
00093
00094
00095
00096 extern OFGlobal<unsigned long> dcmEnableBackwardCompatibility;
00097
00098 #ifndef DUL_KEYS
00099 #define DUL_KEYS 1
00100 typedef void DUL_NETWORKKEY;
00101 typedef void DUL_ASSOCIATIONKEY;
00102 typedef unsigned char DUL_PRESENTATIONCONTEXTID;
00103 #endif
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 #define DUL_LEN_TITLE OFstatic_cast(size_t, 16)
00114 #define DUL_LEN_NAME OFstatic_cast(size_t, 64)
00115 #define DUL_LEN_UID OFstatic_cast(size_t, 64)
00116 #define DUL_LEN_NODE OFstatic_cast(size_t, 127)
00117
00118
00119
00120
00121 #define DUL_TYPEASSOCIATERQ OFstatic_cast(unsigned char, 0x01)
00122 #define DUL_TYPEASSOCIATEAC OFstatic_cast(unsigned char, 0x02)
00123 #define DUL_TYPEASSOCIATERJ OFstatic_cast(unsigned char, 0x03)
00124 #define DUL_TYPEDATA OFstatic_cast(unsigned char, 0x04)
00125 #define DUL_TYPERELEASERQ OFstatic_cast(unsigned char, 0x05)
00126 #define DUL_TYPERELEASERP OFstatic_cast(unsigned char, 0x06)
00127 #define DUL_TYPEABORT OFstatic_cast(unsigned char, 0x07)
00128
00129 #define DUL_MAXTYPE OFstatic_cast(unsigned char, 0x07)
00130
00133 class DUL_ModeCallback
00134 {
00135 public:
00139 virtual void callback(unsigned long mode) = 0;
00140 };
00141
00142 typedef struct {
00143 char applicationContextName[DUL_LEN_NAME + 1];
00144 char callingAPTitle[DUL_LEN_TITLE + 1];
00145 char calledAPTitle[DUL_LEN_TITLE + 1];
00146 char respondingAPTitle[DUL_LEN_TITLE + 1];
00147 unsigned long maxPDU;
00148 unsigned short result;
00149 unsigned short resultSource;
00150 unsigned short diagnostic;
00151 char callingPresentationAddress[64];
00152 char calledPresentationAddress[64];
00153 LST_HEAD *requestedPresentationContext;
00154 LST_HEAD *acceptedPresentationContext;
00155 unsigned short maximumOperationsInvoked;
00156 unsigned short maximumOperationsPerformed;
00157 char callingImplementationClassUID[DICOM_UI_LENGTH + 1];
00158 char callingImplementationVersionName[16 + 1];
00159 char calledImplementationClassUID[DICOM_UI_LENGTH + 1];
00160 char calledImplementationVersionName[16 + 1];
00161 unsigned long peerMaxPDU;
00162 SOPClassExtendedNegotiationSubItemList *requestedExtNegList;
00163 SOPClassExtendedNegotiationSubItemList *acceptedExtNegList;
00164 OFBool useSecureLayer;
00165 } DUL_ASSOCIATESERVICEPARAMETERS;
00166
00167 typedef enum {
00168 DUL_SC_ROLE_DEFAULT,
00169 DUL_SC_ROLE_SCU,
00170 DUL_SC_ROLE_SCP,
00171 DUL_SC_ROLE_SCUSCP
00172 } DUL_SC_ROLE;
00173
00174 #define DUL_PRESENTATION_ACCEPT 0
00175 #define DUL_PRESENTATION_REJECT_USER 1
00176 #define DUL_PRESENTATION_REJECT_NOREASON 2
00177 #define DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX 3
00178 #define DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX 4
00179
00180 typedef OFList<char *> DUL_TRANSFERSYNTAXLIST;
00181
00182 typedef struct {
00183 void *reserved[2];
00184 DUL_PRESENTATIONCONTEXTID presentationContextID;
00185 char abstractSyntax[DUL_LEN_UID + 1];
00186 LST_HEAD *proposedTransferSyntax;
00187 char acceptedTransferSyntax[DUL_LEN_UID + 1];
00188 unsigned char result;
00189 DUL_SC_ROLE proposedSCRole;
00190 DUL_SC_ROLE acceptedSCRole;
00191 } DUL_PRESENTATIONCONTEXT;
00192
00193 typedef struct {
00194 void *reserved[2];
00195 char transferSyntax[DUL_LEN_UID + 1];
00196 } DUL_TRANSFERSYNTAX;
00197
00198 typedef struct dul_abortitems {
00199 unsigned char result;
00200 unsigned char source;
00201 unsigned char reason;
00202 } DUL_ABORTITEMS;
00203
00204 typedef enum {
00205 DUL_COMMANDPDV,
00206 DUL_DATASETPDV
00207 }
00208 DUL_DATAPDV;
00209
00210 typedef enum {
00211 DUL_BLOCK,
00212 DUL_NOBLOCK
00213 }
00214 DUL_BLOCKOPTIONS;
00215
00216 typedef struct {
00217 unsigned long fragmentLength;
00218 unsigned char presentationContextID;
00219 DUL_DATAPDV pdvType;
00220 OFBool lastPDV;
00221 void *data;
00222 } DUL_PDV;
00223
00224 typedef struct {
00225 unsigned long count;
00226 void *scratch;
00227 unsigned long scratchLength;
00228 DUL_ABORTITEMS abort;
00229 DUL_PDV *pdv;
00230 } DUL_PDVLIST;
00231
00232
00233
00234
00235
00236
00237
00238
00239 #define DUL_ORDERMASK 0x03
00240 #define DUL_ORDERLITTLEENDIAN 0x01
00241 #define DUL_ORDERBIGENDIAN 0x02
00242
00243 #define DUL_DOMAINMASK 0x04
00244 #define DUL_FULLDOMAINNAME 0x04
00245
00246 #define DUL_AEREQUESTOR "AE REQUESTOR"
00247 #define DUL_AEACCEPTOR "AE ACCEPTOR"
00248 #define DUL_AEBOTH "AE BOTH"
00249
00250
00251
00252
00253
00254 #define DUL_REJ_RSLTPERMANENT 0x01
00255 #define DUL_REJ_RSLTTRANSIENT 0x02
00256
00257
00258
00259
00260
00261
00262 #define DUL_SCU_INITIATED_ABORT 0x00
00263 #define DUL_SCP_INITIATED_ABORT 0x02
00264
00265 #define DUL_ABORTSERVICEUSER 0x00
00266 #define DUL_ABORTSERVICEPROVIDER 0x02
00267
00268
00269 #define DUL_ABORTNOREASON 0x00
00270 #define DUL_ABORTUNRECOGNIZEDPDU 0x01
00271 #define DUL_ABORTUNEXPECTEDPDU 0x02
00272 #define DUL_ABORTUNRECOGNIZEDPDUPARAM 0x04
00273 #define DUL_ABORTUNEXPECTEDPDUPARAM 0x05
00274 #define DUL_ABORTINVALIDPDUPARAM 0x06
00275
00276
00277
00278
00279
00280 #define DUL_REJECT_PERMANENT 0x01
00281 #define DUL_REJECT_TRANSIENT 0x02
00282
00283 #define DUL_ULSU_REJECT 0x01
00284 #define DUL_ULSP_ACSE_REJECT 0x02
00285 #define DUL_ULSP_PRESENTATION_REJECT 0x03
00286
00287 #define DUL_ULSU_REJ_NOREASON 0x01
00288 #define DUL_ULSU_REJ_UNSUP_APP_CTX_NAME 0x02
00289 #define DUL_ULSU_REJ_UNREC_CALLING_TITLE 0x03
00290 #define DUL_ULSU_REJ_UNREC_CALLED_TITLE 0x07
00291
00292 #define DUL_ULSP_ACSE_REJ_NOREASON 0x01
00293 #define DUL_ULSP_ACSE_UNSUP_PROTOCOL 0x02
00294
00295 #define DUL_ULSP_PRES_REJ_TEMP_CONGEST 0x01
00296 #define DUL_ULSP_PRES_REJ_LIMIT 0x02
00297
00298 #define DUL_ABORTNOREASON 0x00
00299 #define DUL_ABORTUNRECOGNIZEDPDU 0x01
00300 #define DUL_ABORTUNEXPECTEDPDU 0x02
00301 #define DUL_ABORTUNRECOGNIZEDPDUPARAM 0x04
00302 #define DUL_ABORTUNEXPECTEDPDUPARAM 0x05
00303 #define DUL_ABORTINVALIDPDUPARAM 0x06
00304
00305
00306
00307
00308
00309 typedef enum {
00310 DUL_K_INTEGER,
00311 DUL_K_STRING
00312 } DUL_DATA_TYPE;
00313 typedef enum {
00314 DUL_K_MAX_PDV_XMIT
00315 } DUL_ASSOCIATION_PARAMETER;
00316
00317 #define DUL_TIMEOUT 180
00318
00319
00320
00321
00322
00323
00324 #define DUL_DULCOMPAT 2768240730UL
00325 #define DUL_DIMSECOMPAT 196608UL
00326 #define DUL_MAXPDUCOMPAT 4278190335UL
00327
00328
00329
00330
00331
00332
00333 OFCondition
00334 DUL_AcknowledgeAssociationRQ(
00335 DUL_ASSOCIATIONKEY ** association,
00336 DUL_ASSOCIATESERVICEPARAMETERS * params,
00337 int activatePDUStorage);
00338
00339 OFCondition
00340 DUL_InitializeNetwork(
00341 const char *mode,
00342 void *param,
00343 int timeout,
00344 unsigned long
00345 options,
00346 DUL_NETWORKKEY ** network);
00347
00348 OFCondition
00349 DUL_ReceiveAssociationRQ(
00350 DUL_NETWORKKEY ** net,
00351 DUL_BLOCKOPTIONS blk,
00352 int timeout,
00353 DUL_ASSOCIATESERVICEPARAMETERS * parameters,
00354 DUL_ASSOCIATIONKEY ** association,
00355 int activatePDUStorage);
00356
00357 OFCondition
00358 DUL_RejectAssociationRQ(
00359 DUL_ASSOCIATIONKEY ** association,
00360 DUL_ABORTITEMS * params,
00361 int activatePDUStorage);
00362
00363 OFCondition
00364 DUL_RequestAssociation(
00365 DUL_NETWORKKEY ** network,
00366 DUL_ASSOCIATESERVICEPARAMETERS * params,
00367 DUL_ASSOCIATIONKEY ** association,
00368 int activatePDUStorage);
00369
00370
00371
00372 OFCondition DUL_AbortAssociation(DUL_ASSOCIATIONKEY ** association);
00373 OFCondition DUL_DropAssociation(DUL_ASSOCIATIONKEY ** association);
00374 OFCondition DUL_DropNetwork(DUL_NETWORKKEY ** network);
00375 OFCondition DUL_ReleaseAssociation(DUL_ASSOCIATIONKEY ** association);
00376 OFCondition DUL_AcknowledgeRelease(DUL_ASSOCIATIONKEY ** association);
00377
00378
00379
00380 OFCondition
00381 DUL_ReadPDVs(DUL_ASSOCIATIONKEY ** association,
00382 DUL_PDVLIST * pdvList, DUL_BLOCKOPTIONS block, int timeout);
00383 OFCondition
00384 DUL_WritePDVs(DUL_ASSOCIATIONKEY ** association,
00385 DUL_PDVLIST * pdvList);
00386 OFCondition DUL_NextPDV(DUL_ASSOCIATIONKEY ** association, DUL_PDV * pdv);
00387
00388
00389
00390
00391 const char *DUL_Message(OFCondition cond);
00392 void DUL_Debug(OFBool flag);
00393 OFCondition
00394 DUL_AssociationParameter(DUL_ASSOCIATIONKEY ** association,
00395 DUL_ASSOCIATION_PARAMETER param, DUL_DATA_TYPE type,
00396 void *address, size_t length);
00397 OFCondition
00398 DUL_MakePresentationCtx(DUL_PRESENTATIONCONTEXT ** ctx,
00399 DUL_SC_ROLE proposedSCRole, DUL_SC_ROLE acceptedSCRole,
00400 DUL_PRESENTATIONCONTEXTID ctxID, unsigned char reason, const char *abstractSyntax,
00401 const char *transferSyntax,...);
00402 void DUL_DumpParams(DUL_ASSOCIATESERVICEPARAMETERS * params);
00403 void DUL_DumpConnectionParameters(DUL_ASSOCIATIONKEY *association, ostream& outstream);
00404
00405 OFCondition DUL_ClearServiceParameters(DUL_ASSOCIATESERVICEPARAMETERS * params);
00406 void DUL_DefaultServiceParameters(DUL_ASSOCIATESERVICEPARAMETERS * params);
00407 void dumpExtNegList(SOPClassExtendedNegotiationSubItemList& lst);
00408
00409
00410
00411
00412
00413
00414
00415 OFBool
00416 DUL_dataWaiting(DUL_ASSOCIATIONKEY * callerAssociation, int timeout);
00417 int
00418 DUL_networkSocket(DUL_NETWORKKEY * callerNet);
00419 OFBool
00420 DUL_associationWaiting(DUL_NETWORKKEY * callerNet, int timeout);
00421
00422
00423
00424
00425 void DUL_activateAssociatePDUStorage(DUL_ASSOCIATIONKEY *dulassoc);
00426 void DUL_returnAssociatePDUStorage(DUL_ASSOCIATIONKEY *dulassoc, void *& pdu, unsigned long& pdusize);
00427
00428
00429 DcmTransportConnection *DUL_getTransportConnection(DUL_ASSOCIATIONKEY * callerAssociation);
00430
00431
00432 OFCondition DUL_setTransportLayer(DUL_NETWORKKEY *callerNetworkKey, DcmTransportLayer *newLayer, int takeoverOwnership);
00433
00434
00435 void DUL_activateCompatibilityMode(DUL_ASSOCIATIONKEY *dulassoc, unsigned long mode);
00436 void DUL_activateCallback(DUL_ASSOCIATIONKEY *dulassoc, DUL_ModeCallback *cb);
00437
00438
00439
00440
00441 unsigned long DUL_getPeerCertificateLength(DUL_ASSOCIATIONKEY *dulassoc);
00442 unsigned long DUL_getPeerCertificate(DUL_ASSOCIATIONKEY *dulassoc, void *buf, unsigned long bufLen);
00443
00444
00445
00446
00447
00448
00449 #endif
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
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