Files
ippserver/packages/ipp/urivalue.go
henrik 04a4b4157f 2-add-keyword-support (#6)
More development.

More types.
Fixed attribute groups in requests.
Started on client.
Saving data to file.

More types. Printing from chromeos works a little bit.

More types.

Spelling corrections.

WIP: Fix keyword handling

Move request to a separate file and add test.

Co-authored-by: Henrik Sölver <henrik.solver@gmail.com>
Reviewed-on: #6
Co-Authored-By: henrik <henrik.solver@gmail.com>
Co-Committed-By: henrik <henrik.solver@gmail.com>
2020-12-27 09:16:32 +01:00

43 lines
717 B
Go

package ipp
import (
"io"
)
type uriValue struct {
name string
value string
}
func NewUriValue(name, value string) *uriValue {
u := new(uriValue)
u.name = name
u.value = value
return u
}
func (u uriValue) String() string {
return u.name + ":" + u.value
}
func (u *uriValue) valueTag() tag {
return uriValueTag
}
func (u *uriValue) unmarshal(byteStream io.Reader) {
u.name, u.value = unmarshalSingleValue(byteStream)
}
func (u *uriValue) marshal() []byte {
res := make([]byte, u.size())
res[0] = byte(uriValueTag)
marshalNameValue(u.name, u.value, res[1:])
return res
}
func (u *uriValue) size() int {
l := 1 + 4 // The attribute tag + 2 lengths
l += len(u.name)
l += len(u.value)
return l
}