1
0

TestClient.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  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;
  28. using System.Collections.Generic;
  29. using System.Net;
  30. using System.Reflection;
  31. using System.Threading;
  32. using log4net;
  33. using OpenMetaverse;
  34. using OpenMetaverse.Packets;
  35. using OpenSim.Framework;
  36. using OpenSim.Region.Framework.Interfaces;
  37. using OpenSim.Region.Framework.Scenes;
  38. using OpenSim.Framework.Client;
  39. namespace OpenSim.Tests.Common.Mock
  40. {
  41. public class TestClient : IClientAPI, IClientCore
  42. {
  43. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  44. // Mock testing variables
  45. public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
  46. public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
  47. EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
  48. // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
  49. // methods on when a teleport is requested
  50. public Scene TeleportTargetScene;
  51. private TestClient TeleportSceneClient;
  52. private IScene m_scene;
  53. // disable warning: public events, part of the public API
  54. #pragma warning disable 67
  55. public event Action<IClientAPI> OnLogout;
  56. public event ObjectPermissions OnObjectPermissions;
  57. public event MoneyTransferRequest OnMoneyTransferRequest;
  58. public event ParcelBuy OnParcelBuy;
  59. public event Action<IClientAPI> OnConnectionClosed;
  60. public event ImprovedInstantMessage OnInstantMessage;
  61. public event ChatMessage OnChatFromClient;
  62. public event TextureRequest OnRequestTexture;
  63. public event RezObject OnRezObject;
  64. public event ModifyTerrain OnModifyTerrain;
  65. public event BakeTerrain OnBakeTerrain;
  66. public event SetAppearance OnSetAppearance;
  67. public event AvatarNowWearing OnAvatarNowWearing;
  68. public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
  69. public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
  70. public event UUIDNameRequest OnDetachAttachmentIntoInv;
  71. public event ObjectAttach OnObjectAttach;
  72. public event ObjectDeselect OnObjectDetach;
  73. public event ObjectDrop OnObjectDrop;
  74. public event StartAnim OnStartAnim;
  75. public event StopAnim OnStopAnim;
  76. public event LinkObjects OnLinkObjects;
  77. public event DelinkObjects OnDelinkObjects;
  78. public event RequestMapBlocks OnRequestMapBlocks;
  79. public event RequestMapName OnMapNameRequest;
  80. public event TeleportLocationRequest OnTeleportLocationRequest;
  81. public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
  82. public event DisconnectUser OnDisconnectUser;
  83. public event RequestAvatarProperties OnRequestAvatarProperties;
  84. public event SetAlwaysRun OnSetAlwaysRun;
  85. public event DeRezObject OnDeRezObject;
  86. public event Action<IClientAPI> OnRegionHandShakeReply;
  87. public event GenericCall2 OnRequestWearables;
  88. public event GenericCall2 OnCompleteMovementToRegion;
  89. public event UpdateAgent OnAgentUpdate;
  90. public event AgentRequestSit OnAgentRequestSit;
  91. public event AgentSit OnAgentSit;
  92. public event AvatarPickerRequest OnAvatarPickerRequest;
  93. public event Action<IClientAPI> OnRequestAvatarsData;
  94. public event AddNewPrim OnAddPrim;
  95. public event RequestGodlikePowers OnRequestGodlikePowers;
  96. public event GodKickUser OnGodKickUser;
  97. public event ObjectDuplicate OnObjectDuplicate;
  98. public event GrabObject OnGrabObject;
  99. public event DeGrabObject OnDeGrabObject;
  100. public event MoveObject OnGrabUpdate;
  101. public event SpinStart OnSpinStart;
  102. public event SpinObject OnSpinUpdate;
  103. public event SpinStop OnSpinStop;
  104. public event ViewerEffectEventHandler OnViewerEffect;
  105. public event FetchInventory OnAgentDataUpdateRequest;
  106. public event TeleportLocationRequest OnSetStartLocationRequest;
  107. public event UpdateShape OnUpdatePrimShape;
  108. public event ObjectExtraParams OnUpdateExtraParams;
  109. public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
  110. public event ObjectSelect OnObjectSelect;
  111. public event ObjectRequest OnObjectRequest;
  112. public event GenericCall7 OnObjectDescription;
  113. public event GenericCall7 OnObjectName;
  114. public event GenericCall7 OnObjectClickAction;
  115. public event GenericCall7 OnObjectMaterial;
  116. public event UpdatePrimFlags OnUpdatePrimFlags;
  117. public event UpdatePrimTexture OnUpdatePrimTexture;
  118. public event UpdateVector OnUpdatePrimGroupPosition;
  119. public event UpdateVector OnUpdatePrimSinglePosition;
  120. public event UpdatePrimRotation OnUpdatePrimGroupRotation;
  121. public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
  122. public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
  123. public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
  124. public event UpdateVector OnUpdatePrimScale;
  125. public event UpdateVector OnUpdatePrimGroupScale;
  126. public event StatusChange OnChildAgentStatus;
  127. public event GenericCall2 OnStopMovement;
  128. public event Action<UUID> OnRemoveAvatar;
  129. public event CreateNewInventoryItem OnCreateNewInventoryItem;
  130. public event CreateInventoryFolder OnCreateNewInventoryFolder;
  131. public event UpdateInventoryFolder OnUpdateInventoryFolder;
  132. public event MoveInventoryFolder OnMoveInventoryFolder;
  133. public event RemoveInventoryFolder OnRemoveInventoryFolder;
  134. public event RemoveInventoryItem OnRemoveInventoryItem;
  135. public event FetchInventoryDescendents OnFetchInventoryDescendents;
  136. public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
  137. public event FetchInventory OnFetchInventory;
  138. public event RequestTaskInventory OnRequestTaskInventory;
  139. public event UpdateInventoryItem OnUpdateInventoryItem;
  140. public event CopyInventoryItem OnCopyInventoryItem;
  141. public event MoveInventoryItem OnMoveInventoryItem;
  142. public event UDPAssetUploadRequest OnAssetUploadRequest;
  143. public event RequestTerrain OnRequestTerrain;
  144. public event RequestTerrain OnUploadTerrain;
  145. public event XferReceive OnXferReceive;
  146. public event RequestXfer OnRequestXfer;
  147. public event ConfirmXfer OnConfirmXfer;
  148. public event AbortXfer OnAbortXfer;
  149. public event RezScript OnRezScript;
  150. public event UpdateTaskInventory OnUpdateTaskInventory;
  151. public event MoveTaskInventory OnMoveTaskItem;
  152. public event RemoveTaskInventory OnRemoveTaskItem;
  153. public event RequestAsset OnRequestAsset;
  154. public event GenericMessage OnGenericMessage;
  155. public event UUIDNameRequest OnNameFromUUIDRequest;
  156. public event UUIDNameRequest OnUUIDGroupNameRequest;
  157. public event ParcelPropertiesRequest OnParcelPropertiesRequest;
  158. public event ParcelDivideRequest OnParcelDivideRequest;
  159. public event ParcelJoinRequest OnParcelJoinRequest;
  160. public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
  161. public event ParcelAbandonRequest OnParcelAbandonRequest;
  162. public event ParcelGodForceOwner OnParcelGodForceOwner;
  163. public event ParcelReclaim OnParcelReclaim;
  164. public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
  165. public event ParcelAccessListRequest OnParcelAccessListRequest;
  166. public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
  167. public event ParcelSelectObjects OnParcelSelectObjects;
  168. public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
  169. public event ParcelDeedToGroup OnParcelDeedToGroup;
  170. public event ObjectDeselect OnObjectDeselect;
  171. public event RegionInfoRequest OnRegionInfoRequest;
  172. public event EstateCovenantRequest OnEstateCovenantRequest;
  173. public event EstateChangeInfo OnEstateChangeInfo;
  174. public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
  175. public event FriendActionDelegate OnApproveFriendRequest;
  176. public event FriendActionDelegate OnDenyFriendRequest;
  177. public event FriendshipTermination OnTerminateFriendship;
  178. public event EconomyDataRequest OnEconomyDataRequest;
  179. public event MoneyBalanceRequest OnMoneyBalanceRequest;
  180. public event UpdateAvatarProperties OnUpdateAvatarProperties;
  181. public event ObjectIncludeInSearch OnObjectIncludeInSearch;
  182. public event UUIDNameRequest OnTeleportHomeRequest;
  183. public event ScriptAnswer OnScriptAnswer;
  184. public event RequestPayPrice OnRequestPayPrice;
  185. public event ObjectSaleInfo OnObjectSaleInfo;
  186. public event ObjectBuy OnObjectBuy;
  187. public event BuyObjectInventory OnBuyObjectInventory;
  188. public event AgentSit OnUndo;
  189. public event ForceReleaseControls OnForceReleaseControls;
  190. public event GodLandStatRequest OnLandStatRequest;
  191. public event RequestObjectPropertiesFamily OnObjectGroupRequest;
  192. public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
  193. public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
  194. public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
  195. public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
  196. public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
  197. public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
  198. public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
  199. public event EstateRestartSimRequest OnEstateRestartSimRequest;
  200. public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
  201. public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
  202. public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
  203. public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
  204. public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
  205. public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
  206. public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
  207. public event ScriptReset OnScriptReset;
  208. public event GetScriptRunning OnGetScriptRunning;
  209. public event SetScriptRunning OnSetScriptRunning;
  210. public event UpdateVector OnAutoPilotGo;
  211. public event TerrainUnacked OnUnackedTerrain;
  212. public event RegionHandleRequest OnRegionHandleRequest;
  213. public event ParcelInfoRequest OnParcelInfoRequest;
  214. public event ActivateGesture OnActivateGesture;
  215. public event DeactivateGesture OnDeactivateGesture;
  216. public event ObjectOwner OnObjectOwner;
  217. public event DirPlacesQuery OnDirPlacesQuery;
  218. public event DirFindQuery OnDirFindQuery;
  219. public event DirLandQuery OnDirLandQuery;
  220. public event DirPopularQuery OnDirPopularQuery;
  221. public event DirClassifiedQuery OnDirClassifiedQuery;
  222. public event EventInfoRequest OnEventInfoRequest;
  223. public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
  224. public event MapItemRequest OnMapItemRequest;
  225. public event OfferCallingCard OnOfferCallingCard;
  226. public event AcceptCallingCard OnAcceptCallingCard;
  227. public event DeclineCallingCard OnDeclineCallingCard;
  228. public event SoundTrigger OnSoundTrigger;
  229. public event StartLure OnStartLure;
  230. public event TeleportLureRequest OnTeleportLureRequest;
  231. public event NetworkStats OnNetworkStatsUpdate;
  232. public event ClassifiedInfoRequest OnClassifiedInfoRequest;
  233. public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
  234. public event ClassifiedDelete OnClassifiedDelete;
  235. public event ClassifiedDelete OnClassifiedGodDelete;
  236. public event EventNotificationAddRequest OnEventNotificationAddRequest;
  237. public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
  238. public event EventGodDelete OnEventGodDelete;
  239. public event ParcelDwellRequest OnParcelDwellRequest;
  240. public event UserInfoRequest OnUserInfoRequest;
  241. public event UpdateUserInfo OnUpdateUserInfo;
  242. public event RetrieveInstantMessages OnRetrieveInstantMessages;
  243. public event PickDelete OnPickDelete;
  244. public event PickGodDelete OnPickGodDelete;
  245. public event PickInfoUpdate OnPickInfoUpdate;
  246. public event AvatarNotesUpdate OnAvatarNotesUpdate;
  247. public event MuteListRequest OnMuteListRequest;
  248. public event AvatarInterestUpdate OnAvatarInterestUpdate;
  249. public event PlacesQuery OnPlacesQuery;
  250. #pragma warning restore 67
  251. /// <value>
  252. /// This agent's UUID
  253. /// </value>
  254. private UUID m_agentId;
  255. /// <value>
  256. /// The last caps seed url that this client was given.
  257. /// </value>
  258. public string CapsSeedUrl;
  259. private Vector3 startPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 2);
  260. public virtual Vector3 StartPos
  261. {
  262. get { return startPos; }
  263. set { }
  264. }
  265. public virtual UUID AgentId
  266. {
  267. get { return m_agentId; }
  268. }
  269. public UUID SessionId
  270. {
  271. get { return UUID.Zero; }
  272. }
  273. public UUID SecureSessionId
  274. {
  275. get { return UUID.Zero; }
  276. }
  277. public virtual string FirstName
  278. {
  279. get { return m_firstName; }
  280. }
  281. private string m_firstName;
  282. public virtual string LastName
  283. {
  284. get { return m_lastName; }
  285. }
  286. private string m_lastName;
  287. public virtual String Name
  288. {
  289. get { return FirstName + " " + LastName; }
  290. }
  291. public bool IsActive
  292. {
  293. get { return true; }
  294. set { }
  295. }
  296. public UUID ActiveGroupId
  297. {
  298. get { return UUID.Zero; }
  299. }
  300. public string ActiveGroupName
  301. {
  302. get { return String.Empty; }
  303. }
  304. public ulong ActiveGroupPowers
  305. {
  306. get { return 0; }
  307. }
  308. public bool IsGroupMember(UUID groupID)
  309. {
  310. return false;
  311. }
  312. public ulong GetGroupPowers(UUID groupID)
  313. {
  314. return 0;
  315. }
  316. public virtual int NextAnimationSequenceNumber
  317. {
  318. get { return 1; }
  319. }
  320. public IScene Scene
  321. {
  322. get { return m_scene; }
  323. }
  324. public bool SendLogoutPacketWhenClosing
  325. {
  326. set { }
  327. }
  328. private uint m_circuitCode;
  329. public uint CircuitCode
  330. {
  331. get { return m_circuitCode; }
  332. set { m_circuitCode = value; }
  333. }
  334. /// <summary>
  335. /// Constructor
  336. /// </summary>
  337. /// <param name="agentData"></param>
  338. /// <param name="scene"></param>
  339. public TestClient(AgentCircuitData agentData, IScene scene)
  340. {
  341. m_agentId = agentData.AgentID;
  342. m_firstName = agentData.firstname;
  343. m_lastName = agentData.lastname;
  344. m_circuitCode = agentData.circuitcode;
  345. m_scene = scene;
  346. CapsSeedUrl = agentData.CapsPath;
  347. }
  348. /// <summary>
  349. /// Attempt a teleport to the given region.
  350. /// </summary>
  351. /// <param name="regionHandle"></param>
  352. /// <param name="position"></param>
  353. /// <param name="lookAt"></param>
  354. public void Teleport(ulong regionHandle, Vector3 position, Vector3 lookAt)
  355. {
  356. OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16);
  357. }
  358. public void CompleteMovement()
  359. {
  360. OnCompleteMovementToRegion();
  361. }
  362. public virtual void ActivateGesture(UUID assetId, UUID gestureId)
  363. {
  364. }
  365. public virtual void SendWearables(AvatarWearable[] wearables, int serial)
  366. {
  367. }
  368. public virtual void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
  369. {
  370. }
  371. public virtual void Kick(string message)
  372. {
  373. }
  374. public virtual void SendStartPingCheck(byte seq)
  375. {
  376. }
  377. public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
  378. {
  379. }
  380. public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
  381. {
  382. }
  383. public virtual void SendKillObject(ulong regionHandle, uint localID)
  384. {
  385. }
  386. public virtual void SetChildAgentThrottle(byte[] throttle)
  387. {
  388. }
  389. public byte[] GetThrottlesPacked(float multiplier)
  390. {
  391. return new byte[0];
  392. }
  393. public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
  394. {
  395. }
  396. public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName,
  397. UUID fromAgentID, byte source, byte audible)
  398. {
  399. }
  400. public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName,
  401. UUID fromAgentID, byte source, byte audible)
  402. {
  403. }
  404. public void SendInstantMessage(GridInstantMessage im)
  405. {
  406. }
  407. public void SendGenericMessage(string method, List<string> message)
  408. {
  409. }
  410. public virtual void SendLayerData(float[] map)
  411. {
  412. }
  413. public virtual void SendLayerData(int px, int py, float[] map)
  414. {
  415. }
  416. public virtual void SendLayerData(int px, int py, float[] map, bool track)
  417. {
  418. }
  419. public virtual void SendWindData(Vector2[] windSpeeds) { }
  420. public virtual void SendCloudData(float[] cloudCover) { }
  421. public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
  422. {
  423. }
  424. public virtual AgentCircuitData RequestClientInfo()
  425. {
  426. AgentCircuitData agentData = new AgentCircuitData();
  427. agentData.AgentID = AgentId;
  428. agentData.SessionID = UUID.Zero;
  429. agentData.SecureSessionID = UUID.Zero;
  430. agentData.circuitcode = m_circuitCode;
  431. agentData.child = false;
  432. agentData.firstname = m_firstName;
  433. agentData.lastname = m_lastName;
  434. ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
  435. agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
  436. agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
  437. return agentData;
  438. }
  439. public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
  440. {
  441. m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour");
  442. // In response to this message, we are going to make a teleport to the scene we've previous been told
  443. // about by test code (this needs to be improved).
  444. AgentCircuitData newAgent = RequestClientInfo();
  445. // Stage 2: add the new client as a child agent to the scene
  446. TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
  447. TeleportTargetScene.AddNewClient(TeleportSceneClient);
  448. }
  449. public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
  450. uint locationID, uint flags, string capsURL)
  451. {
  452. m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
  453. CapsSeedUrl = capsURL;
  454. TeleportSceneClient.CompleteMovement();
  455. //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
  456. }
  457. public virtual void SendTeleportFailed(string reason)
  458. {
  459. m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);
  460. }
  461. public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
  462. IPEndPoint newRegionExternalEndPoint, string capsURL)
  463. {
  464. // This is supposed to send a packet to the client telling it's ready to start region crossing.
  465. // Instead I will just signal I'm ready, mimicking the communication behavior.
  466. // It's ugly, but avoids needless communication setup. This is used in ScenePresenceTests.cs.
  467. // Arthur V.
  468. wh.Set();
  469. }
  470. public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
  471. {
  472. }
  473. public virtual void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
  474. {
  475. }
  476. public virtual void SendTeleportLocationStart()
  477. {
  478. }
  479. public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
  480. {
  481. }
  482. public virtual void SendPayPrice(UUID objectID, int[] payPrice)
  483. {
  484. }
  485. public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
  486. uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
  487. {
  488. }
  489. public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
  490. Vector3 position, Vector3 velocity, Quaternion rotation, UUID agentid)
  491. {
  492. }
  493. public virtual void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
  494. {
  495. }
  496. public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
  497. {
  498. }
  499. public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
  500. {
  501. }
  502. public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
  503. PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
  504. Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
  505. UUID objectID, UUID ownerID, string text, byte[] color,
  506. uint parentID,
  507. byte[] particleSystem, byte clickAction, byte material)
  508. {
  509. }
  510. public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
  511. PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
  512. Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
  513. UUID objectID, UUID ownerID, string text, byte[] color,
  514. uint parentID,
  515. byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
  516. bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
  517. {
  518. }
  519. public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
  520. Vector3 position, Quaternion rotation, Vector3 velocity,
  521. Vector3 rotationalvelocity, byte state, UUID AssetId,
  522. UUID ownerID, int attachPoint)
  523. {
  524. }
  525. public void FlushPrimUpdates()
  526. {
  527. }
  528. public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
  529. List<InventoryItemBase> items,
  530. List<InventoryFolderBase> folders,
  531. bool fetchFolders,
  532. bool fetchItems)
  533. {
  534. }
  535. public virtual void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
  536. {
  537. }
  538. public virtual void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackID)
  539. {
  540. }
  541. public virtual void SendRemoveInventoryItem(UUID itemID)
  542. {
  543. }
  544. public virtual void SendBulkUpdateInventory(InventoryNodeBase node)
  545. {
  546. }
  547. public UUID GetDefaultAnimation(string name)
  548. {
  549. return UUID.Zero;
  550. }
  551. public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
  552. {
  553. }
  554. public virtual void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
  555. {
  556. }
  557. public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
  558. {
  559. }
  560. public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
  561. int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
  562. int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
  563. int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
  564. {
  565. }
  566. public virtual void SendNameReply(UUID profileId, string firstname, string lastname)
  567. {
  568. }
  569. public virtual void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
  570. {
  571. }
  572. public virtual void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain,
  573. byte flags)
  574. {
  575. }
  576. public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
  577. {
  578. }
  579. public void SendAttachedSoundGainChange(UUID objectID, float gain)
  580. {
  581. }
  582. public void SendAlertMessage(string message)
  583. {
  584. }
  585. public void SendAgentAlertMessage(string message, bool modal)
  586. {
  587. }
  588. public void SendSystemAlertMessage(string message)
  589. {
  590. }
  591. public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message,
  592. string url)
  593. {
  594. }
  595. public virtual void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
  596. {
  597. if (OnRegionHandShakeReply != null)
  598. {
  599. OnRegionHandShakeReply(this);
  600. }
  601. if (OnCompleteMovementToRegion != null)
  602. {
  603. OnCompleteMovementToRegion();
  604. }
  605. }
  606. public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
  607. {
  608. }
  609. public void SendConfirmXfer(ulong xferID, uint PacketID)
  610. {
  611. }
  612. public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
  613. {
  614. }
  615. public void SendInitiateDownload(string simFileName, string clientFileName)
  616. {
  617. }
  618. public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
  619. {
  620. ImageDataPacket im = new ImageDataPacket();
  621. im.Header.Reliable = false;
  622. im.ImageID.Packets = numParts;
  623. im.ImageID.ID = ImageUUID;
  624. if (ImageSize > 0)
  625. im.ImageID.Size = ImageSize;
  626. im.ImageData.Data = ImageData;
  627. im.ImageID.Codec = imageCodec;
  628. im.Header.Zerocoded = true;
  629. sentdatapkt.Add(im);
  630. }
  631. public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
  632. {
  633. ImagePacketPacket im = new ImagePacketPacket();
  634. im.Header.Reliable = false;
  635. im.ImageID.Packet = partNumber;
  636. im.ImageID.ID = imageUuid;
  637. im.ImageData.Data = imageData;
  638. sentpktpkt.Add(im);
  639. }
  640. public void SendImageNotFound(UUID imageid)
  641. {
  642. }
  643. public void SendShutdownConnectionNotice()
  644. {
  645. }
  646. public void SendSimStats(SimStats stats)
  647. {
  648. }
  649. public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
  650. uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
  651. uint NextOwnerMask, int OwnershipCost, byte SaleType,int SalePrice, uint Category,
  652. UUID LastOwnerID, string ObjectName, string Description)
  653. {
  654. }
  655. public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
  656. UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
  657. UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
  658. string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
  659. uint BaseMask, byte saleType, int salePrice)
  660. {
  661. }
  662. public void SendAgentOffline(UUID[] agentIDs)
  663. {
  664. }
  665. public void SendAgentOnline(UUID[] agentIDs)
  666. {
  667. }
  668. public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
  669. Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
  670. {
  671. }
  672. public void SendAdminResponse(UUID Token, uint AdminLevel)
  673. {
  674. }
  675. public void SendGroupMembership(GroupMembershipData[] GroupMembership)
  676. {
  677. }
  678. public bool AddMoney(int debit)
  679. {
  680. return false;
  681. }
  682. public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong time, uint dlen, uint ylen, float phase)
  683. {
  684. }
  685. public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
  686. {
  687. }
  688. public void SendViewerTime(int phase)
  689. {
  690. }
  691. public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
  692. string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL,
  693. UUID partnerID)
  694. {
  695. }
  696. public void SetDebugPacketLevel(int newDebug)
  697. {
  698. }
  699. public void InPacket(object NewPack)
  700. {
  701. }
  702. public void ProcessInPacket(Packet NewPack)
  703. {
  704. }
  705. public void Close(bool ShutdownCircuit)
  706. {
  707. m_scene.RemoveClient(AgentId);
  708. }
  709. public void Start()
  710. {
  711. }
  712. public void Stop()
  713. {
  714. }
  715. public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
  716. {
  717. }
  718. public void SendLogoutPacket()
  719. {
  720. }
  721. public void Terminate()
  722. {
  723. }
  724. public EndPoint GetClientEP()
  725. {
  726. return null;
  727. }
  728. public ClientInfo GetClientInfo()
  729. {
  730. return null;
  731. }
  732. public void SetClientInfo(ClientInfo info)
  733. {
  734. }
  735. public void SendScriptQuestion(UUID objectID, string taskName, string ownerName, UUID itemID, int question)
  736. {
  737. }
  738. public void SendHealth(float health)
  739. {
  740. }
  741. public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID)
  742. {
  743. }
  744. public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
  745. {
  746. }
  747. public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
  748. {
  749. }
  750. public void SendEstateCovenantInformation(UUID covenant)
  751. {
  752. }
  753. public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
  754. {
  755. }
  756. public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
  757. {
  758. }
  759. public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
  760. {
  761. }
  762. public void SendForceClientSelectObjects(List<uint> objectIDs)
  763. {
  764. }
  765. public void SendCameraConstraint(Vector4 ConstraintPlane)
  766. {
  767. }
  768. public void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount)
  769. {
  770. }
  771. public void SendLandParcelOverlay(byte[] data, int sequence_id)
  772. {
  773. }
  774. public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
  775. {
  776. }
  777. public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, byte autoScale, string mediaType,
  778. string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop)
  779. {
  780. }
  781. public void SendGroupNameReply(UUID groupLLUID, string GroupName)
  782. {
  783. }
  784. public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
  785. {
  786. }
  787. public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
  788. {
  789. }
  790. public void SendAsset(AssetRequestToClient req)
  791. {
  792. }
  793. public void SendTexture(AssetBase TextureAsset)
  794. {
  795. }
  796. public void SendSetFollowCamProperties (UUID objectID, SortedDictionary<int, float> parameters)
  797. {
  798. }
  799. public void SendClearFollowCamProperties (UUID objectID)
  800. {
  801. }
  802. public void SendRegionHandle (UUID regoinID, ulong handle)
  803. {
  804. }
  805. public void SendParcelInfo (RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
  806. {
  807. }
  808. public void SetClientOption(string option, string value)
  809. {
  810. }
  811. public string GetClientOption(string option)
  812. {
  813. return string.Empty;
  814. }
  815. public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
  816. {
  817. }
  818. public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
  819. {
  820. }
  821. public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
  822. {
  823. }
  824. public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
  825. {
  826. }
  827. public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
  828. {
  829. }
  830. public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
  831. {
  832. }
  833. public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
  834. {
  835. }
  836. public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
  837. {
  838. }
  839. public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
  840. {
  841. }
  842. public void KillEndDone()
  843. {
  844. }
  845. public void SendEventInfoReply (EventData info)
  846. {
  847. }
  848. public void SendOfferCallingCard (UUID destID, UUID transactionID)
  849. {
  850. }
  851. public void SendAcceptCallingCard (UUID transactionID)
  852. {
  853. }
  854. public void SendDeclineCallingCard (UUID transactionID)
  855. {
  856. }
  857. public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
  858. {
  859. }
  860. public void SendJoinGroupReply(UUID groupID, bool success)
  861. {
  862. }
  863. public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool succss)
  864. {
  865. }
  866. public void SendLeaveGroupReply(UUID groupID, bool success)
  867. {
  868. }
  869. public void SendTerminateFriend(UUID exFriendID)
  870. {
  871. }
  872. public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
  873. {
  874. //throw new NotImplementedException();
  875. return false;
  876. }
  877. public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
  878. {
  879. }
  880. public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
  881. {
  882. }
  883. public void SendAgentDropGroup(UUID groupID)
  884. {
  885. }
  886. public void SendAvatarNotesReply(UUID targetID, string text)
  887. {
  888. }
  889. public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
  890. {
  891. }
  892. public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
  893. {
  894. }
  895. public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
  896. {
  897. }
  898. public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
  899. {
  900. }
  901. public void SendCreateGroupReply(UUID groupID, bool success, string message)
  902. {
  903. }
  904. public void RefreshGroupMembership()
  905. {
  906. }
  907. public void SendUseCachedMuteList()
  908. {
  909. }
  910. public void SendMuteListUpdate(string filename)
  911. {
  912. }
  913. public void SendPickInfoReply(UUID pickID,UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
  914. {
  915. }
  916. public bool TryGet<T>(out T iface)
  917. {
  918. iface = default(T);
  919. return false;
  920. }
  921. public T Get<T>()
  922. {
  923. return default(T);
  924. }
  925. public void Disconnect(string reason)
  926. {
  927. }
  928. public void Disconnect()
  929. {
  930. }
  931. }
  932. }