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