CapabilitiesModule.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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 copyrightD
  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;
  29. using System.Collections.Generic;
  30. using System.Linq;
  31. using System.Reflection;
  32. using System.Text;
  33. using log4net;
  34. using Nini.Config;
  35. using Mono.Addins;
  36. using OpenMetaverse;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Console;
  39. using OpenSim.Framework.Servers;
  40. using OpenSim.Framework.Servers.HttpServer;
  41. using OpenSim.Region.Framework.Interfaces;
  42. using OpenSim.Region.Framework.Scenes;
  43. using Caps=OpenSim.Framework.Capabilities.Caps;
  44. namespace OpenSim.Region.CoreModules.Framework
  45. {
  46. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CapabilitiesModule")]
  47. public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule
  48. {
  49. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  50. private string m_showCapsCommandFormat = " {0,-38} {1,-60}\n";
  51. protected Scene m_scene;
  52. /// <summary>
  53. /// Each agent has its own capabilities handler.
  54. /// </summary>
  55. protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>();
  56. protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
  57. protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
  58. = new Dictionary<UUID, Dictionary<ulong, string>>();
  59. public void Initialise(IConfigSource source)
  60. {
  61. }
  62. public void AddRegion(Scene scene)
  63. {
  64. m_scene = scene;
  65. m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
  66. MainConsole.Instance.Commands.AddCommand(
  67. "Comms", false, "show caps list",
  68. "show caps list",
  69. "Shows list of registered capabilities for users.", HandleShowCapsListCommand);
  70. MainConsole.Instance.Commands.AddCommand(
  71. "Comms", false, "show caps stats by user",
  72. "show caps stats by user [<first-name> <last-name>]",
  73. "Shows statistics on capabilities use by user.",
  74. "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.",
  75. HandleShowCapsStatsByUserCommand);
  76. MainConsole.Instance.Commands.AddCommand(
  77. "Comms", false, "show caps stats by cap",
  78. "show caps stats by cap [<cap-name>]",
  79. "Shows statistics on capabilities use by capability.",
  80. "If a capability name is given, then prints a detailed breakdown of use by each user.",
  81. HandleShowCapsStatsByCapCommand);
  82. }
  83. public void RegionLoaded(Scene scene)
  84. {
  85. }
  86. public void RemoveRegion(Scene scene)
  87. {
  88. m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
  89. }
  90. public void PostInitialise()
  91. {
  92. }
  93. public void Close() {}
  94. public string Name
  95. {
  96. get { return "Capabilities Module"; }
  97. }
  98. public Type ReplaceableInterface
  99. {
  100. get { return null; }
  101. }
  102. public void CreateCaps(UUID agentId, uint circuitCode)
  103. {
  104. int ts = Util.EnvironmentTickCount();
  105. /* this as no business here...
  106. * must be done elsewhere ( and is )
  107. int flags = m_scene.GetUserFlags(agentId);
  108. m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts));
  109. if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
  110. return;
  111. */
  112. Caps caps;
  113. String capsObjectPath = GetCapsPath(agentId);
  114. lock (m_capsObjects)
  115. {
  116. if (m_capsObjects.ContainsKey(circuitCode))
  117. {
  118. Caps oldCaps = m_capsObjects[circuitCode];
  119. if (capsObjectPath == oldCaps.CapsObjectPath)
  120. {
  121. // m_log.WarnFormat(
  122. // "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
  123. // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
  124. return;
  125. }
  126. else
  127. {
  128. // not reusing add extra melanie cleanup
  129. // Remove tge handlers. They may conflict with the
  130. // new object created below
  131. oldCaps.DeregisterHandlers();
  132. // Better safe ... should not be needed but also
  133. // no big deal
  134. m_capsObjects.Remove(circuitCode);
  135. }
  136. }
  137. // m_log.DebugFormat(
  138. // "[CAPS]: Adding capabilities for agent {0} in {1} with path {2}",
  139. // agentId, m_scene.RegionInfo.RegionName, capsObjectPath);
  140. caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
  141. (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
  142. capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
  143. m_log.DebugFormat("[CreateCaps]: new caps agent {0}, circuit {1}, path {2}, time {3} ",agentId,
  144. circuitCode,caps.CapsObjectPath, Util.EnvironmentTickCountSubtract(ts));
  145. m_capsObjects[circuitCode] = caps;
  146. }
  147. m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
  148. // m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts));
  149. }
  150. public void RemoveCaps(UUID agentId, uint circuitCode)
  151. {
  152. m_log.DebugFormat("[CAPS]: Remove caps for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName);
  153. lock (m_childrenSeeds)
  154. {
  155. if (m_childrenSeeds.ContainsKey(agentId))
  156. {
  157. m_childrenSeeds.Remove(agentId);
  158. }
  159. }
  160. lock (m_capsObjects)
  161. {
  162. if (m_capsObjects.ContainsKey(circuitCode))
  163. {
  164. m_capsObjects[circuitCode].DeregisterHandlers();
  165. m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[circuitCode]);
  166. m_capsObjects.Remove(circuitCode);
  167. }
  168. else
  169. {
  170. foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
  171. {
  172. if (kvp.Value.AgentID == agentId)
  173. {
  174. kvp.Value.DeregisterHandlers();
  175. m_scene.EventManager.TriggerOnDeregisterCaps(agentId, kvp.Value);
  176. m_capsObjects.Remove(kvp.Key);
  177. return;
  178. }
  179. }
  180. m_log.WarnFormat(
  181. "[CAPS]: Received request to remove CAPS handler for root agent {0} in {1}, but no such CAPS handler found!",
  182. agentId, m_scene.RegionInfo.RegionName);
  183. }
  184. }
  185. }
  186. public Caps GetCapsForUser(uint circuitCode)
  187. {
  188. lock (m_capsObjects)
  189. {
  190. if (m_capsObjects.ContainsKey(circuitCode))
  191. {
  192. return m_capsObjects[circuitCode];
  193. }
  194. }
  195. return null;
  196. }
  197. public void ActivateCaps(uint circuitCode)
  198. {
  199. lock (m_capsObjects)
  200. {
  201. if (m_capsObjects.ContainsKey(circuitCode))
  202. {
  203. m_capsObjects[circuitCode].Activate();
  204. }
  205. }
  206. }
  207. public void SetAgentCapsSeeds(AgentCircuitData agent)
  208. {
  209. lock (m_capsPaths)
  210. m_capsPaths[agent.AgentID] = agent.CapsPath;
  211. lock (m_childrenSeeds)
  212. m_childrenSeeds[agent.AgentID]
  213. = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
  214. }
  215. public string GetCapsPath(UUID agentId)
  216. {
  217. lock (m_capsPaths)
  218. {
  219. if (m_capsPaths.ContainsKey(agentId))
  220. {
  221. return m_capsPaths[agentId];
  222. }
  223. }
  224. return null;
  225. }
  226. public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
  227. {
  228. Dictionary<ulong, string> seeds = null;
  229. lock (m_childrenSeeds)
  230. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  231. return seeds;
  232. return new Dictionary<ulong, string>();
  233. }
  234. public void DropChildSeed(UUID agentID, ulong handle)
  235. {
  236. Dictionary<ulong, string> seeds;
  237. lock (m_childrenSeeds)
  238. {
  239. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  240. {
  241. seeds.Remove(handle);
  242. }
  243. }
  244. }
  245. public string GetChildSeed(UUID agentID, ulong handle)
  246. {
  247. Dictionary<ulong, string> seeds;
  248. string returnval;
  249. lock (m_childrenSeeds)
  250. {
  251. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  252. {
  253. if (seeds.TryGetValue(handle, out returnval))
  254. return returnval;
  255. }
  256. }
  257. return null;
  258. }
  259. public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
  260. {
  261. //m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
  262. lock (m_childrenSeeds)
  263. m_childrenSeeds[agentID] = seeds;
  264. }
  265. public void DumpChildrenSeeds(UUID agentID)
  266. {
  267. m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
  268. lock (m_childrenSeeds)
  269. {
  270. foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
  271. {
  272. uint x, y;
  273. Util.RegionHandleToRegionLoc(kvp.Key, out x, out y);
  274. m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
  275. }
  276. }
  277. }
  278. private void HandleShowCapsListCommand(string module, string[] cmdParams)
  279. {
  280. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  281. return;
  282. StringBuilder capsReport = new StringBuilder();
  283. capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
  284. lock (m_capsObjects)
  285. {
  286. foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
  287. {
  288. capsReport.AppendFormat("** Circuit {0}:\n", kvp.Key);
  289. Caps caps = kvp.Value;
  290. for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
  291. {
  292. Uri uri = new Uri(kvp2.Value.ToString());
  293. capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
  294. }
  295. foreach (KeyValuePair<string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers())
  296. capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url);
  297. foreach (KeyValuePair<string, string> kvp3 in caps.ExternalCapsHandlers)
  298. capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
  299. }
  300. }
  301. MainConsole.Instance.Output(capsReport.ToString());
  302. }
  303. private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams)
  304. {
  305. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  306. return;
  307. if (cmdParams.Length != 5 && cmdParams.Length != 6)
  308. {
  309. MainConsole.Instance.Output("Usage: show caps stats by cap [<cap-name>]");
  310. return;
  311. }
  312. StringBuilder sb = new StringBuilder();
  313. sb.AppendFormat("Region {0}:\n", m_scene.Name);
  314. if (cmdParams.Length == 5)
  315. {
  316. BuildSummaryStatsByCapReport(sb);
  317. }
  318. else if (cmdParams.Length == 6)
  319. {
  320. BuildDetailedStatsByCapReport(sb, cmdParams[5]);
  321. }
  322. MainConsole.Instance.Output(sb.ToString());
  323. }
  324. private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
  325. {
  326. /*
  327. sb.AppendFormat("Capability name {0}\n", capName);
  328. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  329. cdt.AddColumn("User Name", 34);
  330. cdt.AddColumn("Req Received", 12);
  331. cdt.AddColumn("Req Handled", 12);
  332. cdt.Indent = 2;
  333. Dictionary<string, int> receivedStats = new Dictionary<string, int>();
  334. Dictionary<string, int> handledStats = new Dictionary<string, int>();
  335. m_scene.ForEachScenePresence(
  336. sp =>
  337. {
  338. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  339. if (caps == null)
  340. return;
  341. Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
  342. IRequestHandler reqHandler;
  343. if (capsHandlers.TryGetValue(capName, out reqHandler))
  344. {
  345. receivedStats[sp.Name] = reqHandler.RequestsReceived;
  346. handledStats[sp.Name] = reqHandler.RequestsHandled;
  347. }
  348. else
  349. {
  350. PollServiceEventArgs pollHandler = null;
  351. if (caps.TryGetPollHandler(capName, out pollHandler))
  352. {
  353. receivedStats[sp.Name] = pollHandler.RequestsReceived;
  354. handledStats[sp.Name] = pollHandler.RequestsHandled;
  355. }
  356. }
  357. }
  358. );
  359. foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
  360. {
  361. cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
  362. }
  363. sb.Append(cdt.ToString());
  364. */
  365. }
  366. private void BuildSummaryStatsByCapReport(StringBuilder sb)
  367. {
  368. /*
  369. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  370. cdt.AddColumn("Name", 34);
  371. cdt.AddColumn("Req Received", 12);
  372. cdt.AddColumn("Req Handled", 12);
  373. cdt.Indent = 2;
  374. Dictionary<string, int> receivedStats = new Dictionary<string, int>();
  375. Dictionary<string, int> handledStats = new Dictionary<string, int>();
  376. m_scene.ForEachScenePresence(
  377. sp =>
  378. {
  379. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  380. if (caps == null)
  381. return;
  382. foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
  383. {
  384. string reqName = reqHandler.Name ?? "";
  385. if (!receivedStats.ContainsKey(reqName))
  386. {
  387. receivedStats[reqName] = reqHandler.RequestsReceived;
  388. handledStats[reqName] = reqHandler.RequestsHandled;
  389. }
  390. else
  391. {
  392. receivedStats[reqName] += reqHandler.RequestsReceived;
  393. handledStats[reqName] += reqHandler.RequestsHandled;
  394. }
  395. }
  396. foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
  397. {
  398. string name = kvp.Key;
  399. PollServiceEventArgs pollHandler = kvp.Value;
  400. if (!receivedStats.ContainsKey(name))
  401. {
  402. receivedStats[name] = pollHandler.RequestsReceived;
  403. handledStats[name] = pollHandler.RequestsHandled;
  404. }
  405. else
  406. {
  407. receivedStats[name] += pollHandler.RequestsReceived;
  408. handledStats[name] += pollHandler.RequestsHandled;
  409. }
  410. }
  411. }
  412. );
  413. foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
  414. cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
  415. sb.Append(cdt.ToString());
  416. */
  417. }
  418. private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
  419. {
  420. /*
  421. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  422. return;
  423. if (cmdParams.Length != 5 && cmdParams.Length != 7)
  424. {
  425. MainConsole.Instance.Output("Usage: show caps stats by user [<first-name> <last-name>]");
  426. return;
  427. }
  428. StringBuilder sb = new StringBuilder();
  429. sb.AppendFormat("Region {0}:\n", m_scene.Name);
  430. if (cmdParams.Length == 5)
  431. {
  432. BuildSummaryStatsByUserReport(sb);
  433. }
  434. else if (cmdParams.Length == 7)
  435. {
  436. string firstName = cmdParams[5];
  437. string lastName = cmdParams[6];
  438. ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
  439. if (sp == null)
  440. return;
  441. BuildDetailedStatsByUserReport(sb, sp);
  442. }
  443. MainConsole.Instance.Output(sb.ToString());
  444. */
  445. }
  446. private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
  447. {
  448. /*
  449. sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
  450. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  451. cdt.AddColumn("Cap Name", 34);
  452. cdt.AddColumn("Req Received", 12);
  453. cdt.AddColumn("Req Handled", 12);
  454. cdt.Indent = 2;
  455. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  456. if (caps == null)
  457. return;
  458. List<CapTableRow> capRows = new List<CapTableRow>();
  459. foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
  460. capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled));
  461. foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
  462. capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled));
  463. foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived))
  464. cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled);
  465. sb.Append(cdt.ToString());
  466. */
  467. }
  468. private void BuildSummaryStatsByUserReport(StringBuilder sb)
  469. {
  470. /*
  471. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  472. cdt.AddColumn("Name", 32);
  473. cdt.AddColumn("Type", 5);
  474. cdt.AddColumn("Req Received", 12);
  475. cdt.AddColumn("Req Handled", 12);
  476. cdt.Indent = 2;
  477. m_scene.ForEachScenePresence(
  478. sp =>
  479. {
  480. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  481. if (caps == null)
  482. return;
  483. Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
  484. int totalRequestsReceived = 0;
  485. int totalRequestsHandled = 0;
  486. foreach (IRequestHandler reqHandler in capsHandlers.Values)
  487. {
  488. totalRequestsReceived += reqHandler.RequestsReceived;
  489. totalRequestsHandled += reqHandler.RequestsHandled;
  490. }
  491. Dictionary<string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers();
  492. foreach (PollServiceEventArgs handler in capsPollHandlers.Values)
  493. {
  494. totalRequestsReceived += handler.RequestsReceived;
  495. totalRequestsHandled += handler.RequestsHandled;
  496. }
  497. cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
  498. }
  499. );
  500. sb.Append(cdt.ToString());
  501. */
  502. }
  503. private class CapTableRow
  504. {
  505. public string Name { get; set; }
  506. public int RequestsReceived { get; set; }
  507. public int RequestsHandled { get; set; }
  508. public CapTableRow(string name, int requestsReceived, int requestsHandled)
  509. {
  510. Name = name;
  511. RequestsReceived = requestsReceived;
  512. RequestsHandled = requestsHandled;
  513. }
  514. }
  515. }
  516. }