ipp

package
v0.0.0-...-403537e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: BSD-2-Clause Imports: 29 Imported by: 0

README

github.com/OpenPrinting/go-mfp/proto/ipp

This Go library is a high-level implementation of the IPP printing protocol, per RFC8011.

If you are looking for a low-level IPP implementation (RFC8010), please consider using goipp library: https://github.com/OpenPrinting/goipp

Documentation

Index

Constants

View Source
const (
	// GetPrinterAttributesAll requests all printer attributes,
	// except the media-col-database.
	GetPrinterAttributesAll = "all"

	// GetPrinterAttributesJobTemplate requests the Job Template
	// Attributes.
	GetPrinterAttributesJobTemplate = "job-template"

	// GetPrinterAttributesPrinterDescription requests the
	// Printer Description Attributes.
	GetPrinterAttributesPrinterDescription = "printer-description"

	// GetPrinterAttributesMediaColDatabase requests the collection
	// of supported media types.
	//
	// Note, the "media-col-database" is not returned by the
	// printer unless explicitly requested, even if "all" attributes
	// are requested.
	GetPrinterAttributesMediaColDatabase = "media-col-database"
)

Standard attribute groups for Get-Printer-Attributes.

View Source
const (
	// AttrOperationAttributesCharset specifies character set
	// for all attributes in the message.
	//
	// It must be very first attribute in the message (RFC8011, 4.1.4.).
	AttrOperationAttributesCharset = "attributes-charset"

	// AttrOperationAttributesNaturalLanguage specifies natural
	// language for all textWithoutLanguage and nameWithoutLanguage
	// attributes in the message.
	//
	// It must be second attribute in the message (RFC8011, 4.1.4.).
	AttrOperationAttributesNaturalLanguage = "attributes-natural-language"

	// AttrOperationPrinterURI uses in requests to specify Printer URI,
	// where appropriate.
	AttrOperationPrinterURI = "printer-uri"

	// AttrOperationRequestedAttributes used in Get-Printer-Attributes
	// request to specify list of requested attributes.
	AttrOperationRequestedAttributes = "requested-attributes"

	// AttrOperationStatusMessage provides a short textual description
	// of the status of the operation.
	AttrOperationStatusMessage = "status-message"
)

Commonly used Operation Attributes.

View Source
const (
	// DefaultVersion is the default version of the IPP protocol.
	DefaultVersion = goipp.DefaultVersion

	// MinVersion is the minimal supported version of the IPP protocol.
	MinVersion goipp.Version = 0x0100

	// MaxVersion is the maximal supported version of the IPP protocol.
	MaxVersion goipp.Version = 0x0202
)

Variables

View Source
var (
	// DefaultCharset is the default value for the "attributes-charset"
	// operation attribute and the "charset-configured" printer attribute
	DefaultCharset = "utf-8"

	// DefaultNaturalLanguage is the default value for
	// "attributes-natural-language" operation attribute.
	DefaultNaturalLanguage = "en-us"

	// DefaultCharsetSupported is the default value for
	// ""charset-supported" printer attribute.
	DefaultCharsetSupported = []string{DefaultCharset}

	// DefaultIppVersionsSupported is the default value for
	// "ipp-features-supported" printer attribute.
	DefaultIppVersionsSupported = []goipp.Version{
		goipp.MakeVersion(2, 0),
		goipp.MakeVersion(1, 0),
		goipp.MakeVersion(1, 1),
	}

	// DefaultRequestHeader is the default value for the
	// RequestHeader structure.
	DefaultRequestHeader = RequestHeader{
		Version:                   goipp.DefaultVersion,
		AttributesCharset:         DefaultCharset,
		AttributesNaturalLanguage: DefaultNaturalLanguage,
	}

	// DefaultResponseHeader is the default value for the
	// RequestHeader structure.
	DefaultResponseHeader = ResponseHeader{
		Version:                   goipp.DefaultVersion,
		Status:                    goipp.StatusOk,
		AttributesCharset:         DefaultCharset,
		AttributesNaturalLanguage: DefaultNaturalLanguage,
		StatusMessage:             "success",
	}

	// DefaultDecoderOptions is the default value for [DecoderOptions]
	DefaultDecoderOptions = DecoderOptions{}
)

Default values for common attributes

View Source
var (
	ErrHTTPMethodNotAllowed = NewErrHTTP(http.StatusMethodNotAllowed, "")
)

Common errors, reported as ErrHTTP:

Functions

func ObjectGetAttr

func ObjectGetAttr(obj Object, name string) (attr goipp.Attribute, found bool)

ObjectGetAttr returns goipp.Attibute by name

func ObjectRegisteredAttrNames

func ObjectRegisteredAttrNames(obj Object) []string

ObjectRegisteredAttrNames returns names of attributes specific for the particular Object type (but not necessarily present in the particular Object instance).

func ObjectSetAttr

func ObjectSetAttr(obj Object, attr goipp.Attribute) error

ObjectSetAttr sets goipp.Attibute by name. It updates both object raw attributes and the corresponding field in the object structure (if any).

func ValidateKeyword

func ValidateKeyword(s string) bool

ValidateKeyword checks that string is the valid keyword.

Types

type CUPSDeviceAttributesGroup

type CUPSDeviceAttributesGroup struct{}

CUPSDeviceAttributesGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.CUPSDeviceAttributes group.

type CUPSGetDefaultRequest

type CUPSGetDefaultRequest struct {
	ObjectRawAttrs
	RequestHeader
	OperationGroup

	// Operation attributes
	RequestedAttributes []string `ipp:"requested-attributes"`
}

CUPSGetDefaultRequest operation (0x4001) returns the default printer URI and attributes.

func (*CUPSGetDefaultRequest) Decode

func (rq *CUPSGetDefaultRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetDefaultRequest from goipp.Message.

func (*CUPSGetDefaultRequest) Encode

func (rq *CUPSGetDefaultRequest) Encode() *goipp.Message

Encode encodes CUPSGetDefaultRequest into the goipp.Message.

func (*CUPSGetDefaultRequest) GetOp

func (rq *CUPSGetDefaultRequest) GetOp() goipp.Op

GetOp returns CUPSGetDefaultRequest IPP Operation code.

type CUPSGetDefaultResponse

type CUPSGetDefaultResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Other attributes.
	Printer *PrinterAttributes
}

CUPSGetDefaultResponse is the CUPS-Get-Default Response.

func (*CUPSGetDefaultResponse) Decode

