4 #if defined(__HAIKU__) || defined(HAIKU_TARGET_PLATFORM_BONE)
5 # include <sys/socket.h>
6 # include <netinet/in.h>
8 # include <net/socket.h>
15 #include "IppContent.h"
17 /*----------------------------------------------------------------------*/
19 short readLength(istream
&is
)
22 is
.read((char *)&len
, sizeof(short));
27 void writeLength(ostream
&os
, short len
)
30 os
.write((char *)&len
, sizeof(short));
33 /*----------------------------------------------------------------------*/
37 memset(this, 0, sizeof(DATETIME
));
40 DATETIME::DATETIME(const DATETIME
&dt
)
42 memcpy(this, &dt
.datetime
, sizeof(DATETIME
));
45 DATETIME
& DATETIME::operator = (const DATETIME
&dt
)
47 memcpy(this, &dt
.datetime
, sizeof(DATETIME
));
51 istream
& operator >> (istream
&is
, DATETIME
&attr
)
56 ostream
& operator << (ostream
&os
, const DATETIME
&attr
)
62 /*----------------------------------------------------------------------*/
64 IppAttribute::IppAttribute(IPP_TAG t
)
69 int IppAttribute::length() const
74 istream
&IppAttribute::input(istream
&is
)
79 ostream
&IppAttribute::output(ostream
&os
) const
81 os
<< (unsigned char)tag
;
85 ostream
&IppAttribute::print(ostream
&os
) const
87 os
<< "Tag: " << hex
<< (int)tag
<< '\n';
91 /*----------------------------------------------------------------------*/
93 IppNamedAttribute::IppNamedAttribute(IPP_TAG t
)
98 IppNamedAttribute::IppNamedAttribute(IPP_TAG t
, const char *s
)
99 : IppAttribute(t
), name(s
? s
: "")
103 int IppNamedAttribute::length() const
105 return IppAttribute::length() + 2 + name
.length();
108 istream
&IppNamedAttribute::input(istream
&is
)
110 short len
= readLength(is
);
113 char *buffer
= new char[len
+ 1];
114 is
.read(buffer
, len
);
123 ostream
&IppNamedAttribute::output(ostream
&os
) const
125 IppAttribute::output(os
);
127 writeLength(os
, name
.length());
133 ostream
&IppNamedAttribute::print(ostream
&os
) const
135 IppAttribute::print(os
);
136 os
<< '\t' << "Name: " << name
<< '\n';
140 /*----------------------------------------------------------------------*/
142 IppNoValueAttribute::IppNoValueAttribute(IPP_TAG t
)
143 : IppNamedAttribute(t
)
147 IppNoValueAttribute::IppNoValueAttribute(IPP_TAG t
, const char *n
)
148 : IppNamedAttribute(t
, n
)
152 int IppNoValueAttribute::length() const
154 return IppAttribute::length() + 2;
157 istream
&IppNoValueAttribute::input(istream
&is
)
159 IppNamedAttribute::input(is
);
161 short len
= readLength(is
);
164 is
.seekg(len
, ios::cur
);
170 ostream
&IppNoValueAttribute::output(ostream
&os
) const
172 IppAttribute::output(os
);
179 ostream
&IppNoValueAttribute::print(ostream
&os
) const
181 return IppNamedAttribute::print(os
);
184 /*----------------------------------------------------------------------*/
186 IppIntegerAttribute::IppIntegerAttribute(IPP_TAG t
)
187 : IppNamedAttribute(t
), value(0)
191 IppIntegerAttribute::IppIntegerAttribute(IPP_TAG t
, const char *n
, int v
)
192 : IppNamedAttribute(t
, n
), value(v
)
196 int IppIntegerAttribute::length() const
198 return IppNamedAttribute::length() + 2 + 4;
201 istream
&IppIntegerAttribute::input(istream
&is
)
203 IppNamedAttribute::input(is
);
205 short len
= readLength(is
);
207 if (0 < len
&& len
<= 4) {
208 is
.read((char *)&value
, sizeof(value
));
209 value
= ntohl(value
);
211 is
.seekg(len
, ios::cur
);
217 ostream
&IppIntegerAttribute::output(ostream
&os
) const
219 IppNamedAttribute::output(os
);
222 unsigned long val
= htonl(value
);
223 os
.write((char *)&val
, sizeof(val
));
227 ostream
&IppIntegerAttribute::print(ostream
&os
) const
229 IppNamedAttribute::print(os
);
230 os
<< '\t' << "Value: " << dec
<< value
<< '\n';
234 /*----------------------------------------------------------------------*/
236 IppBooleanAttribute::IppBooleanAttribute(IPP_TAG t
)
237 : IppNamedAttribute(t
), value(false)
241 IppBooleanAttribute::IppBooleanAttribute(IPP_TAG t
, const char *n
, bool f
)
242 : IppNamedAttribute(t
, n
), value(f
)
246 int IppBooleanAttribute::length() const
248 return IppNamedAttribute::length() + 2 + 1;
252 istream
&IppBooleanAttribute::input(istream
&is
)
254 IppNamedAttribute::input(is
);
256 short len
= readLength(is
);
258 if (0 < len
&& len
<= 1) {
260 is
.read((char *)&c
, sizeof(c
));
261 value
= c
? true : false;
263 is
.seekg(len
, ios::cur
);
269 ostream
&IppBooleanAttribute::output(ostream
&os
) const
271 IppNamedAttribute::output(os
);
274 char c
= (char)value
;
275 os
.write((char *)&c
, sizeof(c
));
280 ostream
&IppBooleanAttribute::print(ostream
&os
) const
282 IppNamedAttribute::print(os
);
283 os
<< '\t' << "Value: " << value
<< '\n';
287 /*----------------------------------------------------------------------*/
289 IppDatetimeAttribute::IppDatetimeAttribute(IPP_TAG t
)
290 : IppNamedAttribute(t
)
294 IppDatetimeAttribute::IppDatetimeAttribute(IPP_TAG t
, const char *n
, const DATETIME
*dt
)
295 : IppNamedAttribute(t
, n
), datetime(*dt
)
299 int IppDatetimeAttribute::length() const
301 return IppNamedAttribute::length() + 2 + 11;
304 istream
&IppDatetimeAttribute::input(istream
&is
)
306 IppNamedAttribute::input(is
);
308 short len
= readLength(is
);
314 is
.seekg(len
, ios::cur
);
321 ostream
&IppDatetimeAttribute::output(ostream
&os
) const
323 IppNamedAttribute::output(os
);
331 ostream
&IppDatetimeAttribute::print(ostream
&os
) const
333 IppNamedAttribute::print(os
);
334 os
<< '\t' << "Value(DateTime): " << datetime
<< '\n';
338 /*----------------------------------------------------------------------*/
340 IppStringAttribute::IppStringAttribute(IPP_TAG t
)
341 : IppNamedAttribute(t
)
345 IppStringAttribute::IppStringAttribute(IPP_TAG t
, const char *n
, const char *s
)
346 : IppNamedAttribute(t
, n
), text(s
? s
: "")
350 int IppStringAttribute::length() const
352 return IppNamedAttribute::length() + 2 + text
.length();
355 istream
&IppStringAttribute::input(istream
&is
)
357 IppNamedAttribute::input(is
);
359 short len
= readLength(is
);
362 char *buffer
= new char[len
+ 1];
363 is
.read(buffer
, len
);
372 ostream
&IppStringAttribute::output(ostream
&os
) const
374 IppNamedAttribute::output(os
);
376 writeLength(os
, text
.length());
382 ostream
&IppStringAttribute::print(ostream
&os
) const
384 IppNamedAttribute::print(os
);
385 os
<< '\t' << "Value: " << text
<< '\n';
389 /*----------------------------------------------------------------------*/
391 IppDoubleStringAttribute::IppDoubleStringAttribute(IPP_TAG t
)
392 : IppNamedAttribute(t
)
396 IppDoubleStringAttribute::IppDoubleStringAttribute(IPP_TAG t
, const char *n
, const char *s1
, const char *s2
)
397 : IppNamedAttribute(t
, n
), text1(s1
? s1
: ""), text2(s2
? s2
: "")
401 int IppDoubleStringAttribute::length() const
403 return IppNamedAttribute::length() + 2 + text1
.length() + 2 + text2
.length();
406 istream
&IppDoubleStringAttribute::input(istream
&is
)
408 IppNamedAttribute::input(is
);
410 short len
= readLength(is
);
413 char *buffer
= new char[len
+ 1];
414 is
.read(buffer
, len
);
420 len
= readLength(is
);
423 char *buffer
= new char[len
+ 1];
424 is
.read(buffer
, len
);
433 ostream
&IppDoubleStringAttribute::output(ostream
&os
) const
435 IppNamedAttribute::output(os
);
437 writeLength(os
, text1
.length());
440 writeLength(os
, text2
.length());
446 ostream
&IppDoubleStringAttribute::print(ostream
&os
) const
448 IppNamedAttribute::print(os
);
449 os
<< '\t' << "Value1: " << text1
<< '\n';
450 os
<< '\t' << "Value2: " << text2
<< '\n';
454 /*----------------------------------------------------------------------*/
456 IppResolutionAttribute::IppResolutionAttribute(IPP_TAG t
)
457 : IppNamedAttribute(t
), xres(0), yres(0), resolution_units((IPP_RESOLUTION_UNITS
)0)
461 IppResolutionAttribute::IppResolutionAttribute(IPP_TAG t
, const char *n
, int x
, int y
, IPP_RESOLUTION_UNITS u
)
462 : IppNamedAttribute(t
, n
), xres(x
), yres(y
), resolution_units(u
)
466 int IppResolutionAttribute::length() const
468 return IppNamedAttribute::length() + 2 + 4 + 2 + 4 + 2 + 1;
471 istream
&IppResolutionAttribute::input(istream
&is
)
473 IppNamedAttribute::input(is
);
475 short len
= readLength(is
);
477 if (0 < len
&& len
<= 4) {
478 is
.read((char *)&xres
, sizeof(xres
));
481 is
.seekg(len
, ios::cur
);
484 len
= readLength(is
);
486 if (0 < len
&& len
<= 4) {
487 is
.read((char *)&yres
, sizeof(yres
));
490 is
.seekg(len
, ios::cur
);
493 len
= readLength(is
);
497 is
.read((char *)&c
, sizeof(c
));
498 resolution_units
= (IPP_RESOLUTION_UNITS
)c
;
500 is
.seekg(len
, ios::cur
);
506 ostream
&IppResolutionAttribute::output(ostream
&os
) const
508 IppNamedAttribute::output(os
);
511 unsigned long val
= htonl(xres
);
512 os
.write((char *)&val
, sizeof(val
));
516 os
.write((char *)&val
, sizeof(val
));
519 unsigned char c
= (unsigned char)resolution_units
;
520 os
.write((char *)&c
, sizeof(c
));
525 ostream
&IppResolutionAttribute::print(ostream
&os
) const
527 IppNamedAttribute::print(os
);
528 os
<< '\t' << "Value(xres): " << dec
<< xres
<< '\n';
529 os
<< '\t' << "Value(yres): " << dec
<< yres
<< '\n';
530 os
<< '\t' << "Value(unit): " << dec
<< resolution_units
<< '\n';
534 /*----------------------------------------------------------------------*/
536 IppRangeOfIntegerAttribute::IppRangeOfIntegerAttribute(IPP_TAG t
)
537 : IppNamedAttribute(t
), lower(0), upper(0)
541 IppRangeOfIntegerAttribute::IppRangeOfIntegerAttribute(IPP_TAG t
, const char *n
, int l
, int u
)
542 : IppNamedAttribute(t
, n
), lower(l
), upper(u
)
546 int IppRangeOfIntegerAttribute::length() const
548 return IppNamedAttribute::length() + 2 + 4 + 2 + 4;
551 istream
&IppRangeOfIntegerAttribute::input(istream
&is
)
553 IppNamedAttribute::input(is
);
555 short len
= readLength(is
);
557 if (0 < len
&& len
<= 4) {
558 is
.read((char *)&lower
, sizeof(lower
));
559 lower
= ntohl(lower
);
561 is
.seekg(len
, ios::cur
);
564 len
= readLength(is
);
566 if (0 < len
&& len
<= 4) {
567 is
.read((char *)&upper
, sizeof(upper
));
568 upper
= ntohl(upper
);
570 is
.seekg(len
, ios::cur
);
576 ostream
&IppRangeOfIntegerAttribute::output(ostream
&os
) const
578 IppNamedAttribute::output(os
);
581 unsigned long val
= htonl(lower
);
582 os
.write((char *)&val
, sizeof(val
));
586 os
.write((char *)&val
, sizeof(val
));
591 ostream
&IppRangeOfIntegerAttribute::print(ostream
&os
) const
593 IppNamedAttribute::print(os
);
594 os
<< '\t' << "Value(lower): " << dec
<< lower
<< '\n';
595 os
<< '\t' << "Value(upper): " << dec
<< upper
<< '\n';
599 /*----------------------------------------------------------------------*/
601 IppContent::IppContent()
604 operation_id
= IPP_GET_PRINTER_ATTRIBUTES
;
605 request_id
= 0x00000001;
611 IppContent::~IppContent()
613 for (list
<IppAttribute
*>::const_iterator it
= attrs
.begin(); it
!= attrs
.end(); it
++) {
618 unsigned short IppContent::getVersion() const
623 void IppContent::setVersion(unsigned short i
)
629 IPP_OPERATION_ID
IppContent::getOperationId() const
631 return (IPP_OPERATION_ID
)operation_id
;
634 void IppContent::setOperationId(IPP_OPERATION_ID i
)
639 IPP_STATUS_CODE
IppContent::getStatusCode() const
641 return (IPP_STATUS_CODE
)operation_id
;
644 unsigned long IppContent::getRequestId() const
649 void IppContent::setRequestId(unsigned long i
)
654 istream
&IppContent::input(istream
&is
)
656 if (!is
.read((char *)&version
, sizeof(version
))) {
660 version
= ntohs(version
);
662 if (!is
.read((char *)&operation_id
, sizeof(operation_id
))) {
666 operation_id
= ntohs(operation_id
);
668 if (!is
.read((char *)&request_id
, sizeof(request_id
))) {
672 request_id
= ntohl(request_id
);
677 if (!is
.read((char *)&tag
, sizeof(tag
))) {
681 if (tag
<= 0x0F) { // delimiter
683 // case IPP_OPERATION_ATTRIBUTES_TAG:
684 // case IPP_JOB_ATTRIBUTES_TAG:
685 // case IPP_END_OF_ATTRIBUTES_TAG:
686 // case IPP_PRINTER_ATTRIBUTES_TAG:
687 // case IPP_UNSUPPORTED_ATTRIBUTES_TAG:
689 attrs
.push_back(new IppAttribute((IPP_TAG
)tag
));
690 if (tag
== IPP_END_OF_ATTRIBUTES_TAG
) {
694 } else if (tag
<= 0x1F) {
696 IppNoValueAttribute
*attr
= new IppNoValueAttribute((IPP_TAG
)tag
);
698 attrs
.push_back(attr
);
700 } else if (tag
<= 0x2F) { // integer values
706 IppIntegerAttribute
*attr
= new IppIntegerAttribute((IPP_TAG
)tag
);
708 attrs
.push_back(attr
);
713 IppBooleanAttribute
*attr
= new IppBooleanAttribute((IPP_TAG
)tag
);
715 attrs
.push_back(attr
);
720 short len
= readLength(is
);
721 is
.seekg(len
, ios::cur
);
722 len
= readLength(is
);
723 is
.seekg(len
, ios::cur
);
728 } else if (tag
<= 0x3F) { // octetString values
733 IppStringAttribute
*attr
= new IppStringAttribute((IPP_TAG
)tag
);
735 attrs
.push_back(attr
);
740 IppDatetimeAttribute
*attr
= new IppDatetimeAttribute((IPP_TAG
)tag
);
742 attrs
.push_back(attr
);
747 IppResolutionAttribute
*attr
= new IppResolutionAttribute((IPP_TAG
)tag
);
749 attrs
.push_back(attr
);
752 case IPP_RANGE_OF_INTEGER
:
754 IppRangeOfIntegerAttribute
*attr
= new IppRangeOfIntegerAttribute((IPP_TAG
)tag
);
756 attrs
.push_back(attr
);
759 case IPP_TEXT_WITH_LANGUAGE
:
760 case IPP_NAME_WITH_LANGUAGE
:
762 IppDoubleStringAttribute
*attr
= new IppDoubleStringAttribute((IPP_TAG
)tag
);
764 attrs
.push_back(attr
);
769 short len
= readLength(is
);
770 is
.seekg(len
, ios::cur
);
771 len
= readLength(is
);
772 is
.seekg(len
, ios::cur
);
777 } else if (tag
<= 0x5F) { // character-string values
779 // case IPP_TEXT_WITHOUT_LANGUAGE:
780 // case IPP_NAME_WITHOUT_LANGUAGE:
783 // case IPP_URISCHEME:
785 // case IPP_NATURAL_LANGUAGE:
786 // case IPP_MIME_MEDIA_TYPE:
788 IppStringAttribute
*attr
= new IppStringAttribute((IPP_TAG
)tag
);
790 attrs
.push_back(attr
);
796 ostream
&IppContent::output(ostream
&os
) const
798 unsigned short ns_version
= htons(version
); // version-number
799 os
.write((char *)&ns_version
, sizeof(ns_version
)); // version-number
801 unsigned short ns_operation_id
= htons(operation_id
); // operation-id
802 os
.write((char *)&ns_operation_id
, sizeof(ns_operation_id
)); // operation-id
804 unsigned long ns_request_id
= htonl(request_id
); // request-id
805 os
.write((char *)&ns_request_id
, sizeof(ns_request_id
)); // request-id
807 for (list
<IppAttribute
*>::const_iterator it
= attrs
.begin(); it
!= attrs
.end(); it
++) {
814 if (!file_path
.empty()) {
815 ifs
.open(file_path
.c_str(), ios::in
| ios::binary
);
819 if (iss
&& iss
->good()) {
822 while (iss
->get(c
)) {
831 void IppContent::setDelimiter(IPP_TAG tag
)
833 attrs
.push_back(new IppAttribute(tag
));
836 void IppContent::setInteger(const char *name
, int value
)
838 attrs
.push_back(new IppIntegerAttribute(IPP_INTEGER
, name
, value
));
841 void IppContent::setBoolean(const char *name
, bool value
)
843 attrs
.push_back(new IppBooleanAttribute(IPP_BOOLEAN
, name
, value
));
846 void IppContent::setString(const char *name
, const char *value
)
848 attrs
.push_back(new IppStringAttribute(IPP_STRING
, name
, value
));
851 void IppContent::setDateTime(const char *name
, const DATETIME
*dt
)
853 attrs
.push_back(new IppDatetimeAttribute(IPP_DATETIME
, name
, dt
));
856 void IppContent::setResolution(const char *name
, int x
, int y
, IPP_RESOLUTION_UNITS u
)
858 attrs
.push_back(new IppResolutionAttribute(IPP_RESOLUTION
, name
, x
, y
, u
));
861 void IppContent::setRangeOfInteger(const char *name
, int lower
, int upper
)
863 attrs
.push_back(new IppRangeOfIntegerAttribute(IPP_RANGE_OF_INTEGER
, name
, lower
, upper
));
866 void IppContent::setTextWithLanguage(const char *name
, const char *s1
, const char *s2
)
868 attrs
.push_back(new IppDoubleStringAttribute(IPP_TEXT_WITH_LANGUAGE
, name
, s1
, s2
));
871 void IppContent::setNameWithLanguage(const char *name
, const char *s1
, const char *s2
)
873 attrs
.push_back(new IppDoubleStringAttribute(IPP_NAME_WITH_LANGUAGE
, name
, s1
, s2
));
876 void IppContent::setTextWithoutLanguage(const char *name
, const char *value
)
878 attrs
.push_back(new IppStringAttribute(IPP_TEXT_WITHOUT_LANGUAGE
, name
, value
));
881 void IppContent::setNameWithoutLanguage(const char *name
, const char *value
)
883 attrs
.push_back(new IppStringAttribute(IPP_NAME_WITHOUT_LANGUAGE
, name
, value
));
886 void IppContent::setKeyword(const char *name
, const char *value
)
888 attrs
.push_back(new IppStringAttribute(IPP_KEYWORD
, name
, value
));
891 void IppContent::setURI(const char *name
, const char *value
)
893 attrs
.push_back(new IppStringAttribute(IPP_URI
, name
, value
));
896 void IppContent::setURIScheme(const char *name
, const char *value
)
898 attrs
.push_back(new IppStringAttribute(IPP_URISCHEME
, name
, value
));
901 void IppContent::setCharset(const char *name
, const char *value
)
903 attrs
.push_back(new IppStringAttribute(IPP_CHARSET
, name
, value
));
906 void IppContent::setNaturalLanguage(const char *name
, const char *value
)
908 attrs
.push_back(new IppStringAttribute(IPP_NATURAL_LANGUAGE
, name
, value
));
911 void IppContent::setMimeMediaType(const char *name
, const char *value
)
913 attrs
.push_back(new IppStringAttribute(IPP_MIME_MEDIA_TYPE
, name
, value
));
916 int IppContent::length() const
918 int length
= 8; // sizeof(version-number + operation-id + request-id)
920 for (list
<IppAttribute
*>::const_iterator it
= attrs
.begin(); it
!= attrs
.end(); it
++) {
921 length
+= (*it
)->length();
927 if (!file_path
.empty()) {
928 ifs
.open(file_path
.c_str(), ios::in
| ios::binary
);
932 if (iss
&& iss
->good()) {
935 streampos pos
= iss
->tellg();
936 iss
->seekg(0, ios::end
);
937 fsize
= iss
->tellg();
938 iss
->seekg(pos
, ios::beg
);
948 void IppContent::setRawData(const char *file
, int n
)
954 void IppContent::setRawData(istream
&ifs
, int n
)
960 ostream
&IppContent::print(ostream
&os
) const
962 os
<< "version: " << hex
<< version
<< '\n';
963 os
<< "operation_id: " << hex
<< operation_id
<< '\n';
964 os
<< "request_id: " << hex
<< request_id
<< '\n';
966 for (list
<IppAttribute
*>::const_iterator it
= attrs
.begin(); it
!= attrs
.end(); it
++) {
973 bool IppContent::fail() const
978 bool IppContent::good() const
980 return /*operation_id >= IPP_SUCCESSFUL_OK_S &&*/ operation_id
<= IPP_SUCCESSFUL_OK_E
;
983 bool IppContent::operator !() const
988 const char *IppContent::getStatusMessage() const
991 switch (operation_id
) {
992 case IPP_SUCCESSFUL_OK
:
993 return "successful-ok";
994 case IPP_SUCCESSFUL_OK_IGNORED_OR_SUBSTITUTED_ATTRIBUTES
:
995 return "successful-ok-ignored-or-substituted-attributes";
996 case IPP_SUCCESSFUL_OK_CONFLICTING_ATTRIBUTES
:
997 return "successful-ok-conflicting-attributes";
999 return "successful-ok-???";
1001 } else if (IPP_CLIENT_ERROR_S
<= operation_id
&& operation_id
<= IPP_CLIENT_ERROR_E
) {
1002 switch (operation_id
) {
1003 case IPP_CLIENT_ERROR_BAD_REQUEST
:
1004 return "client-error-bad-request";
1005 case IPP_CLIENT_ERROR_FORBIDDEN
:
1006 return "client-error-forbidden";
1007 case IPP_CLIENT_ERROR_NOT_AUTHENTICATED
:
1008 return "client-error-not-authenticated";
1009 case IPP_CLIENT_ERROR_NOT_AUTHORIZED
:
1010 return "client-error-not-authorized";
1011 case IPP_CLIENT_ERROR_NOT_POSSIBLE
:
1012 return "client-error-not-possible";
1013 case IPP_CLIENT_ERROR_TIMEOUT
:
1014 return "client-error-timeout";
1015 case IPP_CLIENT_ERROR_NOT_FOUND
:
1016 return "client-error-not-found";
1017 case IPP_CLIENT_ERROR_GONE
:
1018 return "client-error-gone";
1019 case IPP_CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE
:
1020 return "client-error-request-entity-too-large";
1021 case IPP_CLIENT_ERROR_REQUEST_VALUE_TOO_LONG
:
1022 return "client-error-request-value-too-long";
1023 case IPP_CLIENT_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED
:
1024 return "client-error-document-format-not-supported";
1025 case IPP_CLIENT_ERROR_ATTRIBUTES_OR_VALUES_NOT_SUPPORTED
:
1026 return "client-error-attributes-or-values-not-supported";
1027 case IPP_CLIENT_ERROR_URI_SCHEME_NOT_SUPPORTED
:
1028 return "client-error-uri-scheme-not-supported";
1029 case IPP_CLIENT_ERROR_CHARSET_NOT_SUPPORTED
:
1030 return "client-error-charset-not-supported";
1031 case IPP_CLIENT_ERROR_CONFLICTING_ATTRIBUTES
:
1032 return "client-error-conflicting-attributes";
1034 return "client-error-???";
1036 } else if (IPP_SERVER_ERROR_S
<= operation_id
&& operation_id
<= IPP_SERVER_ERROR_E
) {
1037 switch (operation_id
) {
1038 case IPP_SERVER_ERROR_INTERNAL_ERROR
:
1039 return "server-error-internal-error";
1040 case IPP_SERVER_ERROR_OPERATION_NOT_SUPPORTED
:
1041 return "server-error-operation-not-supported";
1042 case IPP_SERVER_ERROR_SERVICE_UNAVAILABLE
:
1043 return "server-error-service-unavailable";
1044 case IPP_SERVER_ERROR_VERSION_NOT_SUPPORTED
:
1045 return "server-error-version-not-supported";
1046 case IPP_SERVER_ERROR_DEVICE_ERROR
:
1047 return "server-error-device-error";
1048 case IPP_SERVER_ERROR_TEMPORARY_ERROR
:
1049 return "server-error-temporary-error";
1050 case IPP_SERVER_ERROR_NOT_ACCEPTING_JOBS
:
1051 return "server-error-not-accepting-jobs";
1052 case IPP_SERVER_ERROR_BUSY
:
1053 return "server-error-busy";
1054 case IPP_SERVER_ERROR_JOB_CANCELED
:
1055 return "server-error-job-canceled";
1057 return "server-error-???";
1060 return "unknown error.";