forked from phin1x/go-ipp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.go
380 lines (357 loc) · 17.2 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
package ipp
type Status int8
const (
StatusCupsInvalid Status = -1
StatusOk = 0x0000
StatusOkIgnoredOrSubstituted = 0x0001
StatusOkConflicting = 0x0002
statusOkIgnoredSubscriptions = 0x0003
statusOkIgnoredNotifications = 0x0004
statusOkTooManyEvents = 0x0005
statusOkButCancelSubscription = 0x0006
statusOkEventsComplete = 0x0007
statusRedirectionOtherSite = 0x0200
statusCupsSeeOther = 0x0280
statusErrorBadRequest = 0x0400
StatusErrorForbidden = 0x0401
StatusErrorNotAuthenticated = 0x0402
StatusErrorNotAuthorized = 0x0403
StatusErrorNotPossible = 0x0404
StatusErrorTimeout = 0x0405
StatusErrorNotFound = 0x0406
StatusErrorGone = 0x0407
StatusErrorRequestEntity = 0x0408
StatusErrorRequestValue = 0x0409
StatusErrorDocumentFormatNotSupported = 0x040a
StatusErrorAttributesOrValues = 0x040b
StatusErrorUriScheme = 0x040c
StatusErrorCharset = 0x040d
StatusErrorConflicting = 0x040e
StatusErrorCompressionError = 0x040f
StatusErrorDocumentFormatError = 0x0410
StatusErrorDocumentAccess = 0x0411
StatusErrorAttributesNotSettable = 0x0412
StatusErrorIgnoredAllSubscriptions = 0x0413
StatusErrorTooManySubscriptions = 0x0414
StatusErrorIgnoredAllNotifications = 0x0415
StatusErrorPrintSupportFileNotFound = 0x0416
StatusErrorDocumentPassword = 0x0417
StatusErrorDocumentPermission = 0x0418
StatusErrorDocumentSecurity = 0x0419
StatusErrorDocumentUnprintable = 0x041a
StatusErrorAccountInfoNeeded = 0x041b
StatusErrorAccountClosed = 0x041c
StatusErrorAccountLimitReached = 0x041d
StatusErrorAccountAuthorizationFailed = 0x041e
StatusErrorNotFetchable = 0x041f
StatusErrorCupsAccountInfoNeeded = 0x049C
StatusErrorCupsAccountClosed = 0x049d
StatusErrorCupsAccountLimitReached = 0x049e
StatusErrorCupsAccountAuthorizationFailed = 0x049f
StatusErrorInternal = 0x0500
StatusErrorOperationNotSupported = 0x0501
StatusErrorServiceUnavailable = 0x0502
StatusErrorVersionNotSupported = 0x0503
StatusErrorDevice = 0x0504
StatusErrorTemporary = 0x0505
StatusErrorNotAcceptingJobs = 0x0506
StatusErrorBusy = 0x0507
StatusErrorJobCanceled = 0x0508
StatusErrorMultipleJobsNotSupported = 0x0509
StatusErrorPrinterIsDeactivated = 0x050a
StatusErrorTooManyJobs = 0x050b
StatusErrorTooManyDocuments = 0x050c
StatusErrorCupsAuthenticationCanceled = 0x1000
StatusErrorCupsPki = 0x1001
StatusErrorCupsUpgradeRequired = 0x1002
)
type Operation int16
const (
OperationCupsInvalid Operation = -0x0001
OperationCupsNone = 0x0000
OperationPrintJob = 0x0002
OperationPrintUri = 0x0003
OperationValidateJob = 0x0004
OperationCreateJob = 0x0005
OperationSendDocument = 0x0006
OperationSendUri = 0x0007
OperationCancelJob = 0x0008
OperationGetJobAttributes = 0x0009
OperationGetJobs = 0x000a
OperationGetPrinterAttributes = 0x000b
OperationHoldJob = 0x000c
OperationReleaseJob = 0x000d
OperationRestartJob = 0x000e
OperationPausePrinter = 0x0010
OperationResumePrinter = 0x0011
OperationPurgeJobs = 0x0012
OperationSetPrinterAttributes = 0x0013
OperationSetJobAttributes = 0x0014
OperationGetPrinterSupportedValues = 0x0015
OperationCreatePrinterSubscriptions = 0x0016
OperationCreateJobSubscriptions = 0x0017
OperationGetSubscriptionAttributes = 0x0018
OperationGetSubscriptions = 0x0019
OperationRenewSubscription = 0x001a
OperationCancelSubscription = 0x001b
OperationGetNotifications = 0x001c
OperationSendNotifications = 0x001d
OperationGetResourceAttributes = 0x001e
OperationGetResourceData = 0x001f
OperationGetResources = 0x0020
OperationGetPrintSupportFiles = 0x0021
OperationEnablePrinter = 0x0022
OperationDisablePrinter = 0x0023
OperationPausePrinterAfterCurrentJob = 0x0024
OperationHoldNewJobs = 0x0025
OperationReleaseHeldNewJobs = 0x0026
OperationDeactivatePrinter = 0x0027
OperationActivatePrinter = 0x0028
OperationRestartPrinter = 0x0029
OperationShutdownPrinter = 0x002a
OperationStartupPrinter = 0x002b
OperationReprocessJob = 0x002c
OperationCancelCurrentJob = 0x002d
OperationSuspendCurrentJob = 0x002e
OperationResumeJob = 0x002f
OperationOperationPromoteJob = 0x0030
OperationScheduleJobAfter = 0x0031
OperationCancelDocument = 0x0033
OperationGetDocumentAttributes = 0x0034
OperationGetDocuments = 0x0035
OperationDeleteDocument = 0x0036
OperationSetDocumentAttributes = 0x0037
OperationCancelJobs = 0x0038
OperationCancelMyJobs = 0x0039
OperationResubmitJob = 0x003a
OperationCloseJob = 0x003b
OperationIdentifyPrinter = 0x003c
OperationValidateDocument = 0x003d
OperationAddDocumentImages = 0x003e
OperationAcknowledgeDocument = 0x003f
OperationAcknowledgeIdentifyPrinter = 0x0040
OperationAcknowledgeJob = 0x0041
OperationFetchDocument = 0x0042
OperationFetchJob = 0x0043
OperationGetOutputDeviceAttributes = 0x0044
OperationUpdateActiveJobs = 0x0045
OperationDeregisterOutputDevice = 0x0046
OperationUpdateDocumentStatus = 0x0047
OperationUpdateJobStatus = 0x0048
OperationUpdateOutputDeviceAttributes = 0x0049
OperationGetNextDocumentData = 0x004a
OperationAllocatePrinterResources = 0x004b
OperationCreatePrinter = 0x004c
OperationDeallocatePrinterResources = 0x004d
OperationDeletePrinter = 0x004e
OperationGetPrinters = 0x004f
OperationShutdownOnePrinter = 0x0050
OperationStartupOnePrinter = 0x0051
OperationCancelResource = 0x0052
OperationCreateResource = 0x0053
OperationInstallResource = 0x0054
OperationSendResourceData = 0x0055
OperationSetResourceAttributes = 0x0056
OperationCreateResourceSubscriptions = 0x0057
OperationCreateSystemSubscriptions = 0x0058
OperationDisableAllPrinters = 0x0059
OperationEnableAllPrinters = 0x005a
OperationGetSystemAttributes = 0x005b
OperationGetSystemSupportedValues = 0x005c
OperationPauseAllPrinters = 0x005d
OperationPauseAllPrintersAfterCurrentJob = 0x005e
OperationRegisterOutputDevice = 0x005f
OperationRestartSystem = 0x0060
OperationResumeAllPrinters = 0x0061
OperationSetSystemAttributes = 0x0062
OperationShutdownAllPrinter = 0x0063
OperationStartupAllPrinters = 0x0064
OperationPrivate = 0x4000
OperationCupsGetDefault = 0x4001
OperationCupsGetPrinters = 0x4002
OperationCupsAddModifyPrinter = 0x4003
OperationCupsDeletePrinter = 0x4004
OperationCupsGetClasses = 0x4005
OperationCupsAddModifyClass = 0x4006
OperationCupsDeleteClass = 0x4007
OperationCupsAcceptJobs = 0x4008
OperationCupsRejectJobs = 0x4009
OperationCupsSetDefault = 0x400a
OperationCupsGetDevices = 0x400b
OperationCupsGetPpds = 0x400c
OperationCupsMoveJob = 0x400d
OperationCupsAuthenticateJob = 0x400e
OperationCupsGetPpd = 0x400f
OperationCupsGetDocument = 0x4027
OperationCupsCreateLocalPrinter = 0x4028
)
type Tag int8
const (
TagCupsInvalid Tag = -1
TagZero = 0x00
TagOperation = 0x01
TagJob = 0x02
TagEnd = 0x03
TagPrinter = 0x04
TagUnsupportedGroup = 0x05
TagSubscription = 0x06
TagEventNotification = 0x07
TagResource = 0x08
TagDocument = 0x09
TagSystem = 0x0a
TagUnsupportedValue = 0x10
TagDefault = 0x11
TagUnknown = 0x12
TagNoValue = 0x013
TagNotSettable = 0x15
TagDeleteAttr = 0x16
TagAdminDefine = 0x17
TagInteger = 0x21
TagBoolean = 0x22
TagEnum = 0x23
TagString = 0x30
TagDate = 0x31
TagResolution = 0x32
TagRange = 0x33
TagBeginCollection = 0x34
TagTextLang = 0x35
TagNameLang = 0x36
TagEndCollection = 0x37
TagText = 0x41
TagName = 0x42
TagReservedString = 0x43
TagKeyword = 0x44
TagUri = 0x45
TagUriScheme = 0x46
TagCharset = 0x47
TagLanguage = 0x48
TagMimeType = 0x49
TagMemberName = 0x4a
TagExtension = 0x7f
TagCupsMask = 0x7fffffff
TagCupsConst = -0x7fffffff - 1
)
type JobState uint8
const (
JobStatePending JobState = 0x03
JobStateHeld = 0x04
JobStateProcessing = 0x05
JobStateStopped = 0x06
JobStateCanceled = 0x07
JobStateAborted = 0x08
JobStateCompleted = 0x09
)
type DocumentState uint8
const (
DocumentStatePending DocumentState = 0x03
DocumentStateProcessing = 0x05
DocumentStateCanceled = 0x07
DocumentStateAborted = 0x08
DocumentStateCompleted = 0x08
)
type PrinterState uint8
const (
PrinterStateIdle PrinterState = 0x0003
PrinterStateProcessing = 0x0004
PrinterStateStopped = 0x0005
)
type JobStateFilter string
const (
JobStateFilterNotCompleted = "not-completed"
JobStateFilterCompleted = "completed"
)
type ErrorPolicy string
const (
ErrorPolicyRetryJob ErrorPolicy = "retry-job"
ErrorPolicyAbortJob = "abort-job"
ErrorPolicyRetryCurrentJob = "retry-current-job"
ErrorPolicyStopPrinter = "stop-printer"
)
const (
CharsetLanguage = "en-US"
Charset = "utf-8"
ProtocolVersionMajor = uint8(2)
ProtocolVersionMinor = uint8(0)
DefaultJobPriority = 50
MimeTypePostscript = "application/postscript"
MimeTypeOctetStream = "application/octet-stream"
)
const (
OperationAttributeCopies string = "copies"
OperationAttributeDocumentFormat = "document-format"
OperationAttributeDocumentName = "document-name"
OperationAttributeJobID = "job-id"
OperationAttributeJobName = "job-name"
OperationAttributeJobPriority = "job-priority"
OperationAttributeJobURI = "job-uri"
OperationAttributeLastDocument = "last-document"
OperationAttributeMyJobs = "my-jobs"
OperationAttributePPDName = "ppd-name"
OperationAttributePrinterIsShared = "printer-is-shared"
OperationAttributePrinterURI = "printer-uri"
OperationAttributePurgeJobs = "purge-jobs"
OperationAttributeRequestedAttributes = "requested-attributes"
OperationAttributeRequestingUserName = "requesting-user-name"
OperationAttributeWhichJobs = "which-jobs"
)
const (
PrinterAttributeDeviceURI string = "device-uri"
PrinterAttributeHoldJobUntil = "job-hold-until"
PrinterAttributePrinterErrorPolicy = "printer-error-policy"
PrinterAttributePrinterInfo = "printer-info"
PrinterAttributePrinterLocation = "printer-location"
PrinterAttributePrinterName = "printer-name"
PrinterAttributePrinterStateReason = "printer-state-reason"
PrinterAttributeJobPrinterURI = "job-printer-uri"
PrinterAttributeMemberURIs = "member-uris"
)
var (
DefaultClassAttributes = []string{"printer-name", "member-names"}
DefaultPrinterAttributes = []string{"printer-name", "printer-type", "printer-location", "printer-info",
"printer-make-and-model", "printer-state", "printer-state-message", "printer-state-reason",
"printer-uri-supported", "device-uri", "printer-is-shared"}
DefaultJobAttributes = []string{"job-id", "job-name", "printer-uri", "job-state", "job-state-reasons",
"job-hold-until", "job-media-progress", "job-k-octets", "number-of-documents", "copies",
"job-originating-user-name"}
AttributeTagMapping = map[string]Tag{
"attributes-charset": TagCharset,
"attributes-natural-language": TagLanguage,
"copies": TagInteger,
"device-uri": TagUri,
"document-format": TagMimeType,
"document-name": TagName,
"document-number": TagInteger,
"document-state": TagEnum,
"finishings": TagEnum,
"hold-job-until": TagKeyword,
"job-hold-until": TagKeyword,
"job-id": TagInteger,
"job-name": TagName,
"job-printer-uri": TagUri,
"job-priority": TagInteger,
"job-sheets": TagName,
"job-state": TagEnum,
"job-state-reason": TagKeyword,
"job-uri": TagUri,
"last-document": TagBoolean,
"media": TagKeyword,
"member-uris": TagUri,
"my-jobs": TagBoolean,
"number-up": TagInteger,
"orientation-requested": TagEnum,
"ppd-name": TagName,
"print-quality": TagEnum,
"printer-error-policy": TagName,
"printer-info": TagText,
"printer-is-shared": TagBoolean,
"printer-location": TagText,
"printer-resolution": TagResolution,
"printer-state": TagEnum,
"printer-state-reason": TagKeyword,
"printer-uri": TagUri,
"purge-jobs": TagBoolean,
"requested-attributes": TagKeyword,
"requesting-user-name": TagName,
"which-jobs": TagKeyword,
}
)