MCPcopy Create free account
hub / github.com/OpenPrinting/cups / main

Function main

cups/fuzzipp.c:56–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 */
55
56int // O - Exit status
57main(int argc, // I - Number of command-line arguments
58 char *argv[]) // I - Command-line arguments
59{
60 ipp_state_t state; // State
61 cups_file_t *fp; // File pointer
62 ipp_t *request; // Request
63
64
65 if (argc == 1)
66 {
67 // Generate a Print-Job request with all common attribute types...
68 int i; // Looping var
69 char filename[256]; // Test filename
70 const char *fuzz_args[3]; // Arguments for sub-process
71 pid_t fuzz_pid; // Sub-process ID
72 int fuzz_status; // Exit status
73 ipp_t *media_col, // media-col collection
74 *media_size; // media-size collection
75 _ippdata_t data; // IPP buffer
76 ipp_uchar_t buffer[262144]; // Write buffer data
77
78 request = ippNewRequest(IPP_OP_PRINT_JOB);
79
80 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/printers/foo");
81 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, "john-doe");
82 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, "Test Job");
83 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, "application/pdf");
84 ippAddOctetString(request, IPP_TAG_OPERATION, "job-password", "8675309", 7);
85 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "job-password-encryption", NULL, "none");
86 ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "print-color-mode", NULL, "color");
87 ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_ENUM, "print-quality", IPP_QUALITY_HIGH);
88 ippAddResolution(request, IPP_TAG_JOB, "printer-resolution", 1200, 1200, IPP_RES_PER_INCH);
89 ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", 42);
90 ippAddBoolean(request, IPP_TAG_JOB, "some-boolean-option", 1);
91 ippAddString(request, IPP_TAG_JOB, IPP_TAG_URISCHEME, "some-uri-scheme", NULL, "mailto");
92 ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAMELANG, "some-name-with-language", "es-MX", "Jose");
93 ippAddString(request, IPP_TAG_JOB, IPP_TAG_TEXTLANG, "some-text-with-language", "es-MX", "¡Hola el mundo!");
94 ippAddRange(request, IPP_TAG_JOB, "page-ranges", 1, 50);
95 ippAddDate(request, IPP_TAG_JOB, "job-hold-until-time", ippTimeToDate(time(NULL) + 3600));
96 ippAddString(request, IPP_TAG_JOB, IPP_TAG_TEXT, "job-message-to-operator", NULL, "This is a test job.");
97
98 media_col = ippNew();
99 media_size = ippNew();
100 ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "x-dimension", 21590);
101 ippAddInteger(media_size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "y-dimension", 27940);
102 ippAddCollection(media_col, IPP_TAG_JOB, "media-size", media_size);
103 ippDelete(media_size);
104 ippAddString(media_col, IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL, "blue");
105 ippAddString(media_col, IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-type", NULL, "stationery");
106
107 ippAddCollection(request, IPP_TAG_JOB, "media-col", media_col);
108 ippDelete(media_col);
109
110 data.wused = 0;
111 data.wsize = sizeof(buffer);
112 data.wbuffer = buffer;
113

Callers

nothing calls this directly

Calls 15

ippNewRequestFunction · 0.85
ippAddStringFunction · 0.85
ippAddOctetStringFunction · 0.85
ippAddIntegerFunction · 0.85
ippAddResolutionFunction · 0.85
ippAddBooleanFunction · 0.85
ippAddRangeFunction · 0.85
ippAddDateFunction · 0.85
ippTimeToDateFunction · 0.85
ippNewFunction · 0.85
ippAddCollectionFunction · 0.85
ippDeleteFunction · 0.85

Tested by

no test coverage detected