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