1 /* 2 * 3 * Copyright (C) 1994-2018, OFFIS e.V. 4 * All rights reserved. See COPYRIGHT file for details. 5 * 6 * This software and supporting documentation were partly developed by 7 * 8 * OFFIS e.V. 9 * R&D Division Health 10 * Escherweg 2 11 * D-26121 Oldenburg, Germany 12 * 13 * For further copyrights, see the following paragraphs. 14 * 15 */ 16 17 /* 18 ** Copyright (C) 1993/1994, OFFIS, Oldenburg University and CERIUM 19 ** 20 ** This software and supporting documentation were 21 ** developed by 22 ** 23 ** Institut OFFIS 24 ** Bereich Kommunikationssysteme 25 ** Westerstr. 10-12 26 ** 26121 Oldenburg, Germany 27 ** 28 ** Fachbereich Informatik 29 ** Abteilung Prozessinformatik 30 ** Carl von Ossietzky Universitaet Oldenburg 31 ** Ammerlaender Heerstr. 114-118 32 ** 26111 Oldenburg, Germany 33 ** 34 ** CERIUM 35 ** Laboratoire SIM 36 ** Faculte de Medecine 37 ** 2 Avenue du Pr. Leon Bernard 38 ** 35043 Rennes Cedex, France 39 ** 40 ** for CEN/TC251/WG4 as a contribution to the Radiological 41 ** Society of North America (RSNA) 1993 Digital Imaging and 42 ** Communications in Medicine (DICOM) Demonstration. 43 ** 44 ** THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER OFFIS, 45 ** OLDENBURG UNIVERSITY NOR CERIUM MAKE ANY WARRANTY REGARDING 46 ** THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 47 ** FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER 48 ** DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE 49 ** ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE 50 ** IS WITH THE USER. 51 ** 52 ** Copyright of the software and supporting documentation 53 ** is, unless otherwise stated, jointly owned by OFFIS, 54 ** Oldenburg University and CERIUM and free access is hereby 55 ** granted as a license to use this software, copy this 56 ** software and prepare derivative works based upon this 57 ** software. However, any distribution of this software 58 ** source code or supporting documentation or derivative 59 ** works (source code and supporting documentation) must 60 ** include the three paragraphs of this copyright notice. 61 ** 62 */ 63 64 /* 65 ** 66 ** Author: Andrew Hewett Created: 03-06-93 67 ** 68 ** Module: association 69 ** 70 ** Purpose: 71 ** This file contains the routines which provide association management 72 ** for DICOM applications. It maintains structures which describe 73 ** active associations and provides access to association specific 74 ** information. Also provided are routines for aiding association 75 ** negotiation (presentation contexts, abstract syntaxes, transfer 76 ** syntaxes, maximum PDU length, and other extended negotiation). 77 ** 78 ** This package uses the facilities of the DICOM Upper Layer for 79 ** receiving/sending association requests/responses. 80 ** 81 ** Each active association is represented by an T_ASC_Association 82 ** structure which contains all relevant information. 83 ** 84 ** Module Prefix: ASC_ 85 ** 86 */ 87 88 89 #ifndef ASSOCIATION_H 90 #define ASSOCIATION_H 91 92 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 93 94 /* 95 ** Required Include Files 96 */ 97 #include "dcmtk/dcmnet/dicom.h" 98 #include "dcmtk/dcmnet/lst.h" 99 #include "dcmtk/dcmnet/dul.h" 100 101 /* 102 ** Constant Definitions 103 */ 104 105 /* 106 * There have been reports that smaller PDUs work better in some environments. 107 * Allow a 4K minimum and a 128K maximum. Any further extension requires 108 * modifications in the DUL code. 109 */ 110 #define ASC_DEFAULTMAXPDU 16384 /* 16K is default if nothing else specified */ 111 #define ASC_MINIMUMPDUSIZE 4096 112 #define ASC_MAXIMUMPDUSIZE 131072 /* 128K - we only handle this big */ 113 114 /* 115 ** Type Definitions 116 */ 117 118 /* 119 ** Network initialization structure. 120 ** Is a wrapper for DUL functionality. 121 */ 122 123 enum T_ASC_NetworkRole 124 { 125 NET_ACCEPTOR, /* Provider Only */ 126 NET_REQUESTOR, /* User Only */ 127 NET_ACCEPTORREQUESTOR /* User and Provider */ 128 }; 129 130 struct DCMTK_DCMNET_EXPORT T_ASC_Network 131 { 132 T_ASC_NetworkRole role; 133 int acceptorPort; 134 DUL_NETWORKKEY *network; 135 }; 136 137 138 /* 139 ** Association negotiation parameters. 140 ** 141 */ 142 143 144 /* not defined anywhere (I think) but a hard limitation for now. 145 * DICOM (1998) defines 22 transfer syntaxes, this upper limit 146 * should allow for sufficiently many private transfer syntaxes. 147 */ 148 #define DICOM_MAXTRANSFERSYNTAXES 50 149 150 151 typedef DUL_PRESENTATIONCONTEXTID T_ASC_PresentationContextID; 152 153 enum T_ASC_P_ResultReason 154 { /* Part 8, pp 45. */ 155 ASC_P_ACCEPTANCE = 0, 156 ASC_P_USERREJECTION = 1, 157 ASC_P_NOREASON = 2, 158 ASC_P_ABSTRACTSYNTAXNOTSUPPORTED = 3, 159 ASC_P_TRANSFERSYNTAXESNOTSUPPORTED = 4, 160 ASC_P_NOTYETNEGOTIATED = 255 161 }; 162 163 enum T_ASC_SC_ROLE 164 { 165 ASC_SC_ROLE_NONE, 166 ASC_SC_ROLE_DEFAULT, 167 ASC_SC_ROLE_SCU, 168 ASC_SC_ROLE_SCP, 169 ASC_SC_ROLE_SCUSCP 170 }; 171 172 struct DCMTK_DCMNET_EXPORT T_ASC_PresentationContext 173 { 174 T_ASC_PresentationContextID presentationContextID; 175 DIC_UI abstractSyntax; 176 unsigned char transferSyntaxCount; 177 DIC_UI proposedTransferSyntaxes[DICOM_MAXTRANSFERSYNTAXES]; 178 DIC_UI acceptedTransferSyntax; 179 T_ASC_P_ResultReason resultReason; 180 T_ASC_SC_ROLE proposedRole; 181 T_ASC_SC_ROLE acceptedRole; 182 }; 183 184 enum T_ASC_RejectParametersResult 185 { 186 ASC_RESULT_REJECTEDPERMANENT = 1, 187 ASC_RESULT_REJECTEDTRANSIENT = 2 188 }; 189 190 enum T_ASC_RejectParametersSource 191 { 192 ASC_SOURCE_SERVICEUSER = 1, 193 ASC_SOURCE_SERVICEPROVIDER_ACSE_RELATED = 2, 194 ASC_SOURCE_SERVICEPROVIDER_PRESENTATION_RELATED = 3 195 }; 196 197 enum T_ASC_RejectParametersReason 198 { /* the following values are coded by DUL */ 199 /* Service User reasons */ 200 ASC_REASON_SU_NOREASON = 0x0101, 201 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED = 0x0102, 202 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED = 0x0103, 203 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED = 0x0107, 204 /* Service Provider ACSE Related reasons */ 205 ASC_REASON_SP_ACSE_NOREASON = 0x0201, 206 ASC_REASON_SP_ACSE_PROTOCOLVERSIONNOTSUPPORTED = 0x0202, 207 /* Service Provider Presentation Related reasons */ 208 ASC_REASON_SP_PRES_TEMPORARYCONGESTION = 0x0301, 209 ASC_REASON_SP_PRES_LOCALLIMITEXCEEDED = 0x0302 210 }; 211 212 struct DCMTK_DCMNET_EXPORT T_ASC_RejectParameters 213 { 214 T_ASC_RejectParametersResult result; 215 T_ASC_RejectParametersSource source; 216 T_ASC_RejectParametersReason reason; 217 }; 218 219 220 struct DCMTK_DCMNET_EXPORT T_ASC_Parameters 221 { 222 DIC_UI ourImplementationClassUID; 223 DIC_SH ourImplementationVersionName; 224 DIC_UI theirImplementationClassUID; 225 DIC_SH theirImplementationVersionName; 226 DUL_ModeCallback *modeCallback; 227 228 DUL_ASSOCIATESERVICEPARAMETERS DULparams; 229 /* 230 * DICOM Upper Layer service parameters. They should only be 231 * accessed via functions defined below. 232 */ 233 234 long ourMaxPDUReceiveSize; /* we say what we can receive */ 235 long theirMaxPDUReceiveSize; /* they say what we can send */ 236 237 }; 238 239 /* 240 ** Association structure containing all association specific 241 ** information. 242 */ 243 struct DCMTK_DCMNET_EXPORT T_ASC_Association 244 { 245 DUL_ASSOCIATIONKEY *DULassociation; 246 T_ASC_Parameters *params; 247 248 unsigned short nextMsgID; /* should be incremented by user */ 249 unsigned long sendPDVLength; /* max length of PDV to send out */ 250 unsigned char *sendPDVBuffer; /* buffer of size sendPDVLength */ 251 }; 252 253 /* 254 ** Public Function Prototypes 255 */ 256 257 /* 258 * Network creation/destroy wrappers. 259 * The T_ASC_Network structure will be allocated/freed by 260 * these routines. 261 */ 262 263 /** network instance creation function (constructor) 264 * @param role association acceptor, requestor or both 265 * @param acceptorPort acceptor port for incoming connections. 266 * For association requestors, zero should be passed here. 267 * @param timeout timeout for network operations, in seconds 268 * @param network T_ASC_Network will be allocated and returned in this parameter 269 * @param options network options. Only DUL_FULLDOMAINNAME is currently defined 270 * as a possible option. 271 * @return EC_Normal if successful, an error code otherwise 272 */ 273 DCMTK_DCMNET_EXPORT OFCondition ASC_initializeNetwork( 274 T_ASC_NetworkRole role, 275 int acceptorPort, 276 int timeout, 277 T_ASC_Network ** network, 278 unsigned long options = 0); 279 280 /** network instance destruction function (destructor) 281 * @param network T_ASC_Network will be freed by this routine 282 * @return EC_Normal if successful, an error code otherwise 283 */ 284 DCMTK_DCMNET_EXPORT OFCondition ASC_dropNetwork(T_ASC_Network ** network); 285 286 /* 287 * Building Association parameters 288 */ 289 290 /* create association parameters and initialize with default values */ 291 DCMTK_DCMNET_EXPORT OFCondition 292 ASC_createAssociationParameters( 293 T_ASC_Parameters ** params, 294 long maxReceivePDUSize); 295 296 /* 297 * Free an association parameters structure and embedded information. 298 * You do not usually need to do this since the parameters structure will 299 * be noted in the association structure and automatically freed when an 300 * association terminates. 301 */ 302 DCMTK_DCMNET_EXPORT OFCondition 303 ASC_destroyAssociationParameters( 304 T_ASC_Parameters ** params); 305 306 /* set transport layer type in association parameters */ 307 DCMTK_DCMNET_EXPORT OFCondition 308 ASC_setTransportLayerType( 309 T_ASC_Parameters * params, 310 OFBool useSecureLayer); 311 312 /* 313 * Copies the provided Application Titles in the association parameters. 314 */ 315 DCMTK_DCMNET_EXPORT OFCondition 316 ASC_setAPTitles( 317 T_ASC_Parameters * params, 318 const char* callingAPTitle, 319 const char* calledAPTitle, 320 const char* respondingAPTitle); 321 322 /* 323 * Copies the Application Titles stored in the association parameters 324 * into the supplied string variables. You must provide storage to copy 325 * into. 326 */ 327 DCMTK_DCMNET_EXPORT OFCondition 328 ASC_getAPTitles( 329 T_ASC_Parameters * params, 330 char* callingAPTitle, 331 size_t callingAPTitleSize, 332 char* calledAPTitle, 333 size_t calledAPTitleSize, 334 char* respondingAPTitle, 335 size_t respondingAPTitleSize); 336 337 /* 338 * Copies the Application Context Name stored in the association parameters 339 * into the supplied string variable. You must provide storage to copy 340 * into. 341 */ 342 DCMTK_DCMNET_EXPORT OFCondition 343 ASC_getApplicationContextName( 344 T_ASC_Parameters * params, 345 char* applicationContextName, 346 size_t applicationContextNameSize); 347 348 /* 349 * Copies the provided Presentation Addresses into the association 350 * parameters. 351 */ 352 DCMTK_DCMNET_EXPORT OFCondition 353 ASC_setPresentationAddresses( 354 T_ASC_Parameters * params, 355 const char* callingPresentationAddress, 356 const char* calledPresentationAddress); 357 358 /* 359 * Copies the Presentation Addresses stored in the association parameters 360 * into the supplied string variables. You must provide storage to copy 361 * into. 362 */ 363 DCMTK_DCMNET_EXPORT OFCondition 364 ASC_getPresentationAddresses( 365 T_ASC_Parameters * params, 366 char* callingPresentationAddress, 367 size_t callingPresentationAddressSize, 368 char* calledPresentationAddress, 369 size_t calledPresentationAddressSize); 370 371 /* 372 * Copies the Rejection Parameters stored in the association parameters into 373 * the supplied structure. You must provide storage to copy into. 374 */ 375 DCMTK_DCMNET_EXPORT OFCondition 376 ASC_getRejectParameters( 377 T_ASC_Parameters * params, 378 T_ASC_RejectParameters * rejectParameters); 379 380 DCMTK_DCMNET_EXPORT OFString& 381 ASC_printRejectParameters( 382 OFString& str, 383 const T_ASC_RejectParameters *rej); 384 385 /* 386 * Adds a presentation context entry to the presentation context list. 387 */ 388 DCMTK_DCMNET_EXPORT OFCondition 389 ASC_addPresentationContext( 390 T_ASC_Parameters * params, 391 T_ASC_PresentationContextID presentationContextID, 392 const char* abstractSyntax, 393 const char* transferSyntaxList[], 394 int transferSyntaxListCount, 395 T_ASC_SC_ROLE proposedRole = ASC_SC_ROLE_DEFAULT); 396 397 /* 398 * Returns the number of presentation contexts contained in the presentation 399 * context list. 400 */ 401 DCMTK_DCMNET_EXPORT int 402 ASC_countPresentationContexts( 403 T_ASC_Parameters * params); 404 405 DCMTK_DCMNET_EXPORT int 406 ASC_countAcceptedPresentationContexts( 407 T_ASC_Parameters * params); 408 409 /* 410 * You must supply the memory for presentationContext, the values stored in 411 * the presentation context list position indicated will be copied into the 412 * memory structure. 413 */ 414 DCMTK_DCMNET_EXPORT OFCondition 415 ASC_getPresentationContext( 416 T_ASC_Parameters * params, 417 int listPosition, 418 T_ASC_PresentationContext * presentationContext); 419 420 /* 421 * The presentation context will be marked as accepted and the provided 422 * transfer syntax name chosen. 423 */ 424 DCMTK_DCMNET_EXPORT OFCondition 425 ASC_acceptPresentationContext( 426 T_ASC_Parameters * params, 427 T_ASC_PresentationContextID presentationContextID, 428 const char* transferSyntax, 429 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT, 430 const OFBool alwaysAcceptDefaultRole = OFFalse); 431 432 DCMTK_DCMNET_EXPORT OFCondition 433 ASC_acceptContextsWithPreferredTransferSyntaxes( 434 T_ASC_Parameters * params, 435 const char* abstractSyntaxes[], int abstractSyntaxCount, 436 const char* transferSyntaxes[], int transferSyntaxCount, 437 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT); 438 439 /* 440 * Any proposed presentation contexts which are found abstractSyntaxes[] 441 * which also have proposed a transfer syntax of transferSyntax, will be 442 * accepted. Any presentation contexts already marked as accepted will be 443 * left alone but any remaining presentation contexts will be refused. 444 */ 445 DCMTK_DCMNET_EXPORT OFCondition 446 ASC_acceptContextsWithTransferSyntax( 447 T_ASC_Parameters * params, 448 const char* transferSyntax, int abstractSyntaxCount, 449 const char* abstractSyntaxes[], 450 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT); 451 452 /* 453 * The presentation context will be marked as refused. 454 */ 455 DCMTK_DCMNET_EXPORT OFCondition 456 ASC_refusePresentationContext( 457 T_ASC_Parameters * params, 458 T_ASC_PresentationContextID presentationContextID, 459 T_ASC_P_ResultReason resultReason); 460 461 /* 462 * ASC_findAcceptedPresentationContext: You must supply the memory for 463 * presentationContext, the values stored in the accepted presentation 464 * context list with given ID will be copied into the memory structure. 465 * Returns EC_Normal if found, or ASC_BADPRESENTATIONCONTEXTID if not 466 * found. 467 */ 468 DCMTK_DCMNET_EXPORT OFCondition 469 ASC_findAcceptedPresentationContext( 470 T_ASC_Parameters * params, 471 T_ASC_PresentationContextID presentationContextID, 472 T_ASC_PresentationContext * presentationContext); 473 474 /* ASC_findAcceptedPresentationContextID: 475 * Searches in the accepted presentation context list for the given 476 * abstract syntax. If found returns its PresentationContextID, otherwise 477 * returns 0 (which is not a valid ID). 478 */ 479 DCMTK_DCMNET_EXPORT T_ASC_PresentationContextID 480 ASC_findAcceptedPresentationContextID( 481 T_ASC_Association *assoc, 482 const char* abstractSyntax); 483 484 /* transfer syntax aware version of T_ASC_PresentationContextID. 485 * Tries to find a presentation context that matches the characteristics 486 * of the given DICOM dataset best 487 * - if possible finds a presentation context with matching TS 488 * - then tries to find an explicit VR uncompressed TS presentation ctx 489 * - then tries to find an implicit VR uncompressed TS presentation ctx 490 * - finally accepts each matching presentation ctx independent of TS. 491 * Returns 0 if no appropriate presentation context could be found at all. 492 */ 493 DCMTK_DCMNET_EXPORT T_ASC_PresentationContextID 494 ASC_findAcceptedPresentationContextID( 495 T_ASC_Association *assoc, 496 const char* abstractSyntax, 497 const char * transferSyntax); 498 499 /* extended negotiation */ 500 DCMTK_DCMNET_EXPORT void ASC_getRequestedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList** extNegList); 501 DCMTK_DCMNET_EXPORT void ASC_getAcceptedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList** extNegList); 502 DCMTK_DCMNET_EXPORT void ASC_setRequestedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList* extNegList); 503 DCMTK_DCMNET_EXPORT void ASC_setAcceptedExtNegList(T_ASC_Parameters* params, SOPClassExtendedNegotiationSubItemList* extNegList); 504 505 /* user identity negotiation */ 506 507 /* function that returns user identity request structure from association 508 * parameters. 509 * @param params - [in] The parameters to read from 510 * @param usrIdentAC - [out] The result pointer to user identity request 511 */ 512 DCMTK_DCMNET_EXPORT void ASC_getUserIdentRQ(T_ASC_Parameters* params, UserIdentityNegotiationSubItemRQ** usrIdentRQ); 513 514 /* function that returns user identity response structure from association 515 * parameters. Note: For accessing the User Identity response value, 516 * it is more convenient to use the function ASC_getCopyOfIdentResponse(). 517 * @param params - [in] The parameters to read from 518 * @param usrIdentAC - [out] The result pointer to user identity response 519 * @return none 520 */ 521 DCMTK_DCMNET_EXPORT void ASC_getUserIdentAC(T_ASC_Parameters* params, UserIdentityNegotiationSubItemAC** usrIdentAC); 522 523 /** Sets User/Password authentication for User Identity Negotiation 524 * request. 525 * @param params - [in/out] The association parameters to be filled 526 * @param userName - [in] The username to send (in UTF-8) 527 * @password - [in] Password in UTF-8 528 * @return EC_Normal if user identity could be set, error otherwise 529 */ 530 DCMTK_DCMNET_EXPORT OFCondition 531 ASC_setIdentRQUserPassword( 532 T_ASC_Parameters * params, 533 const OFString& userName, 534 const OFString& password, 535 const OFBool requestRsp = OFTrue); 536 537 /** Sets User authentication (no password) for User Identity Negotiation 538 * request. 539 * @param params - [in/out] The association parameters to be filled 540 * @param userName - [in] The username to send (in UTF-8) 541 * @return EC_Normal if user identity could be set, error otherwise 542 */ 543 DCMTK_DCMNET_EXPORT OFCondition 544 ASC_setIdentRQUserOnly( 545 T_ASC_Parameters * params, 546 const OFString& userName, 547 const OFBool requestRsp = OFTrue); 548 549 /** Sets Kerberos authentication for User Identity Negotiation request. 550 * @param params - [in/out] The association parameters to be filled 551 * @param kerbTicket - [in] The kerberos ticket to send (will be copied) 552 * @param length - [in] Length of kerberos ticket 553 * @return EC_Normal if kerberos ticket could be set, error otherwise 554 */ 555 DCMTK_DCMNET_EXPORT OFCondition 556 ASC_setIdentRQKerberos( 557 T_ASC_Parameters * params, 558 const char* kerbTicket, 559 const Uint16 length, 560 const OFBool requestRsp = OFTrue); 561 562 /** Sets SAML authentication for User Identity Negotiation request. 563 * @param params - [in/out] The association parameters to be filled 564 * @param saml - [in] The SAML information to send (will be copied) 565 * @param length - [in] Length of SAML information 566 * @return EC_Normal if SAML info could be set, error otherwise 567 */ 568 DCMTK_DCMNET_EXPORT OFCondition 569 ASC_setIdentRQSaml( 570 T_ASC_Parameters * params, 571 const char* saml, 572 const Uint16 length, 573 const OFBool requestRsp = OFTrue); 574 575 /** Sets JSON Web Token (JWT) authentication for User Identity Negotiation 576 * request. 577 * @param params - [in/out] The association parameters to be filled 578 * @param jwt - [in] The JWT information to send (will be copied) 579 * @param length - [in] Length of JWT information 580 * @return EC_Normal if JWT info could be set, error otherwise 581 */ 582 DCMTK_DCMNET_EXPORT OFCondition 583 ASC_setIdentRQJwt( 584 T_ASC_Parameters * params, 585 const char* jwt, 586 const Uint16 length, 587 const OFBool requestRsp = OFTrue); 588 589 /** Acknowledges a User Identity Negotiation request. 590 * @param params - [in/out] The association parameters to be filled 591 * @param response - [in] The response to return (Kerberos or SAML) (will be copied) 592 * @param length - [in] Length of response 593 * @return EC_Normal if response could be set, error otherwise 594 */ 595 DCMTK_DCMNET_EXPORT OFCondition ASC_setIdentAC( 596 T_ASC_Parameters * params, 597 const char* response, 598 const Uint16 length); 599 600 /** Returns a copy of the User Identity Negotiation response value. 601 * CAUTION: The returned buffer (copy of original data) must be freed by the 602 * caller! 603 * @param params - [in] The association parameters to get response from 604 * @param buffer - [out] The buffer to write to. Memory is allocated inside 605 * function, so the returned buffer memory must be freed 606 * by the caller. If there is no response or there was 607 * was a problem, NULL is returned here. 608 * @param length - [out] Length of returned buffer. If there is a problem or no 609 * response at all, this is set to 0. 610 * @return none 611 */ 612 DCMTK_DCMNET_EXPORT void 613 ASC_getCopyOfIdentResponse(T_ASC_Parameters * params, 614 char*& buffer, 615 unsigned short& bufferLen); 616 617 /* TLS/SSL */ 618 619 /* get peer certificate from open association */ 620 DCMTK_DCMNET_EXPORT unsigned long ASC_getPeerCertificateLength(T_ASC_Association *assoc); 621 DCMTK_DCMNET_EXPORT unsigned long ASC_getPeerCertificate(T_ASC_Association *assoc, void *buf, unsigned long bufLen); 622 623 /* set new transport layer object */ 624 DCMTK_DCMNET_EXPORT OFCondition 625 ASC_setTransportLayer(T_ASC_Network *network, DcmTransportLayer *newLayer, int takeoverOwnership); 626 627 enum ASC_associateType 628 { 629 ASC_ASSOC_RQ, 630 ASC_ASSOC_AC, 631 ASC_ASSOC_RJ 632 }; 633 634 DCMTK_DCMNET_EXPORT OFString& 635 ASC_dumpParameters(OFString& str, T_ASC_Parameters * param, ASC_associateType dir); 636 637 DCMTK_DCMNET_EXPORT OFString& 638 ASC_dumpConnectionParameters(OFString& str, T_ASC_Association *association); 639 640 DCMTK_DCMNET_EXPORT void ASC_activateCallback(T_ASC_Parameters *params, DUL_ModeCallback *cb); 641 642 /* 643 * Association Inquiries 644 */ 645 646 DCMTK_DCMNET_EXPORT OFBool 647 ASC_associationWaiting(T_ASC_Network * network, int timeout); 648 649 DCMTK_DCMNET_EXPORT OFBool 650 ASC_dataWaiting(T_ASC_Association * association, int timeout); 651 652 DCMTK_DCMNET_EXPORT OFBool 653 ASC_selectReadableAssociation( 654 T_ASC_Association* assocs[], 655 int assocCount, int timeout); 656 657 /* 658 * Association Messages 659 */ 660 661 DCMTK_DCMNET_EXPORT OFCondition 662 ASC_requestAssociation( 663 T_ASC_Network * network, 664 T_ASC_Parameters * params, /* params will be saved in the association structure */ 665 T_ASC_Association ** association, 666 void **associatePDU=NULL, 667 unsigned long *associatePDUlength=NULL, 668 DUL_BLOCKOPTIONS block=DUL_BLOCK, 669 int timeout=0); 670 671 DCMTK_DCMNET_EXPORT OFCondition 672 ASC_receiveAssociation( 673 T_ASC_Network * network, 674 T_ASC_Association ** association, 675 long maxReceivePDUSize, 676 void **associatePDU=NULL, 677 unsigned long *associatePDUlength=NULL, 678 OFBool useSecureLayer=OFFalse, 679 DUL_BLOCKOPTIONS block=DUL_BLOCK, 680 int timeout=0); 681 682 DCMTK_DCMNET_EXPORT OFCondition 683 ASC_acknowledgeAssociation( 684 T_ASC_Association * assoc, 685 void **associatePDU=NULL, 686 unsigned long *associatePDUlength=NULL); 687 688 DCMTK_DCMNET_EXPORT OFCondition 689 ASC_rejectAssociation( 690 T_ASC_Association * association, 691 const T_ASC_RejectParameters * rejectParameters, 692 void **associatePDU=NULL, 693 unsigned long *associatePDUlength=NULL); 694 695 DCMTK_DCMNET_EXPORT OFCondition 696 ASC_releaseAssociation(T_ASC_Association * association); 697 698 DCMTK_DCMNET_EXPORT OFCondition 699 ASC_acknowledgeRelease(T_ASC_Association * association); 700 701 DCMTK_DCMNET_EXPORT OFCondition 702 ASC_abortAssociation(T_ASC_Association * association); 703 704 DCMTK_DCMNET_EXPORT OFCondition 705 ASC_dropSCPAssociation(T_ASC_Association * association, int timeout = DUL_TIMEOUT); 706 707 DCMTK_DCMNET_EXPORT OFCondition 708 ASC_dropAssociation(T_ASC_Association * association); 709 710 DCMTK_DCMNET_EXPORT OFCondition 711 ASC_destroyAssociation(T_ASC_Association ** association); 712 713 /// @deprecated Please use OFString& ASC_printRejectParameters(OFString&, T_ASC_RejectParameters*) instead. 714 DCMTK_DCMNET_EXPORT void 715 ASC_printRejectParameters( 716 FILE *f, 717 const T_ASC_RejectParameters *rej); 718 719 /// @deprecated Please use OFString& ASC_printRejectParameters(OFString&, T_ASC_RejectParameters*) instead. 720 DCMTK_DCMNET_EXPORT void 721 ASC_printRejectParameters( 722 STD_NAMESPACE ostream& out, 723 const T_ASC_RejectParameters *rej); 724 725 /* 726 * Write parameters in textual form to stdout (debugging aid) 727 */ 728 /** 729 * @deprecated Please use OFString& ASC_dumpParameters(OFString&, T_ASC_Parameters *, 730 * ASC_associateType) instead. 731 */ 732 DCMTK_DCMNET_EXPORT void 733 ASC_dumpParameters(T_ASC_Parameters * params, STD_NAMESPACE ostream& outstream); 734 735 /* 736 * Write presentation context structure in textual form to stdout. 737 * (debugging aid) 738 */ 739 /// @deprecated You should dump the complete T_ASC_Parameters with ASC_dumpParameters() instead. 740 DCMTK_DCMNET_EXPORT void 741 ASC_dumpPresentationContext(T_ASC_PresentationContext * presentationContext, STD_NAMESPACE ostream& outstream); 742 743 /** 744 * @deprecated Please use OFString& ASC_dumpParameters(OFString&, T_ASC_Parameters*, 745 * ASC_associateType) instead. 746 */ 747 DCMTK_DCMNET_EXPORT void 748 ASC_dumpConnectionParameters(T_ASC_Association *association, STD_NAMESPACE ostream& outstream); 749 750 /** Converts given ASC role to string (e.g. for printing) 751 * @param role The role to convert 752 @return The role as a string 753 */ 754 DCMTK_DCMNET_EXPORT const char* 755 ASC_role2String(const T_ASC_SC_ROLE role); 756 757 /** Converts given ASC role to DUL role 758 * @param role The role to convert 759 @return The role as DUL role 760 */ 761 DCMTK_DCMNET_EXPORT DUL_SC_ROLE 762 ascRole2dulRole(const T_ASC_SC_ROLE role); 763 764 765 #endif 766