Documentation ¶
Overview ¶
Package goipp implements IPP core protocol, as defined by RFC 8010
It doesn't implement high-level operations, such as "print a document", "cancel print job" and so on. It's scope is limited to proper generation and parsing of IPP requests and responses.
IPP protocol uses the following simple model: 1. Send a request 2. Receive a response
Request and response both has a similar format, represented here by type Message, with the only difference, that Code field of that Message is the Operation code in request and Status code in response. So most of operations are common for request and response messages
Example (Get-Printer-Attributes): ¶
package main import ( "bytes" "net/http" "os" "github.com/OpenPrinting/goipp" ) const uri = "http://192.168.1.102:631" // Build IPP OpGetPrinterAttributes request func makeRequest() ([]byte, error) { m := goipp.NewRequest(goipp.DefaultVersion, goipp.OpGetPrinterAttributes, 1) m.Operation.Add(goipp.MakeAttribute("attributes-charset", goipp.TagCharset, goipp.String("utf-8"))) m.Operation.Add(goipp.MakeAttribute("attributes-natural-language", goipp.TagLanguage, goipp.String("en-US"))) m.Operation.Add(goipp.MakeAttribute("printer-uri", goipp.TagURI, goipp.String(uri))) m.Operation.Add(goipp.MakeAttribute("requested-attributes", goipp.TagKeyword, goipp.String("all"))) return m.EncodeBytes() } // Check that there is no error func check(err error) { if err != nil { panic(err) } } func main() { request, err := makeRequest() check(err) resp, err := http.Post(uri, goipp.ContentType, bytes.NewBuffer(request)) check(err) var respMsg goipp.Message err = respMsg.Decode(resp.Body) check(err) respMsg.Print(os.Stdout, false) }
Example (Print PDF file): ¶
package main import ( "bytes" "errors" "fmt" "io" "net/http" "os" "github.com/OpenPrinting/goipp" ) const ( PrinterURL = "http://192.168.1.102:631/ipp/print" TestPage = "onepage-a4.pdf" ) type T int // checkErr checks for an error. If err != nil, it prints error // message and exits func checkErr(err error, format string, args ...interface{}) { if err != nil { msg := fmt.Sprintf(format, args...) fmt.Fprintf(os.Stderr, "%s: %s\n", msg, err) os.Exit(1) } } // ExamplePrintPDF demo func main() { // Build and encode IPP request req := goipp.NewRequest(goipp.DefaultVersion, goipp.OpPrintJob, 1) req.Operation.Add(goipp.MakeAttribute("attributes-charset", goipp.TagCharset, goipp.String("utf-8"))) req.Operation.Add(goipp.MakeAttribute("attributes-natural-language", goipp.TagLanguage, goipp.String("en-US"))) req.Operation.Add(goipp.MakeAttribute("printer-uri", goipp.TagURI, goipp.String(PrinterURL))) req.Operation.Add(goipp.MakeAttribute("requesting-user-name", goipp.TagName, goipp.String("John Doe"))) req.Operation.Add(goipp.MakeAttribute("job-name", goipp.TagName, goipp.String("job name"))) req.Operation.Add(goipp.MakeAttribute("document-format", goipp.TagMimeType, goipp.String("application/pdf"))) payload, err := req.EncodeBytes() checkErr(err, "IPP encode") // Open document file file, err := os.Open(TestPage) checkErr(err, "Open document file") defer file.Close() // Build HTTP request body := io.MultiReader(bytes.NewBuffer(payload), file) httpReq, err := http.NewRequest(http.MethodPost, PrinterURL, body) checkErr(err, "HTTP") httpReq.Header.Set("content-type", goipp.ContentType) httpReq.Header.Set("accept", goipp.ContentType) httpReq.Header.Set("accept-encoding", "gzip, deflate, identity") // Execute HTTP request httpRsp, err := http.DefaultClient.Do(httpReq) if httpRsp != nil { defer httpRsp.Body.Close() } checkErr(err, "HTTP") if httpRsp.StatusCode/100 != 2 { checkErr(errors.New(httpRsp.Status), "HTTP") } // Decode IPP response rsp := &goipp.Message{} err = rsp.Decode(httpRsp.Body) checkErr(err, "IPP decode") if goipp.Status(rsp.Code) != goipp.StatusOk { err = errors.New(goipp.Status(rsp.Code).String()) checkErr(err, "IPP") } }
Index ¶
- Constants
- func ValueEqual(v1, v2 Value) bool
- type Attribute
- type Attributes
- type Binary
- type Boolean
- type Code
- type Collection
- type DecoderOptions
- type Group
- type Groups
- type Integer
- type Message
- func (m *Message) Decode(in io.Reader) error
- func (m *Message) DecodeBytes(data []byte) error
- func (m *Message) DecodeBytesEx(data []byte, opt DecoderOptions) error
- func (m *Message) DecodeEx(in io.Reader, opt DecoderOptions) error
- func (m *Message) Encode(out io.Writer) error
- func (m *Message) EncodeBytes() ([]byte, error)
- func (m Message) Equal(m2 Message) bool
- func (m *Message) Print(out io.Writer, request bool)
- func (m *Message) Reset()
- type Op
- type Range
- type Resolution
- type Status
- type String
- type Tag
- type TextWithLang
- type Time
- type Type
- type Units
- type Value
- type Values
- type Version
- type Void
Constants ¶
const (
// ContentType is the HTTP content type for IPP messages
ContentType = "application/ipp"
)
Variables ¶
This section is empty.
Functions ¶
func ValueEqual ¶
ValueEqual checks if two values are equal
Equality means that types and values are equal. For structured values, like Collection, deep comparison is performed
Types ¶
type Attribute ¶
Attribute represents a single attribute, which consist of the Name and one or more Values
func MakeAttribute ¶
MakeAttribute makes Attribute with single value
type Attributes ¶
type Attributes []Attribute
Attributes represents a slice of attributes
func (Attributes) Equal ¶
func (attrs Attributes) Equal(attrs2 Attributes) bool
Equal checks that attrs and attrs2 are equal
type Boolean ¶
type Boolean bool
Boolean is the Value that contains true of false
Use with: TagBoolean
type Collection ¶
type Collection Attributes
Collection is the Value that represents collection of attributes
Use with: TagBeginCollection
func (Collection) Equal ¶
func (v Collection) Equal(v2 Attributes) bool
Equal checks that two collections are equal
func (Collection) Type ¶
func (Collection) Type() Type
Type returns type of Value (TypeCollection for Collection)
type DecoderOptions ¶ added in v1.1.0
type DecoderOptions struct { // EnableWorkarounds, if set to true, enables various workarounds // for decoding IPP messages that violate IPP protocol specification // // Currently it includes the following workarounds: // * Pantum M7300FDW violates collection encoding rules. // Instead of using TagMemberName, it uses named attributes // within the collection // // The list of implemented workarounds may grow in the // future EnableWorkarounds bool }
DecoderOptions represents message decoder options
type Group ¶ added in v1.1.0
type Group struct { Tag Tag // Group tag Attrs Attributes // Group attributes }
Group represents a group of attributes.
Since 1.1.0
type Groups ¶ added in v1.1.0
type Groups []Group
Groups represents a sequence of groups
The primary purpose of this type is to represent messages with repeated groups with the same group tag
See Message type documentation for more details ¶
Since 1.1.0
type Integer ¶
type Integer int32
Integer is the Value that represents 32-bit signed int
Use with: TagInteger, TagEnum
type Message ¶
type Message struct { // Common header Version Version // Protocol version Code Code // Operation for request, status for response RequestID uint32 // Set in request, returned in response // Groups of Attributes // // This field allows to represent messages with repeated // groups of attributes with the same group tag. The most // noticeable use case is the Get-Jobs response which uses // multiple Job groups, one per returned job. See RFC 8011, // 4.2.6.2. for more details // // See also the following discussions which explain the demand // to implement this interface: // https://github.com/OpenPrinting/goipp/issues/2 // https://github.com/OpenPrinting/goipp/pull/3 // // With respect to backward compatibility, the following // behavior is implemented here: // 1. (*Message).Decode() fills both Groups and named per-group // fields (i.e., Operation, Job etc) // 2. (*Message).Encode() and (*Message) Print, if Groups != nil, // uses Groups and ignores named per-group fields. Otherwise, // named fields are used as in 1.0.0 // 3. (*Message) Equal(), for each message uses Groups if // it is not nil or named per-group fields otherwise. // In another words, Equal() compares messages as if // they were encoded // // Since 1.1.0 Groups Groups // Attributes, by group Operation Attributes // Operation attributes Job Attributes // Job attributes Printer Attributes // Printer attributes Unsupported Attributes // Unsupported attributes Subscription Attributes // Subscription attributes EventNotification Attributes // Event Notification attributes Resource Attributes // Resource attributes Document Attributes // Document attributes System Attributes // System attributes Future11 Attributes // \ Future12 Attributes // \ Future13 Attributes // | Reserved for future extensions Future14 Attributes // / Future15 Attributes // / }
Message represents a single IPP message, which may be either client request or server response
func NewRequest ¶
NewRequest creates a new request message
Use DefaultVersion as a first argument, if you don't have any specific needs
func NewResponse ¶
NewResponse creates a new response message
Use DefaultVersion as a first argument, if you don't
func (*Message) DecodeBytes ¶
DecodeBytes decodes message from byte slice
func (*Message) DecodeBytesEx ¶ added in v1.1.0
func (m *Message) DecodeBytesEx(data []byte, opt DecoderOptions) error
DecodeBytesEx decodes message from byte slice
It is extended version of the DecodeBytes method, with additional DecoderOptions parameter
func (*Message) DecodeEx ¶ added in v1.1.0
func (m *Message) DecodeEx(in io.Reader, opt DecoderOptions) error
DecodeEx reads message from io.Reader
It is extended version of the Decode method, with additional DecoderOptions parameter
func (*Message) EncodeBytes ¶
EncodeBytes encodes message to byte slice
type Op ¶
type Op Code
Op represents an IPP Operation Code
const ( OpPrintJob Op = 0x0002 // Print-Job: Print a single file OpPrintURI Op = 0x0003 // Print-URI: Print a single URL OpValidateJob Op = 0x0004 // Validate-Job: Validate job values prior to submission OpCreateJob Op = 0x0005 // Create-Job: Create an empty print job OpSendDocument Op = 0x0006 // Send-Document: Add a file to a job OpSendURI Op = 0x0007 // Send-URI: Add a URL to a job OpCancelJob Op = 0x0008 // Cancel-Job: Cancel a job OpGetJobAttributes Op = 0x0009 // Get-Job-Attribute: Get information about a job OpGetJobs Op = 0x000a // Get-Jobs: Get a list of jobs OpGetPrinterAttributes Op = 0x000b // Get-Printer-Attributes: Get information about a printer OpHoldJob Op = 0x000c // Hold-Job: Hold a job for printing OpReleaseJob Op = 0x000d // Release-Job: Release a job for printing OpRestartJob Op = 0x000e // Restart-Job: Reprint a job OpPausePrinter Op = 0x0010 // Pause-Printer: Stop a printer OpResumePrinter Op = 0x0011 // Resume-Printer: Start a printer OpPurgeJobs Op = 0x0012 // Purge-Jobs: Delete all jobs OpSetPrinterAttributes Op = 0x0013 // Set-Printer-Attributes: Set printer values OpSetJobAttributes Op = 0x0014 // Set-Job-Attributes: Set job values OpGetPrinterSupportedValues Op = 0x0015 // Get-Printer-Supported-Values: Get supported values OpCreatePrinterSubscriptions Op = 0x0016 // Create-Printer-Subscriptions: Create one or more printer subscriptions OpCreateJobSubscriptions Op = 0x0017 // Create-Job-Subscriptions: Create one of more job subscriptions OpGetSubscriptionAttributes Op = 0x0018 // Get-Subscription-Attributes: Get subscription information OpGetSubscriptions Op = 0x0019 // Get-Subscriptions: Get list of subscriptions OpRenewSubscription Op = 0x001a // Renew-Subscription: Renew a printer subscription OpCancelSubscription Op = 0x001b // Cancel-Subscription: Cancel a subscription OpGetNotifications Op = 0x001c // Get-Notifications: Get notification events OpSendNotifications Op = 0x001d // Send-Notifications: Send notification events OpGetResourceAttributes Op = 0x001e // Get-Resource-Attributes: Get resource information OpGetResourceData Op = 0x001f // Get-Resource-Data: Get resource data OpGetResources Op = 0x0020 // Get-Resources: Get list of resources OpGetPrintSupportFiles Op = 0x0021 // Get-Printer-Support-Files: Get printer support files OpEnablePrinter Op = 0x0022 // Enable-Printer: Accept new jobs for a printer OpDisablePrinter Op = 0x0023 // Disable-Printer: Reject new jobs for a printer OpPausePrinterAfterCurrentJob Op = 0x0024 // Pause-Printer-After-Current-Job: Stop printer after the current job OpHoldNewJobs Op = 0x0025 // Hold-New-Jobs: Hold new jobs OpReleaseHeldNewJobs Op = 0x0026 // Release-Held-New-Jobs: Release new jobs that were previously held OpDeactivatePrinter Op = 0x0027 // Deactivate-Printer: Stop a printer and do not accept jobs OpActivatePrinter Op = 0x0028 // Activate-Printer: Start a printer and accept jobs OpRestartPrinter Op = 0x0029 // Restart-Printer: Restart a printer OpShutdownPrinter Op = 0x002a // Shutdown-Printer: Turn a printer off OpStartupPrinter Op = 0x002b // Startup-Printer: Turn a printer on OpReprocessJob Op = 0x002c // Reprocess-Job: Reprint a job OpCancelCurrentJob Op = 0x002d // Cancel-Current-Job: Cancel the current job OpSuspendCurrentJob Op = 0x002e // Suspend-Current-Job: Suspend the current job OpResumeJob Op = 0x002f // Resume-Job: Resume the current job OpPromoteJob Op = 0x0030 // Promote-Job: Promote a job to print sooner OpScheduleJobAfter Op = 0x0031 // Schedule-Job-After: Schedule a job to print after another OpCancelDocument Op = 0x0033 // Cancel-Document: Cancel a document OpGetDocumentAttributes Op = 0x0034 // Get-Document-Attributes: Get document information OpGetDocuments Op = 0x0035 // Get-Documents: Get a list of documents in a job OpDeleteDocument Op = 0x0036 // Delete-Document: Delete a document OpSetDocumentAttributes Op = 0x0037 // Set-Document-Attributes: Set document values OpCancelJobs Op = 0x0038 // Cancel-Jobs: Cancel all jobs (administrative) OpCancelMyJobs Op = 0x0039 // Cancel-My-Jobs: Cancel a user's jobs OpResubmitJob Op = 0x003a // Resubmit-Job: Copy and reprint a job OpCloseJob Op = 0x003b // Close-Job: Close a job and start printing OpIdentifyPrinter Op = 0x003c // Identify-Printer: Make the printer beep, flash, or display a message for identification OpValidateDocument Op = 0x003d // Validate-Document: Validate document values prior to submission OpAddDocumentImages Op = 0x003e // Add-Document-Images: Add image(s) from the specified scanner source OpAcknowledgeDocument Op = 0x003f // Acknowledge-Document: Acknowledge processing of a document OpAcknowledgeIdentifyPrinter Op = 0x0040 // Acknowledge-Identify-Printer: Acknowledge action on an Identify-Printer request OpAcknowledgeJob Op = 0x0041 // Acknowledge-Job: Acknowledge processing of a job OpFetchDocument Op = 0x0042 // Fetch-Document: Fetch a document for processing OpFetchJob Op = 0x0043 // Fetch-Job: Fetch a job for processing OpGetOutputDeviceAttributes Op = 0x0044 // Get-Output-Device-Attributes: Get printer information for a specific output device OpUpdateActiveJobs Op = 0x0045 // Update-Active-Jobs: Update the list of active jobs that a proxy has processed OpDeregisterOutputDevice Op = 0x0046 // Deregister-Output-Device: Remove an output device OpUpdateDocumentStatus Op = 0x0047 // Update-Document-Status: Update document values OpUpdateJobStatus Op = 0x0048 // Update-Job-Status: Update job values OpupdateOutputDeviceAttributes Op = 0x0049 // Update-Output-Device-Attributes: Update output device values OpGetNextDocumentData Op = 0x004a // Get-Next-Document-Data: Scan more document data OpAllocatePrinterResources Op = 0x004b // Allocate-Printer-Resources: Use resources for a printer OpCreatePrinter Op = 0x004c // Create-Printer: Create a new service OpDeallocatePrinterResources Op = 0x004d // Deallocate-Printer-Resources: Stop using resources for a printer OpDeletePrinter Op = 0x004e // Delete-Printer: Delete an existing service OpGetPrinters Op = 0x004f // Get-Printers: Get a list of services OpShutdownOnePrinter Op = 0x0050 // Shutdown-One-Printer: Shutdown a service OpStartupOnePrinter Op = 0x0051 // Startup-One-Printer: Start a service OpCancelResource Op = 0x0052 // Cancel-Resource: Uninstall a resource OpCreateResource Op = 0x0053 // Create-Resource: Create a new (empty) resource OpInstallResource Op = 0x0054 // Install-Resource: Install a resource OpSendResourceData Op = 0x0055 // Send-Resource-Data: Upload the data for a resource OpSetResourceAttributes Op = 0x0056 // Set-Resource-Attributes: Set resource object attributes OpCreateResourceSubscriptions Op = 0x0057 // Create-Resource-Subscriptions: Create event subscriptions for a resource OpCreateSystemSubscriptions Op = 0x0058 // Create-System-Subscriptions: Create event subscriptions for a system OpDisableAllPrinters Op = 0x0059 // Disable-All-Printers: Stop accepting new jobs on all services OpEnableAllPrinters Op = 0x005a // Enable-All-Printers: Start accepting new jobs on all services OpGetSystemAttributes Op = 0x005b // Get-System-Attributes: Get system object attributes OpGetSystemSupportedValues Op = 0x005c // Get-System-Supported-Values: Get supported values for system object attributes OpPauseAllPrinters Op = 0x005d // Pause-All-Printers: Stop all services immediately OpPauseAllPrintersAfterCurrentJob Op = 0x005e // Pause-All-Printers-After-Current-Job: Stop all services after processing the current jobs OpRegisterOutputDevice Op = 0x005f // Register-Output-Device: Register a remote service OpRestartSystem Op = 0x0060 // Restart-System: Restart all services OpResumeAllPrinters Op = 0x0061 // Resume-All-Printers: Start job processing on all services OpSetSystemAttributes Op = 0x0062 // Set-System-Attributes: Set system object attributes OpShutdownAllPrinters Op = 0x0063 // Shutdown-All-Printers: Shutdown all services OpStartupAllPrinters Op = 0x0064 // Startup-All-Printers: Startup all services OpCupsGetDefault Op = 0x4001 // CUPS-Get-Default: Get the default printer OpCupsGetPrinters Op = 0x4002 // CUPS-Get-Printers: Get a list of printers and/or classes OpCupsAddModifyPrinter Op = 0x4003 // CUPS-Add-Modify-Printer: Add or modify a printer OpCupsDeletePrinter Op = 0x4004 // CUPS-Delete-Printer: Delete a printer OpCupsGetClasses Op = 0x4005 // CUPS-Get-Classes: Get a list of classes OpCupsAddModifyClass Op = 0x4006 // CUPS-Add-Modify-Class: Add or modify a class OpCupsDeleteClass Op = 0x4007 // CUPS-Delete-Class: Delete a class OpCupsAcceptJobs Op = 0x4008 // CUPS-Accept-Jobs: Accept new jobs on a printer OpCupsRejectJobs Op = 0x4009 // CUPS-Reject-Jobs: Reject new jobs on a printer OpCupsSetDefault Op = 0x400a // CUPS-Set-Default: Set the default printer OpCupsGetDevices Op = 0x400b // CUPS-Get-Devices: Get a list of supported devices OpCupsGetPpds Op = 0x400c // CUPS-Get-PPDs: Get a list of supported drivers OpCupsMoveJob Op = 0x400d // CUPS-Move-Job: Move a job to a different printer OpCupsAuthenticateJob Op = 0x400e // CUPS-Authenticate-Job: Authenticate a job OpCupsGetPpd Op = 0x400f // CUPS-Get-PPD: Get a PPD file OpCupsGetDocument Op = 0x4027 // CUPS-Get-Document: Get a document file OpCupsCreateLocalPrinter Op = 0x4028 // CUPS-Create-Local-Printer: Create a local (temporary) printer )
Op codes
type Range ¶
type Range struct {
Lower, Upper int // Lower/upper bounds
}
Range is the Value that represents a range of 32-bit signed integers
Use with: TagRange
type Resolution ¶
Resolution is the Value that represents image resolution.
Use with: TagResolution
func (Resolution) String ¶
func (v Resolution) String() string
String converts Resolution value to string
func (Resolution) Type ¶
func (Resolution) Type() Type
Type returns type of Value (TypeResolution for Resolution)
type Status ¶
type Status Code
Status represents an IPP Status Code
const ( StatusOk Status = 0x0000 // successful-ok StatusOkIgnoredOrSubstituted Status = 0x0001 // successful-ok-ignored-or-substituted-attributes StatusOkConflicting Status = 0x0002 // successful-ok-conflicting-attributes StatusOkIgnoredSubscriptions Status = 0x0003 // successful-ok-ignored-subscriptions StatusOkIgnoredNotifications Status = 0x0004 // successful-ok-ignored-notifications StatusOkTooManyEvents Status = 0x0005 // successful-ok-too-many-events StatusOkButCancelSubscription Status = 0x0006 // successful-ok-but-cancel-subscription StatusOkEventsComplete Status = 0x0007 // successful-ok-events-complete StatusRedirectionOtherSite Status = 0x0200 // redirection-other-site StatusCupsSeeOther Status = 0x0280 // cups-see-other StatusErrorBadRequest Status = 0x0400 // client-error-bad-request StatusErrorForbidden Status = 0x0401 // client-error-forbidden StatusErrorNotAuthenticated Status = 0x0402 // client-error-not-authenticated StatusErrorNotAuthorized Status = 0x0403 // client-error-not-authorized StatusErrorNotPossible Status = 0x0404 // client-error-not-possible StatusErrorTimeout Status = 0x0405 // client-error-timeout StatusErrorNotFound Status = 0x0406 // client-error-not-found StatusErrorGone Status = 0x0407 // client-error-gone StatusErrorRequestEntity Status = 0x0408 // client-error-request-entity-too-large StatusErrorRequestValue Status = 0x0409 // client-error-request-value-too-long StatusErrorDocumentFormatNotSupported Status = 0x040a // client-error-document-format-not-supported StatusErrorAttributesOrValues Status = 0x040b // client-error-attributes-or-values-not-supported StatusErrorURIScheme Status = 0x040c // client-error-uri-scheme-not-supported StatusErrorCharset Status = 0x040d // client-error-charset-not-supported StatusErrorConflicting Status = 0x040e // client-error-conflicting-attributes StatusErrorCompressionNotSupported Status = 0x040f // client-error-compression-not-supported StatusErrorCompressionError Status = 0x0410 // client-error-compression-error StatusErrorDocumentFormatError Status = 0x0411 // client-error-document-format-error StatusErrorDocumentAccess Status = 0x0412 // client-error-document-access-error StatusErrorAttributesNotSettable Status = 0x0413 // client-error-attributes-not-settable StatusErrorIgnoredAllSubscriptions Status = 0x0414 // client-error-ignored-all-subscriptions StatusErrorTooManySubscriptions Status = 0x0415 // client-error-too-many-subscriptions StatusErrorIgnoredAllNotifications Status = 0x0416 // client-error-ignored-all-notifications StatusErrorPrintSupportFileNotFound Status = 0x0417 // client-error-print-support-file-not-found StatusErrorDocumentPassword Status = 0x0418 // client-error-document-password-error StatusErrorDocumentPermission Status = 0x0419 // client-error-document-permission-error StatusErrorDocumentSecurity Status = 0x041a // client-error-document-security-error StatusErrorDocumentUnprintable Status = 0x041b // client-error-document-unprintable-error StatusErrorAccountInfoNeeded Status = 0x041c // client-error-account-info-needed StatusErrorAccountClosed Status = 0x041d // client-error-account-closed StatusErrorAccountLimitReached Status = 0x041e // client-error-account-limit-reached StatusErrorAccountAuthorizationFailed Status = 0x041f // client-error-account-authorization-failed StatusErrorNotFetchable Status = 0x0420 // client-error-not-fetchable StatusErrorInternal Status = 0x0500 // server-error-internal-error StatusErrorOperationNotSupported Status = 0x0501 // server-error-operation-not-supported StatusErrorVersionNotSupported Status = 0x0503 // server-error-version-not-supported StatusErrorDevice Status = 0x0504 // server-error-device-error StatusErrorTemporary Status = 0x0505 // server-error-temporary-error StatusErrorNotAcceptingJobs Status = 0x0506 // server-error-not-accepting-jobs StatusErrorBusy Status = 0x0507 // server-error-busy StatusErrorJobCanceled Status = 0x0508 // server-error-job-canceled StatusErrorMultipleJobsNotSupported Status = 0x0509 // server-error-multiple-document-jobs-not-supported StatusErrorPrinterIsDeactivated Status = 0x050a // server-error-printer-is-deactivated StatusErrorTooManyJobs Status = 0x050b // server-error-too-many-jobs StatusErrorTooManyDocuments Status = 0x050c // server-error-too-many-documents )
Status codes
type String ¶
type String string
String is the Value that represents string of text
Use with: TagText, TagName, TagReservedString, TagKeyword, TagURI, TagURIScheme, TagCharset, TagLanguage, TagMimeType, TagMemberName
type Tag ¶
type Tag int
Tag represents a tag used in a binary representation of the IPP message
const ( // Delimiter tags TagZero Tag = 0x00 // Zero tag - used for separators TagOperationGroup Tag = 0x01 // Operation group TagJobGroup Tag = 0x02 // Job group TagEnd Tag = 0x03 // End-of-attributes TagPrinterGroup Tag = 0x04 // Printer group TagUnsupportedGroup Tag = 0x05 // Unsupported attributes group TagSubscriptionGroup Tag = 0x06 // Subscription group TagEventNotificationGroup Tag = 0x07 // Event group TagResourceGroup Tag = 0x08 // Resource group TagDocumentGroup Tag = 0x09 // Document group TagSystemGroup Tag = 0x0a // System group TagFuture11Group Tag = 0x0b // Future group 11 TagFuture12Group Tag = 0x0c // Future group 12 TagFuture13Group Tag = 0x0d // Future group 13 TagFuture14Group Tag = 0x0e // Future group 14 TagFuture15Group Tag = 0x0f // Future group 15 // Value tags TagUnsupportedValue Tag = 0x10 // Unsupported value TagDefault Tag = 0x11 // Default value TagUnknown Tag = 0x12 // Unknown value TagNoValue Tag = 0x13 // No-value value TagNotSettable Tag = 0x15 // Not-settable value TagDeleteAttr Tag = 0x16 // Delete-attribute value TagAdminDefine Tag = 0x17 // Admin-defined value TagInteger Tag = 0x21 // Integer value TagBoolean Tag = 0x22 // Boolean value TagEnum Tag = 0x23 // Enumeration value TagString Tag = 0x30 // Octet string value TagDateTime Tag = 0x31 // Date/time value TagResolution Tag = 0x32 // Resolution value TagRange Tag = 0x33 // Range value TagBeginCollection Tag = 0x34 // Beginning of collection value TagTextLang Tag = 0x35 // Text-with-language value TagNameLang Tag = 0x36 // Name-with-language value TagEndCollection Tag = 0x37 // End of collection value TagText Tag = 0x41 // Text value TagName Tag = 0x42 // Name value TagReservedString Tag = 0x43 // Reserved for future string value TagKeyword Tag = 0x44 // Keyword value TagURI Tag = 0x45 // URI value TagURIScheme Tag = 0x46 // URI scheme value TagCharset Tag = 0x47 // Character set value TagLanguage Tag = 0x48 // Language value TagMimeType Tag = 0x49 // MIME media type value TagMemberName Tag = 0x4a // Collection member name value TagExtension Tag = 0x7f // Extension point for 32-bit tags )
Tag values
func (Tag) IsDelimiter ¶
IsDelimiter returns true for delimiter tags
type TextWithLang ¶
type TextWithLang struct {
Lang, Text string // Language and text
}
TextWithLang is the Value that represents a combination of two strings:
- text on some natural language (i.e., "hello")
- name of that language (i.e., "en")
Use with: TagTextLang, TagNameLang
func (TextWithLang) String ¶
func (v TextWithLang) String() string
String converts TextWithLang value to string
func (TextWithLang) Type ¶
func (TextWithLang) Type() Type
Type returns type of Value (TypeTextWithLang for TextWithLang)
type Type ¶
type Type int
Type enumerates all possible value types
const ( TypeInvalid Type = -1 // Invalid Value type TypeVoid Type = iota // Value is Void TypeInteger // Value is Integer TypeBoolean // Value is Boolean TypeString // Value is String TypeDateTime // Value is Time TypeResolution // Value is Resolution TypeRange // Value is Range TypeTextWithLang // Value is TextWithLang TypeBinary // Value is Binary TypeCollection // Value is Collection )
Type values
type Value ¶
Value represents an attribute value
IPP uses typed values, and type of each value is unambiguously defined by the attribute tag
type Values ¶
Values represents a sequence of values with tags. Usually Values used as a "payload" of Attribute
type Version ¶
type Version uint16
Version represents a protocol version. It consist of Major and Minor version codes, packed into a single 16-bit word
const DefaultVersion Version = 0x0200
DefaultVersion is the default IPP version (2.0 for now)
func MakeVersion ¶
MakeVersion makes version from major and minor parts