PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/branches/stable-1-0/openslp/slpd/slpd_knownda.h

#
C++ Header | 226 lines | 30 code | 32 blank | 164 comment | 0 complexity | 9bed4a0c6dff6ed89591c673cf672de6 MD5 | raw file
Possible License(s): BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-2.1
  1. /***************************************************************************/
  2. /* */
  3. /* Project: OpenSLP - OpenSource implementation of Service Location */
  4. /* Protocol Version 2 */
  5. /* */
  6. /* File: slpd_knownda.h */
  7. /* */
  8. /* Abstract: Keeps track of known DAs */
  9. /* */
  10. /*-------------------------------------------------------------------------*/
  11. /* */
  12. /* Please submit patches to http://www.openslp.org */
  13. /* */
  14. /*-------------------------------------------------------------------------*/
  15. /* */
  16. /* Copyright (C) 2000 Caldera Systems, Inc */
  17. /* All rights reserved. */
  18. /* */
  19. /* Redistribution and use in source and binary forms, with or without */
  20. /* modification, are permitted provided that the following conditions are */
  21. /* met: */
  22. /* */
  23. /* Redistributions of source code must retain the above copyright */
  24. /* notice, this list of conditions and the following disclaimer. */
  25. /* */
  26. /* Redistributions in binary form must reproduce the above copyright */
  27. /* notice, this list of conditions and the following disclaimer in */
  28. /* the documentation and/or other materials provided with the */
  29. /* distribution. */
  30. /* */
  31. /* Neither the name of Caldera Systems nor the names of its */
  32. /* contributors may be used to endorse or promote products derived */
  33. /* from this software without specific prior written permission. */
  34. /* */
  35. /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
  36. /* `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
  37. /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
  38. /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CALDERA */
  39. /* SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
  40. /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
  41. /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
  42. /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
  43. /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  44. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
  45. /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  46. /* */
  47. /***************************************************************************/
  48. #ifndef SLPD_KNOWNDA_H_INCLUDED
  49. #define SLPD_KNOWNDA_H_INCLUDED
  50. #include "slpd.h"
  51. /*=========================================================================*/
  52. /* common code includes */
  53. /*=========================================================================*/
  54. #include "slp_buffer.h"
  55. #include "slp_message.h"
  56. /*=========================================================================*/
  57. int SLPDKnownDAInit();
  58. /* Initializes the KnownDA list. Removes all entries and adds entries */
  59. /* that are statically configured. */
  60. /* */
  61. /* returns zero on success, Non-zero on failure */
  62. /*=========================================================================*/
  63. /*=========================================================================*/
  64. int SLPDKnownDADeinit();
  65. /* Deinitializes the KnownDA list. Removes all entries and deregisters */
  66. /* all services. */
  67. /* */
  68. /* returns zero on success, Non-zero on failure */
  69. /*=========================================================================*/
  70. /*=========================================================================*/
  71. int SLPDKnownDAAdd(SLPMessage msg, SLPBuffer buf);
  72. /* Adds a DA to the known DA list if it is new, removes it if DA is going */
  73. /* down or adjusts entry if DA changed. */
  74. /* */
  75. /* msg (IN) DAAdvert Message descriptor */
  76. /* */
  77. /* buf (IN) The DAAdvert message buffer */
  78. /* */
  79. /* returns Zero on success, Non-zero on error */
  80. /*=========================================================================*/
  81. /*=========================================================================*/
  82. void SLPDKnownDARemove(struct in_addr* addr);
  83. /* Removes known DAs that sent DAAdverts from the specified in_addr */
  84. /*=========================================================================*/
  85. /*=========================================================================*/
  86. void* SLPDKnownDAEnumStart();
  87. /* Start an enumeration of all Known DAs */
  88. /* */
  89. /* Returns: An enumeration handle that is passed to subsequent calls to */
  90. /* SLPDKnownDAEnum(). Returns NULL on failure. Returned */
  91. /* enumeration handle (if not NULL) must be passed to */
  92. /* SLPDKnownDAEnumEnd() when you are done with it. */
  93. /*=========================================================================*/
  94. /*=========================================================================*/
  95. SLPMessage SLPDKnownDAEnum(void* eh, SLPMessage* msg, SLPBuffer* buf);
  96. /* Enumerate through all Known DAs */
  97. /* */
  98. /* eh (IN) pointer to opaque data that is used to maintain */
  99. /* enumerate entries. Pass in a pointer to NULL to start */
  100. /* enumeration. */
  101. /* */
  102. /* msg (OUT) pointer to the DAAdvert message descriptor */
  103. /* */
  104. /* buf (OUT) pointer to the DAAdvert message buffer */
  105. /* */
  106. /* returns: Pointer to enumerated entry or NULL if end of enumeration */
  107. /*=========================================================================*/
  108. /*=========================================================================*/
  109. void SLPDKnownDAEnumEnd(void* eh);
  110. /* End an enumeration started by SLPDKnownDAEnumStart() */
  111. /* */
  112. /* Parameters: eh (IN) The enumeration handle returned by */
  113. /* SLPDKnownDAEnumStart() */
  114. /*=========================================================================*/
  115. /*=========================================================================*/
  116. int SLPDKnownDAGenerateMyDAAdvert(int errorcode,
  117. int deadda,
  118. int xid,
  119. SLPBuffer* sendbuf);
  120. /* Pack a buffer with a DAAdvert using information from a SLPDAentry */
  121. /* */
  122. /* errorcode (IN) the errorcode for the DAAdvert */
  123. /* */
  124. /* xid (IN) the xid to for the DAAdvert */
  125. /* */
  126. /* daentry (IN) pointer to the daentry that contains the rest of the info */
  127. /* to make the DAAdvert */
  128. /* */
  129. /* sendbuf (OUT) pointer to the SLPBuffer that will be packed with a */
  130. /* DAAdvert */
  131. /* */
  132. /* returns: zero on success, non-zero on error */
  133. /*=========================================================================*/
  134. #if defined(ENABLE_SLPv1)
  135. /*=========================================================================*/
  136. int SLPDKnownDAGenerateMyV1DAAdvert(int errorcode,
  137. int encoding,
  138. unsigned int xid,
  139. SLPBuffer* sendbuf);
  140. /* Pack a buffer with a v1 DAAdvert using information from a SLPDAentry */
  141. /* */
  142. /* errorcode (IN) the errorcode for the DAAdvert */
  143. /* */
  144. /* encoding (IN) the SLPv1 language encoding for the DAAdvert */
  145. /* */
  146. /* xid (IN) the xid to for the DAAdvert */
  147. /* */
  148. /* sendbuf (OUT) pointer to the SLPBuffer that will be packed with a */
  149. /* DAAdvert */
  150. /* */
  151. /* returns: zero on success, non-zero on error */
  152. /*=========================================================================*/
  153. #endif
  154. /*=========================================================================*/
  155. void SLPDKnownDAEcho(SLPMessage msg, SLPBuffer buf);
  156. /* Echo a srvreg message to a known DA */
  157. /* */
  158. /* msg (IN) the SrvReg message descriptor */
  159. /* */
  160. /* buf (IN) the SrvReg message buffer to echo */
  161. /* */
  162. /* Returns: none */
  163. /*=========================================================================*/
  164. /*=========================================================================*/
  165. void SLPDKnownDAActiveDiscovery(int seconds);
  166. /* Add a socket to the outgoing list to do active DA discovery SrvRqst */
  167. /* */
  168. /* Returns: none */
  169. /*=========================================================================*/
  170. /*=========================================================================*/
  171. void SLPDKnownDAPassiveDAAdvert(int seconds, int dadead);
  172. /* Send passive daadvert messages if properly configured and running as */
  173. /* a DA */
  174. /* */
  175. /* seconds (IN) number seconds that elapsed since the last call to this */
  176. /* function */
  177. /* */
  178. /* dadead (IN) nonzero if the DA is dead and a bootstamp of 0 should be */
  179. /* sent */
  180. /* */
  181. /* Returns: none */
  182. /*=========================================================================*/
  183. /*=========================================================================*/
  184. void SLPDKnownDAImmortalRefresh(int seconds);
  185. /* Refresh all SLP_LIFETIME_MAXIMUM services */
  186. /* */
  187. /* seconds (IN) time in seconds since last call */
  188. /*=========================================================================*/
  189. #ifdef DEBUG
  190. /*=========================================================================*/
  191. void SLPDKnownDADump();
  192. /*=========================================================================*/
  193. #endif
  194. #endif