|
|
@ -103,7 +103,7 @@ void dumpRequest(ipp_t *req, bool answer = false, const TQString& s = TQString::
|
|
|
|
kdDebug(500) << s << endl;
|
|
|
|
kdDebug(500) << s << endl;
|
|
|
|
attr = ippNextAttribute(req);
|
|
|
|
attr = ippNextAttribute(req);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
kdDebug(500) << "State = 0x" << TQString::number(req->state, 16) << endl;
|
|
|
|
kdDebug(500) << "State = 0x" << TQString::number(req->state, 16) << endl;
|
|
|
|
kdDebug(500) << "ID = 0x" << TQString::number(req->request.status.request_id, 16) << endl;
|
|
|
|
kdDebug(500) << "ID = 0x" << TQString::number(req->request.status.request_id, 16) << endl;
|
|
|
|
if (answer)
|
|
|
|
if (answer)
|
|
|
@ -152,7 +152,7 @@ void dumpRequest(ipp_t *req, bool answer = false, const TQString& s = TQString::
|
|
|
|
kdDebug(500) << s << endl;
|
|
|
|
kdDebug(500) << s << endl;
|
|
|
|
attr = attr->next;
|
|
|
|
attr = attr->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString errorString(int status)
|
|
|
|
TQString errorString(int status)
|
|
|
@ -258,9 +258,9 @@ void IppRequest::addIntegerList_p(int group, int type, const TQString& name, con
|
|
|
|
for (TQValueList<int>::ConstIterator it=values.begin(); it != values.end(); ++it, i++)
|
|
|
|
for (TQValueList<int>::ConstIterator it=values.begin(); it != values.end(); ++it, i++)
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
ippSetInteger(request_, &attr, i, *it);
|
|
|
|
ippSetInteger(request_, &attr, i, *it);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
attr->values[i].integer = *it;
|
|
|
|
attr->values[i].integer = *it;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -278,9 +278,9 @@ void IppRequest::addBoolean(int group, const TQString& name, const TQValueList<b
|
|
|
|
for (TQValueList<bool>::ConstIterator it=values.begin(); it != values.end(); ++it, i++)
|
|
|
|
for (TQValueList<bool>::ConstIterator it=values.begin(); it != values.end(); ++it, i++)
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
ippSetBoolean(request_, &attr, i, (char)(*it));
|
|
|
|
ippSetBoolean(request_, &attr, i, (char)(*it));
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
attr->values[i].boolean = (char)(*it);
|
|
|
|
attr->values[i].boolean = (char)(*it);
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -289,19 +289,19 @@ void IppRequest::setOperation(int op)
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
ippSetOperation(request_, (ipp_op_t)op);
|
|
|
|
ippSetOperation(request_, (ipp_op_t)op);
|
|
|
|
ippSetRequestId(request_, 1); // 0 is not RFC-compliant, should be at least 1
|
|
|
|
ippSetRequestId(request_, 1); // 0 is not RFC-compliant, should be at least 1
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
request_->request.op.operation_id = (ipp_op_t)op;
|
|
|
|
request_->request.op.operation_id = (ipp_op_t)op;
|
|
|
|
request_->request.op.request_id = 1; // 0 is not RFC-compliant, should be at least 1
|
|
|
|
request_->request.op.request_id = 1; // 0 is not RFC-compliant, should be at least 1
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int IppRequest::status()
|
|
|
|
int IppRequest::status()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
return (request_ ? ippGetStatusCode(request_) : (connect_ ? cupsLastError() : -2));
|
|
|
|
return (request_ ? ippGetStatusCode(request_) : (connect_ ? cupsLastError() : -2));
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
return (request_ ? request_->request.status.status_code : (connect_ ? cupsLastError() : -2));
|
|
|
|
return (request_ ? request_->request.status.status_code : (connect_ ? cupsLastError() : -2));
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString IppRequest::statusMessage()
|
|
|
|
TQString IppRequest::statusMessage()
|
|
|
@ -330,9 +330,9 @@ bool IppRequest::integerValue_p(const TQString& name, int& value, int type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
value = ippGetInteger(attr, 0);
|
|
|
|
value = ippGetInteger(attr, 0);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
value = attr->values[0].integer;
|
|
|
|
value = attr->values[0].integer;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
else return false;
|
|
|
@ -346,9 +346,9 @@ bool IppRequest::stringValue_p(const TQString& name, TQString& value, int type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
value = TQString::fromLocal8Bit(ippGetString(attr, 0, NULL));
|
|
|
|
value = TQString::fromLocal8Bit(ippGetString(attr, 0, NULL));
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
value = TQString::fromLocal8Bit(attr->values[0].string.text);
|
|
|
|
value = TQString::fromLocal8Bit(attr->values[0].string.text);
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
else return false;
|
|
|
@ -364,10 +364,10 @@ bool IppRequest::stringListValue_p(const TQString& name, TQStringList& values, i
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
for (int i=0;i<ippGetCount(attr);i++)
|
|
|
|
for (int i=0;i<ippGetCount(attr);i++)
|
|
|
|
values.append(TQString::fromLocal8Bit(ippGetString(attr, i, NULL)));
|
|
|
|
values.append(TQString::fromLocal8Bit(ippGetString(attr, i, NULL)));
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
for (int i=0;i<attr->num_values;i++)
|
|
|
|
for (int i=0;i<attr->num_values;i++)
|
|
|
|
values.append(TQString::fromLocal8Bit(attr->values[i].string.text));
|
|
|
|
values.append(TQString::fromLocal8Bit(attr->values[i].string.text));
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
else return false;
|
|
|
@ -381,9 +381,9 @@ bool IppRequest::boolean(const TQString& name, bool& value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
value = (bool)ippGetBoolean(attr, 0);
|
|
|
|
value = (bool)ippGetBoolean(attr, 0);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
value = (bool)attr->values[0].boolean;
|
|
|
|
value = (bool)attr->values[0].boolean;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
else return false;
|
|
|
@ -437,16 +437,16 @@ bool IppRequest::doFileRequest(const TQString& res, const TQString& filename)
|
|
|
|
/* No printers found */
|
|
|
|
/* No printers found */
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
if ( request_ && ippGetStatusCode(request_) == 0x406 )
|
|
|
|
if ( request_ && ippGetStatusCode(request_) == 0x406 )
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
if ( request_ && request_->request.status.status_code == 0x406 )
|
|
|
|
if ( request_ && request_->request.status.status_code == 0x406 )
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
if (!request_ || ippGetState(request_) == IPP_ERROR || (ippGetStatusCode(request_) & 0x0F00))
|
|
|
|
if (!request_ || ippGetState(request_) == IPP_ERROR || (ippGetStatusCode(request_) & 0x0F00))
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
if (!request_ || request_->state == IPP_ERROR || (request_->request.status.status_code & 0x0F00))
|
|
|
|
if (!request_ || request_->state == IPP_ERROR || (request_->request.status.status_code & 0x0F00))
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -465,11 +465,11 @@ bool IppRequest::htmlReport(int group, TQTextStream& output)
|
|
|
|
ipp_attribute_t *attr = ippFirstAttribute(request_);
|
|
|
|
ipp_attribute_t *attr = ippFirstAttribute(request_);
|
|
|
|
while (attr && ippGetGroupTag(attr) != group)
|
|
|
|
while (attr && ippGetGroupTag(attr) != group)
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
ipp_attribute_t *attr = request_->attrs;
|
|
|
|
ipp_attribute_t *attr = request_->attrs;
|
|
|
|
while (attr && attr->group_tag != group)
|
|
|
|
while (attr && attr->group_tag != group)
|
|
|
|
attr = attr->next;
|
|
|
|
attr = attr->next;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
// print each attribute
|
|
|
|
// print each attribute
|
|
|
|
const ipp_uchar_t *d;
|
|
|
|
const ipp_uchar_t *d;
|
|
|
|
TQCString dateStr;
|
|
|
|
TQCString dateStr;
|
|
|
@ -542,7 +542,7 @@ bool IppRequest::htmlReport(int group, TQTextStream& output)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
output << "</td>\n </tr>" << endl;
|
|
|
|
output << "</td>\n </tr>" << endl;
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
while (attr && attr->group_tag == group)
|
|
|
|
while (attr && attr->group_tag == group)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
output << " <tr bgcolor=\"" << (bg ? "#ffffd9" : "#ffffff") << "\">\n <td><b>" << attr->name << "</b></td>\n <td>" << endl;
|
|
|
|
output << " <tr bgcolor=\"" << (bg ? "#ffffd9" : "#ffffff") << "\">\n <td><b>" << attr->name << "</b></td>\n <td>" << endl;
|
|
|
@ -602,7 +602,7 @@ bool IppRequest::htmlReport(int group, TQTextStream& output)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
output << "</td>\n </tr>" << endl;
|
|
|
|
output << "</td>\n </tr>" << endl;
|
|
|
|
attr = attr->next;
|
|
|
|
attr = attr->next;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// end table
|
|
|
|
// end table
|
|
|
|
output << "</table>" << endl;
|
|
|
|
output << "</table>" << endl;
|
|
|
@ -670,7 +670,7 @@ TQMap<TQString,TQString> IppRequest::toMap(int group)
|
|
|
|
value.truncate(value.length()-1);
|
|
|
|
value.truncate(value.length()-1);
|
|
|
|
opts[TQString::fromLocal8Bit(ippGetName(attr))] = value;
|
|
|
|
opts[TQString::fromLocal8Bit(ippGetName(attr))] = value;
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
attr = ippNextAttribute(request_);
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
if (group != -1 && attr->group_tag != group)
|
|
|
|
if (group != -1 && attr->group_tag != group)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
attr = attr->next;
|
|
|
|
attr = attr->next;
|
|
|
@ -719,7 +719,7 @@ TQMap<TQString,TQString> IppRequest::toMap(int group)
|
|
|
|
value.truncate(value.length()-1);
|
|
|
|
value.truncate(value.length()-1);
|
|
|
|
opts[TQString::fromLocal8Bit(attr->name)] = value;
|
|
|
|
opts[TQString::fromLocal8Bit(attr->name)] = value;
|
|
|
|
attr = attr->next;
|
|
|
|
attr = attr->next;
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return opts;
|
|
|
|
return opts;
|
|
|
@ -780,7 +780,7 @@ void IppRequest::setMap(const TQMap<TQString,TQString>& opts)
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
#ifdef HAVE_CUPS_1_6
|
|
|
|
ipp_attribute_t* IppRequest::first()
|
|
|
|
ipp_attribute_t* IppRequest::first()
|
|
|
|
{ return (request_ ? ippFirstAttribute(request_) : NULL); }
|
|
|
|
{ return (request_ ? ippFirstAttribute(request_) : NULL); }
|
|
|
|
#else // HAVE_CUPS_1_6
|
|
|
|
#else
|
|
|
|
ipp_attribute_t* IppRequest::first()
|
|
|
|
ipp_attribute_t* IppRequest::first()
|
|
|
|
{ return (request_ ? request_->attrs : NULL); }
|
|
|
|
{ return (request_ ? request_->attrs : NULL); }
|
|
|
|
#endif // HAVE_CUPS_1_6
|
|
|
|
#endif
|
|
|
|