Changeset 751 for trunk/server/source3/printing/print_iprint.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/server/source3/printing/print_iprint.c (modified) (34 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/printing/print_iprint.c
r745 r751 35 35 #define NOVELL_SERVER_VERSION_OES_SP1 33554432 36 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 37 80 /* 38 81 * 'iprint_passwd_cb()' - The iPrint password callback... … … 93 136 request = ippNew(); 94 137 95 request->request.op.operation_id = (ipp_op_t)OPERATION_NOVELL_MGMT;96 request->request.op.request_id = 1;138 ; 139 ; 97 140 98 141 language = cupsLangDefault(); … … 115 158 116 159 if (((response = cupsDoRequest(http, request, "/ipp/")) == NULL) || 117 ( response->request.status.status_code>= IPP_OK_CONFLICT))160 ( >= IPP_OK_CONFLICT)) 118 161 goto out; 119 162 120 163 if (((attr = ippFindAttribute(response, "server-version", 121 164 IPP_TAG_STRING)) != NULL)) { 122 if ((ver = strstr( attr->values[0].string.text,165 if ((ver = strstr(, 123 166 NOVELL_SERVER_VERSION_STRING)) != NULL) { 124 167 ver += strlen(NOVELL_SERVER_VERSION_STRING); … … 136 179 } 137 180 138 if ((os = strstr( attr->values[0].string.text,181 if ((os = strstr(, 139 182 NOVELL_SERVER_SYSNAME)) != NULL) { 140 183 os += strlen(NOVELL_SERVER_SYSNAME); … … 185 228 request = ippNew(); 186 229 187 request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;188 request->request.op.request_id = reqId;230 ; 231 ; 189 232 190 233 language = cupsLangDefault(); … … 231 274 } 232 275 233 for (attr = response->attrs; attr != NULL;) {276 for (attr = ; attr != NULL;) { 234 277 /* 235 278 * Skip leading attributes until we hit a printer... 236 279 */ 237 280 238 while (attr != NULL && attr->group_tag!= IPP_TAG_PRINTER)239 attr = attr->next;281 while (attr != NULL && != IPP_TAG_PRINTER) 282 attr = ; 240 283 241 284 if (attr == NULL) … … 251 294 secure = 0; 252 295 253 while (attr != NULL && attr->group_tag== IPP_TAG_PRINTER) {254 if (strcmp( attr->name, "printer-name") == 0 &&255 attr->value_tag== IPP_TAG_NAME)256 name = attr->values[0].string.text;257 258 if (strcmp( attr->name, "printer-info") == 0 &&259 ( attr->value_tag== IPP_TAG_TEXT ||260 attr->value_tag== IPP_TAG_TEXTLANG))261 info = attr->values[0].string.text;296 while (attr != NULL && == IPP_TAG_PRINTER) { 297 if (strcmp(, "printer-name") == 0 && 298 == IPP_TAG_NAME) 299 name = ; 300 301 if (strcmp(, "printer-info") == 0 && 302 ( == IPP_TAG_TEXT || 303 == IPP_TAG_TEXTLANG)) 304 info = ; 262 305 263 306 /* … … 267 310 * printer should show up 268 311 */ 269 if (!strcmp( attr->name, "smb-enabled") &&270 (( attr->value_tag== IPP_TAG_INTEGER &&271 ! attr->values[0].integer) ||272 ( attr->value_tag== IPP_TAG_BOOLEAN &&273 ! attr->values[0].boolean)))312 if (!strcmp(, "smb-enabled") && 313 (( == IPP_TAG_INTEGER && 314 !) || 315 ( == IPP_TAG_BOOLEAN && 316 !))) 274 317 smb_enabled = 0; 275 318 … … 280 323 * printer should show up 281 324 */ 282 if (!strcmp( attr->name, "security-enabled") &&283 (( attr->value_tag== IPP_TAG_INTEGER &&284 attr->values[0].integer) ||285 ( attr->value_tag== IPP_TAG_BOOLEAN &&286 attr->values[0].boolean)))325 if (!strcmp(, "security-enabled") && 326 (( == IPP_TAG_INTEGER && 327 ) || 328 ( == IPP_TAG_BOOLEAN && 329 ))) 287 330 secure = 1; 288 331 289 attr = attr->next;332 attr = ; 290 333 } 291 334 … … 344 387 request = ippNew(); 345 388 346 request->request.op.operation_id = 347 (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS; 348 request->request.op.request_id = 1; 389 ippSetOperation(request, (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS); 390 ippSetRequestId(request, 1); 349 391 350 392 language = cupsLangDefault(); … … 369 411 } 370 412 371 for (attr = response->attrs; attr != NULL;) {413 for (attr = ; attr != NULL;) { 372 414 /* 373 415 * Skip leading attributes until we hit a printer... 374 416 */ 375 417 376 while (attr != NULL && attr->group_tag!= IPP_TAG_PRINTER)377 attr = attr->next;418 while (attr != NULL && != IPP_TAG_PRINTER) 419 attr = ; 378 420 379 421 if (attr == NULL) … … 384 426 */ 385 427 386 while (attr != NULL && attr->group_tag== IPP_TAG_PRINTER)428 while (attr != NULL && == IPP_TAG_PRINTER) 387 429 { 388 if (strcmp( attr->name, "printer-name") == 0 &&389 ( attr->value_tag== IPP_TAG_URI ||390 attr->value_tag== IPP_TAG_NAME ||391 attr->value_tag== IPP_TAG_TEXT ||392 attr->value_tag== IPP_TAG_NAMELANG ||393 attr->value_tag== IPP_TAG_TEXTLANG))430 if (strcmp(, "printer-name") == 0 && 431 ( == IPP_TAG_URI || 432 == IPP_TAG_NAME || 433 == IPP_TAG_TEXT || 434 == IPP_TAG_NAMELANG || 435 == IPP_TAG_TEXTLANG)) 394 436 { 395 for (i = 0; i< attr->num_values; i++)437 for (i = 0; i<; i++) 396 438 { 397 char *url = attr->values[i].string.text;439 char *url = ; 398 440 if (!url || !strlen(url)) 399 441 continue; … … 401 443 } 402 444 } 403 attr = attr->next;445 attr = ; 404 446 } 405 447 } … … 467 509 request = ippNew(); 468 510 469 request->request.op.operation_id = IPP_CANCEL_JOB;470 request->request.op.request_id = 1;511 ; 512 ; 471 513 472 514 language = cupsLangDefault(); … … 494 536 495 537 if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { 496 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {538 if ( >= IPP_OK_CONFLICT) { 497 539 DEBUG(0,("Unable to cancel job %d - %s\n", pjob->sysjob, 498 540 ippErrorString(cupsLastError()))); … … 565 607 request = ippNew(); 566 608 567 request->request.op.operation_id = IPP_HOLD_JOB;568 request->request.op.request_id = 1;609 ; 610 ; 569 611 570 612 language = cupsLangDefault(); … … 594 636 595 637 if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { 596 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {638 if ( >= IPP_OK_CONFLICT) { 597 639 DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob, 598 640 ippErrorString(cupsLastError()))); … … 665 707 request = ippNew(); 666 708 667 request->request.op.operation_id = IPP_RELEASE_JOB;668 request->request.op.request_id = 1;709 ; 710 ; 669 711 670 712 language = cupsLangDefault(); … … 694 736 695 737 if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { 696 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {738 if ( >= IPP_OK_CONFLICT) { 697 739 DEBUG(0,("Unable to release job %d - %s\n", pjob->sysjob, 698 740 ippErrorString(cupsLastError()))); … … 723 765 */ 724 766 725 static int iprint_job_submit(int snum, struct printjob *pjob) 767 static int iprint_job_submit(int snum, struct printjob *pjob, 768 enum printing_types printing_type, 769 char *lpq_cmd) 726 770 { 727 771 int ret = 1; /* Return value */ … … 764 808 request = ippNew(); 765 809 766 request->request.op.operation_id = IPP_PRINT_JOB;767 request->request.op.request_id = 1;810 ; 811 ; 768 812 769 813 language = cupsLangDefault(); … … 798 842 799 843 if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) { 800 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {844 if ( >= IPP_OK_CONFLICT) { 801 845 DEBUG(0,("Unable to print file to %s - %s\n", 802 846 lp_printername(snum), … … 818 862 819 863 attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER); 820 if (attr != NULL && attr->group_tag== IPP_TAG_JOB)864 if (attr != NULL && == IPP_TAG_JOB) 821 865 { 822 pjob->sysjob = attr->values[0].integer;866 pjob->sysjob = ; 823 867 } 824 868 } … … 867 911 int job_k_octets; /* job-k-octets attribute */ 868 912 time_t job_time; /* time-at-creation attribute */ 869 time_t printer_current_time = 0; /* printer's current time */870 913 time_t printer_up_time = 0; /* printer's uptime */ 871 914 ipp_jstate_t job_status; /* job-status attribute */ … … 940 983 request = ippNew(); 941 984 942 request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;943 request->request.op.request_id = 2;985 ; 986 ; 944 987 945 988 language = cupsLangDefault(); … … 972 1015 } 973 1016 974 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {1017 if ( >= IPP_OK_CONFLICT) { 975 1018 DEBUG(0,("Unable to get printer status for %s - %s\n", printername, 976 ippErrorString( response->request.status.status_code)));1019 ippErrorString())); 977 1020 *q = queue; 978 1021 goto out; … … 984 1027 985 1028 if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) { 986 if ( attr->values[0].integer== IPP_PRINTER_STOPPED)1029 if ( == IPP_PRINTER_STOPPED) 987 1030 status->status = LPSTAT_STOPPED; 988 1031 else … … 992 1035 if ((attr = ippFindAttribute(response, "printer-state-message", 993 1036 IPP_TAG_TEXT)) != NULL) 994 fstrcpy(status->message, attr->values[0].string.text); 995 996 if ((attr = ippFindAttribute(response, "printer-current-time", 997 IPP_TAG_DATE)) != NULL) 998 printer_current_time = ippDateToTime(attr->values[0].date); 1037 fstrcpy(status->message, ippGetString(attr, 0, NULL)); 999 1038 1000 1039 if ((attr = ippFindAttribute(response, "printer-up-time", 1001 1040 IPP_TAG_INTEGER)) != NULL) 1002 printer_up_time = attr->values[0].integer;1041 printer_up_time = ; 1003 1042 1004 1043 ippDelete(response); … … 1017 1056 request = ippNew(); 1018 1057 1019 request->request.op.operation_id = IPP_GET_JOBS;1020 request->request.op.request_id = 3;1058 ; 1059 ; 1021 1060 1022 1061 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, … … 1046 1085 } 1047 1086 1048 if ( response->request.status.status_code>= IPP_OK_CONFLICT) {1087 if ( >= IPP_OK_CONFLICT) { 1049 1088 DEBUG(0,("Unable to get jobs for %s - %s\n", uri, 1050 ippErrorString( response->request.status.status_code)));1089 ippErrorString())); 1051 1090 goto out; 1052 1091 } … … 1060 1099 queue = NULL; 1061 1100 1062 for (attr = response->attrs; attr != NULL; attr = attr->next) {1101 for (attr = ) { 1063 1102 /* 1064 1103 * Skip leading attributes until we hit a job... 1065 1104 */ 1066 1105 1067 while (attr != NULL && attr->group_tag!= IPP_TAG_JOB)1068 attr = attr->next;1106 while (attr != NULL && != IPP_TAG_JOB) 1107 attr = ; 1069 1108 1070 1109 if (attr == NULL) … … 1101 1140 job_name = NULL; 1102 1141 1103 while (attr != NULL && attr->group_tag== IPP_TAG_JOB) {1104 if ( attr->name== NULL) {1105 attr = attr->next;1142 while (attr != NULL && == IPP_TAG_JOB) { 1143 if ( == NULL) { 1144 attr = ; 1106 1145 break; 1107 1146 } 1108 1147 1109 if (strcmp( attr->name, "job-id") == 0 &&1110 attr->value_tag== IPP_TAG_INTEGER)1111 job_id = attr->values[0].integer;1112 1113 if (strcmp( attr->name, "job-k-octets") == 0 &&1114 attr->value_tag== IPP_TAG_INTEGER)1115 job_k_octets = attr->values[0].integer;1116 1117 if (strcmp( attr->name, "job-priority") == 0 &&1118 attr->value_tag== IPP_TAG_INTEGER)1119 job_priority = attr->values[0].integer;1120 1121 if (strcmp( attr->name, "job-state") == 0 &&1122 attr->value_tag== IPP_TAG_ENUM)1123 job_status = (ipp_jstate_t) (attr->values[0].integer);1124 1125 if (strcmp( attr->name, "time-at-creation") == 0 &&1126 attr->value_tag== IPP_TAG_INTEGER)1148 if (strcmp(, "job-id") == 0 && 1149 == IPP_TAG_INTEGER) 1150 job_id = ; 1151 1152 if (strcmp(, "job-k-octets") == 0 && 1153 == IPP_TAG_INTEGER) 1154 job_k_octets = ; 1155 1156 if (strcmp(, "job-priority") == 0 && 1157 == IPP_TAG_INTEGER) 1158 job_priority = ; 1159 1160 if (strcmp(, "job-state") == 0 && 1161 == IPP_TAG_ENUM) 1162 job_status = (ipp_jstate_t)); 1163 1164 if (strcmp(, "time-at-creation") == 0 && 1165 == IPP_TAG_INTEGER) 1127 1166 { 1128 1167 /* … … 1134 1173 1135 1174 if (jobUseUnixTime) 1136 job_time = attr->values[0].integer;1175 job_time = 1137 1176 else 1138 job_time = time(NULL) - printer_up_time + attr->values[0].integer;1177 job_time = time(NULL) - printer_up_time + ; 1139 1178 } 1140 1179 1141 if (strcmp( attr->name, "job-name") == 0 &&1142 ( attr->value_tag== IPP_TAG_NAMELANG ||1143 attr->value_tag== IPP_TAG_NAME))1144 job_name = attr->values[0].string.text;1145 1146 if (strcmp( attr->name, "job-originating-user-name") == 0 &&1147 ( attr->value_tag== IPP_TAG_NAMELANG ||1148 attr->value_tag== IPP_TAG_NAME))1149 user_name = attr->values[0].string.text;1150 1151 attr = attr->next;1180 if (strcmp(, "job-name") == 0 && 1181 ( == IPP_TAG_NAMELANG || 1182 == IPP_TAG_NAME)) 1183 job_name = ; 1184 1185 if (strcmp(, "job-originating-user-name") == 0 && 1186 ( == IPP_TAG_NAMELANG || 1187 == IPP_TAG_NAME)) 1188 user_name = ; 1189 1190 attr = ; 1152 1191 } 1153 1192 … … 1163 1202 } 1164 1203 1165 temp-> job= job_id;1204 temp-> = job_id; 1166 1205 temp->size = job_k_octets * 1024; 1167 1206 temp->status = job_status == IPP_JOB_PENDING ? LPQ_QUEUED :
Note:
See TracChangeset
for help on using the changeset viewer.