func (rsp *CUPSGetDefaultResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetDefaultResponse from goipp.Message.

func (*CUPSGetDefaultResponse) Encode

func (rsp *CUPSGetDefaultResponse) Encode() *goipp.Message

Encode encodes CUPSGetDefaultResponse into goipp.Message.

type CUPSGetDevicesRequest

type CUPSGetDevicesRequest struct {
	ObjectRawAttrs
	RequestHeader
	OperationGroup

	// Operational attributes
	ExcludeSchemes      []string          `ipp:"exclude-schemes"`
	IncludeSchemes      []string          `ipp:"include-schemes"`
	Limit               optional.Val[int] `ipp:"limit"`
	RequestedAttributes []string          `ipp:"requested-attributes"`
	Timeout             optional.Val[int] `ipp:"timeout"`
}

CUPSGetDevicesRequest operation (0x400b) performs search for available printers and returns all of the supported device-uri's

func (*CUPSGetDevicesRequest) Decode

func (rq *CUPSGetDevicesRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetDevicesRequest from goipp.Message.

func (*CUPSGetDevicesRequest) Encode

func (rq *CUPSGetDevicesRequest) Encode() *goipp.Message

Encode encodes CUPSGetDevicesRequest into the goipp.Message.

func (*CUPSGetDevicesRequest) GetOp

func (rq *CUPSGetDevicesRequest) GetOp() goipp.Op

GetOp returns CUPSGetDevicesRequest IPP Operation code.

type CUPSGetDevicesResponse

type CUPSGetDevicesResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Other attributes.
	Printer []*DeviceAttributes
}

CUPSGetDevicesResponse is the CUPS-Get-Devices Response.

func (*CUPSGetDevicesResponse) Decode

func (rsp *CUPSGetDevicesResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetDevicesResponse from goipp.Message.

func (*CUPSGetDevicesResponse) Encode

func (rsp *CUPSGetDevicesResponse) Encode() *goipp.Message

Encode encodes CUPSGetDevicesResponse into goipp.Message.

type CUPSGetPPDRequest

type CUPSGetPPDRequest struct {
	ObjectRawAttrs
	RequestHeader

	OperationGroup
	CUPSPPDAttributesGroup

	// Operational attributes
	//
	// Use PrinterURI to specify particular print queue
	// or PPDName to request PPD file by its name.
	PrinterURI optional.Val[string] `ipp:"printer-uri"`
	PPDName    optional.Val[string] `ipp:"ppd-name"`
}

CUPSGetPPDRequest operation (0x400f) returns PPD file from the server.

func (*CUPSGetPPDRequest) Decode

func (rq *CUPSGetPPDRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPPDRequest from goipp.Message.

func (*CUPSGetPPDRequest) Encode

func (rq *CUPSGetPPDRequest) Encode() *goipp.Message

Encode encodes CUPSGetPPDRequest into the goipp.Message.

func (*CUPSGetPPDRequest) GetOp

func (rq *CUPSGetPPDRequest) GetOp() goipp.Op

GetOp returns CUPSGetPPDRequest IPP Operation code.

type CUPSGetPPDResponse

type CUPSGetPPDResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Operational attributes
	PrinterURI optional.Val[string] `ipp:"printer-uri"`
}

CUPSGetPPDResponse is the CUPS-Get-PPD Response.

If the PPD file is found, goipp.StatusOk is returned with the PPD file represented by the ResponseHeader.Body.

If the PPD file cannot be served by the local server because the printer-uri attribute points to an external printer, a goipp.StatusCupsSeeOther is returned and PrinterURI contains the correct URI to use.

If the PPD file does not exist, goipp.StatusErrorNotFound is returned.

func (*CUPSGetPPDResponse) Decode

func (rsp *CUPSGetPPDResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPPDResponse from goipp.Message.

func (*CUPSGetPPDResponse) Encode

func (rsp *CUPSGetPPDResponse) Encode() *goipp.Message

Encode encodes CUPSGetPPDResponse into goipp.Message.

type CUPSGetPPDsRequest

type CUPSGetPPDsRequest struct {
	ObjectRawAttrs
	RequestHeader

	OperationGroup
	CUPSPPDAttributesGroup

	// Operational attributes
	PPDFilter
}

CUPSGetPPDsRequest operation (0x400c) returns list of available PPDs

func (*CUPSGetPPDsRequest) Decode

func (rq *CUPSGetPPDsRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPPDsRequest from goipp.Message.

func (*CUPSGetPPDsRequest) Encode

func (rq *CUPSGetPPDsRequest) Encode() *goipp.Message

Encode encodes CUPSGetPPDsRequest into the goipp.Message.

func (*CUPSGetPPDsRequest) GetOp

func (rq *CUPSGetPPDsRequest) GetOp() goipp.Op

GetOp returns CUPSGetPPDsRequest IPP Operation code.

type CUPSGetPPDsResponse

type CUPSGetPPDsResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Other attributes.
	PPDs []*PPDAttributes
}

CUPSGetPPDsResponse is the CUPS-Get-PPDs Response.

func (*CUPSGetPPDsResponse) Decode

func (rsp *CUPSGetPPDsResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPPDsResponse from goipp.Message.

func (*CUPSGetPPDsResponse) Encode

func (rsp *CUPSGetPPDsResponse) Encode() *goipp.Message

Encode encodes CUPSGetPPDsResponse into goipp.Message.

type CUPSGetPrintersRequest

type CUPSGetPrintersRequest struct {
	ObjectRawAttrs
	RequestHeader
	OperationGroup

	// Operation attributes
	FirstPrinterName    optional.Val[string] `ipp:"first-printer-name"`
	Limit               optional.Val[int]    `ipp:"limit"`
	PrinterID           optional.Val[int]    `ipp:"printer-id"`
	PrinterLocation     optional.Val[string] `ipp:"printer-location"`
	PrinterType         optional.Val[int]    `ipp:"printer-type"`
	PrinterTypeMask     optional.Val[int]    `ipp:"printer-type-mask"`
	RequestedAttributes []string             `ipp:"requested-attributes"`
	RequestedUserName   optional.Val[string] `ipp:"requested-user-name,name"`
}

CUPSGetPrintersRequest operation (0x4002) returns the printer attributes for every printer known to the system.

func (*CUPSGetPrintersRequest) Decode

func (rq *CUPSGetPrintersRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPrintersRequest from goipp.Message.

func (*CUPSGetPrintersRequest) Encode

func (rq *CUPSGetPrintersRequest) Encode() *goipp.Message

Encode encodes CUPSGetPrintersRequest into the goipp.Message.

func (*CUPSGetPrintersRequest) GetOp

func (rq *CUPSGetPrintersRequest) GetOp() goipp.Op

GetOp returns CUPSGetPrintersRequest IPP Operation code.

type CUPSGetPrintersResponse

type CUPSGetPrintersResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Other attributes.
	Printer []*PrinterAttributes
}

CUPSGetPrintersResponse is the CUPS-Get-Printers Response.

func (*CUPSGetPrintersResponse) Decode

func (rsp *CUPSGetPrintersResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CUPSGetPrintersResponse from goipp.Message.

func (*CUPSGetPrintersResponse) Encode

func (rsp *CUPSGetPrintersResponse) Encode() *goipp.Message

Encode encodes CUPSGetPrintersResponse into goipp.Message.

type CUPSPPDAttributesGroup

type CUPSPPDAttributesGroup struct{}

CUPSPPDAttributesGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.CUPSPPDAttributes group.

type CUPSPrinterClassAttributesGroup

type CUPSPrinterClassAttributesGroup struct{}

CUPSPrinterClassAttributesGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.CUPSPrinterClassAttributes group.

type Client

type Client struct {
	URL        *url.URL          // Destination URL (ipp://...)
	HTTPClient *transport.Client // HTTP Client
	RequestID  uint32            // RequestID of the next request
	// contains filtered or unexported fields
}

Client implements Client-side IPP Printer object.

func NewClient

func NewClient(u *url.URL, tr *transport.Transport) *Client

NewClient creates a new IPP client.

If tr is nil, transport.NewTransport will be used to create a new transport.

func (*Client) Do

func (c *Client) Do(ctx context.Context, rq Request, rsp Response) error

Do sends the Request and waits for Response.

The following Request fields are filled automatically:

  • Version, if zero, will be set to goipp.DefaultVersion
  • RequestID will be set to next Client's RequestID in sequence

It automatically closes Response Body. This is convenient for most IPP requests, as body is rarely returned by IPP.

For requests with returned body, use Client.DoWithBody instead.

func (*Client) DoWithBody

func (c *Client) DoWithBody(ctx context.Context,
	rq Request, rsp Response) error

DoWithBody sends the Request and waits for Response.

The following Request fields are filled automatically:

  • Version, if zero, will be set to goipp.DefaultVersion
  • RequestID will be set to next Client's RequestID in sequence

On success, caller MUST close Response body after use.

func (*Client) GetPrinterAttributes

func (c *Client) GetPrinterAttributes(ctx context.Context,
	attrs []string, format string) (*PrinterAttributes, error)

GetPrinterAttributes returns printer attributes. The attrs attribute allows to specify list of requested attributes.

Note, certain printer attributes may depend on the format being printer, so second argument, if not "", allows to specify the desired document format.

According to the RFC8011, only the following attributes may depend on the document format:

  • Job Template attributes ("xxx-default", "xxx-supported", and "xxx-ready")
  • "pdl-override-supported"
  • "compression-supported"
  • "job-k-octets-supported"
  • "job-impressions-supported
  • "job-media-sheets-supported"
  • "printer-driver-installer"
  • "color-supported"
  • "reference-uri-schemes-supported"

See RFC8011, 4.2.5.1. for details.

func (*Client) SetDecoderOptions

func (c *Client) SetDecoderOptions(opt *DecoderOptions)

SetDecoderOptions updates the [DecoderrOptions] that affect decoding of the received IPP messages

type Color

type Color uint32

Color represents a traditional 32-bit alpha-premultiplied color with 8 bits per channel.

It has the following layout:

0xRRGGBBAA
   | | | |
   | | | `- Alpha
   | | `--- Blue
   | `----- Green
   `------- Red

For convenience, it implements a color.Color interface.

func (Color) RGBA

func (c Color) RGBA() (r, g, b, a uint32)

RGBA splits Color into separate channels, with 16 bits per channel

It implements color.Color interface.

type CreateJobRequest

type CreateJobRequest struct {
	ObjectRawAttrs
	RequestHeader

	// Operation attributes
	JobCreateOperation

	// Job attributes
	Job *JobAttributes
}

CreateJobRequest operation (0x0005) creates a new print Job. This operation requires that the document data is supplied by the client separately, using Send-Document or Send-URI operations.

func (*CreateJobRequest) Decode

func (rq *CreateJobRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CreateJobRequest from goipp.Message.

func (*CreateJobRequest) Encode

func (rq *CreateJobRequest) Encode() *goipp.Message

Encode encodes CreateJobRequest into the goipp.Message.

func (*CreateJobRequest) GetOp

func (rq *CreateJobRequest) GetOp() goipp.Op

GetOp returns CreateJobRequest IPP Operation code.

type CreateJobResponse

type CreateJobResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Unsupported attributes, if any
	UnsupportedAttributes goipp.Attributes

	// Job status
	Job *JobStatus
}

CreateJobResponse is the Create-Job response.

func (*CreateJobResponse) Decode

func (rsp *CreateJobResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes CreateJobResponse from goipp.Message.

func (*CreateJobResponse) Encode

func (rsp *CreateJobResponse) Encode() *goipp.Message

Encode encodes CreateJobResponse into goipp.Message.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder decodes [Object]s from the goipp.Attributes.

func NewDecoder

func NewDecoder(opt *DecoderOptions) *Decoder

NewDecoder creates the new Decoder. Of opt is nil, DefaultDecoderOptions will be used

func (*Decoder) Decode

func (dec *Decoder) Decode(obj Object, attrs goipp.Attributes) error

Decode decodes Object from the goipp.Attributes.

The obj parameter must be pointer to structure that implements the Object interface. Its codec will be generated on demand.

This function will panic, if codec cannot be generated.

func (*Decoder) DecodeSingle

func (dec *Decoder) DecodeSingle(obj Object, attr goipp.Attribute) error

DecodeSingle decodes (updates) a single attribute of the Object.

func (*Decoder) Errors

func (dec *Decoder) Errors() []error

Errors returns slice of decoder errors.

func (*Decoder) Free

func (dec *Decoder) Free()

Free returns Decoder into the sync.Pool of free decoders. Calling this function is not required, but recommended when decoder is not used anymore as an optimization.

type DecoderOptions

type DecoderOptions struct {
	// KeepTrying, if set, instructs decoder do not stop on
	// value decoding errors, but just skip problematic value
	// and continue.
	KeepTrying bool
}

DecoderOptions represent options used when Object is being decoded from the goipp.Attributes.

type DeviceAttributes

type DeviceAttributes struct {
	ObjectRawAttrs
	CUPSDeviceAttributesGroup

	DeviceClass        optional.Val[KwDeviceClass] `ipp:"device-class"`
	DeviceInfo         optional.Val[string]        `ipp:"device-info"`
	DeviceMakeAndModel optional.Val[string]        `ipp:"device-make-and-model"`
	DeviceURI          optional.Val[string]        `ipp:"device-uri"`
	DeviceID           optional.Val[string]        `ipp:"device-id"`
	DeviceLocation     optional.Val[string]        `ipp:"device-location"`
}

DeviceAttributes represents device attributes, as returned by the CUPS-Get-Devices request

type DocumentDescriptionGroup

type DocumentDescriptionGroup struct{}

DocumentDescriptionGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.DocumentDescription group.

type DocumentStatusGroup

type DocumentStatusGroup struct{}

DocumentStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.DocumentStatusGroup group.

type DocumentTemplateGroup

type DocumentTemplateGroup struct{}

DocumentTemplateGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.DocumentTemplate group.

type EnJobState

type EnJobState int

EnJobState represents "job-state" values.

See RFC8011, 5.3.7.

const (
	// EnJobStatePending means the job is candidate to start processing,
	// but not yet processing.
	EnJobStatePending EnJobState = 3

	// EnJobStatePendingHeld means the job is not candidate for processing
	// until hold is removed.
	EnJobStatePendingHeld EnJobState = 4

	// EnJobStateProcessing means the job is being processed.
	EnJobStateProcessing EnJobState = 5

	// EnJobStateProcessingStopped means the job processing has been stopped
	// for some reason.
	EnJobStateProcessingStopped EnJobState = 6

	// EnJobStateCanceled means the job has been canceled by the
	// Cancel-Job operation.
	EnJobStateCanceled EnJobState = 7

	// EnJobStateAborted means the job has been aborted by the system.
	EnJobStateAborted EnJobState = 8

	// EnJobStateCompleted means the job has been completed.
	EnJobStateCompleted EnJobState = 9
)

type EnPrinterType

type EnPrinterType int

EnPrinterType is the CUPS extension, bits of the "printer-type" printer attribute. Though used as a bitmap, from the IPP point of view it is defined as type2 enum

const (
	// Local printer or class
	EnPrinterLocal EnPrinterType = 0x0000

	// This is printer class, not individual printer
	EnPrinterClass EnPrinterType = 0x0001

	// This is remote printer or class
	EnPrinterRemote EnPrinterType = 0x0002

	// Printer can do B&W printing
	EnPrinterBW EnPrinterType = 0x0004

	// Printer can do color printing
	EnPrinterColor EnPrinterType = 0x0008

	// Printer can do two-sided printing
	EnPrinterDuplex EnPrinterType = 0x0010

	// Printer can staple output
	EnPrinterStaple EnPrinterType = 0x0020

	// Printer can do copies in hardware
	EnPrinterCopies EnPrinterType = 0x0040

	// Printer can quickly collate copies
	EnPrinterCollate EnPrinterType = 0x0080

	// Printer can punch output
	EnPrinterPunch EnPrinterType = 0x0100

	// Printer can cover output
	EnPrinterCover EnPrinterType = 0x0200

	// Printer can bind output
	EnPrinterBind EnPrinterType = 0x0400

	// Printer can sort output
	EnPrinterSort EnPrinterType = 0x0800

	// Letter/Legal/A4-size media
	EnPrinterSmall EnPrinterType = 0x1000

	// Tabloid/B/C/A3/A2-size media
	EnPrinterMedium EnPrinterType = 0x2000

	// D/E/A1/A0-size media
	EnPrinterLarge EnPrinterType = 0x4000

	// Can print on rolls and custom-size media
	EnPrinterVariable EnPrinterType = 0x8000

	// Default printer on network
	EnPrinterDefault EnPrinterType = 0x20000

	// It's a fax queue
	EnPrinterFax EnPrinterType = 0x40000

	// Printer is rejecting jobs
	EnPrinterRejecting EnPrinterType = 0x80000

	// Printer is not shared
	EnPrinterNotShared EnPrinterType = 0x200000

	// Printer requires authentication
	EnPrinterAuthenticated EnPrinterType = 0x400000

	// Printer supports maintenance commands
	EnPrinterCommands EnPrinterType = 0x800000

	// Printer was discovered
	EnPrinterDiscovered EnPrinterType = 0x1000000

	// Scanner-only device
	EnPrinterScanner EnPrinterType = 0x2000000

	// Printer with scanning capabilities
	EnPrinterMfp EnPrinterType = 0x4000000

	// 3D printer
	EnPrinter3D EnPrinterType = 0x8000000
)

EnPrinterType bits:

func (EnPrinterType) String

func (bits EnPrinterType) String() string

String returns string representation for EnPrinter3D

type ErrHTTP

type ErrHTTP struct {
	Status  int    // HTTP status
	Message string // Error message
}

ErrHTTP represents HTTP error. It consist of the HTTP status and message text. Implements error interface.

func NewErrHTTP

func NewErrHTTP(code int, msg string) *ErrHTTP

NewErrHTTP creates a new HTTP error. If msg is "", http.StatusText used instead.

func (*ErrHTTP) Error

func (e *ErrHTTP) Error() string

Error returns an error string. It implements [error] interface.

type ErrIPP

type ErrIPP struct {
	Version       goipp.Version // IPP version
	RequestID     uint32        // IPP Request ID
	Status        goipp.Status  // IPP status
	StatusMessage string        // Optional error message
}

ErrIPP represents IPP error that can be returned to the IPP client as the IPP error response.

It consist of the IPP status and optional message text. Implements [error] interface.

func NewErrIPPFromMessage

func NewErrIPPFromMessage(rq *goipp.Message, code goipp.Status,
	format string, args ...any) *ErrIPP

NewErrIPPFromMessage creates a new IPP error that can be sent as response to the goipp.Message.

func NewErrIPPFromRequest

func NewErrIPPFromRequest(rq Request, code goipp.Status,
	format string, args ...any) *ErrIPP

NewErrIPPFromRequest creates a new IPP error that can be sent as response to the decoded Request.

func (*ErrIPP) Encode

func (e *ErrIPP) Encode() *goipp.Message

Encode encodes ErrIPP into the goipp.Message.

func (*ErrIPP) Error

func (e *ErrIPP) Error() string

Error returns an error string. It implements [error] interface.

type EventNotificationsGroup

type EventNotificationsGroup struct{}

EventNotificationsGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.EventNotifications group.

type GetPrinterAttributesRequest

type GetPrinterAttributesRequest struct {
	ObjectRawAttrs
	RequestHeader
	OperationGroup

	// Operation attributes
	PrinterURI          string               `ipp:"printer-uri"`
	RequestedAttributes []string             `ipp:"requested-attributes"`
	DocumentFormat      optional.Val[string] `ipp:"document-format"`
}

GetPrinterAttributesRequest operation (0x000b) returns the requested printer attributes.

func (*GetPrinterAttributesRequest) Decode

Decode decodes GetPrinterAttributesRequest from goipp.Message.

func (*GetPrinterAttributesRequest) Encode

Encode encodes GetPrinterAttributesRequest into the goipp.Message.

func (*GetPrinterAttributesRequest) GetOp

func (rq *GetPrinterAttributesRequest) GetOp() goipp.Op

GetOp returns GetPrinterAttributesRequest IPP Operation code.

type GetPrinterAttributesResponse

type GetPrinterAttributesResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Names of unsupported attributes
	UnsupportedAttributes []string

	// Returned printer attributes
	Printer *PrinterAttributes
}

GetPrinterAttributesResponse is the CUPS-Get-Default Response.

func (*GetPrinterAttributesResponse) Decode

Decode decodes GetPrinterAttributesResponse from goipp.Message.

func (*GetPrinterAttributesResponse) Encode

Encode encodes GetPrinterAttributesResponse into goipp.Message.

type Handler

type Handler struct {
	Op goipp.Op
	// contains filtered or unexported fields
}

Handler is the IPP request handler. It implements http.Handler interface.

func NewHandler

func NewHandler[RQT any,
	RQ interface {
		*RQT
		Request
	}](f func(ctx context.Context, rq RQ) (*goipp.Message, error)) *Handler

NewHandler creates a new IPP handler from the function that consumes Request and returns the goipp.Message response:

func DoCUPSGetDefaultRequest(rq *CUPSGetDefaultRequest) *goipp.Message {
. . .
}

handler := NewHandler(DoCUPSGetDefaultRequest)

type JobAttributes

type JobAttributes struct {
	ObjectRawAttrs
	JobTemplateGroup

	// RFC8011, Internet Printing Protocol/1.1: Model and Semantics
	// 5.2 Job Template Attributes
	Copies                   optional.Val[int]                        `ipp:"copies"`
	Finishings               []int                                    `ipp:"finishings"`
	JobHoldUntil             optional.Val[KwJobHoldUntil]             `ipp:"job-hold-until"`
	JobPriority              optional.Val[int]                        `ipp:"job-priority"`
	JobSheets                optional.Val[KwJobSheets]                `ipp:"job-sheets"`
	Media                    optional.Val[KwMedia]                    `ipp:"media"`
	MultipleDocumentHandling optional.Val[KwMultipleDocumentHandling] `ipp:"multiple-document-handling"`
	NumberUp                 optional.Val[int]                        `ipp:"number-up"`
	OrientationRequested     optional.Val[int]                        `ipp:"orientation-requested"`
	PageRanges               []goipp.Range                            `ipp:"page-ranges"`
	PrinterResolution        optional.Val[goipp.Resolution]           `ipp:"printer-resolution"`
	PrintQuality             optional.Val[int]                        `ipp:"print-quality"`
	Sides                    optional.Val[KwSides]                    `ipp:"sides"`

	// PWG5100.2: IPP “output-bin” attribute extension
	OutputBin optional.Val[string] `ipp:"output-bin"`

	// PWG5100.7: IPP Job Extensions v2.1 (JOBEXT)
	// 6.8 Job Template Attributes
	JobDelayOutputUntil     optional.Val[KwJobDelayOutputUntil] `ipp:"job-delay-output-until"`
	JobDelayOutputUntilTime optional.Val[time.Time]             `ipp:"job-delay-output-until-time"`
	JobHoldUntilTime        optional.Val[time.Time]             `ipp:"job-hold-until-time"`
	JobAccountID            optional.Val[string]                `ipp:"job-account-id"`
	JobAccountingUserID     optional.Val[string]                `ipp:"job-accounting-user-id"`
	JobCancelAfter          optional.Val[int]                   `ipp:"job-cancel-after"`
	JobRetainUntil          optional.Val[string]                `ipp:"job-retain-until"`
	JobRetainUntilInterval  optional.Val[int]                   `ipp:"job-retain-until-interval"`
	JobRetainUntilTime      optional.Val[time.Time]             `ipp:"job-retain-until-time"`
	JobSheetMessage         optional.Val[string]                `ipp:"job-sheet-message"`
	JobSheetsCol            JobSheets                           `ipp:"job-sheets-col"`
	PrintContentOptimize    optional.Val[string]                `ipp:"print-content-optimize"`

	// PWG5100.11: IPP Job and Printer Extensions – Set 2 (JPS2)
	// 7 Job Template Attributes
	FeedOrientation  optional.Val[string] `ipp:"feed-orientation"`
	JobPhoneNumber   optional.Val[string] `ipp:"job-phone-number"`
	JobRecipientName optional.Val[string] `ipp:"job-recipient-name"`

	// PWG5100.13: IPP Driver Replacement Extensions v2.0 (NODRIVER)
	// 6.2 Job and Document Template Attributes
	JobErrorAction       optional.Val[string] `ipp:"job-error-action"`
	MediaOverprint       MediaOverprint       `ipp:"media-overprint"`
	PrintColorMode       optional.Val[string] `ipp:"print-color-mode"`
	PrintRenderingIntent optional.Val[string] `ipp:"print-rendering-intent"`
	PrintScaling         optional.Val[string] `ipp:"print-scaling"`

	// Wi-Fi Peer-to-Peer Services Print (P2Ps-Print)
	// Technical Specification
	// (for Wi-Fi Direct® services certification)
	PclmSourceResolution optional.Val[goipp.Resolution] `ipp:"pclm-source-resolution"`
}

JobAttributes are attributes, supplied with Job creation request

func DecodeJobAttributes

func DecodeJobAttributes(attrs goipp.Attributes, opt *DecoderOptions) (
	*JobAttributes, error)

DecodeJobAttributes decodes JobAttributes from goipp.Attributes.

type JobCreateOperation

type JobCreateOperation struct {
	OperationGroup

	PrinterURI              string               `ipp:"printer-uri"`
	RequestingUserName      optional.Val[string] `ipp:"requesting-user-name"`
	Compression             optional.Val[string] `ipp:"compression"`
	DocumentFormat          optional.Val[string] `ipp:"document-format"`
	DocumentName            optional.Val[string] `ipp:"document-name"`
	DocumentNaturalLanguage optional.Val[string] `ipp:"document-natural-language"`
	IppAttributeFidelity    optional.Val[bool]   `ipp:"ipp-attribute-fidelity"`
	JobImpressions          optional.Val[int]    `ipp:"job-impressions"`
	JobKOctets              optional.Val[int]    `ipp:"job-k-octets"`
	JobMediaSheets          optional.Val[int]    `ipp:"job-media-sheets"`
	JobName                 optional.Val[string] `ipp:"job-name"`
}

JobCreateOperation contains operation attributes common for the job creation requests.

type JobDescriptionGroup

type JobDescriptionGroup struct{}

JobDescriptionGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.JobDescriptionGroup group.

type JobPresets

type JobPresets struct {
	PresetCategory string `ipp:"preset-category"`
	PresetName     string `ipp:"preset-name"`
	JobAttributes
}

JobPresets represents "job-presets-supported" collection entry in PrinterDescription

type JobSheets

type JobSheets struct {
	JobSheets KwJobSheets `ipp:"job-sheets"`
	Media     string      `ipp:"media"`
	MediaCol  MediaCol    `ipp:"media-col"`
}

JobSheets represents "job-sheets-col" collection entry in JobAttributes

type JobStatus

type JobStatus struct {
	ObjectRawAttrs

	JobDescriptionGroup
	JobStatusGroup

	JobID                   int                  `ipp:"job-id"`
	JobImpressionsCompleted optional.Val[int]    `ipp:"job-impressions-completed"`
	JobMediaSheetsCompleted optional.Val[int]    `ipp:"job-media-sheets-completed"`
	JobName                 optional.Val[string] `ipp:"job-name"`
	JobOriginatingUserName  optional.Val[string] `ipp:"job-originating-user-name"`
	JobState                EnJobState           `ipp:"job-state"`
	JobStateMessage         optional.Val[string] `ipp:"job-state-message"`
	JobStateReasons         []KwJobStateReasons  `ipp:"job-state-reasons"`
	JobURI                  string               `ipp:"job-uri"`
}

JobStatus contains Job status attributes

func DecodeJobStatusAttributes

func DecodeJobStatusAttributes(attrs goipp.Attributes, opt *DecoderOptions) (
	*JobStatus, error)

DecodeJobStatusAttributes decodes JobStatus from goipp.Attributes.

type JobStatusGroup

type JobStatusGroup struct{}

JobStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.JobStatus group.

type JobTemplate

type JobTemplate struct {
	// RFC8011, Internet Printing Protocol/1.1: Model and Semantics
	// 5.2 Job Template Attributes
	CopiesDefault                     optional.Val[int]                        `ipp:"copies-default"`
	CopiesSupported                   optional.Val[goipp.Range]                `ipp:"copies-supported"`
	FinishingsDefault                 []int                                    `ipp:"finishings-default"`
	FinishingsSupported               []int                                    `ipp:"finishings-supported"`
	JobHoldUntilDefault               optional.Val[KwJobHoldUntil]             `ipp:"job-hold-until-default"`
	JobHoldUntilSupported             []KwJobHoldUntil                         `ipp:"job-hold-until-supported"`
	JobPriorityDefault                optional.Val[int]                        `ipp:"job-priority-default"`
	JobPrioritySupported              optional.Val[int]                        `ipp:"job-priority-supported"`
	JobSheetsDefault                  []KwJobSheets                            `ipp:"job-sheets-default"`
	JobSheetsSupported                []KwJobSheets                            `ipp:"job-sheets-supported"`
	MediaDefault                      optional.Val[KwMedia]                    `ipp:"media-default"`
	MediaReady                        []KwMedia                                `ipp:"media-ready"`
	MediaSupported                    []KwMedia                                `ipp:"media-supported"`
	MultipleDocumentHandlingDefault   optional.Val[KwMultipleDocumentHandling] `ipp:"multiple-document-handling-default"`
	MultipleDocumentHandlingSupported []KwMultipleDocumentHandling             `ipp:"multiple-document-handling-supported"`
	NumberUpDefault                   optional.Val[int]                        `ipp:"number-up-default"`
	NumberUpSupported                 []goipp.IntegerOrRange                   `ipp:"number-up-supported"`
	OrientationRequestedDefault       optional.Val[int]                        `ipp:"orientation-requested-default"`
	OrientationRequestedSupported     []int                                    `ipp:"orientation-requested-supported"`
	PageRangesSupported               optional.Val[bool]                       `ipp:"page-ranges-supported"`
	PrinterResolutionDefault          optional.Val[goipp.Resolution]           `ipp:"printer-resolution-default"`
	PrinterResolutionSupported        []goipp.Resolution                       `ipp:"printer-resolution-supported"`
	PrintQualityDefault               optional.Val[int]                        `ipp:"print-quality-default"`
	PrintQualitySupported             []int                                    `ipp:"print-quality-supported"`
	SidesDefault                      optional.Val[KwSides]                    `ipp:"sides-default"`
	SidesSupported                    []KwSides                                `ipp:"sides-supported"`

	// PWG5100.2: IPP “output-bin” attribute extension
	OutputBinDefault   optional.Val[string] `ipp:"output-bin-default"`
	OutputBinSupported []string             `ipp:"output-bin-supported"`

	// PWG5100.7: IPP Job Extensions v2.1 (JOBEXT)
	// 6.9 Printer Description Attributes
	JobAccountIDDefault              optional.Val[string]                `ipp:"job-account-id-default"`
	JobAccountIDSupported            optional.Val[bool]                  `ipp:"job-account-id-supported"`
	JobAccountingUserIDDefault       optional.Val[string]                `ipp:"job-accounting-user-id-default"`
	JobAccountingUserIDSupported     optional.Val[bool]                  `ipp:"job-accounting-user-id-supported"`
	JobCancelAfterDefault            optional.Val[int]                   `ipp:"job-cancel-after-default"`
	JobCancelAfterSupported          optional.Val[goipp.Range]           `ipp:"job-cancel-after-supported"`
	JobDelayOutputUntilDefault       optional.Val[KwJobDelayOutputUntil] `ipp:"job-delay-output-until-default"`
	JobDelayOutputUntilSupported     []KwJobDelayOutputUntil             `ipp:"job-delay-output-until-supported"`
	JobDelayOutputUntilTimeSupported optional.Val[goipp.Range]           `ipp:"job-delay-output-until-time-supported"`
	JobHoldUntilTimeSupported        optional.Val[bool]                  `ipp:"job-hold-until-time-supported"`
	JobRetainUntilDefault            optional.Val[string]                `ipp:"job-retain-until-default"`
	JobRetainUntilIntervalDefault    optional.Val[int]                   `ipp:"job-retain-until-interval-default"`
	JobRetainUntilIntervalSupported  optional.Val[goipp.Range]           `ipp:"job-retain-until-interval-supported"`
	JobRetainUntilSupported          []string                            `ipp:"job-retain-until-supported"`
	JobRetainUntilTimeSupported      optional.Val[goipp.Range]           `ipp:"job-retain-until-time-supported"`
	JobSheetsColDefault              optional.Val[JobSheets]             `ipp:"job-sheets-col-default"`
	JobSheetsColSupported            []string                            `ipp:"job-sheets-col-supported"`
	PrintContentOptimizeDefault      optional.Val[string]                `ipp:"print-content-optimize-default"`
	PrintContentOptimizeSupported    []string                            `ipp:"print-content-optimize-supported"`

	// PWG5100.11: IPP Job and Printer Extensions – Set 2 (JPS2)
	// 7 Job Template Attributes
	FeedOrientationDefault               optional.Val[string] `ipp:"feed-orientation-default"`
	FeedOrientationSupported             string               `ipp:"feed-orientation-supported"`
	JobPhoneNumberDefault                optional.Val[string] `ipp:"job-phone-number-default"`
	JobPhoneNumberSupported              optional.Val[bool]   `ipp:"job-phone-number-supported"`
	JobRecipientNameDefault              optional.Val[string] `ipp:"job-recipient-name-default"`
	JobRecipientNameSupported            optional.Val[bool]   `ipp:"job-recipient-name-supported"`
	PdlInitFileEntrySupported            []string             `ipp:"pdl-init-file-entry-supported"`
	PdlInitFileNameSubdirectorySupported optional.Val[bool]   `ipp:"pdl-init-file-name-subdirectory-supported"`
	PdlInitFileNameSupported             []string             `ipp:"pdl-init-file-name-supported"`
	PdlInitFileSupported                 []string             `ipp:"pdl-init-file-supported"`
	PrintProcessingAttributesSupported   []string             `ipp:"print-processing-attributes-supported"`
	SaveDispositionSupported             []string             `ipp:"save-disposition-supported"`
	SaveDocumentFormatDefault            optional.Val[string] `ipp:"save-document-format-default"`
	SaveDocumentFormatSupported          []string             `ipp:"save-document-format-supported"`
	SaveLocationDefault                  optional.Val[string] `ipp:"save-location-default"`
	SaveLocationSupported                []string             `ipp:"save-location-supported"`
	SaveNameSubdirectorySupported        optional.Val[bool]   `ipp:"save-name-subdirectory-supported"`
	SaveNameSupported                    optional.Val[bool]   `ipp:"save-name-supported"`

	// PWG5100.13: IPP Driver Replacement Extensions v2.0 (NODRIVER)
	// 6.2 Job and Document Template Attributes
	// 6.5 Printer Description Attributes
	JobErrorActionDefault           optional.Val[string]         `ipp:"job-error-action-default"`
	JobErrorActionSupported         []string                     `ipp:"job-error-action-supported"`
	MediaOverprintDefault           optional.Val[MediaOverprint] `ipp:"media-overprint-default"`
	MediaOverprintDistanceSupported optional.Val[goipp.Range]    `ipp:"media-overprint-distance-supported"`
	MediaOverprintMethodSupported   []string                     `ipp:"media-overprint-method-supported"`
	MediaOverprintSupported         []string                     `ipp:"media-overprint-supported"`
	PrintColorModeDefault           optional.Val[string]         `ipp:"print-color-mode-default"`
	PrintColorModeSupported         []string                     `ipp:"print-color-mode-supported"`
	PrinterMandatoryJobAttributes   []string                     `ipp:"printer-mandatory-job-attributes"`
	PrintRenderingIntentDefault     optional.Val[string]         `ipp:"print-rendering-intent-default"`
	PrintRenderingIntentSupported   []string                     `ipp:"print-rendering-intent-supported"`
	PrintScalingDefault             optional.Val[string]         `ipp:"print-scaling-default"`
	PrintScalingSupported           []string                     `ipp:"print-scaling-supported"`

	// Wi-Fi Peer-to-Peer Services Print (P2Ps-Print)
	// Technical Specification
	// (for Wi-Fi Direct® services certification)
	PclmSourceResolutionDefault   optional.Val[goipp.Resolution] `ipp:"pclm-source-resolution-default"`
	PclmSourceResolutionSupported []goipp.Resolution             `ipp:"pclm-source-resolution-supported"`
}

JobTemplate are attributes, included into the Printer Description and describing possible settings for JobAttributes

type JobTemplateGroup

type JobTemplateGroup struct{}

JobTemplateGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.JobTemplate group.

type KwColor

type KwColor string

KwColor represents a standard color name PWG5101.1: 4. Color Names

const (
	KwColorNoColor        KwColor = "no-color"
	KwColorBlack          KwColor = "black"
	KwColorClearBlack     KwColor = "clear-black"
	KwColorLightBlack     KwColor = "light-black"
	KwColorBlue           KwColor = "blue"
	KwColorClearBlue      KwColor = "clear-blue"
	KwColorDarkBlue       KwColor = "dark-blue"
	KwColorLightBlue      KwColor = "light-blue"
	KwColorBrown          KwColor = "brown"
	KwColorClearBrown     KwColor = "clear-brown"
	KwColorDarkBrown      KwColor = "dark-brown"
	KwColorLightBrown     KwColor = "light-brown"
	KwColorBuff           KwColor = "buff"
	KwColorClearBuff      KwColor = "clear-buff"
	KwColorDarkBuff       KwColor = "dark-buff"
	KwColorLightBuff      KwColor = "light-buff"
	KwColorCyan           KwColor = "cyan"
	KwColorClearCyan      KwColor = "clear-cyan"
	KwColorDarkCyan       KwColor = "dark-cyan"
	KwColorLightCyan      KwColor = "light-cyan"
	KwColorGold           KwColor = "gold"
	KwColorClearGold      KwColor = "clear-gold"
	KwColorDarkGold       KwColor = "dark-gold"
	KwColorLightGold      KwColor = "light-gold"
	KwColorGoldenrod      KwColor = "goldenrod"
	KwColorClearGoldenrod KwColor = "clear-goldenrod"
	KwColorDarkGoldenrod  KwColor = "dark-goldenrod"
	KwColorLightGoldenrod KwColor = "light-goldenrod"
	KwColorGray           KwColor = "gray"
	KwColorClearGray      KwColor = "clear-gray"
	KwColorDarkGray       KwColor = "dark-gray"
	KwColorLightGray      KwColor = "light-gray"
	KwColorGreen          KwColor = "green"
	KwColorClearGreen     KwColor = "clear-green"
	KwColorDarkGreen      KwColor = "dark-green"
	KwColorLightGreen     KwColor = "light-green"
	KwColorIvory          KwColor = "ivory"
	KwColorClearIvory     KwColor = "clear-ivory"
	KwColorDarkIvory      KwColor = "dark-ivory"
	KwColorLightIvory     KwColor = "light-ivory"
	KwColorMagenta        KwColor = "magenta"
	KwColorClearMagenta   KwColor = "clear-magenta"
	KwColorDarkMagenta    KwColor = "dark-magenta"
	KwColorLightMagenta   KwColor = "light-magenta"
	KwColorMustard        KwColor = "mustard"
	KwColorClearMustard   KwColor = "clear-mustard"
	KwColorDarkMustard    KwColor = "dark-mustard"
	KwColorLightMustard   KwColor = "light-mustard"
	KwColorOrange         KwColor = "orange"
	KwColorClearOrange    KwColor = "clear-orange"
	KwColorDarkOrange     KwColor = "dark-orange"
	KwColorLightOrange    KwColor = "light-orange"
	KwColorPink           KwColor = "pink"
	KwColorClearPink      KwColor = "clear-pink"
	KwColorDarkPink       KwColor = "dark-pink"
	KwColorLightPink      KwColor = "light-pink"
	KwColorRed            KwColor = "red"
	KwColorClearRed       KwColor = "clear-red"
	KwColorDarkRed        KwColor = "dark-red"
	KwColorLightRed       KwColor = "light-red"
	KwColorSilver         KwColor = "silver"
	KwColorClearSilver    KwColor = "clear-silver"
	KwColorDarkSilver     KwColor = "dark-silver"
	KwColorLightSilver    KwColor = "light-silver"
	KwColorTurquoise      KwColor = "turquoise"
	KwColorClearTurquoise KwColor = "clear-turquoise"
	KwColorDarkTurquoise  KwColor = "dark-turquoise"
	KwColorLightTurquoise KwColor = "light-turquoise"
	KwColorViolet         KwColor = "violet"
	KwColorClearViolet    KwColor = "clear-violet"
	KwColorDarkViolet     KwColor = "dark-violet"
	KwColorLightViolet    KwColor = "light-violet"
	KwColorWhite          KwColor = "white"
	KwColorClearWhite     KwColor = "clear-white"
	KwColorYellow         KwColor = "yellow"
	KwColorClearYellow    KwColor = "clear-yellow"
	KwColorDarkYellow     KwColor = "dark-yellow"
	KwColorLightYellow    KwColor = "light-yellow`"
)

Standard values for KwColor

func (KwColor) LocalizedName

func (cn KwColor) LocalizedName() string

LocalizedName returns Localized Name for standard colors.

If color is not known, the empty string ("") will be returned.

type KwCompression

type KwCompression string

KwCompression represents standard keyword values for compression.

See RFC8011, 5.4.32.

const (
	// KwCompressionNone is no compression
	KwCompressionNone KwCompression = "none"

	// KwCompressionDeflate is RFC1951 ZIP inflate/deflate
	KwCompressionDeflate KwCompression = "deflate"

	// KwCompressionGzip is RFC1952 GNU zip
	KwCompressionGzip KwCompression = "gzip"

	// KwCompressionCompress is RFC1977 UNIX compression
	KwCompressionCompress KwCompression = "compress"
)

type KwDeviceClass

type KwDeviceClass string

KwDeviceClass represents known values of the CUPS' "device-class" attribute, used by CUPS-Get-Devices.

See CUPS Implementation of IPP for details.

const (
	// KwDeviceClassFile is a disk file.
	KwDeviceClassFile KwDeviceClass = "file"

	// KwDeviceClassDirect is a directly connected device, i.e.,
	// parallel or fixed-rate serial port, Centronics, IEEE-1284,
	// and USB printer ports.
	KwDeviceClassDirect KwDeviceClass = "direct"

	// KwDeviceClassSerial is a variable-rate serial port.
	KwDeviceClassSerial KwDeviceClass = "serial"

	// KwDeviceClassNetwork is a network connection, typically via
	// AppSocket, HTTP, IPP, LPD, or SMB/CIFS protocols.
	//
	// As a special exception, IPP over USB also belongs to this
	// class, because this protocol uses a pseudo-network connection.
	KwDeviceClassNetwork KwDeviceClass = "network"
)

type KwJobDelayOutputUntil

type KwJobDelayOutputUntil string

KwJobDelayOutputUntil represents standard keyword values for "job-delay-output-until" attribute.

See PWG5100.7, 6.8.4.

const (
	// KwJobDelayOutputUntilDayTime means delay output until daylight,
	// typically 6am to 6pm.
	KwJobDelayOutputUntilDayTime KwJobDelayOutputUntil = "day-time"

	// KwJobDelayOutputUntilEvening means delay output until the evening,
	// typically from 6pm to 12am.
	KwJobDelayOutputUntilEvening KwJobDelayOutputUntil = "evening"

	// KwJobDelayOutputUntilIndefinite means delay output indefinitely;
	// the time period can be changed using the Set- Job-Attributes
	// operation
	KwJobDelayOutputUntilIndefinite KwJobDelayOutputUntil = "indefinite"

	// KwJobDelayOutputUntilNight means delay output until the night,
	// typically from 12am to 6am.
	KwJobDelayOutputUntilNight KwJobDelayOutputUntil = "night"

	// KwJobDelayOutputUntilNoDelayOutput means do not delay the output.
	KwJobDelayOutputUntilNoDelayOutput KwJobDelayOutputUntil = "no-delay-output"

	// KwJobDelayOutputUntilSecondShift means delay output until the
	// second work shift, typically from 4pm to 12am.
	KwJobDelayOutputUntilSecondShift KwJobDelayOutputUntil = "second-shift"

	// KwJobDelayOutputUntilThirdShift means delay output until the
	// third work shift, typically from 12am to 8am.
	KwJobDelayOutputUntilThirdShift KwJobDelayOutputUntil = "third-shift"

	// KwJobDelayOutputUntilWeekend means delay output until the weekend.
	KwJobDelayOutputUntilWeekend KwJobDelayOutputUntil = "weekend"
)

type KwJobHoldUntil

type KwJobHoldUntil string

KwJobHoldUntil represents standard keyword values for "job-hold-until" attribute.

See PWG5100.7, 5.2.2.

const (
	// KwJobHoldUntilNoHold means do not delay the output.
	KwJobHoldUntilNoHold KwJobHoldUntil = "no-hold"

	// KwJobHoldUntilIndefinite means delay output indefinitely;
	// the time period can be changed using the Set- Job-Attributes
	// operation
	KwJobHoldUntilIndefinite KwJobHoldUntil = "indefinite"

	// KwJobHoldUntilDayTime means delay output until daylight,
	// typically 6am to 6pm.
	KwJobHoldUntilDayTime KwJobHoldUntil = "day-time"

	// KwJobHoldUntilEvening means delay output until the evening,
	// typically from 6pm to 12am.
	KwJobHoldUntilEvening KwJobHoldUntil = "evening"

	// KwJobHoldUntilNight means delay output until the night,
	// typically from 12am to 6am.
	KwJobHoldUntilNight KwJobHoldUntil = "night"

	// KwJobHoldUntilWeekend means delay output until the weekend.
	KwJobHoldUntilWeekend KwJobHoldUntil = "weekend"

	// KwJobHoldUntilSecondShift means delay output until the
	// second work shift, typically from 4pm to 12am.
	KwJobHoldUntilSecondShift KwJobHoldUntil = "second-shift"

	// KwJobHoldUntilThirdShift means delay output until the
	// third work shift, typically from 12am to 8am.
	KwJobHoldUntilThirdShift KwJobHoldUntil = "third-shift"
)

type KwJobSheets

type KwJobSheets string

KwJobSheets represents standard keyword values for "job-sheets" attribute.

See: RFC8011, 5.2.3., PWG5100.7, 8.1.

const (

	// KwJobSheetsNone means no Job sheet is printed
	KwJobSheetsNone KwJobSheets = "none"

	// KwJobSheetsStandard means one or more site-specific
	// standard Job sheets are printed
	KwJobSheetsStandard KwJobSheets = "standard"

	// KwJobSheetsJobStartSheet means that a ob Sheet is printed to
	// indicate the start of the Job.
	KwJobSheetsJobStartSheet KwJobSheets = "job-start-sheet "

	// KwJobSheetsJobEndSheet means that a ob Sheet is printed to
	// indicate the end of the Job.
	KwJobSheetsJobEndSheet KwJobSheets = "job-end-sheet"

	// KwJobSheetsJobBothSheets instructs Printer to print
	// Job Sheets o indicate the start and end of all the
	// output associated with the Job.
	KwJobSheetsJobBothSheets KwJobSheets = "job-both-sheets"

	// KwJobSheetsFirstPrintStreamPage instructs Printer to print the
	// first input Page in the Document Data as the Job Sheet.
	// The Printer's standard Job Sheet is suppressed.
	KwJobSheetsFirstPrintStreamPage KwJobSheets = "first-print-stream-page"
)

type KwJobSpooling

type KwJobSpooling string

KwJobSpooling represents standard keyword values for "job-spooling-supported" attribute.

See PWG5100.7, 6.9.31.

const (
	// KwJobSpoolingAutomatic means that it is up to the
	// Printer when to process the Document data.
	KwJobSpoolingAutomatic KwJobSpooling = "automatic"

	// KwJobSpoolingSpool means that the Document data is
	// processed after it has been spooled (stored).
	KwJobSpoolingSpool KwJobSpooling = "spool"

	// KwJobSpoolingStream means that the Document data is
	// processed as it is received.
	KwJobSpoolingStream KwJobSpooling = "stream"
)

type KwJobStateReasons

type KwJobStateReasons string

KwJobStateReasons represents standard keyword values for "job-state-reasons" attribute.

RFC8011: 5.3.8.

const (
	// rfc3998: 9.1.
	KwJobStateReasonsJobSuspended KwJobStateReasons = "job-suspended"

	// RFC8011: 5.3.8.
	KwJobStateReasonsNone KwJobStateReasons = "none"

	KwJobStateReasonsAbortedBySystem           KwJobStateReasons = "aborted-by-system"
	KwJobStateReasonsCompressionError          KwJobStateReasons = "compression-error"
	KwJobStateReasonsDocumentAccessError       KwJobStateReasons = "document-access-error"
	KwJobStateReasonsDocumentFormatError       KwJobStateReasons = "document-format-error"
	KwJobStateReasonsJobCanceledAtDevice       KwJobStateReasons = "job-canceled-at-device"
	KwJobStateReasonsJobCanceledByOperator     KwJobStateReasons = "job-canceled-by-operator"
	KwJobStateReasonsJobCanceledByUser         KwJobStateReasons = "job-canceled-by-user"
	KwJobStateReasonsJobCompletedSuccessfully  KwJobStateReasons = "job-completed-successfully"
	KwJobStateReasonsJobCompletedWithErrors    KwJobStateReasons = "job-completed-with-errors"
	KwJobStateReasonsJobCompletedWithWarnings  KwJobStateReasons = "job-completed-with-warnings"
	KwJobStateReasonsJobDataInsufficient       KwJobStateReasons = "job-data-insufficient"
	KwJobStateReasonsJobHoldUntilSpecified     KwJobStateReasons = "job-hold-until-specified"
	KwJobStateReasonsJobIncoming               KwJobStateReasons = "job-incoming"
	KwJobStateReasonsJobInterpreting           KwJobStateReasons = "job-interpreting"
	KwJobStateReasonsJobOutgoing               KwJobStateReasons = "job-outgoing"
	KwJobStateReasonsJobPrinting               KwJobStateReasons = "job-printing"
	KwJobStateReasonsJobQueuedForMarker        KwJobStateReasons = "job-queued-for-marker"
	KwJobStateReasonsJobQueued                 KwJobStateReasons = "job-queued"
	KwJobStateReasonsJobRestartable            KwJobStateReasons = "job-restartable"
	KwJobStateReasonsJobTransforming           KwJobStateReasons = "job-transforming"
	KwJobStateReasonsPrinterStoppedPartly      KwJobStateReasons = "printer-stopped-partly"
	KwJobStateReasonsPrinterStopped            KwJobStateReasons = "printer-stopped"
	KwJobStateReasonsProcessingToStopPoint     KwJobStateReasons = "processing-to-stop-point"
	KwJobStateReasonsQueuedInDevice            KwJobStateReasons = "queued-in-device"
	KwJobStateReasonsResourcesAreNotReady      KwJobStateReasons = "resources-are-not-ready"
	KwJobStateReasonsServiceOffLine            KwJobStateReasons = "service-off-line"
	KwJobStateReasonsSubmissionInterrupted     KwJobStateReasons = "submission-interrupted"
	KwJobStateReasonsUnsupportedCompression    KwJobStateReasons = "unsupported-compression"
	KwJobStateReasonsUnsupportedDocumentFormat KwJobStateReasons = "unsupported-document-format"

	// PWG5100.3: 6.1
	KwJobStateReasonsResourcesAreNotSupported KwJobStateReasons = "resources-are-not-supported"

	// PWG5100.7: 8.2, 11.1.
	KwJobStateReasonsDigitalSignatureDidNotVerify     KwJobStateReasons = "digital-signature-did-not-verify"
	KwJobStateReasonsDigitalSignatureTypeNotSupported KwJobStateReasons = "digital-signature-type-not-supported"
	KwJobStateReasonsErrorsDetected                   KwJobStateReasons = "errors-detected"
	KwJobStateReasonsJobDelayOutputUntilSpecified     KwJobStateReasons = "job-delay-output-until-specified"
	KwJobStateReasonsJobDigitalSignatureWait          KwJobStateReasons = "job-digital-signature-wait"
	KwJobStateReasonsJobSpooling                      KwJobStateReasons = "job-spooling"
	KwJobStateReasonsJobStreaming                     KwJobStateReasons = "job-streaming"
	KwJobStateReasonsWarningsDetected                 KwJobStateReasons = "warnings-detected"

	// PWG5100.11: 11.3.
	KwJobStateReasonsjobPasswordWait        KwJobStateReasons = "job-password-wait"
	KwJobStateReasonsjobPrintedSuccessfully KwJobStateReasons = "job-printed-successfully"
	KwJobStateReasonsjobPrintedWithErrors   KwJobStateReasons = "job-printed-with-errors"
	KwJobStateReasonsjobPrintedWithWarnings KwJobStateReasons = "job-printed-with-warnings"
	KwJobStateReasonsjobResuming            KwJobStateReasons = "job-resuming"
	KwJobStateReasonsjobSavedSuccessfully   KwJobStateReasons = "job-saved-successfully"
	KwJobStateReasonsjobSavedWithErrors     KwJobStateReasons = "job-saved-with-errors"
	KwJobStateReasonsjobSavedWithWarnings   KwJobStateReasons = "job-saved-with-warnings"
	KwJobStateReasonsjobSaving              KwJobStateReasons = "job-saving"
	KwJobStateReasonsjobSuspendedByOperator KwJobStateReasons = "job-suspended-by-operator"
	KwJobStateReasonsjobSuspendedBySystem   KwJobStateReasons = "job-suspended-by-system"
	KwJobStateReasonsjobSuspendedByUser     KwJobStateReasons = "job-suspended-by-user"
	KwJobStateReasonsjobSuspending          KwJobStateReasons = "job-suspending"

	// PWG5100.13: 9.1.
	KwJobStateReasonsDocumentPasswordError    KwJobStateReasons = "document-password-error"
	KwJobStateReasonsDocumentPermissionError  KwJobStateReasons = "document-permission-error"
	KwJobStateReasonsDocumentSecurityError    KwJobStateReasons = "document-security-error"
	KwJobStateReasonsDocumentUnprintableError KwJobStateReasons = "document-unprintable-error"

	// PWG5100.15: 8.2
	KwJobStateReasonsConnectedToDestination    KwJobStateReasons = "connected-to-destination"
	KwJobStateReasonsConnectingToDestination   KwJobStateReasons = "connecting-to-destination"
	KwJobStateReasonsDestinationURIFailed      KwJobStateReasons = "destination-uri-failed"
	KwJobStateReasonsFaxModemCarrierLost       KwJobStateReasons = "fax-modem-carrier-lost"
	KwJobStateReasonsFaxModemEquipmentFailure  KwJobStateReasons = "fax-modem-equipment-failure"
	KwJobStateReasonsFaxModemInactivityTimeout KwJobStateReasons = "fax-modem-inactivity-timeout"
	KwJobStateReasonsFaxModemLineBusy          KwJobStateReasons = "fax-modem-line-busy"
	KwJobStateReasonsFaxModemNoAnswer          KwJobStateReasons = "fax-modem-no-answer"
	KwJobStateReasonsFaxModemNoDialTone        KwJobStateReasons = "fax-modem-no-dial-tone"
	KwJobStateReasonsFaxModemProtocolError     KwJobStateReasons = "fax-modem-protocol-error"
	KwJobStateReasonsFaxModemTrainingFailure   KwJobStateReasons = "fax-modem-training-failure"
	KwJobStateReasonsFaxModemVoiceDetected     KwJobStateReasons = "fax-modem-voice-detected"
	KwJobStateReasonsJobTransferring           KwJobStateReasons = "job-transferring"

	// PWG5100.16: 8.1
	KwJobStateReasonsAccountAuthorizationFailed    KwJobStateReasons = "account-authorization-failed"
	KwJobStateReasonsAccountClosed                 KwJobStateReasons = "account-closed"
	KwJobStateReasonsAccountInfoNeeded             KwJobStateReasons = "account-info-needed"
	KwJobStateReasonsAccountLimitReached           KwJobStateReasons = "account-limit-reached"
	KwJobStateReasonsConflictingAttributes         KwJobStateReasons = "conflicting-attributes"
	KwJobStateReasonsJobHeldForReview              KwJobStateReasons = "job-held-for-review"
	KwJobStateReasonsJobReleaseWait                KwJobStateReasons = "job-release-wait"
	KwJobStateReasonsUnsupportedAttributesOrValues KwJobStateReasons = "unsupported-attributes-or-values"

	// PWG5100.17: 9.3.
	KwJobStateReasonsWaitingForUserAction KwJobStateReasons = "waiting-for-user-action"

	// PWG5100.18: 9.4.
	KwJobStateReasonsJobFetchable KwJobStateReasons = "job-fetchable"
)

Standard values for KwJobStateReasons attribute.

type KwMedia

type KwMedia string

KwMedia represents standard media size. Used in many places

const (
	KwMediaAsmeF                 KwMedia = "asme_f_28x40in"
	KwMediaIso2a0                KwMedia = "iso_2a0_1189x1682mm"
	KwMediaIsoA0                 KwMedia = "iso_a0_841x1189mm"
	KwMediaIsoA1                 KwMedia = "iso_a1_594x841mm"
	KwMediaIsoA1x3               KwMedia = "iso_a1x3_841x1783mm"
	KwMediaIsoA1x4               KwMedia = "iso_a1x4_841x2378mm"
	KwMediaIsoA2                 KwMedia = "iso_a2_420x594mm"
	KwMediaIsoA2x3               KwMedia = "iso_a2x3_594x1261mm"
	KwMediaIsoA2x4               KwMedia = "iso_a2x4_594x1682mm"
	KwMediaIsoA2x5               KwMedia = "iso_a2x5_594x2102mm"
	KwMediaIsoA3Extra            KwMedia = "iso_a3-extra_322x445mm"
	KwMediaIsoA3                 KwMedia = "iso_a3_297x420mm"
	KwMediaIsoA0x3               KwMedia = "iso_a0x3_1189x2523mm"
	KwMediaIsoA3x3               KwMedia = "iso_a3x3_420x891mm"
	KwMediaIsoA3x4               KwMedia = "iso_a3x4_420x1189mm"
	KwMediaIsoA3x5               KwMedia = "iso_a3x5_420x1486mm"
	KwMediaIsoA3x6               KwMedia = "iso_a3x6_420x1783mm"
	KwMediaIsoA3x7               KwMedia = "iso_a3x7_420x2080mm"
	KwMediaIsoA4Extra            KwMedia = "iso_a4-extra_235.5x322.3mm"
	KwMediaIsoA4Tab              KwMedia = "iso_a4-tab_225x297mm"
	KwMediaIsoA4                 KwMedia = "iso_a4_210x297mm"
	KwMediaIsoA4x3               KwMedia = "iso_a4x3_297x630mm"
	KwMediaIsoA4x4               KwMedia = "iso_a4x4_297x841mm"
	KwMediaIsoA4x5               KwMedia = "iso_a4x5_297x1051mm"
	KwMediaIsoA4x6               KwMedia = "iso_a4x6_297x1261mm"
	KwMediaIsoA4x7               KwMedia = "iso_a4x7_297x1471mm"
	KwMediaIsoA4x8               KwMedia = "iso_a4x8_297x1682mm"
	KwMediaIsoA4x9               KwMedia = "iso_a4x9_297x1892mm"
	KwMediaIsoA5Extra            KwMedia = "iso_a5-extra_174x235mm"
	KwMediaIsoA5                 KwMedia = "iso_a5_148x210mm"
	KwMediaIsoA6                 KwMedia = "iso_a6_105x148mm"
	KwMediaIsoA7                 KwMedia = "iso_a7_74x105mm"
	KwMediaIsoA8                 KwMedia = "iso_a8_52x74mm"
	KwMediaIsoA9                 KwMedia = "iso_a9_37x52mm"
	KwMediaIsoA10                KwMedia = "iso_a10_26x37mm"
	KwMediaIsoB0                 KwMedia = "iso_b0_1000x1414mm"
	KwMediaIsoB1                 KwMedia = "iso_b1_707x1000mm"
	KwMediaIsoB2                 KwMedia = "iso_b2_500x707mm"
	KwMediaIsoB3                 KwMedia = "iso_b3_353x500mm"
	KwMediaIsoB4                 KwMedia = "iso_b4_250x353mm"
	KwMediaIsoB5Extra            KwMedia = "iso_b5-extra_201x276mm"
	KwMediaIsoB5                 KwMedia = "iso_b5_176x250mm"
	KwMediaIsoB6                 KwMedia = "iso_b6_125x176mm"
	KwMediaIsoB6c4               KwMedia = "iso_b6c4_125x324mm"
	KwMediaIsoB7                 KwMedia = "iso_b7_88x125mm"
	KwMediaIsoB8                 KwMedia = "iso_b8_62x88mm"
	KwMediaIsoB9                 KwMedia = "iso_b9_44x62mm"
	KwMediaIsoB10                KwMedia = "iso_b10_31x44mm"
	KwMediaIsoC0                 KwMedia = "iso_c0_917x1297mm"
	KwMediaIsoC1                 KwMedia = "iso_c1_648x917mm"
	KwMediaIsoC2                 KwMedia = "iso_c2_458x648mm"
	KwMediaIsoC3                 KwMedia = "iso_c3_324x458mm"
	KwMediaIsoC4                 KwMedia = "iso_c4_229x324mm"
	KwMediaIsoC5                 KwMedia = "iso_c5_162x229mm"
	KwMediaIsoC6                 KwMedia = "iso_c6_114x162mm"
	KwMediaIsoC6c5               KwMedia = "iso_c6c5_114x229mm"
	KwMediaIsoC7                 KwMedia = "iso_c7_81x114mm"
	KwMediaIsoC7c6               KwMedia = "iso_c7c6_81x162mm"
	KwMediaIsoC8                 KwMedia = "iso_c8_57x81mm"
	KwMediaIsoC9                 KwMedia = "iso_c9_40x57mm"
	KwMediaIsoC10                KwMedia = "iso_c10_28x40mm"
	KwMediaIsoDl                 KwMedia = "iso_dl_110x220mm"
	KwMediaIsoID1                KwMedia = "iso_id-1_53.98x85.6mm"
	KwMediaIsoRa0                KwMedia = "iso_ra0_860x1220mm"
	KwMediaIsoRa1                KwMedia = "iso_ra1_610x860mm"
	KwMediaIsoRa2                KwMedia = "iso_ra2_430x610mm"
	KwMediaIsoRa3                KwMedia = "iso_ra3_305x430mm"
	KwMediaIsoRa4                KwMedia = "iso_ra4_215x305mm"
	KwMediaIsoSra0               KwMedia = "iso_sra0_900x1280mm"
	KwMediaIsoSra1               KwMedia = "iso_sra1_640x900mm"
	KwMediaIsoSra2               KwMedia = "iso_sra2_450x640mm"
	KwMediaIsoSra3               KwMedia = "iso_sra3_320x450mm"
	KwMediaIsoSra4               KwMedia = "iso_sra4_225x320mm"
	KwMediaJisB0                 KwMedia = "jis_b0_1030x1456mm"
	KwMediaJisB1                 KwMedia = "jis_b1_728x1030mm"
	KwMediaJisB2                 KwMedia = "jis_b2_515x728mm"
	KwMediaJisB3                 KwMedia = "jis_b3_364x515mm"
	KwMediaJisB4                 KwMedia = "jis_b4_257x364mm"
	KwMediaJisB5                 KwMedia = "jis_b5_182x257mm"
	KwMediaJisB6                 KwMedia = "jis_b6_128x182mm"
	KwMediaJisB7                 KwMedia = "jis_b7_91x128mm"
	KwMediaJisB8                 KwMedia = "jis_b8_64x91mm"
	KwMediaJisB9                 KwMedia = "jis_b9_45x64mm"
	KwMediaJisB10                KwMedia = "jis_b10_32x45mm"
	KwMediaJisExec               KwMedia = "jis_exec_216x330mm"
	KwMediaJpnChou2              KwMedia = "jpn_chou2_111.1x146mm"
	KwMediaJpnChou3              KwMedia = "jpn_chou3_120x235mm"
	KwMediaJpnChou4              KwMedia = "jpn_chou4_90x205mm"
	KwMediaJpnChou40             KwMedia = "jpn_chou40_90x225mm"
	KwMediaJpnHagaki             KwMedia = "jpn_hagaki_100x148mm"
	KwMediaJpnKahu               KwMedia = "jpn_kahu_240x322.1mm"
	KwMediaJpnKaku1              KwMedia = "jpn_kaku1_270x382mm"
	KwMediaJpnKaku2              KwMedia = "jpn_kaku2_240x332mm"
	KwMediaJpnKaku3              KwMedia = "jpn_kaku3_216x277mm"
	KwMediaJpnKaku4              KwMedia = "jpn_kaku4_197x267mm"
	KwMediaJpnKaku5              KwMedia = "jpn_kaku5_190x240mm"
	KwMediaJpnKaku7              KwMedia = "jpn_kaku7_142x205mm"
	KwMediaJpnKaku8              KwMedia = "jpn_kaku8_119x197mm"
	KwMediaJpnOufuku             KwMedia = "jpn_oufuku_148x200mm"
	KwMediaJpnYou4               KwMedia = "jpn_you4_105x235mm"
	KwMediaNa5x7                 KwMedia = "na_5x7_5x7in"
	KwMediaNa6x9                 KwMedia = "na_6x9_6x9in"
	KwMediaNa7x9                 KwMedia = "na_7x9_7x9in"
	KwMediaNa9x11                KwMedia = "na_9x11_9x11in"
	KwMediaNa10x11               KwMedia = "na_10x11_10x11in"
	KwMediaNa10x13               KwMedia = "na_10x13_10x13in"
	KwMediaNa10x14               KwMedia = "na_10x14_10x14in"
	KwMediaNa10x15               KwMedia = "na_10x15_10x15in"
	KwMediaNa11x12               KwMedia = "na_11x12_11x12in"
	KwMediaNa11x15               KwMedia = "na_11x15_11x15in"
	KwMediaNa12x19               KwMedia = "na_12x19_12x19in"
	KwMediaNaA2                  KwMedia = "na_a2_4.375x5.75in"
	KwMediaNaArchA               KwMedia = "na_arch-a_9x12in"
	KwMediaNaArchB               KwMedia = "na_arch-b_12x18in"
	KwMediaNaArchC               KwMedia = "na_arch-c_18x24in"
	KwMediaNaArchD               KwMedia = "na_arch-d_24x36in"
	KwMediaNaArchE2              KwMedia = "na_arch-e2_26x38in"
	KwMediaNaArchE3              KwMedia = "na_arch-e3_27x39in"
	KwMediaNaArchE               KwMedia = "na_arch-e_36x48in"
	KwMediaNaBPlus               KwMedia = "na_b-plus_12x19.17in"
	KwMediaNaC5                  KwMedia = "na_c5_6.5x9.5in"
	KwMediaNaC                   KwMedia = "na_c_17x22in"
	KwMediaNaD                   KwMedia = "na_d_22x34in"
	KwMediaNaE                   KwMedia = "na_e_34x44in"
	KwMediaNaEdp                 KwMedia = "na_edp_11x14in"
	KwMediaNaEurEdp              KwMedia = "na_eur-edp_12x14in"
	KwMediaNaExecutive           KwMedia = "na_executive_7.25x10.5in"
	KwMediaNaF                   KwMedia = "na_f_44x68in"
	KwMediaNaFanfoldEur          KwMedia = "na_fanfold-eur_8.5x12in"
	KwMediaNaFanfoldUs           KwMedia = "na_fanfold-us_11x14.875in"
	KwMediaNaFoolscap            KwMedia = "na_foolscap_8.5x13in"
	KwMediaNaGovtLegal           KwMedia = "na_govt-legal_8x13in"
	KwMediaNaGovtLetter          KwMedia = "na_govt-letter_8x10in"
	KwMediaNaIndex3x5            KwMedia = "na_index-3x5_3x5in"
	KwMediaNaIndex4x6Ext         KwMedia = "na_index-4x6-ext_6x8in"
	KwMediaNaIndex4x6            KwMedia = "na_index-4x6_4x6in"
	KwMediaNaIndex5x8            KwMedia = "na_index-5x8_5x8in"
	KwMediaNaInvoice             KwMedia = "na_invoice_5.5x8.5in"
	KwMediaNaLedger              KwMedia = "na_ledger_11x17in"
	KwMediaNaLegalExtra          KwMedia = "na_legal-extra_9.5x15in"
	KwMediaNaLegal               KwMedia = "na_legal_8.5x14in"
	KwMediaNaLetterExtra         KwMedia = "na_letter-extra_9.5x12in"
	KwMediaNaLetterPlus          KwMedia = "na_letter-plus_8.5x12.69in"
	KwMediaNaLetter              KwMedia = "na_letter_8.5x11in"
	KwMediaNaMonarch             KwMedia = "na_monarch_3.875x7.5in"
	KwMediaNaNumber9             KwMedia = "na_number-9_3.875x8.875in"
	KwMediaNaNumber10            KwMedia = "na_number-10_4.125x9.5in"
	KwMediaNaNumber11            KwMedia = "na_number-11_4.5x10.375in"
	KwMediaNaNumber12            KwMedia = "na_number-12_4.75x11in"
	KwMediaNaNumber14            KwMedia = "na_number-14_5x11.5in"
	KwMediaNaOficio              KwMedia = "na_oficio_8.5x13.4in"
	KwMediaNaPersonal            KwMedia = "na_personal_3.625x6.5in"
	KwMediaNaQuarto              KwMedia = "na_quarto_8.5x10.83in"
	KwMediaNaSuperA              KwMedia = "na_super-a_8.94x14in"
	KwMediaNaSuperB              KwMedia = "na_super-b_13x19in"
	KwMediaNaWideFormat          KwMedia = "na_wide-format_30x42in"
	KwMediaOe12x16               KwMedia = "oe_12x16_12x16in"
	KwMediaOe14x17               KwMedia = "oe_14x17_14x17in"
	KwMediaOe18x22               KwMedia = "oe_18x22_18x22in"
	KwMediaOeA2plus              KwMedia = "oe_a2plus_17x24in"
	KwMediaOeBusinessCard        KwMedia = "oe_business-card_2x3.5in"
	KwMediaOePhoto10r            KwMedia = "oe_photo-10r_10x12in"
	KwMediaOePhoto12r            KwMedia = "oe_photo-12r_12x15in"
	KwMediaOePhoto14x18          KwMedia = "oe_photo-14x18_14x18in"
	KwMediaOePhoto16r            KwMedia = "oe_photo-16r_16x20in"
	KwMediaOePhoto20r            KwMedia = "oe_photo-20r_20x24in"
	KwMediaOePhoto22r            KwMedia = "oe_photo-22r_22x29.5in"
	KwMediaOePhoto22x28          KwMedia = "oe_photo-22x28_22x28in"
	KwMediaOePhoto24r            KwMedia = "oe_photo-24r_24x31.5in"
	KwMediaOePhoto24x30          KwMedia = "oe_photo-24x30_24x30in"
	KwMediaOePhoto30r            KwMedia = "oe_photo-30r_30x40in"
	KwMediaOePhotoL              KwMedia = "oe_photo-l_3.5x5in"
	KwMediaOePhotoS8r            KwMedia = "oe_photo-s8r_8x12in"
	KwMediaOeSquarePhoto4x4in    KwMedia = "oe_square-photo_4x4in"
	KwMediaOeSquarePhoto5x5in    KwMedia = "oe_square-photo_5x5in"
	KwMediaOm16k184x260mm        KwMedia = "om_16k_184x260mm"
	KwMediaOm16k195x270mm        KwMedia = "om_16k_195x270mm"
	KwMediaOmBusinessCard55x85mm KwMedia = "om_business-card_55x85mm"
	KwMediaOmBusinessCard55x91mm KwMedia = "om_business-card_55x91mm"
	KwMediaOmCard                KwMedia = "om_card_54x86mm"
	KwMediaOmDaiPaKai            KwMedia = "om_dai-pa-kai_275x395mm"
	KwMediaOmDscPhoto            KwMedia = "om_dsc-photo_89x119mm"
	KwMediaOmFolioSp             KwMedia = "om_folio-sp_215x315mm"
	KwMediaOmFolio               KwMedia = "om_folio_210x330mm"
	KwMediaOmInvite              KwMedia = "om_invite_220x220mm"
	KwMediaOmItalian             KwMedia = "om_italian_110x230mm"
	KwMediaOmJuuroKuKai          KwMedia = "om_juuro-ku-kai_198x275mm"
	KwMediaOmLargePhoto          KwMedia = "om_large-photo_200x300mm"
	KwMediaOmMediumPhoto         KwMedia = "om_medium-photo_130x180mm"
	KwMediaOmPaKai               KwMedia = "om_pa-kai_267x389mm"
	KwMediaOmPhoto30x40          KwMedia = "om_photo-30x40_300x400mm"
	KwMediaOmPhoto30x45          KwMedia = "om_photo-30x45_300x450mm"
	KwMediaOmPhoto35x46          KwMedia = "om_photo-35x46_350x460mm"
	KwMediaOmPhoto40x60          KwMedia = "om_photo-40x60_400x600mm"
	KwMediaOmPhoto50x75          KwMedia = "om_photo-50x75_500x750mm"
	KwMediaOmPhoto50x76          KwMedia = "om_photo-50x76_500x760mm"
	KwMediaOmPhoto60x90          KwMedia = "om_photo-60x90_600x900mm"
	KwMediaOmSmallPhoto          KwMedia = "om_small-photo_100x150mm"
	KwMediaOmSquarePhoto         KwMedia = "om_square-photo_89x89mm"
	KwMediaOmWidePhoto           KwMedia = "om_wide-photo_100x200mm"
	KwMediaPrc1                  KwMedia = "prc_1_102x165mm"
	KwMediaPrc2                  KwMedia = "prc_2_102x176mm"
	KwMediaPrc4                  KwMedia = "prc_4_110x208mm"
	KwMediaPrc6                  KwMedia = "prc_6_120x320mm"
	KwMediaPrc7                  KwMedia = "prc_7_160x230mm"
	KwMediaPrc8                  KwMedia = "prc_8_120x309mm"
	KwMediaPrc16k                KwMedia = "prc_16k_146x215mm"
	KwMediaPrc32k                KwMedia = "prc_32k_97x151mm"
	KwMediaRoc8k                 KwMedia = "roc_8k_10.75x15.5in"
	KwMediaRoc16k                KwMedia = "roc_16k_7.75x10.75in"
)

Standard constants for KwMedia

func (KwMedia) Size

func (kw KwMedia) Size() (wid, hei int)

Size returns media size, width and height, in 1/100 mm. If size is not known, (-1, -1) is returned.

type KwMediaBackCoating

type KwMediaBackCoating string

KwMediaBackCoating represents standard keyword values for "media-back-coating" attribute.

PWG5100.7: 6.3.1.2

const (
	// KwMediaBackCoatingNone means the media does not have any coating.
	KwMediaBackCoatingNone KwMediaBackCoating = "none"

	// KwMediaBackCoatingGlossy means the media has a "glossy" coating.
	KwMediaBackCoatingGlossy KwMediaBackCoating = "glossy"

	// KwMediaBackCoatingHighGloss means the media has a "high-gloss"
	// coating.
	KwMediaBackCoatingHighGloss KwMediaBackCoating = "high-gloss"

	// KwMediaBackCoatingSemiGloss means the media has a "semi-gloss"
	// coating.
	KwMediaBackCoatingSemiGloss KwMediaBackCoating = "semi-gloss"

	// KwMediaBackCoatingSatin means the media has a "satin" coating.
	KwMediaBackCoatingSatin KwMediaBackCoating = "satin"

	// KwMediaBackCoatingMatte means the media has a "matte" coating.
	KwMediaBackCoatingMatte KwMediaBackCoating = "matte"
)

type KwMultipleDocumentHandling

type KwMultipleDocumentHandling string

KwMultipleDocumentHandling represents standard keyword values for "multiple-document-handling" attribute.

See RFC8011, 5.2.4.

const (
	KwMultipleDocumentHandlingSingleDocument         KwMultipleDocumentHandling = "single-document"
	KwMultipleDocumentHandlingSingleDocumentNewSheet KwMultipleDocumentHandling = "single-document-new-sheet"

	KwMultipleDocumentHandlingSeparateDocumentsUncollatedCopies KwMultipleDocumentHandling = "separate-documents-uncollated-copies"
	KwMultipleDocumentHandlingSeparateDocumentsCollatedCopies   KwMultipleDocumentHandling = "separate-documents-collated-copies"
)

KwMultipleDocumentHandling constants indicate, how Printer handles Job with multiple documents.

Imagine we have a Job with documents "a" and "b". Also, we may request a single copy or multiple copies. If multiple copies of, say, document "a" are requested, we will denote it as a(*).

So, depending of the "multiple-document-handling" parameter, Job with multiple documents "a" and "b" will be printed as follows (square brakes means finishing process):

"single-document"
Documents are concatenated,  and "b" may start at the last page of "a",
but each copy of a+b concatenation starts at its own page.
  Sungle copy:       [a+b]
  Multiple copies:   [a+b] [a+b] ... [a+b]

"single-document-new-sheet"
Like "single-document", but "b" starts at its own page:
  Single copy:       [a b]
  Multiple copies:   [a b] [a b] ... [a b]

"separate-documents-uncollated-copies"
Each document handled separately. First printed all copies
of "a", then all copies of "b":
  Single copy:       [a] [b]
  Multiple copies:   [a] [a] ... [a]  [b] [b] ... [b]

"separate-documents-collated-copies"
Like "separate-documents-uncollated-copies", but in a case
of multiple copies, ordering is different:
  Single copy:       [a] [b]
  Multiple copies:   [a] [b] [a] [b] ... [a] [b]

type KwPdlOverride

type KwPdlOverride string

KwPdlOverride represents standard keyword values for "pdl-override-supported" attribute.

See RFC8011, 5.4.28.

const (
	// KwPdlOverrideAattempted indicates that Printer attempts to
	// make the IPP attribute values take precedence over embedded
	// instructions in the Document data.
	KwPdlOverrideAattempted KwPdlOverride = "attempted"

	// KwPdlOverrideNotAttempted indicates that the Printer makes no
	// attempt to make the IPP attribute values take precedence over
	// embedded instructions in the Document data.
	KwPdlOverrideNotAttempted KwPdlOverride = "not-attempted"
)

type KwPrinterStateReasons

type KwPrinterStateReasons string

KwPrinterStateReasons represents standard keyword values for "printer-state-reasons" attribute.

See RFC8011, 5.4.12.

const (
	// The following are standard keyword values of "printer-state-reasons"
	// attribute:
	KwPrinterStateNone                           KwPrinterStateReasons = "none"
	KwPrinterStateOther                          KwPrinterStateReasons = "other"
	KwPrinterStateConnectingToDevice             KwPrinterStateReasons = "connecting-to-device"
	KwPrinterStateCoverOpen                      KwPrinterStateReasons = "cover-open"
	KwPrinterStateDeveloperEmpty                 KwPrinterStateReasons = "developer-empty"
	KwPrinterStateDeveloperLow                   KwPrinterStateReasons = "developer-low"
	KwPrinterStateDoorOpen                       KwPrinterStateReasons = "door-open"
	KwPrinterStateFuserOverTemp                  KwPrinterStateReasons = "fuser-over-temp"
	KwPrinterStateFuserUnderTemp                 KwPrinterStateReasons = "fuser-under-temp"
	KwPrinterStateInputTrayMissing               KwPrinterStateReasons = "input-tray-missing"
	KwPrinterStateInterlockOpen                  KwPrinterStateReasons = "interlock-open"
	KwPrinterStateInterpreterResourceUnavailable KwPrinterStateReasons = "interpreter-resource-unavailable"
	KwPrinterStateMarkerSupplyEmpty              KwPrinterStateReasons = "marker-supply-empty"
	KwPrinterStateMarkerSupplyLow                KwPrinterStateReasons = "marker-supply-low"
	KwPrinterStateMarkerWasteAlmostFull          KwPrinterStateReasons = "marker-waste-almost-full"
	KwPrinterStateMarkerWasteFull                KwPrinterStateReasons = "marker-waste-full"
	KwPrinterStateMediaEmpty                     KwPrinterStateReasons = "media-empty"
	KwPrinterStateMediaJam                       KwPrinterStateReasons = "media-jam"
	KwPrinterStateMediaLow                       KwPrinterStateReasons = "media-low"
	KwPrinterStateMediaNeeded                    KwPrinterStateReasons = "media-needed"
	KwPrinterStateMovingToPaused                 KwPrinterStateReasons = "moving-to-paused"
	KwPrinterStateOpcLifeOver                    KwPrinterStateReasons = "opc-life-over"
	KwPrinterStateOpcNearEol                     KwPrinterStateReasons = "opc-near-eol"
	KwPrinterStateOutputAreaAlmostFull           KwPrinterStateReasons = "output-area-almost-full"
	KwPrinterStateOutputAreaFull                 KwPrinterStateReasons = "output-area-full"
	KwPrinterStateOutputTrayMissing              KwPrinterStateReasons = "output-tray-missing"
	KwPrinterStatePaused                         KwPrinterStateReasons = "paused"
	KwPrinterStateShutdown                       KwPrinterStateReasons = "shutdown"
	KwPrinterStateSpoolAreaFull                  KwPrinterStateReasons = "spool-area-full"
	KwPrinterStateStoppedPartly                  KwPrinterStateReasons = "stopped-partly"
	KwPrinterStateStopping                       KwPrinterStateReasons = "stopping"
	KwPrinterStateTimedOut                       KwPrinterStateReasons = "timed-out"
	KwPrinterStateTonerEmpty                     KwPrinterStateReasons = "toner-empty"
	KwPrinterStateTonerLow                       KwPrinterStateReasons = "toner-low"

	// "printer-state-reasons" may also have one of the following
	// standard suffixes, indicating its level of severity:
	KwPrinterStateReport  KwPrinterStateReasons = "-report"
	KwPrinterStateWarning KwPrinterStateReasons = "-warning"
	KwPrinterStateError   KwPrinterStateReasons = "-error"
)

Standard values for KwPrinterStateReasons

func (KwPrinterStateReasons) Reason

Reason splits KwPrinterStateReasons into reason and severity and returns its reason part.

func (KwPrinterStateReasons) Severity

Severity splits KwPrinterStateReasons into reason and severity and returns its severity part.

func (KwPrinterStateReasons) Split

func (s KwPrinterStateReasons) Split() (
	reason, severity KwPrinterStateReasons)

Split splits KwPrinterStateReasons string into reason and severity suffix (which can be one of "-report", "-warning" or "-error".

If string contains one of the known suffixes, reason itself and suffix will be returned separately. Otherwise, the first returned value will be unmodified string, and second will be "":

"media-low-warning"  ->  "media-low", "-warning"
"media-jam-error"    ->  "media-jam", "-error"
"shutdown"           ->  "shutdown",  ""

type KwSides

type KwSides string

KwSides represents standard keyword values for "sides" attribute.

See RFC8011, 5.2.8.

const (
	// KwSidesOneSided imposes one-side output
	KwSidesOneSided KwSides = "one-sided"

	// KwSidesTwoSidedLongEdge imposed two-sided output with
	// Impressions orientation suitable for the long edge binding
	KwSidesTwoSidedLongEdge KwSides = "two-sided-long-edge"

	// KwSidesTwoSidedShortEdge imposed two-sided output with
	// Impressions orientation suitable for the short edge binding
	KwSidesTwoSidedShortEdge KwSides = "two-sided-short-edge"
)

type KwURIAuthentication

type KwURIAuthentication string

KwURIAuthentication represents standard keyword values for "uri-authentication-supported" attribute.

See RFC8011, 5.4.2.

const (
	// KwURIAuthenticationNone means that there is no
	// authentication mechanism associated with the URI.
	KwURIAuthenticationNone KwURIAuthentication = "none"

	// KwURIAuthenticationRequestingUserName means that Client
	// sends authenticated user by the "requesting-user-name"
	// operation attribute.
	KwURIAuthenticationRequestingUserName KwURIAuthentication = "requesting-user-name"

	// KwURIAuthenticationBasic means HTTP basic authentication.
	KwURIAuthenticationBasic KwURIAuthentication = "basic"

	// KwURIAuthenticationDigest means HTTP digest authentication.
	KwURIAuthenticationDigest KwURIAuthentication = "digest"

	// KwURIAuthenticationCertificate means TLS authentication
	// based on X.509 certificates.
	KwURIAuthenticationCertificate KwURIAuthentication = "certificate"
)

type KwURISecurity

type KwURISecurity string

KwURISecurity represents standard keyword values for "uri-security-supported" attribute.

See RFC8011, 5.4.3.

const (
	// KwURISecurityNone means that there is no secure communication
	// channel in use for given URI
	KwURISecurityNone KwURISecurity = "none"

	// KwURISecurityTLS indicates TLS security
	KwURISecurityTLS KwURISecurity = "tls"
)

type KwWhichJobs

type KwWhichJobs string

KwWhichJobs represents standard keyword values for "which-jobs" attribute.

RFC8011: 4.2.6.1. PWG5100.7: 8.5. PWG5100.11: 11.2. PWG5100.18: 9.8.

const (

	// KwWhichJobsCompleted means all completed jobs, i.e. jobs
	// whose state is 'completed', 'canceled', or 'aborted'.
	KwWhichJobsCompleted KwWhichJobs = "completed"

	// KwWhichJobsNotCompleted means all non-completed jobs, i.e.
	// Job whose state is 'pending', 'processing', 'processing-stopped',
	// or 'pending-held'.
	KwWhichJobsNotCompleted KwWhichJobs = "not-completed"

	// KwWhichJobsAborted means all jobs in the 'aborted' state.
	KwWhichJobsAborted KwWhichJobs = "aborted"

	// KwWhichJobsAll means all jobs regardless of state.
	KwWhichJobsAll KwWhichJobs = "all"

	// KwWhichJobsCanceled means all jobs in the 'canceled' state.
	KwWhichJobsCanceled KwWhichJobs = "canceled"

	// KwWhichJobsPending means all jobs in the 'pending' state.
	KwWhichJobsPending KwWhichJobs = "pending"

	// KwWhichJobsPendingHeld means all jobs in the 'pending-held' state.
	KwWhichJobsPendingHeld KwWhichJobs = "pending-held"

	// KwWhichJobsProcessing means all jobs in the 'processing' state.
	KwWhichJobsProcessing KwWhichJobs = "processing"

	// KwWhichJobsProcessinStopped means all jobs in the
	// 'processing-stopped' state
	KwWhichJobsProcessinStopped KwWhichJobs = "processing-stopped"

	// KwWhichJobsProofPrint means all jobs that have been submitted
	// using the "proof-print" Job Template attribute and which are in
	// the ‘completed’, ‘canceled’, or ‘aborted’ state.
	KwWhichJobsProofPrint KwWhichJobs = "proof-print"

	// KwWhichJobsSaved means all jobs that have been saved using the
	// "job-save-disposition" Job Template attribute and which are in
	// the ‘completed’, ‘canceled’, or ‘aborted’ state.
	KwWhichJobsSaved KwWhichJobs = "saved"

	// KwWhichJobsFetchable means those jobs whose "job-state-reasons"
	// Job Description attribute contains the value 'job-fetchable' are to
	// be returned by the Get-Jobs operation.
	KwWhichJobsFetchable KwWhichJobs = "fetchable"
)

type MediaCol

type MediaCol struct {
	// ----- PWG5100.3 -----
	MediaBackCoating  optional.Val[KwMediaBackCoating] `ipp:"media-back-coating"`
	MediaColor        optional.Val[KwColor]            `ipp:"media-color"`
	MediaFrontCoating optional.Val[KwMediaBackCoating] `ipp:"media-front-coating"`
	MediaHoleCount    optional.Val[int]                `ipp:"media-hole-count"`
	MediaInfo         optional.Val[string]             `ipp:"media-info"`
	MediaKey          optional.Val[KwMedia]            `ipp:"media-key"`
	MediaOrderCount   optional.Val[int]                `ipp:"media-order-count"`
	MediaPrePrinted   optional.Val[string]             `ipp:"media-pre-printed"`
	MediaRecycled     optional.Val[string]             `ipp:"media-recycled"`
	MediaSize         optional.Val[MediaSize]          `ipp:"media-size"`
	MediaType         optional.Val[string]             `ipp:"media-type"`
	MediaWeightMetric optional.Val[int]                `ipp:"media-weight-metric"`

	// ----- PWG5100.7 -----
	MediaBottomMargin optional.Val[int]    `ipp:"media-bottom-margin"`
	MediaGrain        optional.Val[string] `ipp:"media-grain"`
	MediaLeftMargin   optional.Val[int]    `ipp:"media-left-margin"`
	MediaRightMargin  optional.Val[int]    `ipp:"media-right-margin"`
	MediaSizeName     optional.Val[string] `ipp:"media-size-name"`
	MediaSource       optional.Val[string] `ipp:"media-source"`
	MediaThickness    optional.Val[int]    `ipp:"media-thickness"`
	MediaTooth        optional.Val[string] `ipp:"media-tooth"`
	MediaTopMargin    optional.Val[int]    `ipp:"media-top-margin"`
}

MediaCol is the "media-col", "media-col-xxx" collection entry. It is used in many places.

PWG5100.7

type MediaColDatabase

type MediaColDatabase struct {
	MediaColDatabase []MediaColEx `ipp:"media-col-database"`
}

MediaColDatabase represents "media-col-database" attribute.

type MediaColEx

type MediaColEx struct {
	MediaCol
	MediaSourceProperties optional.Val[MediaSourceProperties] `ipp:"media-source-properties"`
}

MediaColEx is the MediaCol with some additional data. It is only used for "media-col-database" and "media-col-ready" Printer Description attributes.

type MediaOverprint

type MediaOverprint struct {
	MediaOverprintDistance int    `ipp:"media-overprint-distance"`
	MediaOverprintMethod   string `ipp:"media-overprint-method"`
}

MediaOverprint represents "media-overprint" collection entry in JobAttributes

type MediaSize

type MediaSize struct {
	XDimension int `ipp:"x-dimension"`
	YDimension int `ipp:"y-dimension"`
}

MediaSize represents media size parameter, defined by a pair of integer dimensions.

type MediaSizeRange

type MediaSizeRange struct {
	XDimension goipp.IntegerOrRange `ipp:"x-dimension"`
	YDimension goipp.IntegerOrRange `ipp:"y-dimension"`
}

MediaSizeRange represents media size parameter, defined by a pair if integer or range of integer dimensions.

type MediaSourceProperties

type MediaSourceProperties struct {
	MediaSourceFeedDirection   string `ipp:"media-source-feed-direction"`
	MediaSourceFeedOrientation int    `ipp:"media-source-feed-orientation"`
}

MediaSourceProperties represents "media-source-properties" collectiobn in MediaCol

type Object

type Object interface {
	// RawAttrs returns ObjectRawAttrs embedded into the structure
	RawAttrs() *ObjectRawAttrs

	// Errors returns a slice of errors that has occurred during
	// the [Object] decoding.
	//
	// If [DecodeOptions.KeepTrying] set to true, non-fatal errors
	// doesn't interrupt decoding but instead saved here (and may
	// be reported as decode warnings).
	Errors() []error
}

Object is the interface that MUST be implemented by any concrete type that can be encoded to and decoded from the set of IPP attributes.

It gives access to the underlying raw IPP attributes.

Every concrete IPP-encodable structure MUST embed ObjectRawAttrs to implement this interface.

type ObjectRawAttrs

type ObjectRawAttrs struct {
	// contains filtered or unexported fields
}

ObjectRawAttrs MUST be embedded into every IPP-encodable structure. It gives access to raw IPP attributes and implements Object interface.

func (*ObjectRawAttrs) All

func (rawattrs *ObjectRawAttrs) All() goipp.Attributes

All returns all goipp.Attributes.

func (*ObjectRawAttrs) Errors

func (rawattrs *ObjectRawAttrs) Errors() []error

Errors returns a slice of errors that has occurred during the Object decoding.

If [DecodeOptions.KeepTrying] set to true, non-fatal errors doesn't interrupt decoding but instead saved here (and may be reported as decode warnings).

func (*ObjectRawAttrs) RawAttrs

func (rawattrs *ObjectRawAttrs) RawAttrs() *ObjectRawAttrs

RawAttrs returns [ObjecRawtAttrs], which gives uniform access to the header of any Object

type OperationGroup

type OperationGroup struct{}

OperationGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.Operation group.

type PPDAttributes

type PPDAttributes struct {
	ObjectRawAttrs
	CUPSPPDAttributesGroup
}

PPDAttributes represents PPD file attributes, as returned by the CUPS-Get-PPDs request

type PPDFilter

type PPDFilter struct {
	ExcludeSchemes      []string             `ipp:"exclude-schemes"`
	IncludeSchemes      []string             `ipp:"include-schemes"`
	Limit               optional.Val[int]    `ipp:"limit"`
	PpdMake             optional.Val[string] `ipp:"ppd-make"`
	PpdMakeAndModel     optional.Val[string] `ipp:"ppd-make-and-model"`
	PpdModelNumber      optional.Val[int]    `ipp:"ppd-model-number"`
	PpdNaturalLanguage  optional.Val[string] `ipp:"ppd-natural-language"`
	PpdProduct          optional.Val[string] `ipp:"ppd-product"`
	PpdPsVersion        optional.Val[string] `ipp:"ppd-psversion"`
	PpdType             optional.Val[string] `ipp:"ppd-type,keyword"`
	RequestedAttributes []string             `ipp:"requested-attributes"`
}

PPDFilter specifies the subset of PPD files and their attributes, returned by the CUPS-Get-PPDs request.

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer implements the IPP printer.

func NewPrinter

func NewPrinter(attrs *PrinterAttributes, options ServerOptions) *Printer

NewPrinter creates a new Printer, which facilities and behavior is defined by the supplied PrinterAttributes.

func (*Printer) ServeHTTP

func (printer *Printer) ServeHTTP(w http.ResponseWriter, rq *http.Request)

ServeHTTP handles incoming HTTP request. It implements http.Handler interface.

func (*Printer) Sniff

func (printer *Printer) Sniff(sniffer Sniffer)

Sniff installs the sniffer callback.

Don't use this function when proxy is already active (i.e., concurrently with the Proxy.ServeHTTP, it can cause race conditions.

type PrinterAttributes

PrinterAttributes represents IPP Printer Attributes

func DecodePrinterAttributes

func DecodePrinterAttributes(attrs goipp.Attributes, opt *DecoderOptions) (
	*PrinterAttributes, error)

DecodePrinterAttributes decodes PrinterAttributes from goipp.Attributes.

func (*PrinterAttributes) IsCharsetSupported

func (pa *PrinterAttributes) IsCharsetSupported(cs string) bool

IsCharsetSupported tells if charset is supported

func (*PrinterAttributes) IsOperationSupported

func (pa *PrinterAttributes) IsOperationSupported(op goipp.Op) bool

IsOperationSupported tells if operation is supported

type PrinterDescription

type PrinterDescription struct {
	// RFC8011, 5.4: Printer Description and Status Attributes
	CharsetConfigured                 optional.Val[string]        `ipp:"charset-configured"`
	CharsetSupported                  []string                    `ipp:"charset-supported"`
	ColorSupported                    optional.Val[bool]          `ipp:"color-supported"`
	CompressionSupported              []KwCompression             `ipp:"compression-supported"`
	DocumentFormatDefault             optional.Val[string]        `ipp:"document-format-default"`
	DocumentFormatSupported           []string                    `ipp:"document-format-supported"`
	GeneratedNaturalLanguageSupported []string                    `ipp:"generated-natural-language-supported"`
	IppVersionsSupported              []goipp.Version             `ipp:"ipp-versions-supported"`
	JobImpressionsSupported           optional.Val[goipp.Range]   `ipp:"job-impressions-supported"`
	JobKOctetsSupported               optional.Val[goipp.Range]   `ipp:"job-k-octets-supported"`
	JobMediaSheetsSupported           optional.Val[goipp.Range]   `ipp:"job-media-sheets-supported"`
	MediaSizeSupported                []MediaSizeRange            `ipp:"media-size-supported"`
	MultipleDocumentJobsSupported     optional.Val[bool]          `ipp:"multiple-document-jobs-supported"`
	MultipleOperationTimeOut          optional.Val[int]           `ipp:"multiple-operation-time-out"`
	NaturalLanguageConfigured         optional.Val[string]        `ipp:"natural-language-configured"`
	OperationsSupported               []goipp.Op                  `ipp:"operations-supported"`
	PagesPerMinuteColor               optional.Val[int]           `ipp:"pages-per-minute-color"`
	PagesPerMinute                    optional.Val[int]           `ipp:"pages-per-minute"`
	PdlOverrideSupported              optional.Val[KwPdlOverride] `ipp:"pdl-override-supported"`
	PrinterDriverInstaller            optional.Val[string]        `ipp:"printer-driver-installer"`
	PrinterDeviceID                   optional.Val[string]        `ipp:"printer-device-id"`
	PrinterInfo                       optional.Val[string]        `ipp:"printer-info"`
	PrinterIsAcceptingJobs            optional.Val[bool]          `ipp:"printer-is-accepting-jobs"`
	PrinterLocation                   optional.Val[string]        `ipp:"printer-location"`
	PrinterMakeAndModel               optional.Val[string]        `ipp:"printer-make-and-model"`
	PrinterMessageFromOperator        optional.Val[string]        `ipp:"printer-message-from-operator"`
	PrinterMoreInfoManufacturer       optional.Val[string]        `ipp:"printer-more-info-manufacturer"`
	PrinterMoreInfo                   optional.Val[string]        `ipp:"printer-more-info"`
	PrinterName                       optional.Val[string]        `ipp:"printer-name"`
	PrinterStateMessage               optional.Val[string]        `ipp:"printer-state-message"`
	PrinterState                      optional.Val[int]           `ipp:"printer-state"`
	PrinterStateReasons               []KwPrinterStateReasons     `ipp:"printer-state-reasons"`
	PrinterUpTime                     optional.Val[int]           `ipp:"printer-up-time"`
	PrinterURISupported               []string                    `ipp:"printer-uri-supported"`
	QueuedJobCount                    optional.Val[int]           `ipp:"queued-job-count"`
	ReferenceURISchemesSupported      []string                    `ipp:"reference-uri-schemes-supported"`
	URIAuthenticationSupported        []KwURIAuthentication       `ipp:"uri-authentication-supported"`
	URISecuritySupported              []KwURISecurity             `ipp:"uri-security-supported"`

	// PWG5100.7: IPP Job Extensions v2.1 (JOBEXT)
	// 6.9 Printer Description Attributes
	ClientInfoSupported              []string                    `ipp:"client-info-supported"`
	DocumentCharsetDefault           optional.Val[string]        `ipp:"document-charset-default"`
	DocumentCharsetSupported         []string                    `ipp:"document-charset-supported"`
	DocumentFormatDetailsSupported   []string                    `ipp:"document-format-details-supported"`
	DocumentNaturalLanguageDefault   optional.Val[string]        `ipp:"document-natural-language-default"`
	DocumentNaturalLanguageSupported []string                    `ipp:"document-natural-language-supported"`
	JobCreationAttributesSupported   []string                    `ipp:"job-creation-attributes-supported"`
	JobHistoryAttributesConfigured   []string                    `ipp:"job-history-attributes-configured"`
	JobHistoryAttributesSupported    []string                    `ipp:"job-history-attributes-supported"`
	JobHistoryIntervalConfigured     optional.Val[int]           `ipp:"job-history-interval-configured"`
	JobHistoryIntervalSupported      optional.Val[goipp.Range]   `ipp:"job-history-interval-supported"`
	JobMandatoryAttributesSupported  optional.Val[bool]          `ipp:"job-mandatory-attributes-supported"`
	JobSpoolingSupported             optional.Val[KwJobSpooling] `ipp:"job-spooling-supported"`
	MediaBackCoatingSupported        []KwMediaBackCoating        `ipp:"media-back-coating-supported"`
	MediaBottomMarginSupported       []int                       `ipp:"media-bottom-margin-supported"`
	MediaColDefault                  optional.Val[MediaCol]      `ipp:"media-col-default"`
	MediaColorSupported              []string                    `ipp:"media-color-supported"`
	MediaColReady                    []MediaColEx                `ipp:"media-col-ready"`
	MediaColSupported                []string                    `ipp:"media-col-supported"`
	MediaFrontCoatingSupported       []KwMediaBackCoating        `ipp:"media-front-coating-supported"`
	MediaGrainSupported              []string                    `ipp:"media-grain-supported"`
	MediaHoleCountSupported          []goipp.Range               `ipp:"media-hole-count-supported"`
	MediaKeySupported                []KwMedia                   `ipp:"media-key-supported"`
	MediaLeftMarginSupported         []int                       `ipp:"media-left-margin-supported"`
	MediaOrderCountSupported         []goipp.Range               `ipp:"media-order-count-supported"`
	MediaPrePrintedSupported         []string                    `ipp:"media-pre-printed-supported"`
	MediaRecycledSupported           []string                    `ipp:"media-recycled-supported"`
	MediaRightMarginSupported        []int                       `ipp:"media-right-margin-supported"`
	MediaSourceSupported             []string                    `ipp:"media-source-supported"`
	MediaThicknessSupported          []goipp.Range               `ipp:"media-thickness-supported"`
	MediaToothSupported              []string                    `ipp:"media-tooth-supported"`
	MediaTopMarginSupported          []int                       `ipp:"media-top-margin-supported"`
	MediaTypeSupported               []string                    `ipp:"media-type-supported"`
	MediaWeightMetricSupported       []goipp.Range               `ipp:"media-weight-metric-supported"`

	// PWG5100.13: IPP Driver Replacement Extensions v2.0 (NODRIVER)
	// 6.5 Printer Description Attributes
	DocumentPasswordSupported         optional.Val[int]         `ipp:"document-password-supported"`
	IdentifyActionsDefault            []string                  `ipp:"identify-actions-default"`
	IdentifyActionsSupported          []string                  `ipp:"identify-actions-supported"`
	IppFeaturesSupported              []string                  `ipp:"ipp-features-supported"`
	JobPresetsSupported               []JobPresets              `ipp:"job-presets-supported"`
	JpegFeaturesSupported             []string                  `ipp:"jpeg-features-supported"`
	JpegKOctetsSupported              optional.Val[goipp.Range] `ipp:"jpeg-k-octets-supported"`
	JpegXDimensionSupported           optional.Val[goipp.Range] `ipp:"jpeg-x-dimension-supported"`
	JpegYDimensionSupported           optional.Val[goipp.Range] `ipp:"jpeg-y-dimension-supported"`
	MultipleOperationTimeOutAction    optional.Val[string]      `ipp:"multiple-operation-time-out-action"`
	PdfKOctetsSupported               optional.Val[goipp.Range] `ipp:"pdf-k-octets-supported"`
	PdfVersionsSupported              []string                  `ipp:"pdf-versions-supported"`
	PreferredAttributesSupported      optional.Val[bool]        `ipp:"preferred-attributes-supported"`
	PrinterDNSSdName                  optional.Val[string]      `ipp:"printer-dns-sd-name"`
	PrinterGeoLocation                optional.Val[string]      `ipp:"printer-geo-location"`
	PrinterGetAttributesSupported     []string                  `ipp:"printer-get-attributes-supported"`
	PrinterIcons                      []string                  `ipp:"printer-icons"`
	PrinterKind                       []string                  `ipp:"printer-kind"`
	PrinterOrganization               []string                  `ipp:"printer-organization"`
	PrinterOrganizationalUnit         []string                  `ipp:"printer-organizational-unit"`
	PrinterStringsLanguagesSupported  []string                  `ipp:"printer-strings-languages-supported"`
	PrinterStringsURI                 optional.Val[string]      `ipp:"printer-strings-uri"`
	RequestingUserURISupported        optional.Val[bool]        `ipp:"requesting-user-uri-supported"`
	RequestingUserURISchemesSupported []string                  `ipp:"requesting-user-uri-schemes-supported"`

	// PWG5100.13: IPP Driver Replacement Extensions v2.0 (NODRIVER)
	// 6.6 Printer Status Attributes
	DeviceServiceCount           optional.Val[int]       `ipp:"device-service-count"`
	DeviceUUID                   optional.Val[string]    `ipp:"device-uuid"`
	PrinterConfigChangeDateTime  optional.Val[time.Time] `ipp:"printer-config-change-date-time"`
	PrinterConfigChangeTime      optional.Val[int]       `ipp:"printer-config-change-time"`
	PrinterFirmwareName          []string                `ipp:"printer-firmware-name"`
	PrinterFirmwarePatches       []string                `ipp:"printer-firmware-patches"`
	PrinterFirmwareStringVersion []string                `ipp:"printer-firmware-string-version"`
	PrinterFirmwareVersion       []string                `ipp:"printer-firmware-version"`
	PrinterInputTray             []string                `ipp:"printer-input-tray"`
	PrinterOutputTray            []string                `ipp:"printer-output-tray"`
	PrinterSupplyDescription     []goipp.TextWithLang    `ipp:"printer-supply-description"`
	PrinterSupplyInfoURI         optional.Val[string]    `ipp:"printer-supply-info-uri"`
	PrinterSupply                []string                `ipp:"printer-supply"`
	PrinterUUID                  optional.Val[string]    `ipp:"printer-uuid"`

	// Wi-Fi Peer-to-Peer Services Print (P2Ps-Print)
	// Technical Specification
	// (for Wi-Fi Direct® services certification)
	PclmRasterBackSide       optional.Val[string] `ipp:"pclm-raster-back-side"`
	PclmStripHeightPreferred optional.Val[int]    `ipp:"pclm-strip-height-preferred"`
	PclmStripHeightSupported []int                `ipp:"pclm-strip-height-supported"`

	// CUPS extensions
	DeviceURI          string                      `ipp:"device-uri"`
	MarkerChangeTime   optional.Val[int]           `ipp:"marker-change-time"`
	MarkerColors       []string                    `ipp:"marker-colors"`
	MarkerHighLevels   []int                       `ipp:"marker-high-levels"`
	MarkerLevels       []int                       `ipp:"marker-levels"`
	MarkerLowLevels    []int                       `ipp:"marker-low-levels"`
	MarkerMessage      optional.Val[string]        `ipp:"marker-message"`
	MarkerNames        []string                    `ipp:"marker-names"`
	MarkerTypes        []string                    `ipp:"marker-types"`
	PrinterID          optional.Val[int]           `ipp:"printer-id"`
	PrinterIsShared    optional.Val[bool]          `ipp:"printer-is-shared"`
	PrinterIsTemporary optional.Val[bool]          `ipp:"printer-is-temporary"`
	PrinterType        optional.Val[EnPrinterType] `ipp:"printer-type"`
	UrfSupported       []string                    `ipp:"urf-supported"`
}

PrinterDescription contains Printer Description and Status Attributes

type PrinterDescriptionGroup

type PrinterDescriptionGroup struct{}

PrinterDescriptionGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.PrinterDescription group.

type PrinterJobSaveDisposition

type PrinterJobSaveDisposition struct {
	SaveDisposition optional.Val[string] `ipp:"save-disposition"`
	SaveInfo        []PrinterSaveInfo    `ipp:"save-info"`
}

PrinterJobSaveDisposition represents "job-save-disposition-default" collection entry in PrinterAttributes

type PrinterSaveInfo

type PrinterSaveInfo struct {
	SaveLocation       optional.Val[string] `ipp:"save-location"`
	SaveName           optional.Val[string] `ipp:"save-name"`
	SaveDocumentFormat optional.Val[string] `ipp:"save-document-format"`
}

PrinterSaveInfo represents "save-info" collection entry in PrinterJobSaveDisposition

type PrinterStatusGroup

type PrinterStatusGroup struct{}

PrinterStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.PrinterStatus group.

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy is the forwarding IPP proxy.

It implements the http.Handler interface for the IPP requests, forwards IPP requests, represented as the http.Request to the destination and responses in the reverse direction and rewrites the IPP request and response bodies to properly translate URLs, embedded into the protocol messages.

func NewProxy

func NewProxy(localPath string, remoteURL *url.URL) *Proxy

NewProxy creates the new Proxy.

The `clnt` is the client side of the proxy. If nil is passed, the client will be created automatically.

func (*Proxy) ServeHTTP

func (proxy *Proxy) ServeHTTP(w http.ResponseWriter, rq *http.Request)

ServeHTTP handles incoming HTTP requests. It implements http.Handler interface.

func (*Proxy) Sniff

func (proxy *Proxy) Sniff(sniffer Sniffer)

Sniff installs the sniffer callback.

Don't use this function when proxy is already active (i.e., concurrently with the Proxy.ServeHTTP, it can cause race conditions.

type Request

type Request interface {
	// Header() returns *RequestHeader.
	//
	// Each concrete Request implementation inherits it by
	// embedding this structure.
	Header() *RequestHeader

	// The following methods each concrete Request implementation
	// must define by itself:
	//   - GetOp returns IPP Operation code of the Request.
	//   - Encode encodes Request into the goipp.Message.
	//   - Decode decodes Request from the goipp.Message.
	GetOp() goipp.Op
	Encode() *goipp.Message
	Decode(*goipp.Message, *DecoderOptions) error
}

Request is the IPP request interface.

type RequestHeader

type RequestHeader struct {
	// IPP version and RequestID.
	Version   goipp.Version
	RequestID uint32

	// Common Operation attributes
	AttributesCharset         string `ipp:"attributes-charset"`
	AttributesNaturalLanguage string `ipp:"attributes-natural-language"`

	// Request body. Sent after IPP message. May be nil
	Body io.Reader
}

RequestHeader is the common Request header. It contains common fields and implements common interfaces.

It should be embedded at the beginning of every structure that implements the Request interface.

func (*RequestHeader) Header

func (rqh *RequestHeader) Header() *RequestHeader

Header returns RequestHeader, which gives uniform access to the header of any Request

func (*RequestHeader) ResponseHeader

func (rqh *RequestHeader) ResponseHeader(status goipp.Status) ResponseHeader

ResponseHeader returns the appropriate ResponseHeader for the request.

type ResourceDescriptionGroup

type ResourceDescriptionGroup struct{}

ResourceDescriptionGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.ResourceDescription group.

type ResourceStatusGroup

type ResourceStatusGroup struct{}

ResourceStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.ResourceStatus group.

type Response

type Response interface {
	// Header() returns *ResponseHeader.
	//
	// Each concrete Response implementation inherits it by
	// embedding this structure
	Header() *ResponseHeader

	// The following methods each concrete Response implementation
	// must define by itself:
	//   - Encode encodes Response into goipp.Message.
	//   - Decode decodes Response from goipp.Message.
	Encode() *goipp.Message
	Decode(*goipp.Message, *DecoderOptions) error
}

Response is the IPP response interface.

type ResponseHeader

type ResponseHeader struct {
	// IPP version, RequestID, IPP Status code.
	Version   goipp.Version
	RequestID uint32
	Status    goipp.Status

	// Common Operation attributes.
	AttributesCharset         string `ipp:"attributes-charset"`
	AttributesNaturalLanguage string `ipp:"attributes-natural-language"`
	StatusMessage             string `ipp:"status-message"`

	// Raw IPP message.
	//
	// This field is filled when Response is received as result
	// of Client.Do or Client.DoWithBody and contains the raw
	// IPP message.
	IPPMessage *goipp.Message

	// Response Body.
	//
	// If Response is received as result of Client.DoWithBody,
	// the Body is never nil and always valid, even if empty.
	// Caller of Client.DoWithBody MUST Close the response
	// to avoid leak of resources.
	//
	// As IPP requests rarely returns non-empty Body, the
	// convenience wrapper, Client.Do, is provided. It
	// closes the Body and sets it to nil.
	Body io.ReadCloser
}

ResponseHeader is the common Response header. It contains common fields and implements common interfaces.

It should be embedded at the beginning of every structure that implements the Response interface.

func (*ResponseHeader) Header

func (rsph *ResponseHeader) Header() *ResponseHeader

Header returns ResponseHeader, which gives uniform access to the header of any Response

type SendDocumentRequest

type SendDocumentRequest struct {
	ObjectRawAttrs
	RequestHeader

	OperationGroup

	// Operation attributes
	PrinterURI         optional.Val[string] `ipp:"printer-uri"`
	JobID              optional.Val[int]    `ipp:"job-id"`
	JobURI             optional.Val[string] `ipp:"job-uri"`
	RequestingUserName optional.Val[string] `ipp:"requesting-user-name"`

	Compression             optional.Val[KwCompression] `ipp:"compression"`
	DocumentFormat          optional.Val[string]        `ipp:"document-format"`
	DocumentName            optional.Val[string]        `ipp:"document-name"`
	DocumentNaturalLanguage optional.Val[string]        `ipp:"document-natural-language"`
	LastDocument            bool                        `ipp:"last-document"`

	// Job attributes
	Job *JobAttributes
}

SendDocumentRequest operation (0x0006) adds document to the job previously created by the Create-Job request.

func (*SendDocumentRequest) Decode

func (rq *SendDocumentRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes SendDocumentRequest from goipp.Message.

func (*SendDocumentRequest) Encode

func (rq *SendDocumentRequest) Encode() *goipp.Message

Encode encodes SendDocumentRequest into the goipp.Message.

func (*SendDocumentRequest) GetOp

func (rq *SendDocumentRequest) GetOp() goipp.Op

GetOp returns SendDocumentRequest IPP Operation code.

type SendDocumentResponse

type SendDocumentResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Unsupported attributes, if any
	UnsupportedAttributes goipp.Attributes

	// Job status
	Job *JobStatus
}

SendDocumentResponse is the Create-Job response.

func (*SendDocumentResponse) Decode

func (rsp *SendDocumentResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes SendDocumentResponse from goipp.Message.

func (*SendDocumentResponse) Encode

func (rsp *SendDocumentResponse) Encode() *goipp.Message

Encode encodes SendDocumentResponse into goipp.Message.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the IPP server.

func NewServer

func NewServer(options ServerOptions) *Server

NewServer returns a new Sever.

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(handler *Handler)

RegisterHandler adds the request Handler.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, rq *http.Request)

ServeHTTP handles incoming HTTP request. It implements http.Handler interface.

Using this interface, the Server can work on a top of existent http.Server, http.ServeMux, transport.PathMux and so on.

func (*Server) Sniff

func (s *Server) Sniff(sniffer Sniffer)

Sniff installs the sniffer callback.

Don't use this function when proxy is already active (i.e., concurrently with the Proxy.ServeHTTP, it can cause race conditions.

type ServerHooks

type ServerHooks struct {
	// OnHTTPRequest is called when the HTTP request is just
	// received.
	OnHTTPRequest func(*transport.ServerQuery)

	// OnIPPRequest is called when the IPP request is
	// received.
	//
	// The hook can modify the [goipp.Message] request
	// in place or completely replace it by returning
	// the non-nil new value.
	OnIPPRequest func(*transport.ServerQuery,
		*goipp.Message) *goipp.Message

	// OnIPPResponse is called when the IPP response is
	// received.
	//
	// The hook can modify the [goipp.Message] response
	// in place or completely replace it by returning
	// the non-nil new value.
	OnIPPResponse func(*transport.ServerQuery,
		*goipp.Message) *goipp.Message
}

ServerHooks allows to specify set of hooks (callbacks) that will be called during the request processing and can modify the request handling.

Every hook is optional and can be set to nil.

If hook calls the transport.ServerQuery.WriteHeader function, the query considered completed and further processing is not performed.

type ServerOptions

type ServerOptions struct {
	// UseRawPrinterAttributes, if set, instruct [Printer]
	// to return attributes, based on PrinterAttributes.RawAttrs
	// instead of the the PrinterAttributes.Encode.
	//
	// It can be useful when the exact content and ordering of
	// printer attributes needs to be specified, because conversion
	// from the IPP attributes to and from the Go structure
	// is not lossless.
	UseRawPrinterAttributes bool

	// Hooks defines IPP server hooks. See [ServerHooks]
	// for details.
	Hooks ServerHooks
}

ServerOptions allows to specify options that can modify the Server behavior.

type Sniffer

type Sniffer struct {
	// Request, if not nil, is called when IPP request is
	// being sent to the destination.
	//
	// The sequence number is incremented for each new
	// request.
	Request func(seqnum uint64, query *transport.ServerQuery,
		msg *goipp.Message, body io.Reader)

	// Response, if not nil, is called when IPP response has been
	// being received from the destination.
	//
	// The sequence number of the response matches the sequence
	// number of the request.
	Response func(seqnum uint64, query *transport.ServerQuery,
		msg *goipp.Message, body io.Reader)
}

Sniffer contains a set of hooks which are called for the IPP protocol sniffing purposes.

type SubscriptionStatusGroup

type SubscriptionStatusGroup struct{}

SubscriptionStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.SubscriptionStatus group.

type SubscriptionTemplateGroup

type SubscriptionTemplateGroup struct{}

SubscriptionTemplateGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.SubscriptionTemplate group.

type SystemDescriptionGroup

type SystemDescriptionGroup struct{}

SystemDescriptionGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.SystemDescription group.

type SystemStatusGroup

type SystemStatusGroup struct{}

SystemStatusGroup should be embedded into the IPP structure to indicate that it contains attributes, defined in the iana.SystemStatus group.

type ValidateJobRequest

type ValidateJobRequest struct {
	ObjectRawAttrs
	RequestHeader

	// Operation attributes
	JobCreateOperation

	Job *JobAttributes
}

ValidateJobRequest operation (0x0004) performs the print job validation as if the document was actually printed, bypassing the actual fetching and printing of the document data.

func (*ValidateJobRequest) Decode

func (rq *ValidateJobRequest) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes ValidateJobRequest from goipp.Message.

func (*ValidateJobRequest) Encode

func (rq *ValidateJobRequest) Encode() *goipp.Message

Encode encodes ValidateJobRequest into the goipp.Message.

func (*ValidateJobRequest) GetOp

func (rq *ValidateJobRequest) GetOp() goipp.Op

GetOp returns ValidateJobRequest IPP Operation code.

type ValidateJobResponse

type ValidateJobResponse struct {
	ObjectRawAttrs
	ResponseHeader
	OperationGroup

	// Unsupported attributes, if any
	UnsupportedAttributes goipp.Attributes
}

ValidateJobResponse is the Validate-Job response.

func (*ValidateJobResponse) Decode

func (rsp *ValidateJobResponse) Decode(
	msg *goipp.Message, opt *DecoderOptions) error

Decode decodes ValidateJobResponse from goipp.Message.

func (*ValidateJobResponse) Encode

func (rsp *ValidateJobResponse) Encode() *goipp.Message

Encode encodes ValidateJobResponse into goipp.Message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL