22 |
#define IRP_MN_QUERY_DIRECTORY 0x01 |
#define IRP_MN_QUERY_DIRECTORY 0x01 |
23 |
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 |
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 |
24 |
|
|
25 |
#define MAX_ASYNC_IO_REQUESTS 10 |
//#define MAX_ASYNC_IO_REQUESTS 10 |
26 |
|
|
27 |
extern char hostname[16]; |
extern char hostname[16]; |
28 |
extern DEVICE_FNS serial_fns; |
extern DEVICE_FNS serial_fns; |
40 |
/* Table with information about rdpdr devices */ |
/* Table with information about rdpdr devices */ |
41 |
RDPDR_DEVICE g_rdpdr_device[RDPDR_MAX_DEVICES]; |
RDPDR_DEVICE g_rdpdr_device[RDPDR_MAX_DEVICES]; |
42 |
|
|
43 |
|
#if 0 |
44 |
/* Used to store incoming io request, until they are ready to be completed */ |
/* Used to store incoming io request, until they are ready to be completed */ |
45 |
struct async_iorequest |
struct async_iorequest |
46 |
{ |
{ |
50 |
uint8 *buffer; |
uint8 *buffer; |
51 |
DEVICE_FNS *fns; |
DEVICE_FNS *fns; |
52 |
} g_iorequest[MAX_ASYNC_IO_REQUESTS]; |
} g_iorequest[MAX_ASYNC_IO_REQUESTS]; |
53 |
|
#endif |
54 |
|
|
55 |
/* Return device_id for a given handle */ |
/* Return device_id for a given handle */ |
56 |
int |
int |
77 |
} |
} |
78 |
} |
} |
79 |
|
|
80 |
|
#if 0 |
81 |
/* Add a new io request to the table containing pending io requests so it won't block rdesktop */ |
/* Add a new io request to the table containing pending io requests so it won't block rdesktop */ |
82 |
BOOL |
BOOL |
83 |
add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, |
add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, |
107 |
error("IO request table full. Increase MAX_ASYNC_IO_REQUESTS in rdpdr.c!\n"); |
error("IO request table full. Increase MAX_ASYNC_IO_REQUESTS in rdpdr.c!\n"); |
108 |
return False; |
return False; |
109 |
} |
} |
110 |
|
#endif |
111 |
|
|
112 |
void |
void |
113 |
rdpdr_send_connect(void) |
rdpdr_send_connect(void) |
285 |
buffer = (uint8 *) xmalloc(1024); |
buffer = (uint8 *) xmalloc(1024); |
286 |
buffer[0] = 0; |
buffer[0] = 0; |
287 |
|
|
|
|
|
288 |
switch (g_rdpdr_device[device].device_type) |
switch (g_rdpdr_device[device].device_type) |
289 |
{ |
{ |
290 |
case DEVICE_TYPE_SERIAL: |
case DEVICE_TYPE_SERIAL: |
298 |
|
|
299 |
fns = ¶llel_fns; |
fns = ¶llel_fns; |
300 |
/* should be async when aio is finished */ |
/* should be async when aio is finished */ |
301 |
/*rw_blocking = False; */ |
/*rw_blocking = False;*/ |
302 |
break; |
break; |
303 |
|
|
304 |
case DEVICE_TYPE_PRINTER: |
case DEVICE_TYPE_PRINTER: |
374 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
375 |
DEBUG(("RDPDR IRP Read (length: %d, offset: %d)\n", length, offset)); |
DEBUG(("RDPDR IRP Read (length: %d, offset: %d)\n", length, offset)); |
376 |
#endif |
#endif |
377 |
if (rw_blocking) // Complete read immediately |
// if (rw_blocking) // Complete read immediately |
378 |
{ |
// { |
379 |
buffer = (uint8 *) xrealloc((void *) buffer, length); |
buffer = (uint8 *) xrealloc((void *) buffer, length); |
380 |
status = fns->read(file, buffer, length, offset, &result); |
status = fns->read(file, buffer, length, offset, &result); |
381 |
buffer_len = result; |
buffer_len = result; |
382 |
break; |
break; |
383 |
} |
// } |
384 |
|
|
385 |
|
#if 0 |
386 |
// Add request to table |
// Add request to table |
387 |
pst_buf = (uint8 *) xmalloc(length); |
pst_buf = (uint8 *) xmalloc(length); |
388 |
serial_get_timeout(file, length, &total_timeout, &interval_timeout); |
serial_get_timeout(file, length, &total_timeout, &interval_timeout); |
396 |
|
|
397 |
status = STATUS_CANCELLED; |
status = STATUS_CANCELLED; |
398 |
break; |
break; |
399 |
|
#endif |
400 |
case IRP_MJ_WRITE: |
case IRP_MJ_WRITE: |
401 |
|
|
402 |
buffer_len = 1; |
buffer_len = 1; |
413 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
414 |
DEBUG(("RDPDR IRP Write (length: %d)\n", result)); |
DEBUG(("RDPDR IRP Write (length: %d)\n", result)); |
415 |
#endif |
#endif |
416 |
if (rw_blocking) // Complete immediately |
// if (rw_blocking) // Complete immediately |
417 |
{ |
// { |
418 |
status = fns->write(file, s->p, length, offset, &result); |
status = fns->write(file, s->p, length, offset, &result); |
419 |
break; |
break; |
420 |
} |
// } |
421 |
|
#if 0 |
422 |
// Add to table |
// Add to table |
423 |
pst_buf = (uint8 *) xmalloc(length); |
pst_buf = (uint8 *) xmalloc(length); |
424 |
in_uint8a(s, pst_buf, length); |
in_uint8a(s, pst_buf, length); |
432 |
|
|
433 |
status = STATUS_CANCELLED; |
status = STATUS_CANCELLED; |
434 |
break; |
break; |
435 |
|
#endif |
436 |
|
|
437 |
case IRP_MJ_QUERY_INFORMATION: |
case IRP_MJ_QUERY_INFORMATION: |
438 |
|
|
676 |
return (rdpdr_channel != NULL); |
return (rdpdr_channel != NULL); |
677 |
} |
} |
678 |
|
|
679 |
|
#if 0 |
680 |
/* Add file descriptors of pending io request to select() */ |
/* Add file descriptors of pending io request to select() */ |
681 |
void |
void |
682 |
rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * timeout) |
rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * timeout) |
722 |
} |
} |
723 |
} |
} |
724 |
|
|
725 |
|
|
726 |
/* Check if select() returned with one of the rdpdr file descriptors, and complete io if it did */ |
/* Check if select() returned with one of the rdpdr file descriptors, and complete io if it did */ |
727 |
void |
void |
728 |
rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) |
rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) |
815 |
} |
} |
816 |
return False; |
return False; |
817 |
} |
} |
818 |
|
#endif |