~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to io/hpmud/hpmud.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************\
2
2
 
3
 
  hpmud.h - public definitions for multi-point transport driver 
4
 
 
 
3
  hpmud.h - public definitions for multi-point transport driver
 
4
 
5
5
  (c) 2004-2008 Copyright Hewlett-Packard Development Company, LP
6
6
 
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:
13
13
 
14
14
  The above copyright notice and this permission notice shall be included in all
15
15
  copies or substantial portions of the Software.
16
16
 
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.
23
23
 
24
24
\*****************************************************************************/
45
45
   HPMUD_R_INVALID_TIMEOUT = 47,
46
46
   HPMUD_R_DATFILE_ERROR = 48,
47
47
   HPMUD_R_IO_TIMEOUT = 49,
 
48
   HPMUD_R_INVALID_MDNS = 50,
48
49
};
49
50
 
50
51
enum HPMUD_IO_MODE
74
75
   HPMUD_SCANTYPE_SOAP = 3,    /* Wookie (ie:ljcm1017) */
75
76
   HPMUD_SCANTYPE_MARVELL = 4,     /* (ie: ljm1005) */
76
77
   HPMUD_SCANTYPE_SOAPHT = 5,   /* HorseThief (ie: ljm1522) */
 
78
   HPMUD_SCANTYPE_SCL_DUPLEX = 6
77
79
};
78
80
 
79
81
enum HPMUD_STATUSTYPE
97
99
enum HPMUD_PLUGIN_TYPE
98
100
{
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,
102
104
};
103
105
 
104
106
#define HPMUD_S_PRINT_CHANNEL "PRINT"
113
115
#define HPMUD_S_SOAP_FAX "HP-SOAP-FAX"
114
116
#define HPMUD_S_DEVMGMT_CHANNEL "HP-DEVMGMT"
115
117
#define HPMUD_S_MARVELL_SCAN_CHANNEL "HP-MARVELL-SCAN"
 
118
#define HPMUD_S_WIFI_CHANNEL "HP-WIFICONFIG"
116
119
 
117
120
typedef int HPMUD_DEVICE;       /* usb, parallel or jetdirect */
118
121
#define HPMUD_DEVICE_MAX 2      /* zero is not used */
127
130
{
128
131
   char uri[HPMUD_LINE_SIZE];
129
132
   int client_cnt;                  /* number of clients that have this device opend */
130
 
   enum HPMUD_IO_MODE io_mode;   
 
133
   enum HPMUD_IO_MODE io_mode;
131
134
   int channel_cnt;                 /* number of open channels */
132
135
   int mlc_up;                      /* 0 = MLC/1284.4 transport up, 1 = MLD/1284.4 transport down */
133
136
};
148
151
#endif
149
152
 
150
153
/*
151
 
 * hpmud_device_open - open specified device, call normally does not block 
 
154
 * hpmud_device_open - open specified device, call normally does not block
152
155
 *
153
156
 * inputs:
154
157
 *  uri - specifies device to open
155
158
 *  io_mode - see enum definition
156
 
 *  
 
159
 *
157
160
 * outputs:
158
161
 *  dd - device descriptor
159
 
 *  return value - see enum definition 
 
162
 *  return value - see enum definition
160
163
 */
161
164
enum HPMUD_RESULT hpmud_open_device(const char *uri, enum HPMUD_IO_MODE io_mode, HPMUD_DEVICE *dd);
162
165
 
165
168
 *
166
169
 * inputs:
167
170
 *  dd - device descriptor
168
 
 *  
 
171
 *
169
172
 * outputs:
170
 
 *  return value - see enum definition 
 
173
 *  return value - see enum definition
171
174
 */
172
175
enum HPMUD_RESULT hpmud_close_device(HPMUD_DEVICE dd);
173
176
 
174
177
/*
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
176
179
 *
177
180
 * If the device is busy, a cached copy may be returned.
178
181
 *
179
182
 * inputs:
180
183
 *  dd - device descriptor
181
184
 *  buf_size - maximum size of buf
182
 
 *  
 
185
 *
183
186
 * outputs:
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
187
190
 */
188
191
enum HPMUD_RESULT hpmud_get_device_id(HPMUD_DEVICE dd, char *buf, int buf_size, int *bytes_read);
189
192
 
192
195
 *
193
196
 * inputs:
194
197
 *  dd - device descriptor
195
 
 *  
 
198
 *
196
199
 * outputs:
197
200
 *  status - 3-bit status, supported by inkjets only
198
 
 *  return value - see enum definition 
 
201
 *  return value - see enum definition
199
202
 */
200
203
enum HPMUD_RESULT hpmud_get_device_status(HPMUD_DEVICE dd, unsigned int *status);
201
204
 
205
208
 * inputs:
206
209
 *  bus - see enum definiton
207
210
 *  buf_size - size of read buffer
208
 
 *  
 
211
 *
209
212
 * outputs:
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
214
217
 */
215
218
enum HPMUD_RESULT hpmud_probe_devices(enum HPMUD_BUS_ID bus, char *buf, int buf_size, int *cnt, int *bytes_read);
216
219
 
222
225
 * inputs:
223
226
 *  dd - device descriptor
224
227
 *  channel_name - requested service name
225
 
 * 
 
228
 *
226
229
 * outputs:
227
230
 *  cd - channel descriptor
228
231
 *  return value - see enum definition
235
238
 * inputs:
236
239
 *  dd - device descriptor
237
240
 *  cd - channel descriptor
238
 
 * 
 
241
 *
239
242
 * outputs:
240
243
 *  return value - see enum definition
241
244
 */
244
247
/*
245
248
 * hpmud_channel_write - write data to specified channel, call will block
246
249
 *
247
 
 * May return with partial bytes written (ie: bytes_wrote < size) with or with-out a timeout. 
 
250
 * May return with partial bytes written (ie: bytes_wrote < size) with or with-out a timeout.
248
251
 *
249
252
 * inputs:
250
253
 *  dd - device descriptor
252
255
 *  buf - data to write
253
256
 *  size - number of bytes to write
254
257
 *  timeout - in seconds
255
 
 * 
 
258
 *
256
259
 * outputs:
257
260
 *  bytes_wrote - number of bytes actually wrote
258
261
 *  return value - see enum definition
262
265
/*
263
266
 * hpmud_channel_read - read data from specified channel, call will block
264
267
 *
265
 
 * May return with partial bytes read (ie: bytes_read < size) or zero if timeout occured. 
 
268
 * May return with partial bytes read (ie: bytes_read < size) or zero if timeout occured.
266
269
 *
267
270
 * inputs:
268
271
 *  dd - device descriptor
269
272
 *  cd - channel descriptor
270
273
 *  size - number of bytes to read
271
274
 *  timeout - in seconds
272
 
 * 
 
275
 *
273
276
 * outputs:
274
277
 *  buf - read data buffer
275
278
 *  bytes_read - number of bytes actually read
282
285
 *
283
286
 * inputs:
284
287
 *  dd - device descriptor
285
 
 * 
 
288
 *
286
289
 * outputs:
287
290
 *  ds - see dstat definition
288
291
 *  return value - see enum definition
301
304
 *  cc - channel descriptor
302
305
 *  snmp_oid - snmp encoded pml oid
303
306
 *  type - oid data type
304
 
 *  data - data payload 
 
307
 *  data - data payload
305
308
 *  data_size - number of bytes to write
306
 
 * 
 
309
 *
307
310
 * outputs:
308
311
 *  pml_result
309
312
 *  return value - see enum definition
322
325
 *  cc - channel descriptor
323
326
 *  snmp_oid - snmp encoded pml oid
324
327
 *  data_size - data buffer size in bytes
325
 
 * 
 
328
 *
326
329
 * outputs:
327
 
 *  data - data payload 
 
330
 *  data - data payload
328
331
 *  type - pml data type
329
332
 *  pml_result
330
333
 *  return value - see enum definition
339
342
 * inputs:
340
343
 *  id - IEEE 1284 device id string
341
344
 *  buf_size - size of buf in bytes
342
 
 * 
 
345
 *
343
346
 * outputs:
344
347
 *  buf - device model string (generalized)
345
348
 *  return value - length of string in bytes, does not include zero termination
354
357
 * inputs:
355
358
 *  id - IEEE 1284 device id string
356
359
 *  buf_size - size of buf in bytes
357
 
 * 
 
360
 *
358
361
 * outputs:
359
362
 *  buf - device model string (raw)
360
363
 *  return value - length of string in bytes, does not include zero termination
369
372
 * inputs:
370
373
 *  uri
371
374
 *  buf_size - size of buf in bytes
372
 
 * 
 
375
 *
373
376
 * outputs:
374
 
 *  buf - device model string 
 
377
 *  buf - device model string
375
378
 *  return value - length of string in bytes, does not include zero termination
376
379
 */
377
380
int hpmud_get_uri_model(const char *uri, char *buf, int buf_size);
384
387
 * inputs:
385
388
 *  uri
386
389
 *  buf_size - size of buf in bytes
387
 
 * 
 
390
 *
388
391
 * outputs:
389
 
 *  buf - device model string 
 
392
 *  buf - device model string
390
393
 *  return value - length of string in bytes, does not include zero termination
391
394
 */
392
395
int hpmud_get_uri_datalink(const char *uri, char *buf, int buf_size);
394
397
/*
395
398
 * hpmud_get_model_attributes - get all model attributes for specified device
396
399
 *
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.
399
402
 *
400
403
 * inputs:
401
404
 *  uri - specifies device
402
405
 *  buf_size - size of buf in bytes
403
 
 * 
 
406
 *
404
407
 * outputs:
405
408
 *  buf - buffer for all model attributes, key/value pair, one per line
406
409
 *  bytes_read - number of bytes actually read
411
414
/*
412
415
 * hpmud_model_query - get model attributes structure for specified device
413
416
 *
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.
416
419
 *
417
420
 * inputs:
418
421
 *  uri - specifies device
419
 
 * 
 
422
 *
420
423
 * outputs:
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
436
 
 * 
 
439
 *
437
440
 * outputs:
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
441
444
 */
442
445
enum HPMUD_RESULT hpmud_make_usb_uri(const char *busnum, const char *devnum, char *uri, int uri_size, int *bytes_read);
450
453
 * inputs:
451
454
 *  sn - specifies product serial number
452
455
 *  uri_size - size of uri buffer in bytes
453
 
 * 
 
456
 *
454
457
 * outputs:
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
458
461
 */
459
462
enum HPMUD_RESULT hpmud_make_usb_serial_uri(const char *sn, char *uri, int uri_size, int *bytes_read);
467
470
 *  ip - internet address
468
471
 *  port - 1-4
469
472
 *  uri_size - size of uri buffer in bytes
470
 
 * 
 
473
 *
471
474
 * outputs:
472
 
 *  uri - zero terminated string 
 
475
 *  uri - zero terminated string
473
476
 *  bytes_read - size of uri
474
477
 *  return value - see enum definition
475
478
 */
483
486
 * inputs:
484
487
 *  dnode - device node
485
488
 *  uri_size - size of uri buffer in bytes
486
 
 * 
 
489
 *
487
490
 * outputs:
488
 
 *  uri - zero terminated string 
 
491
 *  uri - zero terminated string
489
492
 *  bytes_read - size of uri
490
493
 *  return value - see enum definition
491
494
 */
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
503
 
 * 
 
506
 *
504
507
 * outputs:
505
 
 *  value - zero terminated string 
 
508
 *  value - zero terminated string
506
509
 *  return value - see enum definition
507
510
 */
508
511
enum HPMUD_RESULT hpmud_get_conf(const char *section, const char *key, char *value, int value_size);
509
512
 
 
513
/*
 
514
 * hpmud_get_key_value - get key value from specified file
 
515
 *
 
516
 * This function is a stateless hpmud helper function.
 
517
 *
 
518
 * inputs:
 
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
 
523
 *
 
524
 * outputs:
 
525
 *  value - zero terminated string
 
526
 *  return value - see enum definition
 
527
 */
 
528
enum HPMUD_RESULT hpmud_get_key_value(const char *file, const char *section, const char *key, char *value, int value_size);
 
529
 
 
530
/*
 
531
 * hpmud_mdns_lookup - lookup IP for MDNS host name
 
532
 *
 
533
 * This function is a stateless hpmud helper function.
 
534
 *
 
535
 * inputs:
 
536
 *  host_name - zero terminated string (ie: "npi7c8a3e")
 
537
 *  sec_timeout - in seconds
 
538
 *
 
539
 * outputs:
 
540
 *  ip - zero terminated string
 
541
 *  return value - see enum definition
 
542
 */
 
543
enum HPMUD_RESULT hpmud_mdns_lookup(const char *host_name, int sec_timeout, char *ip);
 
544
 
 
545
/*
 
546
 * hpmud_make_mdns_uri - make a network uri from host name
 
547
 *
 
548
 * This function is a stateless hpmud helper function. Requires UDP port 5353 to be open.
 
549
 *
 
550
 * inputs:
 
551
 *  host - zero terminated string (ie: "npi7c8a3e")
 
552
 *  uri_size - size of uri buffer in bytes
 
553
 *
 
554
 * outputs:
 
555
 *  uri - zero terminated string
 
556
 *  bytes_read - size of uri
 
557
 *  return value - see enum definition
 
558
 */
 
559
enum HPMUD_RESULT hpmud_make_mdns_uri(const char *host, int port, char *uri, int uri_size, int *bytes_read);
 
560
 
510
561
#ifdef __cplusplus
511
562
}
512
563
#endif