| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
package goipp |
| 10 |
|
| 11 |
import ( |
| 12 |
"fmt" |
| 13 |
) |
| 14 |
|
| 15 |
|
| 16 |
type Op Code |
| 17 |
|
| 18 |
const ( |
| 19 |
OpPrintJob Op = 0x0002 |
| 20 |
OpPrintURI Op = 0x0003 |
| 21 |
OpValidateJob Op = 0x0004 |
| 22 |
OpCreateJob Op = 0x0005 |
| 23 |
OpSendDocument Op = 0x0006 |
| 24 |
OpSendURI Op = 0x0007 |
| 25 |
OpCancelJob Op = 0x0008 |
| 26 |
OpGetJobAttributes Op = 0x0009 |
| 27 |
OpGetJobs Op = 0x000a |
| 28 |
OpGetPrinterAttributes Op = 0x000b |
| 29 |
OpHoldJob Op = 0x000c |
| 30 |
OpReleaseJob Op = 0x000d |
| 31 |
OpRestartJob Op = 0x000e |
| 32 |
|
| 33 |
OpPausePrinter Op = 0x0010 |
| 34 |
OpResumePrinter Op = 0x0011 |
| 35 |
OpPurgeJobs Op = 0x0012 |
| 36 |
OpSetPrinterAttributes Op = 0x0013 |
| 37 |
OpSetJobAttributes Op = 0x0014 |
| 38 |
OpGetPrinterSupportedValues Op = 0x0015 |
| 39 |
OpCreatePrinterSubscriptions Op = 0x0016 |
| 40 |
OpCreateJobSubscriptions Op = 0x0017 |
| 41 |
OpGetSubscriptionAttributes Op = 0x0018 |
| 42 |
OpGetSubscriptions Op = 0x0019 |
| 43 |
OpRenewSubscription Op = 0x001a |
| 44 |
OpCancelSubscription Op = 0x001b |
| 45 |
OpGetNotifications Op = 0x001c |
| 46 |
OpSendNotifications Op = 0x001d |
| 47 |
OpGetResourceAttributes Op = 0x001e |
| 48 |
OpGetResourceData Op = 0x001f |
| 49 |
|
| 50 |
OpGetResources Op = 0x0020 |
| 51 |
OpGetPrintSupportFiles Op = 0x0021 |
| 52 |
OpEnablePrinter Op = 0x0022 |
| 53 |
OpDisablePrinter Op = 0x0023 |
| 54 |
OpPausePrinterAfterCurrentJob Op = 0x0024 |
| 55 |
OpHoldNewJobs Op = 0x0025 |
| 56 |
OpReleaseHeldNewJobs Op = 0x0026 |
| 57 |
OpDeactivatePrinter Op = 0x0027 |
| 58 |
OpActivatePrinter Op = 0x0028 |
| 59 |
OpRestartPrinter Op = 0x0029 |
| 60 |
OpShutdownPrinter Op = 0x002a |
| 61 |
OpStartupPrinter Op = 0x002b |
| 62 |
OpReprocessJob Op = 0x002c |
| 63 |
OpCancelCurrentJob Op = 0x002d |
| 64 |
OpSuspendCurrentJob Op = 0x002e |
| 65 |
OpResumeJob Op = 0x002f |
| 66 |
|
| 67 |
OpPromoteJob Op = 0x0030 |
| 68 |
OpScheduleJobAfter Op = 0x0031 |
| 69 |
OpCancelDocument Op = 0x0033 |
| 70 |
OpGetDocumentAttributes Op = 0x0034 |
| 71 |
OpGetDocuments Op = 0x0035 |
| 72 |
OpDeleteDocument Op = 0x0036 |
| 73 |
OpSetDocumentAttributes Op = 0x0037 |
| 74 |
OpCancelJobs Op = 0x0038 |
| 75 |
OpCancelMyJobs Op = 0x0039 |
| 76 |
OpResubmitJob Op = 0x003a |
| 77 |
OpCloseJob Op = 0x003b |
| 78 |
OpIdentifyPrinter Op = 0x003c |
| 79 |
OpValidateDocument Op = 0x003d |
| 80 |
OpAddDocumentImages Op = 0x003e |
| 81 |
OpAcknowledgeDocument Op = 0x003f |
| 82 |
|
| 83 |
OpAcknowledgeIdentifyPrinter Op = 0x0040 |
| 84 |
OpAcknowledgeJob Op = 0x0041 |
| 85 |
OpFetchDocument Op = 0x0042 |
| 86 |
OpFetchJob Op = 0x0043 |
| 87 |
OpGetOutputDeviceAttributes Op = 0x0044 |
| 88 |
OpUpdateActiveJobs Op = 0x0045 |
| 89 |
OpDeregisterOutputDevice Op = 0x0046 |
| 90 |
OpUpdateDocumentStatus Op = 0x0047 |
| 91 |
OpUpdateJobStatus Op = 0x0048 |
| 92 |
OpupdateOutputDeviceAttributes Op = 0x0049 |
| 93 |
OpGetNextDocumentData Op = 0x004a |
| 94 |
OpAllocatePrinterResources Op = 0x004b |
| 95 |
OpCreatePrinter Op = 0x004c |
| 96 |
OpDeallocatePrinterResources Op = 0x004d |
| 97 |
OpDeletePrinter Op = 0x004e |
| 98 |
OpGetPrinters Op = 0x004f |
| 99 |
|
| 100 |
OpShutdownOnePrinter Op = 0x0050 |
| 101 |
OpStartupOnePrinter Op = 0x0051 |
| 102 |
OpCancelResource Op = 0x0052 |
| 103 |
OpCreateResource Op = 0x0053 |
| 104 |
OpInstallResource Op = 0x0054 |
| 105 |
OpSendResourceData Op = 0x0055 |
| 106 |
OpSetResourceAttributes Op = 0x0056 |
| 107 |
OpCreateResourceSubscriptions Op = 0x0057 |
| 108 |
OpCreateSystemSubscriptions Op = 0x0058 |
| 109 |
OpDisableAllPrinters Op = 0x0059 |
| 110 |
OpEnableAllPrinters Op = 0x005a |
| 111 |
OpGetSystemAttributes Op = 0x005b |
| 112 |
OpGetSystemSupportedValues Op = 0x005c |
| 113 |
OpPauseAllPrinters Op = 0x005d |
| 114 |
OpPauseAllPrintersAfterCurrentJob Op = 0x005e |
| 115 |
OpRegisterOutputDevice Op = 0x005f |
| 116 |
|
| 117 |
OpRestartSystem Op = 0x0060 |
| 118 |
OpResumeAllPrinters Op = 0x0061 |
| 119 |
OpSetSystemAttributes Op = 0x0062 |
| 120 |
OpShutdownAllPrinters Op = 0x0063 |
| 121 |
OpStartupAllPrinters Op = 0x0064 |
| 122 |
|
| 123 |
OpCupsGetDefault Op = 0x4001 |
| 124 |
OpCupsGetPrinters Op = 0x4002 |
| 125 |
OpCupsAddModifyPrinter Op = 0x4003 |
| 126 |
OpCupsDeletePrinter Op = 0x4004 |
| 127 |
OpCupsGetClasses Op = 0x4005 |
| 128 |
OpCupsAddModifyClass Op = 0x4006 |
| 129 |
OpCupsDeleteClass Op = 0x4007 |
| 130 |
OpCupsAcceptJobs Op = 0x4008 |
| 131 |
OpCupsRejectJobs Op = 0x4009 |
| 132 |
OpCupsSetDefault Op = 0x400a |
| 133 |
OpCupsGetDevices Op = 0x400b |
| 134 |
OpCupsGetPpds Op = 0x400c |
| 135 |
OpCupsMoveJob Op = 0x400d |
| 136 |
OpCupsAuthenticateJob Op = 0x400e |
| 137 |
OpCupsGetPpd Op = 0x400f |
| 138 |
|
| 139 |
OpCupsGetDocument Op = 0x4027 |
| 140 |
OpCupsCreateLocalPrinter Op = 0x4028 |
| 141 |
|
| 142 |
) |
| 143 |
|
| 144 |
|
| 145 |
func (op Op) String() string { |
| 146 |
switch op { |
| 147 |
case OpPrintJob: |
| 148 |
return "Print-Job" |
| 149 |
case OpPrintURI: |
| 150 |
return "Print-URI" |
| 151 |
case OpValidateJob: |
| 152 |
return "Validate-Job" |
| 153 |
case OpCreateJob: |
| 154 |
return "Create-Job" |
| 155 |
case OpSendDocument: |
| 156 |
return "Send-Document" |
| 157 |
case OpSendURI: |
| 158 |
return "Send-URI" |
| 159 |
case OpCancelJob: |
| 160 |
return "Cancel-Job" |
| 161 |
case OpGetJobAttributes: |
| 162 |
return "Get-Job-Attribute" |
| 163 |
case OpGetJobs: |
| 164 |
return "Get-Jobs" |
| 165 |
case OpGetPrinterAttributes: |
| 166 |
return "Get-Printer-Attributes" |
| 167 |
case OpHoldJob: |
| 168 |
return "Hold-Job" |
| 169 |
case OpReleaseJob: |
| 170 |
return "Release-Job" |
| 171 |
case OpRestartJob: |
| 172 |
return "Restart-Job" |
| 173 |
case OpPausePrinter: |
| 174 |
return "Pause-Printer" |
| 175 |
case OpResumePrinter: |
| 176 |
return "Resume-Printer" |
| 177 |
case OpPurgeJobs: |
| 178 |
return "Purge-Jobs" |
| 179 |
case OpSetPrinterAttributes: |
| 180 |
return "Set-Printer-Attributes" |
| 181 |
case OpSetJobAttributes: |
| 182 |
return "Set-Job-Attributes" |
| 183 |
case OpGetPrinterSupportedValues: |
| 184 |
return "Get-Printer-Supported-Values" |
| 185 |
case OpCreatePrinterSubscriptions: |
| 186 |
return "Create-Printer-Subscriptions" |
| 187 |
case OpCreateJobSubscriptions: |
| 188 |
return "Create-Job-Subscriptions" |
| 189 |
case OpGetSubscriptionAttributes: |
| 190 |
return "Get-Subscription-Attributes" |
| 191 |
case OpGetSubscriptions: |
| 192 |
return "Get-Subscriptions" |
| 193 |
case OpRenewSubscription: |
| 194 |
return "Renew-Subscription" |
| 195 |
case OpCancelSubscription: |
| 196 |
return "Cancel-Subscription" |
| 197 |
case OpGetNotifications: |
| 198 |
return "Get-Notifications" |
| 199 |
case OpSendNotifications: |
| 200 |
return "Send-Notifications" |
| 201 |
case OpGetResourceAttributes: |
| 202 |
return "Get-Resource-Attributes" |
| 203 |
case OpGetResourceData: |
| 204 |
return "Get-Resource-Data" |
| 205 |
case OpGetResources: |
| 206 |
return "Get-Resources" |
| 207 |
case OpGetPrintSupportFiles: |
| 208 |
return "Get-Printer-Support-Files" |
| 209 |
case OpEnablePrinter: |
| 210 |
return "Enable-Printer" |
| 211 |
case OpDisablePrinter: |
| 212 |
return "Disable-Printer" |
| 213 |
case OpPausePrinterAfterCurrentJob: |
| 214 |
return "Pause-Printer-After-Current-Job" |
| 215 |
case OpHoldNewJobs: |
| 216 |
return "Hold-New-Jobs" |
| 217 |
case OpReleaseHeldNewJobs: |
| 218 |
return "Release-Held-New-Jobs" |
| 219 |
case OpDeactivatePrinter: |
| 220 |
return "Deactivate-Printer" |
| 221 |
case OpActivatePrinter: |
| 222 |
return "Activate-Printer" |
| 223 |
case OpRestartPrinter: |
| 224 |
return "Restart-Printer" |
| 225 |
case OpShutdownPrinter: |
| 226 |
return "Shutdown-Printer" |
| 227 |
case OpStartupPrinter: |
| 228 |
return "Startup-Printer" |
| 229 |
case OpReprocessJob: |
| 230 |
return "Reprocess-Job" |
| 231 |
case OpCancelCurrentJob: |
| 232 |
return "Cancel-Current-Job" |
| 233 |
case OpSuspendCurrentJob: |
| 234 |
return "Suspend-Current-Job" |
| 235 |
case OpResumeJob: |
| 236 |
return "Resume-Job" |
| 237 |
case OpPromoteJob: |
| 238 |
return "Promote-Job" |
| 239 |
case OpScheduleJobAfter: |
| 240 |
return "Schedule-Job-After" |
| 241 |
case OpCancelDocument: |
| 242 |
return "Cancel-Document" |
| 243 |
case OpGetDocumentAttributes: |
| 244 |
return "Get-Document-Attributes" |
| 245 |
case OpGetDocuments: |
| 246 |
return "Get-Documents" |
| 247 |
case OpDeleteDocument: |
| 248 |
return "Delete-Document" |
| 249 |
case OpSetDocumentAttributes: |
| 250 |
return "Set-Document-Attributes" |
| 251 |
case OpCancelJobs: |
| 252 |
return "Cancel-Jobs" |
| 253 |
case OpCancelMyJobs: |
| 254 |
return "Cancel-My-Jobs" |
| 255 |
case OpResubmitJob: |
| 256 |
return "Resubmit-Job" |
| 257 |
case OpCloseJob: |
| 258 |
return "Close-Job" |
| 259 |
case OpIdentifyPrinter: |
| 260 |
return "Identify-Printer" |
| 261 |
case OpValidateDocument: |
| 262 |
return "Validate-Document" |
| 263 |
case OpAddDocumentImages: |
| 264 |
return "Add-Document-Images" |
| 265 |
case OpAcknowledgeDocument: |
| 266 |
return "Acknowledge-Document" |
| 267 |
case OpAcknowledgeIdentifyPrinter: |
| 268 |
return "Acknowledge-Identify-Printer" |
| 269 |
case OpAcknowledgeJob: |
| 270 |
return "Acknowledge-Job" |
| 271 |
case OpFetchDocument: |
| 272 |
return "Fetch-Document" |
| 273 |
case OpFetchJob: |
| 274 |
return "Fetch-Job" |
| 275 |
case OpGetOutputDeviceAttributes: |
| 276 |
return "Get-Output-Device-Attributes" |
| 277 |
case OpUpdateActiveJobs: |
| 278 |
return "Update-Active-Jobs" |
| 279 |
case OpDeregisterOutputDevice: |
| 280 |
return "Deregister-Output-Device" |
| 281 |
case OpUpdateDocumentStatus: |
| 282 |
return "Update-Document-Status" |
| 283 |
case OpUpdateJobStatus: |
| 284 |
return "Update-Job-Status" |
| 285 |
case OpupdateOutputDeviceAttributes: |
| 286 |
return "Update-Output-Device-Attributes" |
| 287 |
case OpGetNextDocumentData: |
| 288 |
return "Get-Next-Document-Data" |
| 289 |
case OpAllocatePrinterResources: |
| 290 |
return "Allocate-Printer-Resources" |
| 291 |
case OpCreatePrinter: |
| 292 |
return "Create-Printer" |
| 293 |
case OpDeallocatePrinterResources: |
| 294 |
return "Deallocate-Printer-Resources" |
| 295 |
case OpDeletePrinter: |
| 296 |
return "Delete-Printer" |
| 297 |
case OpGetPrinters: |
| 298 |
return "Get-Printers" |
| 299 |
case OpShutdownOnePrinter: |
| 300 |
return "Shutdown-One-Printer" |
| 301 |
case OpStartupOnePrinter: |
| 302 |
return "Startup-One-Printer" |
| 303 |
case OpCancelResource: |
| 304 |
return "Cancel-Resource" |
| 305 |
case OpCreateResource: |
| 306 |
return "Create-Resource" |
| 307 |
case OpInstallResource: |
| 308 |
return "Install-Resource" |
| 309 |
case OpSendResourceData: |
| 310 |
return "Send-Resource-Data" |
| 311 |
case OpSetResourceAttributes: |
| 312 |
return "Set-Resource-Attributes" |
| 313 |
case OpCreateResourceSubscriptions: |
| 314 |
return "Create-Resource-Subscriptions" |
| 315 |
case OpCreateSystemSubscriptions: |
| 316 |
return "Create-System-Subscriptions" |
| 317 |
case OpDisableAllPrinters: |
| 318 |
return "Disable-All-Printers" |
| 319 |
case OpEnableAllPrinters: |
| 320 |
return "Enable-All-Printers" |
| 321 |
case OpGetSystemAttributes: |
| 322 |
return "Get-System-Attributes" |
| 323 |
case OpGetSystemSupportedValues: |
| 324 |
return "Get-System-Supported-Values" |
| 325 |
case OpPauseAllPrinters: |
| 326 |
return "Pause-All-Printers" |
| 327 |
case OpPauseAllPrintersAfterCurrentJob: |
| 328 |
return "Pause-All-Printers-After-Current-Job" |
| 329 |
case OpRegisterOutputDevice: |
| 330 |
return "Register-Output-Device" |
| 331 |
case OpRestartSystem: |
| 332 |
return "Restart-System" |
| 333 |
case OpResumeAllPrinters: |
| 334 |
return "Resume-All-Printers" |
| 335 |
case OpSetSystemAttributes: |
| 336 |
return "Set-System-Attributes" |
| 337 |
case OpShutdownAllPrinters: |
| 338 |
return "Shutdown-All-Printers" |
| 339 |
case OpStartupAllPrinters: |
| 340 |
return "Startup-All-Printers" |
| 341 |
case OpCupsGetDefault: |
| 342 |
return "CUPS-Get-Default" |
| 343 |
case OpCupsGetPrinters: |
| 344 |
return "CUPS-Get-Printers" |
| 345 |
case OpCupsAddModifyPrinter: |
| 346 |
return "CUPS-Add-Modify-Printer" |
| 347 |
case OpCupsDeletePrinter: |
| 348 |
return "CUPS-Delete-Printer" |
| 349 |
case OpCupsGetClasses: |
| 350 |
return "CUPS-Get-Classes" |
| 351 |
case OpCupsAddModifyClass: |
| 352 |
return "CUPS-Add-Modify-Class" |
| 353 |
case OpCupsDeleteClass: |
| 354 |
return "CUPS-Delete-Class" |
| 355 |
case OpCupsAcceptJobs: |
| 356 |
return "CUPS-Accept-Jobs" |
| 357 |
case OpCupsRejectJobs: |
| 358 |
return "CUPS-Reject-Jobs" |
| 359 |
case OpCupsSetDefault: |
| 360 |
return "CUPS-Set-Default" |
| 361 |
case OpCupsGetDevices: |
| 362 |
return "CUPS-Get-Devices" |
| 363 |
case OpCupsGetPpds: |
| 364 |
return "CUPS-Get-PPDs" |
| 365 |
case OpCupsMoveJob: |
| 366 |
return "CUPS-Move-Job" |
| 367 |
case OpCupsAuthenticateJob: |
| 368 |
return "CUPS-Authenticate-Job" |
| 369 |
case OpCupsGetPpd: |
| 370 |
return "CUPS-Get-PPD" |
| 371 |
case OpCupsGetDocument: |
| 372 |
return "CUPS-Get-Document" |
| 373 |
case OpCupsCreateLocalPrinter: |
| 374 |
return "CUPS-Create-Local-Printer" |
| 375 |
} |
| 376 |
|
| 377 |
return fmt.Sprintf("0x%4.4x", int(op)) |
| 378 |
} |