From: msweet Date: Tue, 8 Apr 2014 20:42:50 +0000 (+0000) Subject: The ipptool program now supports collection attributes with multiple values X-Git-Tag: v2.2b1~668 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9498f97a9c5b119aaeced4f2d2f8b9ce4e4c9412;p=thirdparty%2Fcups.git The ipptool program now supports collection attributes with multiple values () Add a test file for FaxOut. Update the get_token function to allow {, }, and "," to be values of their own. Update the collection code to allow multiple top-level collection values (still no support for embedding member attributes with multiple collection values, however we don't need to test that right now...) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11802 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES.txt b/CHANGES.txt index 5566eb523..50fa52372 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,8 @@ CHANGES IN CUPS V2.0b1 - Dropped support for AIX, HP-UX, and OSF/1 (aka Digital UNIX) - Dropped lppasswd and support for Digest authentication in in the scheduler (STR #4321) + - The ipptool program now supports collection attributes with multiple + values () - The sample drivers now include all of the installed localizations by default () - Adopted Linux man page conventions and updated all man pages diff --git a/test/fax-job.test b/test/fax-job.test new file mode 100644 index 000000000..dd35532d0 --- /dev/null +++ b/test/fax-job.test @@ -0,0 +1,59 @@ +# Fax a test page using Create-Job + Send-Document +# +# Usage: +# +# ./ipptest -f filename ipp://... fax-job.test +{ + # The name of the test... + NAME "Create FaxOut Job for 555-1212 and an IPP destination" + + # The operation to use + OPERATION Create-Job + + # Attributes, starting in the operation group... + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + GROUP job-attributes-tag + ATTR collection destination-uris { + MEMBER uri destination-uri tel:4055551212 + },{ + MEMBER uri destination-uri ipp://11.22.33.44/ipp/print + MEMBER enum print-quality 5 + MEMBER keyword media na_letter_8.5x11in + } + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes + + # What attributes do we expect? + EXPECT job-id OF-TYPE integer WITH-VALUE >0 + EXPECT job-uri OF-TYPE uri +} +{ + # The name of the test... + NAME "Send FaxOut Document" + + # The operation to use + OPERATION Send-Document + + # Attributes, starting in the operation group... + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + ATTR mimetype document-format $filetype + ATTR boolean last-document true + + FILE $filename + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes +} diff --git a/test/ipptool.c b/test/ipptool.c index 1fce1d865..f3009b42f 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -1787,6 +1787,36 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ pass = 0; goto test_exit; } + + do + { + ipp_t *col; /* Collection value */ + long pos = ftell(fp); /* Save position of file */ + + if (!get_token(fp, token, sizeof(token), &linenum)) + break; + + if (strcmp(token, ",")) + { + fseek(fp, pos, SEEK_SET); + break; + } + + if (!get_token(fp, token, sizeof(token), &linenum) || strcmp(token, "{")) + { + print_fatal_error("Unexpected \"%s\" on line %d.", token, linenum); + pass = 0; + goto test_exit; + break; + } + + if ((col = get_collection(vars, fp, &linenum)) == NULL) + break; + + ippSetCollection(request, &attrptr, ippGetCount(attrptr), col); + lastcol = attrptr; + } + while (!strcmp(token, "{")); break; case IPP_TAG_STRING : @@ -3816,6 +3846,13 @@ get_token(FILE *fp, /* I - File to read from */ (*linenum) ++; } + else if (ch == '{' || ch == '}' || ch == ',') + { + buf[0] = (char)ch; + buf[1] = '\0'; + + return (buf); + } else { /* diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 8db819c8c..725878870 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -198,6 +198,7 @@ 278C58EA136B64B000836530 /* Kerberos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 278C58E6136B64B000836530 /* Kerberos.framework */; }; 278C58EB136B64B000836530 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 278C58E7136B64B000836530 /* Security.framework */; }; 278C58EC136B64B000836530 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 278C58E8136B64B000836530 /* SystemConfiguration.framework */; }; + 7200511218F492F200E7B81B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 278C58E5136B64AF00836530 /* CoreFoundation.framework */; }; 720DD6CD1358FD720064AA82 /* libcups.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72220EAE1333047D00FCA411 /* libcups.dylib */; }; 720DD6D31358FDDE0064AA82 /* snmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 720DD6D21358FDDE0064AA82 /* snmp.c */; }; 720DD6D413590AB90064AA82 /* ieee1284.c in Sources */ = {isa = PBXBuildFile; fileRef = 724379CA1334000E009631B9 /* ieee1284.c */; }; @@ -1455,6 +1456,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 7200511218F492F200E7B81B /* CoreFoundation.framework in Frameworks */, 274FF6231333321400317ECB /* libcups.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0;