Add constants
This commit is contained in:
6
main.go
6
main.go
@@ -14,7 +14,7 @@ func main() {
|
|||||||
defer cancel() // cancel when we are finished consuming integers
|
defer cancel() // cancel when we are finished consuming integers
|
||||||
go mdnsserver.Run(ctx)
|
go mdnsserver.Run(ctx)
|
||||||
|
|
||||||
http.HandleFunc("/", handle)
|
http.HandleFunc("/ipp/print", handle)
|
||||||
|
|
||||||
log.Info("http server started on :1234")
|
log.Info("http server started on :1234")
|
||||||
err := http.ListenAndServe(":1234", nil)
|
err := http.ListenAndServe(":1234", nil)
|
||||||
@@ -25,6 +25,10 @@ func main() {
|
|||||||
|
|
||||||
func handle(w http.ResponseWriter, r *http.Request) {
|
func handle(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Infoln("handle")
|
log.Infoln("handle")
|
||||||
|
if r.Method != "POST" {
|
||||||
|
http.Error(w, "Unsupported method", http.StatusMethodNotAllowed)
|
||||||
|
|
||||||
|
}
|
||||||
// Disable caching of this page
|
// Disable caching of this page
|
||||||
|
|
||||||
// Check if user is logged in, if not redirect to login page
|
// Check if user is logged in, if not redirect to login page
|
||||||
|
|||||||
44
messages.go
Normal file
44
messages.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// References
|
||||||
|
// https://tools.ietf.org/html/rfc8010
|
||||||
|
// https://tools.ietf.org/html/rfc8011
|
||||||
|
|
||||||
|
// Defined atribute group tags
|
||||||
|
const (
|
||||||
|
beginAttributeGroupTag = 0x00
|
||||||
|
operationAttributesTag = 0x01
|
||||||
|
jobAttributesTag = 0x02
|
||||||
|
endOfAttributesTag = 0x03
|
||||||
|
printerAttributesTag = 0x04
|
||||||
|
unsupportedAttributesTag = 0x05
|
||||||
|
)
|
||||||
|
|
||||||
|
// Defined value tags
|
||||||
|
// from rfc8010
|
||||||
|
const (
|
||||||
|
// Out of band
|
||||||
|
unsupportedValueTag = 0x10
|
||||||
|
unknownValueTag = 0x12
|
||||||
|
noValueValueTag = 0x13
|
||||||
|
// Integer values
|
||||||
|
integerValueTag = 0x21
|
||||||
|
booleanIntegerTag = 0x22
|
||||||
|
enumValueTag = 0x23
|
||||||
|
// Character string values
|
||||||
|
textWithoutLanguagage = 0x41
|
||||||
|
nameWithoutLanguagage = 0x42
|
||||||
|
keyword = 0x44
|
||||||
|
uri = 0x45
|
||||||
|
uriScheme = 0x46
|
||||||
|
charset = 0x47
|
||||||
|
naturalLanguagage = 0x48
|
||||||
|
mimeMediaType = 0x49
|
||||||
|
memberAttrName = 0x4a
|
||||||
|
)
|
||||||
|
|
||||||
|
type ippRequestHeader struct {
|
||||||
|
versionNumber uint16
|
||||||
|
operationId uint16
|
||||||
|
requestId uint32
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user