rm.3B 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .\" Copyright (C) 1994-2018 Altair Engineering, Inc.
  2. .\" For more information, contact Altair at www.altair.com.
  3. .\"
  4. .\" This file is part of the PBS Professional ("PBS Pro") software.
  5. .\"
  6. .\" Open Source License Information:
  7. .\"
  8. .\" PBS Pro is free software. You can redistribute it and/or modify it under the
  9. .\" terms of the GNU Affero General Public License as published by the Free
  10. .\" Software Foundation, either version 3 of the License, or (at your option) any
  11. .\" later version.
  12. .\"
  13. .\" PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  14. .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. .\" FOR A PARTICULAR PURPOSE.
  16. .\" See the GNU Affero General Public License for more details.
  17. .\"
  18. .\" You should have received a copy of the GNU Affero General Public License
  19. .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. .\"
  21. .\" Commercial License Information:
  22. .\"
  23. .\" For a copy of the commercial license terms and conditions,
  24. .\" go to: (http://www.pbspro.com/UserArea/agreement.html)
  25. .\" or contact the Altair Legal Department.
  26. .\"
  27. .\" Altair’s dual-license business model allows companies, individuals, and
  28. .\" organizations to create proprietary derivative works of PBS Pro and
  29. .\" distribute them - whether embedded or bundled with other software -
  30. .\" under a commercial license agreement.
  31. .\"
  32. .\" Use of Altair’s trademarks, including but not limited to "PBS™",
  33. .\" "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  34. .\" trademark licensing policies.
  35. .\"
  36. .TH RM 3 "29 August 2011" Local "PBS Professional"
  37. .SH NAME
  38. openrm, closerm, downrm, configrm, addreq, allreq, getreq, flushreq, activereq, fullresp \- resource monitor API
  39. .SH SYNOPSIS
  40. .B #include <sys/types.h>
  41. .br
  42. .B #include <netinet/in.h>
  43. .br
  44. .B #include <rm.h>
  45. .LP
  46. .B
  47. int openrm (host, port)
  48. .br
  49. .RS 6
  50. char *host;
  51. .br
  52. unsigned int port;
  53. .RE
  54. .LP
  55. .B int closerm (stream)
  56. .br
  57. .RS 6
  58. int stream;
  59. .RE
  60. .LP
  61. .B
  62. int downrm (stream)
  63. .br
  64. .RS 6
  65. int stream;
  66. .RE
  67. .LP
  68. .B
  69. int configrm (stream, file)
  70. .br
  71. .RS 6
  72. int stream;
  73. .br
  74. char *file;
  75. .RE
  76. .LP
  77. .B
  78. int addreq (stream, line)
  79. .br
  80. .RS 6
  81. int stream;
  82. .br
  83. char *line;
  84. .RE
  85. .LP
  86. .B
  87. int allreq (line)
  88. .br
  89. .RS 6
  90. char *line;
  91. .RE
  92. .LP
  93. .B
  94. char *getreq(stream)
  95. .br
  96. .RS 6
  97. int stream;
  98. .RE
  99. .LP
  100. .B
  101. int flushreq()
  102. .LP
  103. .B
  104. int activereq()
  105. .LP
  106. .B
  107. void fullresp(flag)
  108. .br
  109. .RS 6
  110. int flag;
  111. .RE
  112. .SH DESCRIPTION
  113. .LP
  114. The resource monitor library contains functions to facilitate
  115. communication with the PBS Professional resource monitor. It is set up
  116. to make it easy to connect to several resource monitors and
  117. handle the network communication efficiently.
  118. .LP
  119. In all these routines, the variable
  120. .B pbs_errno
  121. will be set when an error is indicated.
  122. The lower levels of network protocol are handled by the
  123. "Data Is Strings"
  124. .I DIS
  125. library and the "Reliable Packet Protocol"
  126. .I RPP
  127. library.
  128. .LP
  129. .B configrm()
  130. causes the resource monitor to read the file named.
  131. .B Deprecated.
  132. .LP
  133. .B addreq()
  134. begins a new message to the resource monitor if necessary.
  135. Then adds a line to the body of an outstanding command to the resource
  136. monitor.
  137. .LP
  138. .B allreq()
  139. begins, for each stream, a new message to the resource monitor if necessary.
  140. Then adds a line to the body of an outstanding command to the resource
  141. monitor.
  142. .LP
  143. .B getreq()
  144. finishes and sends any outstanding message to the resource monitor.
  145. If
  146. .B fullresp()
  147. has been called to turn off "full response" mode, the routine
  148. searches down the line to find the equal sign just before the
  149. response value.
  150. The returned string (if it is not NULL) has been allocated by
  151. .I malloc
  152. and thus
  153. .I free
  154. must be called when it is no longer needed to prevent memory leaks.
  155. .LP
  156. .B flushreq()
  157. finishes and sends any outstanding messages to all resource monitors.
  158. For each active resource monitor structure, it checks if any
  159. outstanding data is waiting to be sent. If there is, it is sent and
  160. the internal structure is marked to show "waiting for response".
  161. .LP
  162. .B fullresp()
  163. turns on, if flag is true, "full response" mode where
  164. .B getreq()
  165. returns a pointer to the beginning of a line of response.
  166. This is the default. If flag is false,
  167. the line returned by
  168. .B getreq()
  169. is just the answer following the equal sign.
  170. .LP
  171. .B activereq()
  172. Returns the stream number of the next stream with something
  173. to read or a negative number (the return from
  174. .I rpp_poll )
  175. if there is no stream to read.
  176. In order to use any of the above with Windows, initialize the network
  177. library and link with
  178. .B winsock2.
  179. To do this, call
  180. .B winsock_init()
  181. before calling the function and link against the
  182. .B ws2_32.lib
  183. library.
  184. .SH SEE ALSO
  185. .BR rpp (3B),
  186. .BR tcp (4P),
  187. .BR udp (4P)