📄 rfc2565.txt
字号:
-----------------------------------------------
| name | u bytes
-----------------------------------------------
| value-length (value is v) | 2 bytes
-----------------------------------------------
| value | v bytes
-----------------------------------------------
Herriot, et al. Experimental [Page 6]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
An additional value consists of:
-----------------------------------------------------------
| value-tag | 1 byte |
----------------------------------------------- |
| name-length (value is 0x0000) | 2 bytes |
----------------------------------------------- |-0 or more
| value-length (value is w) | 2 bytes |
----------------------------------------------- |
| value | w bytes |
-----------------------------------------------------------
Note: an additional value is like an attribute whose name-length is 0.
From the standpoint of a parsing loop, the encoding consists of:
-----------------------------------------------
| version-number | 2 bytes - required
-----------------------------------------------
| operation-id (request) |
| or | 2 bytes - required
| status-code (response) |
-----------------------------------------------
| request-id | 4 bytes - required
-----------------------------------------------------------
| tag (delimiter-tag or value-tag) | 1 byte |
----------------------------------------------- |-0 or more
| empty or rest of attribute | x bytes |
-----------------------------------------------------------
| end-of-attributes-tag | 2 bytes - required
-----------------------------------------------
| data | y bytes - optional
-----------------------------------------------
The value of the tag determines whether the bytes following the
tag are:
- attributes
- data
- the remainder of a single attribute where the tag specifies the
type of the value.
3.2 Syntax of Encoding
The syntax below is ABNF [RFC2234] except 'strings of literals' MUST
be case sensitive. For example 'a' means lower case 'a' and not
upper case 'A'. In addition, SIGNED-BYTE and SIGNED-SHORT fields
are represented as '%x' values which show their range of values.
Herriot, et al. Experimental [Page 7]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
ipp-message = ipp-request / ipp-response
ipp-request = version-number operation-id request-id
*(xxx-attributes-tag xxx-attribute-sequence)
end-of-attributes-tag data
ipp-response = version-number status-code request-id
*(xxx-attributes-tag xxx-attribute-sequence)
end-of-attributes-tag data
xxx-attribute-sequence = *compound-attribute
xxx-attributes-tag = operation-attributes-tag / job-attributes-tag /
printer-attributes-tag / unsupported-attributes-tag
version-number = major-version-number minor-version-number
major-version-number = SIGNED-BYTE ; initially %d1
minor-version-number = SIGNED-BYTE ; initially %d0
operation-id = SIGNED-SHORT ; mapping from model defined below
status-code = SIGNED-SHORT ; mapping from model defined below
request-id = SIGNED-INTEGER ; whose value is > 0
compound-attribute = attribute *additional-values
attribute = value-tag name-length name value-length value
additional-values = value-tag zero-name-length value-length value
name-length = SIGNED-SHORT ; number of octets of 'name'
name = LALPHA *( LALPHA / DIGIT / "-" / "_" / "." )
value-length = SIGNED-SHORT ; number of octets of 'value'
value = OCTET-STRING
data = OCTET-STRING
zero-name-length = %x00.00 ; name-length of 0
operation-attributes-tag = %x01 ; tag of 1
job-attributes-tag = %x02 ; tag of 2
printer-attributes-tag = %x04 ; tag of 4
unsupported-attributes-tag = %x05 ; tag of 5
end-of-attributes-tag = %x03 ; tag of 3
value-tag = %x10-FF
SIGNED-BYTE = BYTE
SIGNED-SHORT = 2BYTE
SIGNED-INTEGER = 4BYTE
DIGIT = %x30-39 ; "0" to "9"
LALPHA = %x61-7A ; "a" to "z"
BYTE = %x00-FF
OCTET-STRING = *BYTE
Herriot, et al. Experimental [Page 8]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
The syntax allows an xxx-attributes-tag to be present when the xxx-
attribute-sequence that follows is empty. The syntax is defined this
way to allow for the response of Get-Jobs where no attributes are
returned for some job-objects. Although it is RECOMMENDED that the
sender not send an xxx-attributes-tag if there are no attributes
(except in the Get-Jobs response just mentioned), the receiver MUST
be able to decode such syntax.
3.3 Version-number
The version-number MUST consist of a major and minor version-number,
each of which MUST be represented by a SIGNED-BYTE. The protocol
described in this document MUST have a major version-number of 1
(0x01) and a minor version-number of 0 (0x00). The ABNF for these
two bytes MUST be %x01.00.
3.4 Operation-id
Operation-ids are defined as enums in the model document. An
operation-ids enum value MUST be encoded as a SIGNED-SHORT.
Note: the values 0x4000 to 0xFFFF are reserved for private
extensions.
3.5 Status-code
Status-codes are defined as enums in the model document. A status-
code enum value MUST be encoded as a SIGNED-SHORT.
The status-code is an operation attribute in the model document. In
the protocol, the status-code is in a special position, outside of
the operation attributes.
If an IPP status-code is returned, then the HTTP Status-Code MUST be
200 (successful-ok). With any other HTTP Status-Code value, the HTTP
response MUST NOT contain an IPP message-body, and thus no IPP
status-code is returned.
3.6 Request-id
The request-id allows a client to match a response with a request.
This mechanism is unnecessary in HTTP, but may be useful when
application/ipp entity bodies are used in another context.
The request-id in a response MUST be the value of the request-id
received in the corresponding request. A client can set the
request-id in each request to a unique value or a constant value,
such as 1, depending on what the client does with the request-id
Herriot, et al. Experimental [Page 9]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
returned in the response. The value of the request-id MUST be greater
than zero.
3.7 Tags
There are two kinds of tags:
- delimiter tags: delimit major sections of the protocol, namely
attributes and data
- value tags: specify the type of each attribute value
3.7.1 Delimiter Tags
The following table specifies the values for the delimiter tags:
Tag Value (Hex) Delimiter
0x00 reserved
0x01 operation-attributes-tag
0x02 job-attributes-tag
0x03 end-of-attributes-tag
0x04 printer-attributes-tag
0x05 unsupported-attributes-tag
0x06-0x0e reserved for future delimiters
0x0F reserved for future chunking-end-of-attributes-
tag
When an xxx-attributes-tag occurs in the protocol, it MUST mean that
zero or more following attributes up to the next delimiter tag are
attributes belonging to group xxx as defined in the model document,
where xxx is operation, job, printer, unsupported.
Doing substitution for xxx in the above paragraph, this means the
following. When an operation-attributes-tag occurs in the protocol,
it MUST mean that the zero or more following attributes up to the
next delimiter tag are operation attributes as defined in the model
document. When an job-attributes-tag occurs in the protocol, it MUST
mean that the zero or more following attributes up to the next
delimiter tag are job attributes or job template attributes as
defined in the model document. When a printer-attributes-tag occurs
in the protocol, it MUST mean that the zero or more following
attributes up to the next delimiter tag are printer attributes as
defined in the model document. When an unsupported-attributes-tag
occurs in the protocol, it MUST mean that the zero or more following
attributes up to the next delimiter tag are unsupported attributes as
defined in the model document.
Herriot, et al. Experimental [Page 10]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
The operation-attributes-tag and end-of-attributes-tag MUST each
occur exactly once in an operation. The operation-attributes-tag MUST
be the first tag delimiter, and the end-of-attributes-tag MUST be the
last tag delimiter. If the operation has a document-content group,
the document data in that group MUST follow the end-of-attributes-
tag.
Each of the other three xxx-attributes-tags defined above is
OPTIONAL in an operation and each MUST occur at most once in an
operation, except for job-attributes-tag in a Get-Jobs response which
may occur zero or more times.
The order and presence of delimiter tags for each operation request
and each operation response MUST be that defined in the model
document. For further details, see section 3.9 "(Attribute) Name" and
section 9 "Appendix A: Protocol Examples".
A Printer MUST treat the reserved delimiter tags differently from
reserved value tags so that the Printer knows that there is an entire
attribute group that it doesn't understand as opposed to a single
value that it doesn't understand.
3.7.2 Value Tags
The remaining tables show values for the value-tag, which is the
first octet of an attribute. The value-tag specifies the type of the
value of the attribute. The following table specifies the "out-of-
band" values for the value-tag.
Tag Value (Hex) Meaning
0x10 unsupported
0x11 reserved for future 'default'
0x12 unknown
0x13 no-value
Tag Value (Hex) Meaning
0x14-0x1F reserved for future "out-of-band" values.
The "unsupported" value MUST be used in the attribute-sequence of an
error response for those attributes which the printer does not
support. The "default" value is reserved for future use of setting
value back to their default value. The "unknown" value is used for
the value of a supported attribute when its value is temporarily
unknown. The "no-value" value is used for a supported attribute to
which
Herriot, et al. Experimental [Page 11]
RFC 2565 IPP/1.0: Encoding and Transport April 1999
no value has been assigned, e.g. "job-k-octets-supported" has no
value if an implementation supports this attribute, but an
administrator has not configured the printer to have a limit.
The following table specifies the integer values for the value-tag:
Tag Value (Hex) Meaning
0x20 reserved
0x21 integer
0x22 boolean
0x23 enum
0x24-0x2F reserved for future integer types
NOTE: 0x20 is reserved for "generic integer" if it should ever be
needed.
The following table specifies the octetString values for the value-
tag:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -