1
1
/*****************************************************************************\
3
hpmud.h - public definitions for multi-point transport driver
3
hpmud.h - public definitions for multi-point transport driver
5
5
(c) 2004-2008 Copyright Hewlett-Packard Development Company, LP
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11
of the Software, and to permit persons to whom the Software is furnished to do
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11
of the Software, and to permit persons to whom the Software is furnished to do
12
12
so, subject to the following conditions:
14
14
The above copyright notice and this permission notice shall be included in all
15
15
copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
\*****************************************************************************/
97
99
enum HPMUD_PLUGIN_TYPE
99
101
HPMUD_PLUGIN_TYPE_NONE = 0,
100
HPMUD_PLUGIN_TYPE_REQUIRED = 1,
101
HPMUD_PLUGIN_TYPE_OPTIONAL = 2,
102
HPMUD_PLUGIN_TYPE_REQUIRED = 1,
103
HPMUD_PLUGIN_TYPE_OPTIONAL = 2,
104
106
#define HPMUD_S_PRINT_CHANNEL "PRINT"
151
* hpmud_device_open - open specified device, call normally does not block
154
* hpmud_device_open - open specified device, call normally does not block
154
157
* uri - specifies device to open
155
158
* io_mode - see enum definition
158
161
* dd - device descriptor
159
* return value - see enum definition
162
* return value - see enum definition
161
164
enum HPMUD_RESULT hpmud_open_device(const char *uri, enum HPMUD_IO_MODE io_mode, HPMUD_DEVICE *dd);
167
170
* dd - device descriptor
170
* return value - see enum definition
173
* return value - see enum definition
172
175
enum HPMUD_RESULT hpmud_close_device(HPMUD_DEVICE dd);
175
* hpmud_get_device_id - read IEEE 1284 device ID string, call normally does not block
178
* hpmud_get_device_id - read IEEE 1284 device ID string, call normally does not block
177
180
* If the device is busy, a cached copy may be returned.
180
183
* dd - device descriptor
181
184
* buf_size - maximum size of buf
184
187
* buf - zero terminated device ID string
185
188
* bytes_read - size of device ID string, does not include zero termination
186
* return value - see enum definition
189
* return value - see enum definition
188
191
enum HPMUD_RESULT hpmud_get_device_id(HPMUD_DEVICE dd, char *buf, int buf_size, int *bytes_read);
206
209
* bus - see enum definiton
207
210
* buf_size - size of read buffer
210
213
* buf - zero terminated CUPS backend formatted data
211
214
* cnt - number of HP devices found
212
215
* bytes_read - number of bytes actually read
213
* return value - see enum definition
216
* return value - see enum definition
215
218
enum HPMUD_RESULT hpmud_probe_devices(enum HPMUD_BUS_ID bus, char *buf, int buf_size, int *cnt, int *bytes_read);
395
398
* hpmud_get_model_attributes - get all model attributes for specified device
397
* Reads device model attributes from models.dat file. This function is a
398
* stateless hpmud helper function.
400
* Reads device model attributes from models.dat file. This function is a
401
* stateless hpmud helper function.
401
404
* uri - specifies device
402
405
* buf_size - size of buf in bytes
405
408
* buf - buffer for all model attributes, key/value pair, one per line
406
409
* bytes_read - number of bytes actually read
412
415
* hpmud_model_query - get model attributes structure for specified device
414
* Reads device model attributes from models.dat file. This function is a
415
* stateless hpmud helper function.
417
* Reads device model attributes from models.dat file. This function is a
418
* stateless hpmud helper function.
418
421
* uri - specifies device
421
424
* ma - see structure definition
422
425
* return value - see enum definition
433
436
* busnum - specifies usbfs bus number
434
437
* devnum - specifies usbfs device number
435
438
* uri_size - size of uri buffer in bytes
438
441
* uri - zero terminated string
439
* bytes_read - size of uri
442
* bytes_read - size of uri
440
443
* return value - see enum definition
442
445
enum HPMUD_RESULT hpmud_make_usb_uri(const char *busnum, const char *devnum, char *uri, int uri_size, int *bytes_read);
451
454
* sn - specifies product serial number
452
455
* uri_size - size of uri buffer in bytes
455
458
* uri - zero terminated string
456
* bytes_read - size of uri
459
* bytes_read - size of uri
457
460
* return value - see enum definition
459
462
enum HPMUD_RESULT hpmud_make_usb_serial_uri(const char *sn, char *uri, int uri_size, int *bytes_read);
500
503
* section - zero terminated string (ie: "[dirs]")
501
504
* key - zero terminated string (ie: "home")
502
505
* value_size - size of value buffer in bytes
505
* value - zero terminated string
508
* value - zero terminated string
506
509
* return value - see enum definition
508
511
enum HPMUD_RESULT hpmud_get_conf(const char *section, const char *key, char *value, int value_size);
514
* hpmud_get_key_value - get key value from specified file
516
* This function is a stateless hpmud helper function.
519
* file - zero terminated file path
520
* section - zero terminated string (ie: "[dirs]")
521
* key - zero terminated string (ie: "home")
522
* value_size - size of value buffer in bytes
525
* value - zero terminated string
526
* return value - see enum definition
528
enum HPMUD_RESULT hpmud_get_key_value(const char *file, const char *section, const char *key, char *value, int value_size);
531
* hpmud_mdns_lookup - lookup IP for MDNS host name
533
* This function is a stateless hpmud helper function.
536
* host_name - zero terminated string (ie: "npi7c8a3e")
537
* sec_timeout - in seconds
540
* ip - zero terminated string
541
* return value - see enum definition
543
enum HPMUD_RESULT hpmud_mdns_lookup(const char *host_name, int sec_timeout, char *ip);
546
* hpmud_make_mdns_uri - make a network uri from host name
548
* This function is a stateless hpmud helper function. Requires UDP port 5353 to be open.
551
* host - zero terminated string (ie: "npi7c8a3e")
552
* uri_size - size of uri buffer in bytes
555
* uri - zero terminated string
556
* bytes_read - size of uri
557
* return value - see enum definition
559
enum HPMUD_RESULT hpmud_make_mdns_uri(const char *host, int port, char *uri, int uri_size, int *bytes_read);
510
561
#ifdef __cplusplus