* Added application print_server_add_on that is used
by the print_server to run a printer driver add-on.
This makes the print_server
1) resistant to add-on crashes
2) and memory leaks in add-ons
3) license of an add-on cannot influence the
license of the print_server since it does not
directly load the add-on anymore; might be
an issue with GPL printer drivers like Gutenprint
Transport add-ons directly loaded by the print_server
should be moved outside the print_server too.
Right now I am not aware that the transport add-ons
in the repository have any of the issues.
The Gutenprint driver has 2 + 3 that was the main
motivation to implement that now.
Disabled for now until the launch issue is resolved.
BRoster does not find the application by its
signature until it is opened in Tracker once.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39346 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Pfeiffer
|
||||
*/
|
||||
#ifndef PRINT_SERVER_ADD_ON_H
|
||||
#define PRINT_SERVER_ADD_ON_H
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
#include <Message.h>
|
||||
#include <Messenger.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class PrintServerAddOn
|
||||
{
|
||||
public:
|
||||
PrintServerAddOn(const char* driver);
|
||||
virtual ~PrintServerAddOn();
|
||||
|
||||
status_t AddPrinter(const char* spoolFolderName);
|
||||
status_t ConfigPage(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t ConfigJob(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t DefaultSettings(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t TakeJob(const char* spoolFile,
|
||||
BDirectory* spoolFolder);
|
||||
|
||||
static status_t FindPathToDriver(const char* driver, BPath* path);
|
||||
|
||||
private:
|
||||
const char* Driver() const;
|
||||
|
||||
status_t Launch(BMessenger& messenger);
|
||||
bool IsLaunched();
|
||||
void Quit();
|
||||
|
||||
void AddDirectory(BMessage& message, const char* name,
|
||||
BDirectory* directory);
|
||||
void AddEntryRef(BMessage& message, const char* name,
|
||||
const entry_ref* entryRef);
|
||||
status_t SendRequest(BMessage& request, BMessage& reply);
|
||||
status_t GetResult(BMessage& reply);
|
||||
status_t GetResultAndUpdateSettings(BMessage& reply,
|
||||
BMessage* settings);
|
||||
|
||||
BString fDriver;
|
||||
status_t fLaunchStatus;
|
||||
BMessenger fMessenger;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2010 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Pfeiffer
|
||||
*/
|
||||
#ifndef PRINT_SERVER_ADD_ON_PROTOCOL_H
|
||||
#define PRINT_SERVER_ADD_ON_PROTOCOL_H
|
||||
|
||||
extern const char* kPrintServerAddOnApplicationSignature;
|
||||
|
||||
extern const char* kPrintServerAddOnStatusAttribute;
|
||||
extern const char* kPrinterDriverAttribute;
|
||||
extern const char* kPrinterNameAttribute;
|
||||
extern const char* kPrinterFolderAttribute;
|
||||
extern const char* kPrintJobFileAttribute;
|
||||
extern const char* kPrintSettingsAttribute;
|
||||
|
||||
enum {
|
||||
// message constants for the five corresponding
|
||||
// printer driver add-on hook functions
|
||||
kMessageAddPrinter = 'PSad',
|
||||
// Request:
|
||||
// BString kPrinterDriverAttribute
|
||||
// BString kPrinterNameAttribute
|
||||
// Reply:
|
||||
// int32 kPrintServerAddOnStatusAttribute
|
||||
|
||||
kMessageConfigPage = 'PScp',
|
||||
// Request:
|
||||
// BString kPrinterDriverAttribute
|
||||
// BString kPrinterFolderAttribute
|
||||
// BMessage kPrintSettingsAttribute
|
||||
// Reply:
|
||||
// int32 kPrintServerAddOnStatusAttribute
|
||||
// BMessage kPrintSettingsAttribute (if status is B_OK)
|
||||
|
||||
kMessageConfigJob = 'PScj',
|
||||
// Request:
|
||||
// BString kPrinterDriverAttribute
|
||||
// BString kPrinterFolderAttribute
|
||||
// BMessage kPrintSettingsAttribute
|
||||
// Reply:
|
||||
// int32 kPrintServerAddOnStatusAttribute
|
||||
// BMessage kPrintSettingsAttribute (if status is B_OK)
|
||||
|
||||
kMessageDefaultSettings = 'PSds',
|
||||
// Request:
|
||||
// BString kPrinterDriverAttribute
|
||||
// BString kPrinterFolderAttribute
|
||||
// Reply:
|
||||
// int32 kPrintServerAddOnStatusAttribute
|
||||
// BMessage kPrintSettingsAttribute (if status is B_OK)
|
||||
|
||||
kMessageTakeJob = 'PStj',
|
||||
// Request:
|
||||
// BString kPrinterDriverAttribute
|
||||
// BString kPrintJobFileAttribute
|
||||
// BString kPrinterFolderAttribute
|
||||
// Reply:
|
||||
// int32 kPrintServerAddOnStatusAttribute
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2001-2010, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ithamar R. Adema
|
||||
* Michael Pfeiffer
|
||||
*/
|
||||
#ifndef PRINTER_DRIVER_ADD_ON_H
|
||||
#define PRINTER_DRIVER_ADD_ON_H
|
||||
|
||||
|
||||
#include <Directory.h>
|
||||
#include <image.h>
|
||||
#include <Message.h>
|
||||
#include <Path.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class PrinterDriverAddOn
|
||||
{
|
||||
public:
|
||||
PrinterDriverAddOn(const char* driver);
|
||||
~PrinterDriverAddOn();
|
||||
|
||||
status_t AddPrinter(const char* spoolFolderName);
|
||||
status_t ConfigPage(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t ConfigJob(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t DefaultSettings(BDirectory* spoolFolder,
|
||||
BMessage* settings);
|
||||
status_t TakeJob(const char* spoolFile,
|
||||
BDirectory* spoolFolder);
|
||||
|
||||
static status_t FindPathToDriver(const char* driver, BPath* path);
|
||||
|
||||
private:
|
||||
bool IsLoaded() const;
|
||||
status_t CopyValidSettings(BMessage* settings,
|
||||
BMessage* newSettings);
|
||||
|
||||
image_id fAddOnID;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user