001/* ***** BEGIN LICENSE BLOCK *****
002 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003 *
004 * The contents of this file are subject to the Mozilla Public License Version
005 * 1.1 (the "License"); you may not use this file except in compliance with
006 * the License. You may obtain a copy of the License at
007 * http://www.mozilla.org/MPL/
008 *
009 * Software distributed under the License is distributed on an "AS IS" basis,
010 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011 * for the specific language governing rights and limitations under the
012 * License.
013 *
014 * The Original Code is part of dcm4che, an implementation of DICOM(TM) in
015 * Java(TM), hosted at https://github.com/gunterze/dcm4che.
016 *
017 * The Initial Developer of the Original Code is
018 * Agfa Healthcare.
019 * Portions created by the Initial Developer are Copyright (C) 2011
020 * the Initial Developer. All Rights Reserved.
021 *
022 * Contributor(s):
023 * See @authors listed below
024 *
025 * Alternatively, the contents of this file may be used under the terms of
026 * either the GNU General Public License Version 2 or later (the "GPL"), or
027 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
028 * in which case the provisions of the GPL or the LGPL are applicable instead
029 * of those above. If you wish to allow use of your version of this file only
030 * under the terms of either the GPL or the LGPL, and not to allow others to
031 * use your version of this file under the terms of the MPL, indicate your
032 * decision by deleting the provisions above and replace them with the notice
033 * and other provisions required by the GPL or the LGPL. If you do not delete
034 * the provisions above, a recipient may use your version of this file under
035 * the terms of any one of the MPL, the GPL or the LGPL.
036 *
037 * ***** END LICENSE BLOCK ***** */
038
039package org.dcm4che3.net;
040
041/**
042 * @author Gunter Zeilinger <gunterze@gmail.com>
043 *
044 */
045public class Status {
046
047    public static final int Success                            = 0x0000;
048
049    public static final int Pending                            = 0xFF00;
050    public static final int PendingWarning                     = 0xFF01;
051
052    public static final int Cancel                             = 0xFE00;
053
054    /**
055     * Failure: no such attribute (105H): the Tag for the specified Attribute 
056     * was not recognized.
057     * Used in N-SET-RSP, N-CREATE-RSP.
058     * May contain:
059     *   Attribute Identifier List (0000,1005)
060     */
061    public static final int NoSuchAttribute                    = 0x0105;
062
063    /**
064     * Failure: invalid attribute value (106H): the Attribute Value specified
065     * was out of range or otherwise inappropriate.
066     * Used in N-SET-RSP, N-CREATE-RSP.
067     * May contain:
068     *   Modification List/Attribute List (no tag)
069     */
070    public static final int InvalidAttributeValue              = 0x0106;
071
072    /**
073     * Warning: attribute list error (107H): one or more Attribute Values were
074     * not read/modified/created because the specified Attribute was not recognized.
075     * Used in N-GET-RSP, N-SET-RSP, N-CREATE-RSP
076     * May contain:
077     *   Affected SOP Class UID (0000,0002)
078     *   Affected SOP Instance UID (0000,1000)
079     *   Attribute Identifier List (0000,1005)
080     */
081    public static final int AttributeListError                 = 0x0107;
082
083    /**
084     * Failure: processing failure (110H): a general failure in processing the
085     * operation was encountered.
086     * Used in N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP,
087     * N-CREATE-RSP, N-DELETE-RSP.
088     * May contain:
089     *   Affected SOP Class UID (0000,0002)
090     *   Error Comment (0000,0902)
091     *   Error ID (0000,0903)
092     *   Affected SOP Instance UID (0000,1000)
093     */
094    public static final int ProcessingFailure                  = 0x0110;
095
096    /**
097     * Failure: duplicate SOP Instance (111H): the new managed SOP Instance
098     * Value supplied by the invoking DIMSE-service-user was already registered
099     * for a managed SOP Instance of the specified SOP Class.
100     * Used in N-CREATE-RSP.
101     * May contain:
102     *   Affected SOP Instance UID (0000,1000)
103     */
104    public static final int DuplicateSOPinstance               = 0x0111;
105
106    /**
107     * Failure: no such SOP Instance (112H): the SOP Instance was not recognized.
108     * Used in N-EVENT-REPORT-RSP, N-SET-RSP, N-ACTION-RSP, N-DELETE-RSP.
109     * May contain:
110     *   Affected SOP Instance UID (0000,1000)
111     */
112    public static final int NoSuchObjectInstance               = 0x0112;
113
114    /**
115     * Failure: no such event type (113H): the event type specified was not
116     * recognized.
117     * Used in N-EVENT-REPORT-RSP.
118     * May contain:
119     *   Affected SOP Class UID (0000,0002)
120     *   Event Type ID (0000,1002)
121     */
122    public static final int NoSuchEventType                    = 0x0113;
123
124    /**
125     * Failure: no such argument (114H): the event/action information specified
126     * was not recognized/supported.
127     * Used in N-EVENT-REPORT-RSP, N-ACTION-RSP.
128     * May contain:
129     *   Affected SOP Class UID (0000,0002)
130     *   Event Type ID (0000,1002)
131     *   Action Type ID (0000,1008)
132     */
133    public static final int NoSuchArgument                     = 0x0114;
134
135    /**
136     * Failure: invalid argument value (115H): the event/action information
137     * value specified was out of range or otherwise inappropriate.
138     * Used in N-EVENT-REPORT-RSP, N-ACTION-RSP.
139     * May contain:
140     *   Affected SOP Class UID (0000,0002)
141     *   Affected SOP Instance UID (0000,1000)
142     *   Event Type ID (0000,1002)
143     *   Event Information (no tag)
144     *   Action Type ID (0000,1008)
145     *   Action Information (no tag)
146     */
147    public static final int InvalidArgumentValue               = 0x0115;
148
149    /**
150     * Warning: attribute value out of range (116H): the Attribute Value
151     * specified was out of range or otherwise inappropriate.
152     * Used in N-SET-RSP, N-CREATE-RSP.
153     * May contain:
154     *   Modification List/Attribute List
155     */
156    public static final int AttributeValueOutOfRange           = 0x0116;
157
158    /**
159     * Failure: invalid SOP Instance (117H): the SOP Instance UID specified
160     * implied a violation of the UID construction rules.
161     * Used in N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP,
162     * N-CREATE-RSP, N-DELETE-RSP.
163     * May contain:
164     *   Affected SOP Instance UID (0000,1000)
165     */
166    public static final int InvalidObjectInstance              = 0x0117;
167
168    /**
169     * Failure: no such SOP class (118H): the SOP Class was not recognized.
170     * Used in N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP,
171     * N-CREATE-RSP, N-DELETE-RSP.
172     * May contain:
173     *   Affected SOP Class UID (0000,0002)
174     */
175    public static final int NoSuchSOPclass                     = 0x0118;
176
177    /**
178     * Failure: class-instance conflict (119H): the specified SOP Instance is
179     * not a member of the specified SOP class.
180     * Used in N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP,
181     * N-DELETE-RSP.
182     * May contain:
183     *   Affected SOP Class UID (0000,0002)
184     *   Affected SOP Instance UID (0000,1000)
185     */
186    public static final int ClassInstanceConflict              = 0x0119;
187
188    /**
189     * Failure: missing Attribute (120H): a required Attribute was not 
190     * supplied.
191     * Used in N-CREATE-RSP.
192     * May contain:
193     *   Modification List/Attribute List (no tag)
194     */
195    public static final int MissingAttribute                   = 0x0120;
196
197    /**
198     * Failure: missing Attribute Value (121H): a required Attribute Value was
199     * not supplied and a default value was not available.
200     * Used in N-SET-RSP, N-CREATE-RSP.
201     * May contain:
202     *   Attribute Identifier List (0000,1005)
203     */
204    public static final int MissingAttributeValue              = 0x0121;
205
206    /**
207     * Refused: SOP Class Not Supported (112H).
208     * Used in C-STORE-RSP, C-FIND-RSP, C-GET-RSP, C-MOVE-RSP.
209     * May contain:
210     *   Affected SOP Class UID (0000,0002)
211     */
212    public static final int SOPclassNotSupported               = 0x0122;
213
214    /**
215     * Failure: no such action type (123H): the action type specified was not
216     * supported.
217     * Used in N-ACTION-RSP.
218     * May contain:
219     *   Affected SOP Class UID (0000,0002)
220     *   Action Type ID (0000,1008)
221     */
222    public static final int NoSuchActionType                   = 0x0123;
223
224    /**
225     * Refused: not authorized (124H): the DIMSE-service-user was not
226     * authorized to invoke the operation.
227     * Used in C-STORE-RSP, C-FIND-RSP, C-GET-RSP, C-MOVE-RSP, N-GET-RSP,
228     * N-SET-RSP, N-ACTION-RSP, N-CREATE-RSP, -DELETE-RSP.
229     * May contain:
230     *   Error Comment (0000,0902)
231     */
232    public static final int NotAuthorized                      = 0x0124;
233
234    /**
235     * Failure: duplicate invocation (210H): the Message ID (0000,0110)
236     * specified is allocated to another notification or operation.
237     * Used in C-STORE-RSP, C-FIND-RSP, C-GET-RSP, C-MOVE-RSP, C-ECHO-RSP,
238     * N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP, N-CREATE-RSP,
239     * N-DELETE-RSP.
240     */
241    public static final int DuplicateInvocation                = 0x0210;
242
243    /**
244     * Failure: unrecognized operation (211H): the operation is not one of
245     * those agreed between the DIMSE-service-users.
246     * Used in C-STORE-RSP, C-FIND-RSP, C-GET-RSP, C-MOVE-RSP, C-ECHO-RSP,
247     * N-EVENT-REPORT-RSP, -GET-RSP, N-SET-RSP, N-ACTION-RSP, N-CREATE-RSP,
248     * N-DELETE-RSP.
249     */
250    public static final int UnrecognizedOperation              = 0x0211;
251
252    /**
253     * Failure: mistyped argument (212H): one of the parameters supplied has
254     * not been agreed for use on the Association between the DIMSE-service-users.
255     * Used in N-EVENT-REPORT-RSP, N-GET-RSP, N-SET-RSP, N-ACTION-RSP,
256     * N-CREATE-RSP, N-DELETE-RSP.
257     */
258    public static final int MistypedArgument                   = 0x0212;
259
260    /**
261     * Failure: resource limitation (213H): the operation was not performed due
262     * to resource limitation.
263     */
264    public static final int ResourceLimitation                 = 0x0213;
265
266    public static final int OutOfResources                     = 0xA700;
267    public static final int UnableToCalculateNumberOfMatches   = 0xA701;
268    public static final int UnableToPerformSubOperations       = 0xA702;
269    public static final int MoveDestinationUnknown             = 0xA801;
270    public static final int IdentifierDoesNotMatchSOPClass     = 0xA900;
271    public static final int DataSetDoesNotMatchSOPClassError   = 0xA900;
272
273    public static final int OneOrMoreFailures                  = 0xB000;
274    public static final int CoercionOfDataElements             = 0xB000;
275    public static final int ElementsDiscarded                  = 0xB006;
276    public static final int DataSetDoesNotMatchSOPClassWarning = 0xB007;
277
278    public static final int UnableToProcess                    = 0xC000;
279    public static final int CannotUnderstand                   = 0xC000;
280
281    public static boolean isPending(int status) {
282        return (status & Pending) == Pending;
283    }
284
285}