]>
git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/UtilTypes.h
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.16 2007/04/20 22:58:10 herscher
21 <rdar://problem/4826126> mDNS: Printer Wizard doesn't offer generic HP printers or generic PS support on Vista RC2
23 Revision 1.15 2006/08/14 23:24:09 cheshire
24 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
26 Revision 1.14 2005/06/30 18:02:54 shersche
27 <rdar://problem/4124524> Workaround for Mac OS X Printer Sharing bug
29 Revision 1.13 2005/04/13 17:46:22 shersche
30 <rdar://problem/4082122> Generic PCL not selected when printers advertise multiple text records
32 Revision 1.12 2005/03/16 03:12:28 shersche
33 <rdar://problem/4050504> Generic PCL driver isn't selected correctly on Win2K
35 Revision 1.11 2005/03/05 02:27:46 shersche
36 <rdar://problem/4030388> Generic drivers don't do color
38 Revision 1.10 2005/02/08 21:45:06 shersche
39 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
41 Revision 1.9 2005/02/01 01:16:12 shersche
42 Change window owner from CSecondPage to CPrinterSetupWizardSheet
44 Revision 1.8 2005/01/06 08:18:26 shersche
45 Add protocol field to service, add EmptyQueues() function to service
47 Revision 1.7 2005/01/04 21:07:29 shersche
48 add description member to service object. this member corresponds to the 'ty' key in a printer text record
50 Revision 1.6 2004/12/30 01:24:02 shersche
51 <rdar://problem/3906182> Remove references to description key
54 Revision 1.5 2004/12/29 18:53:38 shersche
55 <rdar://problem/3725106>
56 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
57 Bug #: 3725106, 3737413
59 Revision 1.4 2004/09/13 21:22:44 shersche
60 <rdar://problem/3796483> Add moreComing argument to OnAddPrinter and OnRemovePrinter callbacks
63 Revision 1.3 2004/06/26 23:27:12 shersche
64 support for installing multiple printers of the same name
66 Revision 1.2 2004/06/25 02:25:59 shersche
67 Remove item field from manufacturer and model structures
68 Submitted by: herscher
70 Revision 1.1 2004/06/18 04:36:58 rpantos
81 #include <DebugServices.h>
83 class CPrinterSetupWizardSheet
;
85 #define kDefaultPriority 50
86 #define kDefaultQTotal 1
88 namespace PrinterSetupWizard
96 typedef std :: list
< Queue
*> Queues
;
97 typedef std :: list
< Printer
*> Printers
;
98 typedef std :: list
< Service
*> Services
;
99 typedef std :: list
< Model
*> Models
;
100 typedef std :: list
< CString
> Decorations
;
111 const std :: string
& type
114 CPrinterSetupWizardSheet
* window
;
118 // These are from the browse reply
125 // These keep track of the different services associated with this printer.
126 // the services are ordered according to preference.
131 // these are derived from the printer matching code
133 // if driverInstalled is false, then infFileName should
134 // have an absolute path to the printers inf file. this
135 // is used to install the printer from printui.dll
137 // if driverInstalled is true, then model is the name
138 // of the driver to use in AddPrinter
140 bool driverInstalled
;
142 CString manufacturer
;
143 CString displayModelName
;
148 // This let's us know that this printer was discovered via OSX Printer Sharing.
149 // We use this knowledge to workaround a problem with OS X Printer sharing.
151 bool isSharedFromOSX
;
179 // these are from the resolve
181 DNSServiceRef serviceRef
;
183 unsigned short portNumber
;
185 unsigned short qtotal
;
188 // There will usually one be one of these, however
189 // this will handle printers that have multiple
190 // queues. These are ordered according to preference.
223 Decorations decorations
;
226 find ( const CString
& name
);
232 bool driverInstalled
;
242 isSharedFromOSX ( false )
249 while ( services
. size () > 0 )
251 Service
* service
= services
. front ();
252 services
. pop_front ();
258 Printer :: LookupService
260 const std :: string
& type
263 Services :: iterator it
;
265 for ( it
= services
. begin (); it
!= services
. end (); it
++ )
267 Service
* service
= * it
;
269 if ( strcmp ( service
-> type
. c_str (), type
. c_str ()) == 0 )
281 qtotal ( kDefaultQTotal
)
288 check ( serviceRef
== NULL
);
294 Service :: SelectedQueue ()
296 return queues
. front ();
300 Service :: EmptyQueues ()
302 while ( queues
. size () > 0 )
304 Queue
* q
= queues
. front ();
313 priority ( kDefaultPriority
)
323 Manufacturer :: find ( const CString
& name
)
327 for ( it
= models
. begin (); it
!= models
. end (); it
++ )
331 if ( model
-> name
== name
)