1 /* ----------------------------- MNI Header -----------------------------------
2 @NAME       : dicom_network.h
3 @DESCRIPTION: Header file for dicom network code
4 @METHOD     :
5 @GLOBALS    :
6 @CREATED    : February 10, 1997 (Peter Neelin)
7 @MODIFIED   :
8  * $Log: dicom_network.h,v $
9  * Revision 6.7  2011-02-17 06:41:51  rotor
10  *  * Fixed a HDF5 error output bug in testing code
11  *
12  * Revision 6.6  2001/03/19 18:30:33  neelin
13  * Added function to set implementation uid and changed name of function
14  * that gets it.
15  *
16  * Revision 6.5  2000/05/17 20:17:48  neelin
17  * Added mechanism to allow testing of input streams for more data through
18  * function acr_file_ismore.
19  * This is used in dicom_client_routines to allow asynchronous transfer
20  * of data, with testing for more input done before sending new messages.
21  * Previous use of select for this was misguided, since select may report that
22  * no data is waiting on the file descriptor while data is store in the file
23  * pointer buffer (or Acr file pointer buffer).
24  *
25  * Revision 6.4  1999/10/29 17:51:51  neelin
26  * Fixed Log keyword
27  *
28  * Revision 6.3  1998/11/11 17:05:03  neelin
29  * Added pointer for client data to dicom structure.
30  *
31  * Revision 6.2  1998/03/23  20:16:37  neelin
32  * Added functions.
33  *
34  * Revision 6.1  1997/10/20  22:52:46  neelin
35  * Added support for implementation user information in association request.
36  *
37  * Revision 6.0  1997/09/12  13:23:59  neelin
38  * Release of minc version 0.6
39  *
40  * Revision 5.0  1997/08/21  13:25:00  neelin
41  * Release of minc version 0.5
42  *
43  * Revision 4.1  1997/07/09  20:01:40  neelin
44  * Added function acr_dicom_get_io_data.
45  *
46  * Revision 4.0  1997/05/07  20:01:23  neelin
47  * Release of minc version 0.4
48  *
49  * Revision 1.2  1997/04/21  20:21:09  neelin
50  * Updated the library to handle dicom messages.
51  *
52  * Revision 1.1  1997/02/20  16:38:17  neelin
53  * Initial revision
54  *
55 @COPYRIGHT  :
56               Copyright 1997 Peter Neelin, McConnell Brain Imaging Centre,
57               Montreal Neurological Institute, McGill University.
58               Permission to use, copy, modify, and distribute this
59               software and its documentation for any purpose and without
60               fee is hereby granted, provided that the above copyright
61               notice appear in all copies.  The author and McGill University
62               make no representations about the suitability of this
63               software for any purpose.  It is provided "as is" without
64               express or implied warranty.
65 ---------------------------------------------------------------------------- */
66 
67 /* PDU types */
68 #define ACR_PDU_ASSOC_RQ 0x01
69 #define ACR_PDU_ASSOC_AC 0x02
70 #define ACR_PDU_ASSOC_RJ 0x03
71 #define ACR_PDU_DATA_TF  0x04
72 #define ACR_PDU_REL_RQ   0x05
73 #define ACR_PDU_REL_RP   0x06
74 #define ACR_PDU_ABORT_RQ 0x07
75 
76 /* Offset for unknown PDU item types */
77 #define ACR_UNKNOWN_PDU_ITEM_OFFSET 0xFF00
78 
79 /* Element ids for PDU messages. These are artificial and are for internal
80    use only, so they have negative group numbers. Unrecognized PDU items
81    are stored with element id 0xffxx, where xx is the PDU item type */
82 #define DCM_PDU_GRPID (-1)
83 #define DCM_PDU_ELEMENT(name, elid, vr) \
84    ACRLIB_GLOBAL_ELEMENT(name, DCM_PDU_GRPID, elid, vr)
85 DCM_PDU_ELEMENT(DCM_PDU_Type,                            0x0010, US);
86 DCM_PDU_ELEMENT(DCM_PDU_Protocol_Version,                0x0020, US);
87 DCM_PDU_ELEMENT(DCM_PDU_Called_Ap_title,                 0x0030, UI);
88 DCM_PDU_ELEMENT(DCM_PDU_Calling_Ap_title,                0x0040, UI);
89 DCM_PDU_ELEMENT(DCM_PDU_Application_context,             0x0050, UI);
90 DCM_PDU_ELEMENT(DCM_PDU_Presentation_context,            0x0060, SQ);
91 DCM_PDU_ELEMENT(DCM_PDU_Presentation_context_reply,      0x0070, SQ);
92 DCM_PDU_ELEMENT(DCM_PDU_Presentation_context_list,       0x0080, SQ);
93 DCM_PDU_ELEMENT(DCM_PDU_Presentation_context_reply_list, 0x0090, SQ);
94 DCM_PDU_ELEMENT(DCM_PDU_Presentation_context_id,         0x0100, US);
95 DCM_PDU_ELEMENT(DCM_PDU_Abstract_syntax,                 0x0120, UI);
96 DCM_PDU_ELEMENT(DCM_PDU_Transfer_syntax,                 0x0130, UI);
97 DCM_PDU_ELEMENT(DCM_PDU_Maximum_length,                  0x0140, UL);
98 DCM_PDU_ELEMENT(DCM_PDU_Implementation_class_uid,        0x0141, UI);
99 DCM_PDU_ELEMENT(DCM_PDU_Implementation_version_name,     0x0142, UI);
100 DCM_PDU_ELEMENT(DCM_PDU_Result,                          0x0150, US);
101 DCM_PDU_ELEMENT(DCM_PDU_Source,                          0x0160, US);
102 DCM_PDU_ELEMENT(DCM_PDU_Reason,                          0x0170, US);
103 
104 /* Function prototypes */
105 public int acr_uid_equal(char *uid1, char *uid2);
106 public char *acr_create_uid(void);
107 public void acr_set_implementation_uid(char *uid);
108 public char *acr_get_implementation_uid(void);
109 public Acr_Status acr_input_dicom_message(Acr_File *dicom_afp,
110                                           Acr_Message *message);
111 public Acr_Status acr_output_dicom_message(Acr_File *dicom_afp,
112                                            Acr_Message message);
113 public Acr_File *acr_initialize_dicom_input(void *io_data,
114                                             int maxlength,
115                                             Acr_Io_Routine io_routine);
116 public void acr_dicom_set_ismore_function(Acr_File *afp,
117                                           Acr_Ismore_Function ismore_function);
118 public Acr_File *acr_initialize_dicom_output(void *io_data,
119                                             int maxlength,
120                                             Acr_Io_Routine io_routine);
121 public void acr_close_dicom_file(Acr_File *afp);
122 public void *acr_dicom_get_io_data(Acr_File *afp);
123 public void acr_dicom_enable_trace(Acr_File *afp);
124 public void acr_dicom_disable_trace(Acr_File *afp);
125 public void acr_dicom_set_eof(Acr_File *afp);
126 public void acr_set_dicom_maximum_length(Acr_File *afp,
127                                          long maximum_length);
128 public void acr_set_dicom_pres_context_id(Acr_File *afp,
129                                           int presentation_context_id);
130 public int acr_get_dicom_pres_context_id(Acr_File *afp);
131 public void acr_set_dicom_client_data(Acr_File *afp, void *client_data);
132 public void *acr_get_dicom_client_data(Acr_File *afp);
133