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
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 #ifndef ASSOCIATION_H
00096 #define ASSOCIATION_H
00097
00098 #include "dcmtk/config/osconfig.h"
00099
00100
00101
00102
00103 #include "dcmtk/dcmnet/dicom.h"
00104 #include "dcmtk/dcmnet/lst.h"
00105 #include "dcmtk/dcmnet/dul.h"
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 #define ASC_DEFAULTMAXPDU 16384
00117 #define ASC_MINIMUMPDUSIZE 4096
00118 #define ASC_MAXIMUMPDUSIZE 131072
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 enum T_ASC_NetworkRole
00130 {
00131 NET_ACCEPTOR,
00132 NET_REQUESTOR,
00133 NET_ACCEPTORREQUESTOR
00134 };
00135
00136 struct T_ASC_Network
00137 {
00138 T_ASC_NetworkRole role;
00139 int acceptorPort;
00140 DUL_NETWORKKEY *network;
00141 };
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 #define DICOM_MAXTRANSFERSYNTAXES 50
00155
00156
00157 typedef DUL_PRESENTATIONCONTEXTID T_ASC_PresentationContextID;
00158
00159 enum T_ASC_P_ResultReason
00160 {
00161 ASC_P_ACCEPTANCE = 0,
00162 ASC_P_USERREJECTION = 1,
00163 ASC_P_NOREASON = 2,
00164 ASC_P_ABSTRACTSYNTAXNOTSUPPORTED = 3,
00165 ASC_P_TRANSFERSYNTAXESNOTSUPPORTED = 4,
00166 ASC_P_NOTYETNEGOTIATED = 255
00167 };
00168
00169 enum T_ASC_SC_ROLE
00170 {
00171 ASC_SC_ROLE_NONE,
00172 ASC_SC_ROLE_DEFAULT,
00173 ASC_SC_ROLE_SCU,
00174 ASC_SC_ROLE_SCP,
00175 ASC_SC_ROLE_SCUSCP
00176 };
00177
00178 struct T_ASC_PresentationContext
00179 {
00180 T_ASC_PresentationContextID presentationContextID;
00181 DIC_UI abstractSyntax;
00182 unsigned char transferSyntaxCount;
00183 DIC_UI proposedTransferSyntaxes[DICOM_MAXTRANSFERSYNTAXES];
00184 DIC_UI acceptedTransferSyntax;
00185 T_ASC_P_ResultReason resultReason;
00186 T_ASC_SC_ROLE proposedRole;
00187 T_ASC_SC_ROLE acceptedRole;
00188 };
00189
00190 enum T_ASC_RejectParametersResult
00191 {
00192 ASC_RESULT_REJECTEDPERMANENT = 1,
00193 ASC_RESULT_REJECTEDTRANSIENT = 2
00194 };
00195
00196 enum T_ASC_RejectParametersSource
00197 {
00198 ASC_SOURCE_SERVICEUSER = 1,
00199 ASC_SOURCE_SERVICEPROVIDER_ACSE_RELATED = 2,
00200 ASC_SOURCE_SERVICEPROVIDER_PRESENTATION_RELATED = 3
00201 };
00202
00203 enum T_ASC_RejectParametersReason
00204 {
00205
00206 ASC_REASON_SU_NOREASON = 0x0101,
00207 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED = 0x0102,
00208 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED = 0x0103,
00209 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED = 0x0107,
00210
00211 ASC_REASON_SP_ACSE_NOREASON = 0x0201,
00212 ASC_REASON_SP_ACSE_PROTOCOLVERSIONNOTSUPPORTED = 0x0202,
00213
00214 ASC_REASON_SP_PRES_TEMPORARYCONGESTION = 0x0301,
00215 ASC_REASON_SP_PRES_LOCALLIMITEXCEEDED = 0x0302
00216 };
00217
00218 struct T_ASC_RejectParameters
00219 {
00220 T_ASC_RejectParametersResult result;
00221 T_ASC_RejectParametersSource source;
00222 T_ASC_RejectParametersReason reason;
00223 };
00224
00225
00226 struct T_ASC_Parameters
00227 {
00228 DIC_UI ourImplementationClassUID;
00229 DIC_SH ourImplementationVersionName;
00230 DIC_UI theirImplementationClassUID;
00231 DIC_SH theirImplementationVersionName;
00232 DUL_ModeCallback *modeCallback;
00233
00234 DUL_ASSOCIATESERVICEPARAMETERS DULparams;
00235
00236
00237
00238
00239
00240 long ourMaxPDUReceiveSize;
00241 long theirMaxPDUReceiveSize;
00242
00243 };
00244
00245
00246
00247
00248
00249 struct T_ASC_Association
00250 {
00251 DUL_ASSOCIATIONKEY *DULassociation;
00252 T_ASC_Parameters *params;
00253
00254 unsigned short nextMsgID;
00255 unsigned long sendPDVLength;
00256 unsigned char *sendPDVBuffer;
00257 };
00258
00259
00260
00261
00262
00273 OFCondition ASC_initializeNetwork(
00274 T_ASC_NetworkRole role,
00275 int acceptorPort,
00276 int timeout,
00277 T_ASC_Network ** network,
00278 unsigned long options = 0);
00279
00284 OFCondition ASC_dropNetwork(T_ASC_Network ** network);
00285
00286
00287
00288
00289
00290 OFCondition
00291 ASC_createAssociationParameters(
00292 T_ASC_Parameters ** params,
00293 long maxReceivePDUSize);
00294
00295 OFCondition
00296 ASC_destroyAssociationParameters(
00297 T_ASC_Parameters ** params);
00298
00299
00300 OFCondition
00301 ASC_setTransportLayerType(
00302 T_ASC_Parameters * params,
00303 OFBool useSecureLayer);
00304
00305 OFCondition
00306 ASC_setAPTitles(
00307 T_ASC_Parameters * params,
00308 const char* callingAPTitle,
00309 const char* calledAPTitle,
00310 const char* respondingAPTitle);
00311
00312 OFCondition
00313 ASC_getAPTitles(
00314 T_ASC_Parameters * params,
00315 char* callingAPTitle,
00316 char* calledAPTitle,
00317 char* respondingAPTitle);
00318
00319 OFCondition
00320 ASC_getApplicationContextName(
00321 T_ASC_Parameters * params,
00322 char* applicationContextName);
00323
00324 OFCondition
00325 ASC_setPresentationAddresses(
00326 T_ASC_Parameters * params,
00327 const char* callingPresentationAddress,
00328 const char* calledPresentationAddress);
00329
00330 OFCondition
00331 ASC_getPresentationAddresses(
00332 T_ASC_Parameters * params,
00333 char* callingPresentationAddress,
00334 char* calledPresentationAddress);
00335
00336 OFCondition
00337 ASC_getRejectParameters(
00338 T_ASC_Parameters * params,
00339 T_ASC_RejectParameters * rejectParameters);
00340
00341 OFString&
00342 ASC_printRejectParameters(
00343 OFString& str,
00344 T_ASC_RejectParameters *rej);
00345
00346 OFCondition
00347 ASC_addPresentationContext(
00348 T_ASC_Parameters * params,
00349 T_ASC_PresentationContextID presentationContextID,
00350 const char* abstractSyntax,
00351 const char* transferSyntaxList[],
00352 int transferSyntaxListCount,
00353 T_ASC_SC_ROLE proposedRole = ASC_SC_ROLE_DEFAULT);
00354
00355 int
00356 ASC_countPresentationContexts(
00357 T_ASC_Parameters * params);
00358
00359 int
00360 ASC_countAcceptedPresentationContexts(
00361 T_ASC_Parameters * params);
00362
00363 OFCondition
00364 ASC_getPresentationContext(
00365 T_ASC_Parameters * params,
00366 int listPosition,
00367 T_ASC_PresentationContext * presentationContext);
00368
00369 OFCondition
00370 ASC_acceptPresentationContext(
00371 T_ASC_Parameters * params,
00372 T_ASC_PresentationContextID presentationContextID,
00373 const char* transferSyntax,
00374 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT);
00375
00376 OFCondition
00377 ASC_acceptContextsWithPreferredTransferSyntaxes(
00378 T_ASC_Parameters * params,
00379 const char* abstractSyntaxes[], int abstractSyntaxCount,
00380 const char* transferSyntaxes[], int transferSyntaxCount,
00381 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT);
00382
00383 OFCondition
00384 ASC_acceptContextsWithTransferSyntax(
00385 T_ASC_Parameters * params,
00386 const char* transferSyntax, int abstractSyntaxCount,
00387 const char* abstractSyntaxes[],
00388 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT);
00389
00390 OFCondition
00391 ASC_refusePresentationContext(
00392 T_ASC_Parameters * params,
00393 T_ASC_PresentationContextID presentationContextID,
00394 T_ASC_P_ResultReason resultReason);
00395
00396 OFCondition
00397 ASC_findAcceptedPresentationContext(
00398 T_ASC_Parameters * params,
00399 T_ASC_PresentationContextID presentationContextID,
00400 T_ASC_PresentationContext * presentationContext);
00401
00402 T_ASC_PresentationContextID
00403 ASC_findAcceptedPresentationContextID(
00404 T_ASC_Association *assoc,
00405 const char* abstractSyntax);
00406
00407 T_ASC_PresentationContextID
00408 ASC_findAcceptedPresentationContextID(
00409 T_ASC_Association *assoc,
00410 const char* abstractSyntax,
00411 const char * transferSyntax);
00412
00413
00414 void ASC_getRequestedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList** extNegList);
00415 void ASC_getAcceptedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList** extNegList);
00416 void ASC_setRequestedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList* extNegList);
00417 void ASC_setAcceptedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList* extNegList);
00418
00419
00420
00421
00422
00423
00424
00425
00426 void ASC_getUserIdentRQ(T_ASC_Parameters* params, UserIdentityNegotiationSubItemRQ** usrIdentRQ);
00427
00428
00429
00430
00431
00432
00433
00434
00435 void ASC_getUserIdentAC(T_ASC_Parameters* params, UserIdentityNegotiationSubItemAC** usrIdentAC);
00436
00444 OFCondition
00445 ASC_setIdentRQUserPassword(
00446 T_ASC_Parameters * params,
00447 const OFString& userName,
00448 const OFString& password,
00449 const OFBool& requestRsp = OFTrue);
00450
00457 OFCondition
00458 ASC_setIdentRQUserOnly(
00459 T_ASC_Parameters * params,
00460 const OFString& userName,
00461 const OFBool& requestRsp = OFTrue);
00462
00469 OFCondition
00470 ASC_setIdentRQKerberos(
00471 T_ASC_Parameters * params,
00472 const char* kerbTicket,
00473 const Uint16& length,
00474 const OFBool& requestRsp = OFTrue);
00475
00482 OFCondition
00483 ASC_setIdentRQSaml(
00484 T_ASC_Parameters * params,
00485 const char* saml,
00486 const Uint16& length,
00487 const OFBool& requestRsp = OFTrue);
00488
00489
00496 OFCondition ASC_setIdentAC(
00497 T_ASC_Parameters * params,
00498 const char* response,
00499 const Uint16& length );
00500
00513 void
00514 ASC_getCopyOfIdentResponse(T_ASC_Parameters * params,
00515 void*& buffer,
00516 unsigned short& bufferLen);
00517
00518
00519
00520
00521 unsigned long ASC_getPeerCertificateLength(T_ASC_Association *assoc);
00522 unsigned long ASC_getPeerCertificate(T_ASC_Association *assoc, void *buf, unsigned long bufLen);
00523
00524
00525 OFCondition
00526 ASC_setTransportLayer(T_ASC_Network *network, DcmTransportLayer *newLayer, int takeoverOwnership);
00527
00528 enum ASC_associateType
00529 {
00530 ASC_ASSOC_RQ,
00531 ASC_ASSOC_AC,
00532 ASC_ASSOC_RJ
00533 };
00534
00535 OFString&
00536 ASC_dumpParameters(OFString& str, T_ASC_Parameters * param, ASC_associateType dir);
00537
00538 OFString&
00539 ASC_dumpConnectionParameters(OFString& str, T_ASC_Association *association);
00540
00541 void ASC_activateCallback(T_ASC_Parameters *params, DUL_ModeCallback *cb);
00542
00543
00544
00545
00546
00547 OFBool
00548 ASC_associationWaiting(T_ASC_Network * network, int timeout);
00549
00550 OFBool
00551 ASC_dataWaiting(T_ASC_Association * association, int timeout);
00552
00553 OFBool
00554 ASC_selectReadableAssociation(
00555 T_ASC_Association* assocs[],
00556 int assocCount, int timeout);
00557
00558
00559
00560
00561
00562 OFCondition
00563 ASC_requestAssociation(
00564 T_ASC_Network * network,
00565 T_ASC_Parameters * params,
00566
00567
00568 T_ASC_Association ** association,
00569 void **associatePDU=NULL,
00570 unsigned long *associatePDUlength=NULL);
00571
00572 OFCondition
00573 ASC_receiveAssociation(
00574 T_ASC_Network * network,
00575 T_ASC_Association ** association,
00576 long maxReceivePDUSize,
00577 void **associatePDU=NULL,
00578 unsigned long *associatePDUlength=NULL,
00579 OFBool useSecureLayer=OFFalse,
00580 DUL_BLOCKOPTIONS block=DUL_BLOCK,
00581 int timeout=0);
00582
00583 OFCondition
00584 ASC_acknowledgeAssociation(
00585 T_ASC_Association * assoc,
00586 void **associatePDU=NULL,
00587 unsigned long *associatePDUlength=NULL);
00588
00589 OFCondition
00590 ASC_rejectAssociation(
00591 T_ASC_Association * association,
00592 T_ASC_RejectParameters * rejectParameters,
00593 void **associatePDU=NULL,
00594 unsigned long *associatePDUlength=NULL);
00595
00596 OFCondition
00597 ASC_releaseAssociation(T_ASC_Association * association);
00598
00599 OFCondition
00600 ASC_acknowledgeRelease(T_ASC_Association * association);
00601
00602 OFCondition
00603 ASC_abortAssociation(T_ASC_Association * association);
00604
00605 OFCondition
00606 ASC_dropSCPAssociation(T_ASC_Association * association, int timeout = DUL_TIMEOUT);
00607
00608 OFCondition
00609 ASC_dropAssociation(T_ASC_Association * association);
00610
00611 OFCondition
00612 ASC_destroyAssociation(T_ASC_Association ** association);
00613
00615 void
00616 ASC_printRejectParameters(
00617 FILE *f,
00618 T_ASC_RejectParameters *rej);
00619
00621 void
00622 ASC_printRejectParameters(
00623 STD_NAMESPACE ostream& out,
00624 T_ASC_RejectParameters *rej);
00625
00630 void
00631 ASC_dumpParameters(T_ASC_Parameters * params, STD_NAMESPACE ostream& outstream);
00632
00634 void
00635 ASC_dumpPresentationContext(T_ASC_PresentationContext * presentationContext, STD_NAMESPACE ostream& outstream);
00636
00641 void
00642 ASC_dumpConnectionParameters(T_ASC_Association *association, STD_NAMESPACE ostream& outstream);
00643
00644
00645 #endif
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775