Simple roundtrip from ipptool works.
This commit is contained in:
45
packages/ipp/keyword.go
Normal file
45
packages/ipp/keyword.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package ipp
|
||||
|
||||
import "io"
|
||||
|
||||
type keyWord struct {
|
||||
name string
|
||||
values []string
|
||||
}
|
||||
|
||||
func newKeyWord() *keyWord {
|
||||
k := new(keyWord)
|
||||
return k
|
||||
}
|
||||
|
||||
func (k *keyWord) string() string {
|
||||
return "a uriValue"
|
||||
}
|
||||
func (k *keyWord) valueTag() tag {
|
||||
return keyWordValueTag
|
||||
}
|
||||
|
||||
func (k *keyWord) unmarshal(byteStream io.Reader) {
|
||||
|
||||
}
|
||||
|
||||
func (k *keyWord) marshal() []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func (k *keyWord) addValue(v string) {
|
||||
k.values = append(k.values, v)
|
||||
}
|
||||
|
||||
func (k *keyWord) size() int {
|
||||
l := 1 + 2 // The value tag (0x44) + name-length field (2 bytes)
|
||||
l += len(k.name)
|
||||
l += 2 // value-length field (2 bytes)
|
||||
l += len(k.values[0])
|
||||
// Add all additional values
|
||||
for _, v := range k.values[1:] {
|
||||
l += 1 + 4 // The value tag (0x44) + 2 length fields (2 bytes)
|
||||
l += len(v)
|
||||
}
|
||||
return l
|
||||
}
|
||||
Reference in New Issue
Block a user