| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
package goipp |
| 10 |
|
| 11 |
import ( |
| 12 |
"fmt" |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
type Status Code |
| 17 |
|
| 18 |
const ( |
| 19 |
StatusOk Status = 0x0000 |
| 20 |
StatusOkIgnoredOrSubstituted Status = 0x0001 |
| 21 |
StatusOkConflicting Status = 0x0002 |
| 22 |
StatusOkIgnoredSubscriptions Status = 0x0003 |
| 23 |
StatusOkIgnoredNotifications Status = 0x0004 |
| 24 |
StatusOkTooManyEvents Status = 0x0005 |
| 25 |
StatusOkButCancelSubscription Status = 0x0006 |
| 26 |
StatusOkEventsComplete Status = 0x0007 |
| 27 |
StatusRedirectionOtherSite Status = 0x0200 |
| 28 |
StatusCupsSeeOther Status = 0x0280 |
| 29 |
StatusErrorBadRequest Status = 0x0400 |
| 30 |
StatusErrorForbidden Status = 0x0401 |
| 31 |
StatusErrorNotAuthenticated Status = 0x0402 |
| 32 |
StatusErrorNotAuthorized Status = 0x0403 |
| 33 |
StatusErrorNotPossible Status = 0x0404 |
| 34 |
StatusErrorTimeout Status = 0x0405 |
| 35 |
StatusErrorNotFound Status = 0x0406 |
| 36 |
StatusErrorGone Status = 0x0407 |
| 37 |
StatusErrorRequestEntity Status = 0x0408 |
| 38 |
StatusErrorRequestValue Status = 0x0409 |
| 39 |
StatusErrorDocumentFormatNotSupported Status = 0x040a |
| 40 |
StatusErrorAttributesOrValues Status = 0x040b |
| 41 |
StatusErrorURIScheme Status = 0x040c |
| 42 |
StatusErrorCharset Status = 0x040d |
| 43 |
StatusErrorConflicting Status = 0x040e |
| 44 |
StatusErrorCompressionNotSupported Status = 0x040f |
| 45 |
StatusErrorCompressionError Status = 0x0410 |
| 46 |
StatusErrorDocumentFormatError Status = 0x0411 |
| 47 |
StatusErrorDocumentAccess Status = 0x0412 |
| 48 |
StatusErrorAttributesNotSettable Status = 0x0413 |
| 49 |
StatusErrorIgnoredAllSubscriptions Status = 0x0414 |
| 50 |
StatusErrorTooManySubscriptions Status = 0x0415 |
| 51 |
StatusErrorIgnoredAllNotifications Status = 0x0416 |
| 52 |
StatusErrorPrintSupportFileNotFound Status = 0x0417 |
| 53 |
StatusErrorDocumentPassword Status = 0x0418 |
| 54 |
StatusErrorDocumentPermission Status = 0x0419 |
| 55 |
StatusErrorDocumentSecurity Status = 0x041a |
| 56 |
StatusErrorDocumentUnprintable Status = 0x041b |
| 57 |
StatusErrorAccountInfoNeeded Status = 0x041c |
| 58 |
StatusErrorAccountClosed Status = 0x041d |
| 59 |
StatusErrorAccountLimitReached Status = 0x041e |
| 60 |
StatusErrorAccountAuthorizationFailed Status = 0x041f |
| 61 |
StatusErrorNotFetchable Status = 0x0420 |
| 62 |
StatusErrorInternal Status = 0x0500 |
| 63 |
StatusErrorOperationNotSupported Status = 0x0501 |
| 64 |
StatusErrorServiceUnavailable Status = 0x0502 |
| 65 |
StatusErrorVersionNotSupported Status = 0x0503 |
| 66 |
StatusErrorDevice Status = 0x0504 |
| 67 |
StatusErrorTemporary Status = 0x0505 |
| 68 |
StatusErrorNotAcceptingJobs Status = 0x0506 |
| 69 |
StatusErrorBusy Status = 0x0507 |
| 70 |
StatusErrorJobCanceled Status = 0x0508 |
| 71 |
StatusErrorMultipleJobsNotSupported Status = 0x0509 |
| 72 |
StatusErrorPrinterIsDeactivated Status = 0x050a |
| 73 |
StatusErrorTooManyJobs Status = 0x050b |
| 74 |
StatusErrorTooManyDocuments Status = 0x050c |
| 75 |
) |
| 76 |
|
| 77 |
|
| 78 |
func (s Status) String() string { |
| 79 |
switch s { |
| 80 |
case StatusOk: |
| 81 |
return "successful-ok" |
| 82 |
case StatusOkIgnoredOrSubstituted: |
| 83 |
return "successful-ok-ignored-or-substituted-attributes" |
| 84 |
case StatusOkConflicting: |
| 85 |
return "successful-ok-conflicting-attributes" |
| 86 |
case StatusOkIgnoredSubscriptions: |
| 87 |
return "successful-ok-ignored-subscriptions" |
| 88 |
case StatusOkIgnoredNotifications: |
| 89 |
return "successful-ok-ignored-notifications" |
| 90 |
case StatusOkTooManyEvents: |
| 91 |
return "successful-ok-too-many-events" |
| 92 |
case StatusOkButCancelSubscription: |
| 93 |
return "successful-ok-but-cancel-subscription" |
| 94 |
case StatusOkEventsComplete: |
| 95 |
return "successful-ok-events-complete" |
| 96 |
case StatusRedirectionOtherSite: |
| 97 |
return "redirection-other-site" |
| 98 |
case StatusCupsSeeOther: |
| 99 |
return "cups-see-other" |
| 100 |
case StatusErrorBadRequest: |
| 101 |
return "client-error-bad-request" |
| 102 |
case StatusErrorForbidden: |
| 103 |
return "client-error-forbidden" |
| 104 |
case StatusErrorNotAuthenticated: |
| 105 |
return "client-error-not-authenticated" |
| 106 |
case StatusErrorNotAuthorized: |
| 107 |
return "client-error-not-authorized" |
| 108 |
case StatusErrorNotPossible: |
| 109 |
return "client-error-not-possible" |
| 110 |
case StatusErrorTimeout: |
| 111 |
return "client-error-timeout" |
| 112 |
case StatusErrorNotFound: |
| 113 |
return "client-error-not-found" |
| 114 |
case StatusErrorGone: |
| 115 |
return "client-error-gone" |
| 116 |
case StatusErrorRequestEntity: |
| 117 |
return "client-error-request-entity-too-large" |
| 118 |
case StatusErrorRequestValue: |
| 119 |
return "client-error-request-value-too-long" |
| 120 |
case StatusErrorDocumentFormatNotSupported: |
| 121 |
return "client-error-document-format-not-supported" |
| 122 |
case StatusErrorAttributesOrValues: |
| 123 |
return "client-error-attributes-or-values-not-supported" |
| 124 |
case StatusErrorURIScheme: |
| 125 |
return "client-error-uri-scheme-not-supported" |
| 126 |
case StatusErrorCharset: |
| 127 |
return "client-error-charset-not-supported" |
| 128 |
case StatusErrorConflicting: |
| 129 |
return "client-error-conflicting-attributes" |
| 130 |
case StatusErrorCompressionNotSupported: |
| 131 |
return "client-error-compression-not-supported" |
| 132 |
case StatusErrorCompressionError: |
| 133 |
return "client-error-compression-error" |
| 134 |
case StatusErrorDocumentFormatError: |
| 135 |
return "client-error-document-format-error" |
| 136 |
case StatusErrorDocumentAccess: |
| 137 |
return "client-error-document-access-error" |
| 138 |
case StatusErrorAttributesNotSettable: |
| 139 |
return "client-error-attributes-not-settable" |
| 140 |
case StatusErrorIgnoredAllSubscriptions: |
| 141 |
return "client-error-ignored-all-subscriptions" |
| 142 |
case StatusErrorTooManySubscriptions: |
| 143 |
return "client-error-too-many-subscriptions" |
| 144 |
case StatusErrorIgnoredAllNotifications: |
| 145 |
return "client-error-ignored-all-notifications" |
| 146 |
case StatusErrorPrintSupportFileNotFound: |
| 147 |
return "client-error-print-support-file-not-found" |
| 148 |
case StatusErrorDocumentPassword: |
| 149 |
return "client-error-document-password-error" |
| 150 |
case StatusErrorDocumentPermission: |
| 151 |
return "client-error-document-permission-error" |
| 152 |
case StatusErrorDocumentSecurity: |
| 153 |
return "client-error-document-security-error" |
| 154 |
case StatusErrorDocumentUnprintable: |
| 155 |
return "client-error-document-unprintable-error" |
| 156 |
case StatusErrorAccountInfoNeeded: |
| 157 |
return "client-error-account-info-needed" |
| 158 |
case StatusErrorAccountClosed: |
| 159 |
return "client-error-account-closed" |
| 160 |
case StatusErrorAccountLimitReached: |
| 161 |
return "client-error-account-limit-reached" |
| 162 |
case StatusErrorAccountAuthorizationFailed: |
| 163 |
return "client-error-account-authorization-failed" |
| 164 |
case StatusErrorNotFetchable: |
| 165 |
return "client-error-not-fetchable" |
| 166 |
case StatusErrorInternal: |
| 167 |
return "server-error-internal-error" |
| 168 |
case StatusErrorOperationNotSupported: |
| 169 |
return "server-error-operation-not-supported" |
| 170 |
case StatusErrorServiceUnavailable: |
| 171 |
return "server-error-service-unavailable" |
| 172 |
case StatusErrorVersionNotSupported: |
| 173 |
return "server-error-version-not-supported" |
| 174 |
case StatusErrorDevice: |
| 175 |
return "server-error-device-error" |
| 176 |
case StatusErrorTemporary: |
| 177 |
return "server-error-temporary-error" |
| 178 |
case StatusErrorNotAcceptingJobs: |
| 179 |
return "server-error-not-accepting-jobs" |
| 180 |
case StatusErrorBusy: |
| 181 |
return "server-error-busy" |
| 182 |
case StatusErrorJobCanceled: |
| 183 |
return "server-error-job-canceled" |
| 184 |
case StatusErrorMultipleJobsNotSupported: |
| 185 |
return "server-error-multiple-document-jobs-not-supported" |
| 186 |
case StatusErrorPrinterIsDeactivated: |
| 187 |
return "server-error-printer-is-deactivated" |
| 188 |
case StatusErrorTooManyJobs: |
| 189 |
return "server-error-too-many-jobs" |
| 190 |
case StatusErrorTooManyDocuments: |
| 191 |
return "server-error-too-many-documents" |
| 192 |
} |
| 193 |
|
| 194 |
return fmt.Sprintf("0x%4.4x", int(s)) |
| 195 |
} |