home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / Computer / h / netprint < prev    next >
Encoding:
Text File  |  1995-08-22  |  12.4 KB  |  398 lines

  1. #ifndef netprint_H
  2. #define netprint_H
  3.  
  4. /* C header file for NetPrint
  5.  * written by DefMod (Jul 24 1995) on Tue Aug 22 14:42:49 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef os_H
  14. #include "os.h"
  15. #endif
  16.  
  17. /**********************************
  18.  * SWI names and SWI reason codes *
  19.  **********************************/
  20. #undef  NetPrint_ReadPSNumber
  21. #define NetPrint_ReadPSNumber                   0x40200
  22. #undef  XNetPrint_ReadPSNumber
  23. #define XNetPrint_ReadPSNumber                  0x60200
  24. #undef  NetPrint_SetPSNumber
  25. #define NetPrint_SetPSNumber                    0x40201
  26. #undef  XNetPrint_SetPSNumber
  27. #define XNetPrint_SetPSNumber                   0x60201
  28. #undef  NetPrint_ReadPSName
  29. #define NetPrint_ReadPSName                     0x40202
  30. #undef  XNetPrint_ReadPSName
  31. #define XNetPrint_ReadPSName                    0x60202
  32. #undef  NetPrint_SetPSName
  33. #define NetPrint_SetPSName                      0x40203
  34. #undef  XNetPrint_SetPSName
  35. #define XNetPrint_SetPSName                     0x60203
  36. #undef  NetPrint_ReadPSTimeouts
  37. #define NetPrint_ReadPSTimeouts                 0x40204
  38. #undef  XNetPrint_ReadPSTimeouts
  39. #define XNetPrint_ReadPSTimeouts                0x60204
  40. #undef  NetPrint_SetPSTimeouts
  41. #define NetPrint_SetPSTimeouts                  0x40205
  42. #undef  XNetPrint_SetPSTimeouts
  43. #define XNetPrint_SetPSTimeouts                 0x60205
  44. #undef  NetPrint_BindPSName
  45. #define NetPrint_BindPSName                     0x40206
  46. #undef  XNetPrint_BindPSName
  47. #define XNetPrint_BindPSName                    0x60206
  48. #undef  NetPrint_ListServers
  49. #define NetPrint_ListServers                    0x40207
  50. #undef  XNetPrint_ListServers
  51. #define XNetPrint_ListServers                   0x60207
  52. #undef  NetPrintListServers_Brief
  53. #define NetPrintListServers_Brief               0x0
  54. #undef  NetPrintListServers_Name
  55. #define NetPrintListServers_Name                0x1
  56. #undef  NetPrintListServers_Full
  57. #define NetPrintListServers_Full                0x2
  58. #undef  NetPrint_ConvertStatusToString
  59. #define NetPrint_ConvertStatusToString          0x40208
  60. #undef  XNetPrint_ConvertStatusToString
  61. #define XNetPrint_ConvertStatusToString         0x60208
  62. #undef  Service_NetPrintCheckD1
  63. #define Service_NetPrintCheckD1                 0x40200
  64.  
  65. /************************************
  66.  * Structure and union declarations *
  67.  ************************************/
  68. typedef struct netprint_brief_entry             netprint_brief_entry;
  69. typedef struct netprint_name_entry              netprint_name_entry;
  70. typedef struct netprint_full_entry              netprint_full_entry;
  71.  
  72. /********************
  73.  * Type definitions *
  74.  ********************/
  75. typedef byte netprint_status;
  76.  
  77. struct netprint_brief_entry
  78.    {  byte station_no;
  79.       byte net_no;
  80.       char ps_name [256];
  81.    };
  82.  
  83. struct netprint_name_entry
  84.    {  char ps_name [256];
  85.    };
  86.  
  87. struct netprint_full_entry
  88.    {  byte station_no;
  89.       byte net_no;
  90.       netprint_status status;
  91.       byte status_station_no;
  92.       byte status_net_no;
  93.       char ps_name [256];
  94.    };
  95.  
  96. /************************
  97.  * Constant definitions *
  98.  ************************/
  99. #define netprint_PS_NAME_LIMIT                  256
  100. #define netprint_STATUS_READY                   ((netprint_status) 0x0u)
  101. #define netprint_STATUS_BUSY                    ((netprint_status) 0x1u)
  102. #define netprint_STATUS_JAMMED                  ((netprint_status) 0x2u)
  103. #define netprint_STATUS_OFFLINE                 ((netprint_status) 0x6u)
  104. #define netprint_STATUS_OPEN                    ((netprint_status) 0x7u)
  105. #define error_NET_PRINT_NAME_TOO_LONG           0x10C00u
  106.       /*Printer name too long*/
  107. #define error_NET_PRINT_SINGLE_STREAM           0x10C01u
  108.       /*Printer in use*/
  109. #define error_NET_PRINT_ALL_PRINTERS_BUSY       0x10C02u
  110.       /*No free printer of this type*/
  111. #define error_NET_PRINT_OFF_LINE                0x10C09u
  112.       /*Printer offline*/
  113. #define error_NET_PRINT_NOT_FOUND               0x10C0Au
  114.       /*Printer server not found*/
  115. #define error_NET_PRINT_INTERNAL_ERROR          0x10C0Bu
  116.       /*Fatal internal error*/
  117.  
  118. /*************************
  119.  * Function declarations *
  120.  *************************/
  121.  
  122. #ifdef __cplusplus
  123.    extern "C" {
  124. #endif
  125.  
  126. /* ------------------------------------------------------------------------
  127.  * Function:      netprint_read_ps_number()
  128.  *
  129.  * Description:   Returns the full station number of your current printer
  130.  *                server
  131.  *
  132.  * Output:        station_no - value of R0 on exit
  133.  *                net_no - value of R1 on exit
  134.  *
  135.  * Other notes:   Calls SWI 0x40200.
  136.  */
  137.  
  138. extern os_error *xnetprint_read_ps_number (byte *station_no,
  139.       byte *net_no);
  140. extern void netprint_read_ps_number (byte *station_no,
  141.       byte *net_no);
  142.  
  143. /* ------------------------------------------------------------------------
  144.  * Function:      netprint_set_ps_number()
  145.  *
  146.  * Description:   Sets the full station number used as the current printer
  147.  *                server
  148.  *
  149.  * Input:         station_no - value of R0 on entry
  150.  *                net_no - value of R1 on entry
  151.  *
  152.  * Other notes:   Calls SWI 0x40201.
  153.  */
  154.  
  155. extern os_error *xnetprint_set_ps_number (byte station_no,
  156.       byte net_no);
  157. __swi (0x40201) void netprint_set_ps_number (byte station_no,
  158.       byte net_no);
  159.  
  160. /* ------------------------------------------------------------------------
  161.  * Function:      netprint_read_ps_name()
  162.  *
  163.  * Description:   Reads the name of your current printer server
  164.  *
  165.  * Input:         buffer - value of R1 on entry
  166.  *                size - value of R2 on entry
  167.  *
  168.  * Output:        end - value of R1 on exit (X version only)
  169.  *
  170.  * Returns:       R1 (non-X version only)
  171.  *
  172.  * Other notes:   Calls SWI 0x40202.
  173.  */
  174.  
  175. extern os_error *xnetprint_read_ps_name (char *buffer,
  176.       int size,
  177.       char **end);
  178. extern char *netprint_read_ps_name (char *buffer,
  179.       int size);
  180.  
  181. /* ------------------------------------------------------------------------
  182.  * Function:      netprint_set_ps_name()
  183.  *
  184.  * Description:   Sets by name the printer server used as your current one
  185.  *
  186.  * Input:         ps_name - value of R0 on entry
  187.  *
  188.  * Other notes:   Calls SWI 0x40203.
  189.  */
  190.  
  191. extern os_error *xnetprint_set_ps_name (char const *ps_name);
  192. __swi (0x40203) void netprint_set_ps_name (char const *ps_name);
  193.  
  194. /* ------------------------------------------------------------------------
  195.  * Function:      netprint_read_ps_timeouts()
  196.  *
  197.  * Description:   Reads the current values for timeouts used by NetPrint
  198.  *
  199.  * Output:        transmit_count - value of R0 on exit
  200.  *                transmit_delay - value of R1 on exit
  201.  *                peek_count - value of R2 on exit
  202.  *                peek_delay - value of R3 on exit
  203.  *                receive_delay - value of R4 on exit
  204.  *                broadcast_delay - value of R5 on exit
  205.  *
  206.  * Other notes:   Calls SWI 0x40204.
  207.  */
  208.  
  209. extern os_error *xnetprint_read_ps_timeouts (int *transmit_count,
  210.       int *transmit_delay,
  211.       int *peek_count,
  212.       int *peek_delay,
  213.       int *receive_delay,
  214.       int *broadcast_delay);
  215. extern void netprint_read_ps_timeouts (int *transmit_count,
  216.       int *transmit_delay,
  217.       int *peek_count,
  218.       int *peek_delay,
  219.       int *receive_delay,
  220.       int *broadcast_delay);
  221.  
  222. /* ------------------------------------------------------------------------
  223.  * Function:      netprint_set_ps_timeouts()
  224.  *
  225.  * Description:   Sets the current values for timeouts used by NetPrint
  226.  *
  227.  * Input:         transmit_count - value of R0 on entry
  228.  *                transmit_delay - value of R1 on entry
  229.  *                peek_count - value of R2 on entry
  230.  *                peek_delay - value of R3 on entry
  231.  *                receive_delay - value of R4 on entry
  232.  *                broadcast_delay - value of R5 on entry
  233.  *
  234.  * Other notes:   Calls SWI 0x40205.
  235.  */
  236.  
  237. extern os_error *xnetprint_set_ps_timeouts (int transmit_count,
  238.       int transmit_delay,
  239.       int peek_count,
  240.       int peek_delay,
  241.       int receive_delay,
  242.       int broadcast_delay);
  243. extern void netprint_set_ps_timeouts (int transmit_count,
  244.       int transmit_delay,
  245.       int peek_count,
  246.       int peek_delay,
  247.       int receive_delay,
  248.       int broadcast_delay);
  249.  
  250. /* ------------------------------------------------------------------------
  251.  * Function:      netprint_bind_ps_name()
  252.  *
  253.  * Description:   Converts a printer server's name to its address,
  254.  *                providing it is free
  255.  *
  256.  * Input:         ps_name - value of R0 on entry
  257.  *
  258.  * Output:        station_no - value of R0 on exit
  259.  *                net_no - value of R1 on exit
  260.  *
  261.  * Other notes:   Calls SWI 0x40206.
  262.  */
  263.  
  264. extern os_error *xnetprint_bind_ps_name (char const *ps_name,
  265.       byte *station_no,
  266.       byte *net_no);
  267. extern void netprint_bind_ps_name (char const *ps_name,
  268.       byte *station_no,
  269.       byte *net_no);
  270.  
  271. /* ------------------------------------------------------------------------
  272.  * Function:      netprintlistservers_brief()
  273.  *
  274.  * Description:   Returns the names and numbers of all printer servers
  275.  *
  276.  * Input:         entries - value of R1 on entry
  277.  *                size - value of R2 on entry
  278.  *                timeout - value of R3 on entry
  279.  *
  280.  * Output:        entry_count - value of R0 on exit
  281.  *                no_more - value of R3 on exit (X version only)
  282.  *
  283.  * Returns:       R3 (non-X version only)
  284.  *
  285.  * Other notes:   Calls SWI 0x40207 with R0 = 0x0.
  286.  */
  287.  
  288. extern os_error *xnetprintlistservers_brief (netprint_brief_entry *entries,
  289.       int size,
  290.       int timeout,
  291.       int *entry_count,
  292.       bool *no_more);
  293. extern bool netprintlistservers_brief (netprint_brief_entry *entries,
  294.       int size,
  295.       int timeout,
  296.       int *entry_count);
  297.  
  298. /* ------------------------------------------------------------------------
  299.  * Function:      netprintlistservers_name()
  300.  *
  301.  * Description:   Returns the names of all printer servers, sorted, with
  302.  *                duplicates removed
  303.  *
  304.  * Input:         entries - value of R1 on entry
  305.  *                size - value of R2 on entry
  306.  *                timeout - value of R3 on entry
  307.  *
  308.  * Output:        entry_count - value of R0 on exit
  309.  *                no_more - value of R3 on exit (X version only)
  310.  *
  311.  * Returns:       R3 (non-X version only)
  312.  *
  313.  * Other notes:   Calls SWI 0x40207 with R0 = 0x1.
  314.  */
  315.  
  316. extern os_error *xnetprintlistservers_name (netprint_name_entry *entries,
  317.       int size,
  318.       int timeout,
  319.       int *entry_count,
  320.       bool *no_more);
  321. extern bool netprintlistservers_name (netprint_name_entry *entries,
  322.       int size,
  323.       int timeout,
  324.       int *entry_count);
  325.  
  326. /* ------------------------------------------------------------------------
  327.  * Function:      netprintlistservers_full()
  328.  *
  329.  * Description:   Returns the names, numbers and status of all printer
  330.  *                servers
  331.  *
  332.  * Input:         entries - value of R1 on entry
  333.  *                size - value of R2 on entry
  334.  *                timeout - value of R3 on entry
  335.  *
  336.  * Output:        entry_count - value of R0 on exit
  337.  *                no_more - value of R3 on exit (X version only)
  338.  *
  339.  * Returns:       R3 (non-X version only)
  340.  *
  341.  * Other notes:   Calls SWI 0x40207 with R0 = 0x2.
  342.  */
  343.  
  344. extern os_error *xnetprintlistservers_full (netprint_full_entry *entries,
  345.       int size,
  346.       int timeout,
  347.       int *entry_count,
  348.       bool *no_more);
  349. extern bool netprintlistservers_full (netprint_full_entry *entries,
  350.       int size,
  351.       int timeout,
  352.       int *entry_count);
  353.  
  354. /* ------------------------------------------------------------------------
  355.  * Function:      netprint_convert_status_to_string()
  356.  *
  357.  * Description:   Translates a status value returned by
  358.  *                NetPrint_ListServers into the local language
  359.  *
  360.  * Input:         status_station_net - value of R0 on entry
  361.  *                buffer - value of R1 on entry
  362.  *                size - value of R2 on entry
  363.  *
  364.  * Output:        end - value of R1 on exit (X version only)
  365.  *
  366.  * Returns:       R1 (non-X version only)
  367.  *
  368.  * Other notes:   Calls SWI 0x40208.
  369.  */
  370.  
  371. extern os_error *xnetprint_convert_status_to_string (bits const *status_station_net,
  372.       char *buffer,
  373.       int size,
  374.       char **end);
  375. extern char *netprint_convert_status_to_string (bits const *status_station_net,
  376.       char *buffer,
  377.       int size);
  378.  
  379. /* ------------------------------------------------------------------------
  380.  * Function:      service_net_print_check_d1()
  381.  *
  382.  * Description:   Issued by NetPrint to determine if there is a local
  383.  *                printer running
  384.  *
  385.  * Output:        unclaimed - value of R1 on exit
  386.  *
  387.  * Other notes:   Calls SWI 0x30 with R1 = 0x40200.
  388.  */
  389.  
  390. extern os_error *xservice_net_print_check_d1 (bool *unclaimed);
  391. extern void service_net_print_check_d1 (bool *unclaimed);
  392.  
  393. #ifdef __cplusplus
  394.    }
  395. #endif
  396.  
  397. #endif
  398.