ptg10805159
796 Communicating with a Network Printer Chapter 21
We start with theipp.hheader file.
1#ifndef _IPP_H
2#define _IPP_H
3/*
4*Defines parts of the IPP protocol between the scheduler
5*and the printer. Based on RFC2911 and RFC2910.
6*/
7/*
8*Status code classes.
9*/
10 #define STATCLASS_OK(x) ((x) >= 0x0000 && (x) <= 0x00ff)
11 #define STATCLASS_INFO(x) ((x) >= 0x0100 && (x) <= 0x01ff)
12 #define STATCLASS_REDIR(x) ((x) >= 0x0300 && (x) <= 0x03ff)
13 #define STATCLASS_CLIERR(x) ((x) >= 0x0400 && (x) <= 0x04ff)
14 #define STATCLASS_SRVERR(x) ((x) >= 0x0500 && (x) <= 0x05ff)
15 /*
16 * Status codes.
17 */
18 #define STAT_OK 0x0000 /* success */
19 #define STAT_OK_ATTRIGN 0x0001 /* OK; some attrs ignored */
20 #define STAT_OK_ATTRCON 0x0002 /* OK; some attrs conflicted */
21 #define STAT_CLI_BADREQ 0x0400 /* invalid client request */
22 #define STAT_CLI_FORBID 0x0401 /* request is forbidden */
23 #define STAT_CLI_NOAUTH 0x0402 /* authentication required */
24 #define STAT_CLI_NOPERM 0x0403 /* client not authorized */
25 #define STAT_CLI_NOTPOS 0x0404 /* request not possible */
26 #define STAT_CLI_TIMOUT 0x0405 /* client too slow */
27 #define STAT_CLI_NOTFND 0x0406 /* no object found for URI */
28 #define STAT_CLI_OBJGONE 0x0407 /* object no longer available */
29 #define STAT_CLI_TOOBIG 0x0408 /* requested entity too big */
30 #define STAT_CLI_TOOLNG 0x0409 /* attribute value too large */
31 #define STAT_CLI_BADFMT 0x040a /* unsupported doc format */
32 #define STAT_CLI_NOTSUP 0x040b /* attributes not supported */
33 #define STAT_CLI_NOSCHM 0x040c /* URI scheme not supported */
34 #define STAT_CLI_NOCHAR 0x040d /* charset not supported */
35 #define STAT_CLI_ATTRCON 0x040e /* attributes conflicted */
36 #define STAT_CLI_NOCOMP 0x040f /* compression not supported */
37 #define STAT_CLI_COMPERR 0x0410 /* data can’t be decompressed */
38 #define STAT_CLI_FMTERR 0x0411 /* document format error */
39 #define STAT_CLI_ACCERR 0x0412 /* error accessing data */
[1 – 14] We start theipp.hheader with the standard#ifdefto prevent errors when it
is included twice in the same file. Then we define the classes of IPP status
codes (see Section 13 in RFC 2911).
[15 – 39] We define specific status codes based on RFC 2911. Wedon’t use these codes
in the program shown here; their use is left as an exercise (See Exercise 21.1).