IGridData.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System.Collections.Generic;
  28. using OpenMetaverse;
  29. using OpenSim.Framework;
  30. namespace OpenSim.Data
  31. {
  32. public enum DataResponse
  33. {
  34. RESPONSE_OK,
  35. RESPONSE_AUTHREQUIRED,
  36. RESPONSE_INVALIDCREDENTIALS,
  37. RESPONSE_ERROR
  38. }
  39. /// <summary>
  40. /// A standard grid interface
  41. /// </summary>
  42. public interface IGridDataPlugin : IPlugin
  43. {
  44. /// <summary>
  45. /// Initialises the interface
  46. /// </summary>
  47. void Initialise(string connect);
  48. /// <summary>
  49. /// Returns a sim profile from a regionHandle
  50. /// </summary>
  51. /// <param name="regionHandle">A 64bit Region Handle</param>
  52. /// <returns>A simprofile</returns>
  53. RegionProfileData GetProfileByHandle(ulong regionHandle);
  54. /// <summary>
  55. /// Returns a sim profile from a UUID
  56. /// </summary>
  57. /// <param name="UUID">A 128bit UUID</param>
  58. /// <returns>A sim profile</returns>
  59. RegionProfileData GetProfileByUUID(UUID UUID);
  60. /// <summary>
  61. /// Returns a sim profile from a string match
  62. /// </summary>
  63. /// <param name="regionName">A string for a partial region name match</param>
  64. /// <returns>A sim profile</returns>
  65. RegionProfileData GetProfileByString(string regionName);
  66. /// <summary>
  67. /// Returns all profiles within the specified range
  68. /// </summary>
  69. /// <param name="Xmin">Minimum sim coordinate (X)</param>
  70. /// <param name="Ymin">Minimum sim coordinate (Y)</param>
  71. /// <param name="Xmax">Maximum sim coordinate (X)</param>
  72. /// <param name="Ymin">Maximum sim coordinate (Y)</param>
  73. /// <returns>An array containing all the sim profiles in the specified range</returns>
  74. RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
  75. /// <summary>
  76. /// Returns up to maxNum profiles of regions that have a name starting with namePrefix
  77. /// </summary>
  78. /// <param name="name">The name to match against</param>
  79. /// <param name="maxNum">Maximum number of profiles to return</param>
  80. /// <returns>A list of sim profiles</returns>
  81. List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
  82. /// <summary>
  83. /// Authenticates a sim by use of its recv key.
  84. /// WARNING: Insecure
  85. /// </summary>
  86. /// <param name="UUID">The UUID sent by the sim</param>
  87. /// <param name="regionHandle">The regionhandle sent by the sim</param>
  88. /// <param name="simrecvkey">The receiving key sent by the sim</param>
  89. /// <returns>Whether the sim has been authenticated</returns>
  90. bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
  91. /// <summary>
  92. /// Adds a new profile to the database
  93. /// </summary>
  94. /// <param name="profile">The profile to add</param>
  95. /// <returns>RESPONSE_OK if successful, error if not.</returns>
  96. DataResponse AddProfile(RegionProfileData profile);
  97. /// <summary>
  98. /// Updates a profile in the database
  99. /// </summary>
  100. /// <param name="profile"></param>
  101. /// <returns></returns>
  102. DataResponse UpdateProfile(RegionProfileData profile);
  103. /// <summary>
  104. /// Remove a profile from the database
  105. /// </summary>
  106. /// <param name="UUID">ID of profile to remove</param>
  107. /// <returns></returns>
  108. DataResponse DeleteProfile(string UUID);
  109. /// <summary>
  110. /// Function not used????
  111. /// </summary>
  112. /// <param name="x"></param>
  113. /// <param name="y"></param>
  114. /// <returns></returns>
  115. ReservationData GetReservationAtPoint(uint x, uint y);
  116. }
  117. public class GridDataInitialiser : PluginInitialiserBase
  118. {
  119. private string connect;
  120. public GridDataInitialiser (string s) { connect = s; }
  121. public override void Initialise (IPlugin plugin)
  122. {
  123. IGridDataPlugin p = plugin as IGridDataPlugin;
  124. p.Initialise (connect);
  125. }
  126. }
  127. }