]>
git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/UtilTypes.h
41a3251c3c54b2f575ca6b9073ca178c4a58f757
1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 Change History (most recent first):
20 Revision 1.18 2009/05/29 20:43:37 herscher
21 <rdar://problem/6928136> Printer Wizard doesn't work correctly in Windows 7 64 bit
23 Revision 1.17 2009/05/27 04:59:57 herscher
24 <rdar://problem/4517393> COMPATIBILITY WITH HP CLJ4700
25 <rdar://problem/6142138> Compatibility with Samsung print driver files
27 Revision 1.16 2007/04/20 22:58:10 herscher
28 <rdar://problem/4826126> mDNS: Printer Wizard doesn't offer generic HP printers or generic PS support on Vista RC2
30 Revision 1.15 2006/08/14 23:24:09 cheshire
31 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
33 Revision 1.14 2005/06/30 18:02:54 shersche
34 <rdar://problem/4124524> Workaround for Mac OS X Printer Sharing bug
36 Revision 1.13 2005/04/13 17:46:22 shersche
37 <rdar://problem/4082122> Generic PCL not selected when printers advertise multiple text records
39 Revision 1.12 2005/03/16 03:12:28 shersche
40 <rdar://problem/4050504> Generic PCL driver isn't selected correctly on Win2K
42 Revision 1.11 2005/03/05 02:27:46 shersche
43 <rdar://problem/4030388> Generic drivers don't do color
45 Revision 1.10 2005/02/08 21:45:06 shersche
46 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
48 Revision 1.9 2005/02/01 01:16:12 shersche
49 Change window owner from CSecondPage to CPrinterSetupWizardSheet
51 Revision 1.8 2005/01/06 08:18:26 shersche
52 Add protocol field to service, add EmptyQueues() function to service
54 Revision 1.7 2005/01/04 21:07:29 shersche
55 add description member to service object. this member corresponds to the 'ty' key in a printer text record
57 Revision 1.6 2004/12/30 01:24:02 shersche
58 <rdar://problem/3906182> Remove references to description key
61 Revision 1.5 2004/12/29 18:53:38 shersche
62 <rdar://problem/3725106>
63 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
64 Bug #: 3725106, 3737413
66 Revision 1.4 2004/09/13 21:22:44 shersche
67 <rdar://problem/3796483> Add moreComing argument to OnAddPrinter and OnRemovePrinter callbacks
70 Revision 1.3 2004/06/26 23:27:12 shersche
71 support for installing multiple printers of the same name
73 Revision 1.2 2004/06/25 02:25:59 shersche
74 Remove item field from manufacturer and model structures
75 Submitted by: herscher
77 Revision 1.1 2004/06/18 04:36:58 rpantos
88 #include <DebugServices.h>
90 class CPrinterSetupWizardSheet
;
92 #define kDefaultPriority 50
93 #define kDefaultQTotal 1
95 namespace PrinterSetupWizard
103 typedef std :: list
< Queue
*> Queues
;
104 typedef std :: list
< Printer
*> Printers
;
105 typedef std :: list
< Service
*> Services
;
106 typedef std :: list
< Model
*> Models
;
117 const std :: string
& type
120 CPrinterSetupWizardSheet
* window
;
124 // These are from the browse reply
131 // These keep track of the different services associated with this printer.
132 // the services are ordered according to preference.
137 // these are derived from the printer matching code
139 // if driverInstalled is false, then infFileName should
140 // have an absolute path to the printers inf file. this
141 // is used to install the printer from printui.dll
143 // if driverInstalled is true, then model is the name
144 // of the driver to use in AddPrinter
146 bool driverInstalled
;
148 CString manufacturer
;
149 CString displayModelName
;
154 // This let's us know that this printer was discovered via OSX Printer Sharing.
155 // We use this knowledge to workaround a problem with OS X Printer sharing.
157 bool isSharedFromOSX
;
185 // these are from the resolve
187 DNSServiceRef serviceRef
;
189 unsigned short portNumber
;
191 unsigned short qtotal
;
194 // There will usually one be one of these, however
195 // this will handle printers that have multiple
196 // queues. These are ordered according to preference.
230 find ( const CString
& name
);
236 bool driverInstalled
;
246 isSharedFromOSX ( false )
253 while ( services
. size () > 0 )
255 Service
* service
= services
. front ();
256 services
. pop_front ();
262 Printer :: LookupService
264 const std :: string
& type
267 Services :: iterator it
;
269 for ( it
= services
. begin (); it
!= services
. end (); it
++ )
271 Service
* service
= * it
;
273 if ( strcmp ( service
-> type
. c_str (), type
. c_str ()) == 0 )
285 qtotal ( kDefaultQTotal
)
292 check ( serviceRef
== NULL
);
298 Service :: SelectedQueue ()
300 return queues
. front ();
304 Service :: EmptyQueues ()
306 while ( queues
. size () > 0 )
308 Queue
* q
= queues
. front ();
317 priority ( kDefaultPriority
)
327 Manufacturer :: find ( const CString
& name
)
331 for ( it
= models
. begin (); it
!= models
. end (); it
++ )
335 if ( model
-> name
== name
)