home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / netprint < prev    next >
Encoding:
Text File  |  1994-09-07  |  12.3 KB  |  388 lines

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