Changeset 77 for trunk/samba/source/printing/printing.c
- Timestamp:
- Sep 30, 2007, 3:42:50 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/printing/printing.c
r1 r77 8 8 This program is free software; you can redistribute it and/or modify 9 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2of the License, or10 the Free Software Foundation; either version 3 of the License, or 11 11 (at your option) any later version. 12 12 … … 17 17 18 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 21 20 */ 22 21 … … 77 76 fstrcpy( jinfo.sharename, sharename ); 78 77 jinfo.jobid = jobid; 79 key.dptr = ( char*)&jinfo;78 key.dptr = (uint8 *)&jinfo; 80 79 key.dsize = sizeof(jinfo); 81 80 … … 94 93 rap_jobid = ++next_rap_jobid; 95 94 SSVAL(buf,0,rap_jobid); 96 data.dptr = (char*)buf;95 data.dptr = buf; 97 96 data.dsize = sizeof(rap_jobid); 98 97 tdb_store(rap_tdb, key, data, TDB_REPLACE); … … 115 114 116 115 SSVAL(buf,0,rap_jobid); 117 key.dptr = (char*)buf;116 key.dptr = buf; 118 117 key.dsize = sizeof(rap_jobid); 119 118 data = tdb_fetch(rap_tdb, key); … … 150 149 fstrcpy( jinfo.sharename, sharename ); 151 150 jinfo.jobid = jobid; 152 key.dptr = ( char*)&jinfo;151 key.dptr = (uint8 *)&jinfo; 153 152 key.dsize = sizeof(jinfo); 154 153 … … 167 166 SAFE_FREE(data.dptr); 168 167 SSVAL(buf,0,rap_jobid); 169 data.dptr = (char*)buf;168 data.dptr = buf; 170 169 data.dsize = sizeof(rap_jobid); 171 170 tdb_delete(rap_tdb, key); … … 179 178 ****************************************************************************/ 180 179 181 BOOL print_backend_init( void)180 BOOL print_backend_init(struct messaging_context *msg_ctx) 182 181 { 183 182 const char *sversion = "INFO/version"; … … 216 215 217 216 /* do NT print initialization... */ 218 return nt_printing_init( );217 return nt_printing_init(msg_ctx); 219 218 } 220 219 … … 274 273 275 274 SIVAL(&j, 0, jobid); 276 ret.dptr = ( char*)&j;275 ret.dptr = (uint8 *)&j; 277 276 ret.dsize = sizeof(j); 278 277 return ret; … … 283 282 ***********************************************************************/ 284 283 285 int unpack_pjob( char*buf, int buflen, struct printjob *pjob )284 int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob ) 286 285 { 287 286 int len = 0; … … 519 518 BOOL ret = False; 520 519 struct tdb_print_db *pdb = get_print_db_byname(sharename); 521 char*buf = NULL;520 uint8 *buf = NULL; 522 521 int len, newlen, buflen; 523 522 … … 555 554 556 555 if (buflen != len) { 557 buf = ( char*)SMB_REALLOC(buf, len);556 buf = (uint8 *)SMB_REALLOC(buf, len); 558 557 if (!buf) { 559 558 DEBUG(0,("pjob_store: failed to enlarge buffer!\n")); … … 868 867 return (pid_t)-1; 869 868 slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename); 870 key.dptr = keystr; 871 key.dsize = strlen(keystr); 869 key = string_tdb_data(keystr); 872 870 873 871 data = tdb_fetch(pdb->tdb, key); … … 906 904 907 905 slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename); 908 key.dptr = keystr; 909 key.dsize = strlen(keystr); 906 key = string_tdb_data(keystr); 910 907 911 908 DEBUG(5, ("set_updating_pid: %s updating lpq cache for print share %s\n", … … 920 917 921 918 SIVAL( buffer, 0, updating_pid); 922 data.dptr = (char *)buffer;919 data.dptr = buffer; 923 920 data.dsize = 4; /* we always assume this is a 4 byte value */ 924 921 … … 961 958 size_t len; 962 959 size_t i; 963 u int qcount;960 unsigned int qcount; 964 961 965 962 if (max_reported_jobs && (max_reported_jobs < pts->qcount)) … … 987 984 } 988 985 989 if ((data.dptr = ( char*)SMB_MALLOC(data.dsize)) == NULL)986 if ((data.dptr = (uint8 *)SMB_MALLOC(data.dsize)) == NULL) 990 987 return; 991 988 … … 1234 1231 /* store the new queue status structure */ 1235 1232 slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); 1236 key.dptr = keystr; 1237 key.dsize = strlen(keystr); 1233 key = string_tdb_data(keystr); 1238 1234 1239 1235 status.qcount = qcount; 1240 data.dptr = ( char*)&status;1236 data.dptr = (uint8 *)&status; 1241 1237 data.dsize = sizeof(status); 1242 1238 tdb_store(pdb->tdb, key, data, TDB_REPLACE); … … 1352 1348 this is the receive function of the background lpq updater 1353 1349 ****************************************************************************/ 1354 static void print_queue_receive(int msg_type, struct process_id src, 1355 void *buf, size_t msglen, 1356 void *private_data) 1350 static void print_queue_receive(struct messaging_context *msg, 1351 void *private_data, 1352 uint32_t msg_type, 1353 struct server_id server_id, 1354 DATA_BLOB *data) 1357 1355 { 1358 1356 fstring sharename; … … 1361 1359 size_t len; 1362 1360 1363 len = tdb_unpack( ( char *)buf, msglen, "fdPP",1361 len = tdb_unpack( (uint8 *)data->data, data->length, "fdPP", 1364 1362 sharename, 1365 1363 &printing_type, … … 1398 1396 DEBUG(5,("start_background_queue: background LPQ thread started\n")); 1399 1397 1400 claim_connection( NULL, "smbd lpq backend", 0, False,1398 claim_connection( NULL, "smbd lpq backend", 1401 1399 FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL); 1402 1400 … … 1405 1403 } 1406 1404 1407 messag e_register(MSG_PRINTER_UPDATE, print_queue_receive,1408 NULL);1405 messaging_register(smbd_messaging_context(), NULL, 1406 MSG_PRINTER_UPDATE, print_queue_receive); 1409 1407 1410 1408 DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); … … 1428 1426 1429 1427 DEBUG(10,("start_background_queue: background LPQ thread got a message\n")); 1430 message_dispatch( );1428 message_dispatch(smbd_messaging_context()); 1431 1429 1432 1430 /* process any pending print change notify messages */ 1433 1431 1434 print_notify_send_messages(0); 1432 print_notify_send_messages(smbd_messaging_context(), 1433 0); 1435 1434 } 1436 1435 } … … 1446 1445 fstring sharename; 1447 1446 pstring lpqcommand, lprmcommand; 1448 char*buffer = NULL;1447 uint8 *buffer = NULL; 1449 1448 size_t len = 0; 1450 1449 size_t newlen; … … 1500 1499 lprmcommand ); 1501 1500 1502 buffer = SMB_XMALLOC_ARRAY( char, len );1501 buffer = SMB_XMALLOC_ARRAY( uint8, len ); 1503 1502 1504 1503 /* now pack the buffer */ … … 1538 1537 /* finally send the message */ 1539 1538 1540 message_send_pid(pid_to_procid(background_lpq_updater_pid), 1541 MSG_PRINTER_UPDATE, buffer, len, False); 1539 messaging_send_buf(smbd_messaging_context(), 1540 pid_to_procid(background_lpq_updater_pid), 1541 MSG_PRINTER_UPDATE, (uint8 *)buffer, len); 1542 1542 1543 1543 SAFE_FREE( buffer ); … … 1608 1608 if (i == data.dsize) { 1609 1609 /* We weren't in the list. Realloc. */ 1610 data.dptr = ( char*)SMB_REALLOC(data.dptr, data.dsize + 8);1610 data.dptr = (uint8 *)SMB_REALLOC(data.dptr, data.dsize + 8); 1611 1611 if (!data.dptr) { 1612 1612 DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n", … … 2303 2303 2304 2304 SIVAL(&store_jobid, 0, jobid); 2305 data.dptr = ( char*)&store_jobid;2305 data.dptr = (uint8 *)&store_jobid; 2306 2306 data.dsize = 4; 2307 2307 … … 2702 2702 ZERO_STRUCTP(status); 2703 2703 slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); 2704 key .dptr = keystr;2705 key.dsize = strlen(keystr); 2704 key = string_tdb_data(keystr); 2705 2706 2706 data = tdb_fetch(pdb->tdb, key); 2707 2707 if (data.dptr) {
Note:
See TracChangeset
for help on using the changeset viewer.