![]() |
CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Server side DBUS CAPS printing cooordinator connection for printing providers. More...
Data Structures | |
| struct | dbus_method_list |
Macros | |
| #define | HASHWORDBITS 32 |
Functions | |
| DBusHandlerResult | dbus_return_i32 (DBusConnection *connection, DBusMessage *message, int32_t val) |
| DBusHandlerResult | dbus_return_i64 (DBusConnection *connection, DBusMessage *message, int64_t val) |
| DBusHandlerResult | dbus_return_file_handle (DBusConnection *connection, DBusMessage *message, int fh) |
| void | dbus_print_argument_failure (DBusMessage *message, const DBusError *error) |
| int64_t | dbus_receive_single_i64 (DBusMessage *message, DBusError *error) |
| static unsigned | __hash_string (const unsigned char *string) |
| static unsigned | provider_property_create (DBusMessage *message) |
| static void | dbus_job_change_notifier (DBusConnection *connection, caps_identifier pr_id, caps_identifier job_id, const struct object_state_job *state) |
| static void | provider_job_queue_drain (DBusConnection *connection, struct caps_coordinator *database, caps_identifier pr_id, const struct object_state_job *state) |
| static DBusHandlerResult | dbus_CreatePrinterId_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static void | dbus_provider_termination_notifier (DBusConnection *connection, caps_identifier pr_id) |
| static DBusHandlerResult | dbus_FreePrinterId_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_SetPrinterState_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_GetJobId_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_SetPrinterInfo_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_JobSetProgression_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_GetJob_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_job_state_update (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static void | dbus_job_finished_notifier (DBusConnection *connection, caps_identifier pr_id, caps_identifier job_id) |
| static DBusHandlerResult | dbus_mark_job_finished (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static DBusHandlerResult | dbus_SetPPDDefinition_dispatch (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| void | dbus_provider_send_job_change_notifier (DBusConnection *connection, caps_identifier pr_id, caps_identifier job_id) |
| static DBusHandlerResult | process_provider_messages (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| static void | provider_remove_on_termination (DBusConnection *connection, const char *s, struct caps_coordinator *database) |
| static DBusHandlerResult | process_provider_signal (DBusConnection *connection, DBusMessage *message, struct caps_coordinator *database) |
| DBusHandlerResult | caps_dbus_provider_dispatch (DBusConnection *connection, DBusMessage *message, void *data) |
Variables | |
| static const struct dbus_method_list | provider_rpc_method_list [] |
| static const char * | introspect_xml_provider_config |
This is the DBUS interface for printing providers.
| #define HASHWORDBITS 32 |
Define the size in bits of a simple hash computed from a string
| DBusHandlerResult dbus_return_i32 | ( | DBusConnection * | connection, |
| DBusMessage * | message, | ||
| int32_t | val | ||
| ) |
Return a simple int32_t as a return value for a DBUS message
| [in] | connection | DBUS connection |
| [in] | message | The message to create an answer to |
| [in] | val | The int32_t to return |
| DBusHandlerResult dbus_return_i64 | ( | DBusConnection * | connection, |
| DBusMessage * | message, | ||
| int64_t | val | ||
| ) |
Return a simple int64_t as a return value for a DBUS message
| [in] | connection | DBUS connection |
| [in] | message | The message to create an answer to |
| [in] | val | The int64_t to return |
| DBusHandlerResult dbus_return_file_handle | ( | DBusConnection * | connection, |
| DBusMessage * | message, | ||
| int | fh | ||
| ) |
Return a file handle as a return value for a DBUS message
| [in] | connection | DBUS connection |
| [in] | message | The message to create an answer to |
| [in] | fh | the file handle |
| void dbus_print_argument_failure | ( | DBusMessage * | message, |
| const DBusError * | error | ||
| ) |
Just print a unified error message for all internal DBUS interfaces
| [in] | message | Just to get the method to show where it happens |
| [in] | error | The error message to print |
| int64_t dbus_receive_single_i64 | ( | DBusMessage * | message, |
| DBusError * | error | ||
| ) |
Receive a simple message with a single int64_t value
| [in] | message | The message to create an answer to |
| [out] | error | Where to store the DBUS error (if any) |
| positive | The received int64_t value |
| -1 | In case of an error, then *error is valid |
Can be used to receive a single printing provider ID or job ID
error (via dbus_error_free()) in case of a failure
|
static |
Compute the hash value for the given string
| [in] | string | String to calculate a hash from |
Defines the so called ‘hashpjw’ function by P.J. Weinberger [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, 1986, 1987 Bell Telephone Laboratories, Inc.]
Value is used to seed the unique provider ID generation.
|
static |
Create some kind of unique value about the counter part of this connection
| [in] | message | The (unmodified) message of the counter part |
message must be still unmodified, else the here used value is invalid
|
static |
Notify clients about a job removal
| [in] | connection | DBUS connection |
| [in] | pr_id | Corresponding printer ID the job was removed from |
| [in] | job_id | The ID of the finished job |
| [in] | state | The first state to report |
Separate function just for easier maintenance.
It first sends the abortion notifier and after that the completion notifier to cover all required state changes according to Print Job States and Notifiers.
|
static |
Drain the possibly still filled job queue of a printer
| [in] | connection | DBUS connection |
| [in] | database | Our local database (printing providers, jobs, ...) |
| [in] | pr_id | The printer's ID to drain |
| [in] | state | Pre-filled state why the queue is to be drained |
Ensure a possibly still filled job queue is drained before the printing provider itself is removed. This includes sending notifiers about the print job removal according to Print Job States and Notifiers.
|
static |
DBUS printing provider RPC: create a new printer with a unique identifier
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Must be called first by the printing provider in order to register its printing service in the next step
Related to CREATE_PR_ID_METHOD and CREATE_PR_ID_XML
|
static |
Notify clients about a printing provider is now gone
| [in] | connection | DBUS connection |
| [in] | pr_id | Corresponding printer ID the job was finished on |
Separate function just for easier maintenance.
|
static |
DBUS printing provider RPC: method 'FreePrId' of path '/org/caps/coordinator' at interface 'org.caps.coordinator.printer'
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Related to FREE_PR_ID_METHOD and FREE_PR_ID_XML
If a printing provider is going to go, call this function to remove it from the coordinator
|
static |
DBUS printing provider RPC: method 'UpdatePrState' of path '/org/caps/printing' at interface 'org.caps.printing.coordinator'
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Related to SET_PRINTER_STATE_METHOD and SET_PRINTER_STATE_XML
|
static |
DBUS printing provider RPC: get the next job identifier from the queue
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Related to GET_JOB_ID_METHOD and GET_JOB_ID_XML
To inform the printing services about a new job we send a signal and all services must call if the job is for them.
|
static |
DBUS printing provider RPC: setup the printer details
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Related to SET_PRINTER_INFO_METHOD and SET_PRINTER_INFO_XML
Since it requires a 'Printer ID', method 'CreateId' must be called first
Counterpart is coord_printer_info_setup()
|
static |
DBUS printing provider RPC: report progression in job printing
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
Related to JOB_SET_PROGRESSION_METHOD and JOB_SET_PROGRESSION_XML
Based on some timeout value, a progression report will send out a signal to the clients about this state change. Refer caps_pp_job_progression_report() for details.
Counterpart is coord_job_progress_report()
|
static |
DBUS printing provider RPC: deliver a specific job.
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
The RPC returns the job's filehandle, or 0 if nothing to be print and negative value in case of an error
To inform the printing services about a new job we send a signal and all services must call if the job is for them.
Related to GET_JOB_METHOD and GET_JOB_XML
|
static |
DBUS printing provider RPC: update the state of a job
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
| DBUS_HANDLER_RESULT_HANDLED | FIXME |
| DBUS_HANDLER_RESULT_NOT_YET_HANDLED | FIXME |
Counterpart is coord_job_state_set()
|
static |
Notify clients about the job is finished (somehow)
| [in] | connection | DBUS connection |
| [in] | pr_id | Corresponding printer ID the job was finished on |
| [in] | job_id | The ID of the finished job |
Separate function just for easier maintenance.
|
static |
DBUS printing provider RPC: mark a printing job as finished
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
| DBUS_HANDLER_RESULT_HANDLED | FIXME |
| DBUS_HANDLER_RESULT_NOT_YET_HANDLED | FIXME |
|
static |
DBUS printing provider RPC: setup the printer's PPD file
| [in] | connection | DBUS connection |
| [in] | message | DBUS message (already pre-processed for this method) |
| [in] | database | Our local database (printing providers, jobs, ...) |
The PPD file is used for backward compatibility. The IPP is using it and most of the printing dialouges are using its content to create a printer specific feature menu.
| void dbus_provider_send_job_change_notifier | ( | DBusConnection * | connection, |
| caps_identifier | pr_id, | ||
| caps_identifier | job_id | ||
| ) |
DBUS printing provider RPC: notify printing providers about a change in their jobs status
| [in] | connection | DBUS connection |
| [in] | pr_id | The printing provider where the the job is for |
| [in] | job_id | Job identifier where something has changed |
A job change can be of:
|
static |
DBUS printing provider RPC: process messages from the printing provider side by passing it to a corresponding function
| [in] | connection | The DBUS connection info |
| [in] | message | The message to process |
| [in,out] | database | The internal printer database |
|
static |
Remove a provider if its own connection to DBUS is terminated
| [in] | connection | DBUS connection |
| [in] | s | The provider's connection info |
| [in,out] | database | The internal printer database |
Since we use the provider's DBUS connection name to use it as its property, we now can use s for the same purpose. E.g. s and #dbus_message_get_sender(message) are the same.
We receive this signal always after the provider's termination. It doesn't matter if the termination was intended or not.
|
static |
Process a received DBUS signal.
| [in] | connection | DBUS connection |
| [in] | message | The DBUS signal message |
| [in] | database | Our internal state/database |
| DBUS_HANDLER_RESULT_HANDLED | Signal processed |
| DBUS_HANDLER_RESULT_NOT_YET_HANDLED | Signal not for us |
Since we have registered a match in dbus_coordinator_allocate() we recieve signals for providers and clients here. We are not interested in clients, but provider_remove_on_termination() sorts them out.
| DBusHandlerResult caps_dbus_provider_dispatch | ( | DBusConnection * | connection, |
| DBusMessage * | message, | ||
| void * | data | ||
| ) |
DBUS printing provider RPC: central callback for the provider side of the DBUS interface
| [in] | connection | DBUS connection |
| [in] | message | DBUS message |
| [in] | data | Our local database (printing providers, jobs, ...) |
It seems the data is NULL, if the message is for the introspectice interface! WTF? At least one time the assert() matches when I had used the d-feet tool to view the introspection data
|
static |
|
static |