gnunet-service-testbed.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2008--2013 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file testbed/gnunet-service-testbed.h
  18. * @brief data structures shared amongst components of TESTBED service
  19. * @author Sree Harsha Totakura
  20. */
  21. #include "platform.h"
  22. #include "gnunet_util_lib.h"
  23. #include "gnunet_testbed_service.h"
  24. #include "gnunet_transport_service.h"
  25. #include "gnunet_core_service.h"
  26. #include "testbed.h"
  27. #include "testbed_api.h"
  28. #include "testbed_api_operations.h"
  29. #include "testbed_api_hosts.h"
  30. #include "gnunet_testing_lib.h"
  31. #include "gnunet-service-testbed_links.h"
  32. /**
  33. * Generic logging
  34. */
  35. #define LOG(kind,...) \
  36. GNUNET_log (kind, __VA_ARGS__)
  37. /**
  38. * Debug logging
  39. */
  40. #define LOG_DEBUG(...) \
  41. LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
  42. /**
  43. * By how much should the arrays lists grow
  44. */
  45. #define LIST_GROW_STEP 10
  46. /**
  47. * A routing entry
  48. */
  49. struct Route
  50. {
  51. /**
  52. * destination host
  53. */
  54. uint32_t dest;
  55. /**
  56. * The destination host is reachable thru
  57. */
  58. uint32_t thru;
  59. };
  60. /**
  61. * Context information for operations forwarded to subcontrollers
  62. */
  63. struct ForwardedOperationContext
  64. {
  65. /**
  66. * The next pointer for DLL
  67. */
  68. struct ForwardedOperationContext *next;
  69. /**
  70. * The prev pointer for DLL
  71. */
  72. struct ForwardedOperationContext *prev;
  73. /**
  74. * The generated operation context
  75. */
  76. struct OperationContext *opc;
  77. /**
  78. * The client to which we have to reply
  79. */
  80. struct GNUNET_SERVICE_Client *client;
  81. /**
  82. * Closure pointer
  83. */
  84. void *cls;
  85. /**
  86. * Task ID for the timeout task
  87. */
  88. struct GNUNET_SCHEDULER_Task * timeout_task;
  89. /**
  90. * The id of the operation that has been forwarded
  91. */
  92. uint64_t operation_id;
  93. /**
  94. * The type of the operation which is forwarded
  95. */
  96. enum OperationType type;
  97. };
  98. /**
  99. * A DLL of host registrations to be made
  100. */
  101. struct HostRegistration
  102. {
  103. /**
  104. * next registration in the DLL
  105. */
  106. struct HostRegistration *next;
  107. /**
  108. * previous registration in the DLL
  109. */
  110. struct HostRegistration *prev;
  111. /**
  112. * The callback to call after this registration's status is available
  113. */
  114. GNUNET_TESTBED_HostRegistrationCompletion cb;
  115. /**
  116. * The closure for the above callback
  117. */
  118. void *cb_cls;
  119. /**
  120. * The host that has to be registered
  121. */
  122. struct GNUNET_TESTBED_Host *host;
  123. };
  124. /**
  125. * Context information used while linking controllers
  126. */
  127. struct LinkControllersContext
  128. {
  129. /**
  130. * The client which initiated the link controller operation
  131. */
  132. struct GNUNET_SERVICE_Client *client;
  133. /**
  134. * The ID of the operation
  135. */
  136. uint64_t operation_id;
  137. };
  138. /**
  139. * A peer
  140. */
  141. struct Peer
  142. {
  143. union
  144. {
  145. struct
  146. {
  147. /**
  148. * The peer handle from testing API
  149. */
  150. struct GNUNET_TESTING_Peer *peer;
  151. /**
  152. * The modified (by GNUNET_TESTING_peer_configure) configuration this
  153. * peer is configured with
  154. */
  155. struct GNUNET_CONFIGURATION_Handle *cfg;
  156. /**
  157. * Is the peer running
  158. */
  159. int is_running;
  160. } local;
  161. struct
  162. {
  163. /**
  164. * The slave this peer is started through
  165. */
  166. struct Slave *slave;
  167. /**
  168. * The id of the remote host this peer is running on
  169. */
  170. uint32_t remote_host_id;
  171. } remote;
  172. } details;
  173. /**
  174. * Is this peer locally created?
  175. */
  176. int is_remote;
  177. /**
  178. * Our local reference id for this peer
  179. */
  180. uint32_t id;
  181. /**
  182. * References to peers are using in forwarded overlay contexts and remote
  183. * overlay connect contexts. A peer can only be destroyed after all such
  184. * contexts are destroyed. For this, we maintain a reference counter. When we
  185. * use a peer in any such context, we increment this counter. We decrement it
  186. * when we are destroying these contexts
  187. */
  188. uint32_t reference_cnt;
  189. /**
  190. * While destroying a peer, due to the fact that there could be references to
  191. * this peer, we delay the peer destroy to a further time. We do this by using
  192. * this flag to destroy the peer while destroying a context in which this peer
  193. * has been used. When the flag is set to 1 and reference_cnt = 0 we destroy
  194. * the peer
  195. */
  196. uint32_t destroy_flag;
  197. };
  198. /**
  199. * The main context information associated with the client which started us
  200. */
  201. struct Context
  202. {
  203. /**
  204. * The client handle associated with this context
  205. */
  206. struct GNUNET_SERVICE_Client *client;
  207. /**
  208. * The network address of the master controller
  209. */
  210. char *master_ip;
  211. /**
  212. * The TESTING system handle for starting peers locally
  213. */
  214. struct GNUNET_TESTING_System *system;
  215. /**
  216. * Our host id according to this context
  217. */
  218. uint32_t host_id;
  219. };
  220. /**
  221. * The structure for identifying a shared service
  222. */
  223. struct SharedService
  224. {
  225. /**
  226. * The name of the shared service
  227. */
  228. char *name;
  229. /**
  230. * Number of shared peers per instance of the shared service
  231. */
  232. uint32_t num_shared;
  233. /**
  234. * Number of peers currently sharing the service
  235. */
  236. uint32_t num_sharing;
  237. };
  238. struct RegisteredHostContext;
  239. /**
  240. * Context information to used during operations which forward the overlay
  241. * connect message
  242. */
  243. struct ForwardedOverlayConnectContext
  244. {
  245. /**
  246. * next ForwardedOverlayConnectContext in the DLL
  247. */
  248. struct ForwardedOverlayConnectContext *next;
  249. /**
  250. * previous ForwardedOverlayConnectContext in the DLL
  251. */
  252. struct ForwardedOverlayConnectContext *prev;
  253. /**
  254. * Which host does this FOCC belong to?
  255. */
  256. struct RegisteredHostContext *rhc;
  257. /**
  258. * A copy of the original overlay connect message
  259. */
  260. struct GNUNET_MessageHeader *orig_msg;
  261. /**
  262. * The client handle
  263. */
  264. struct GNUNET_SERVICE_Client *client;
  265. /**
  266. * The id of the operation which created this context information
  267. */
  268. uint64_t operation_id;
  269. /**
  270. * the id of peer 1
  271. */
  272. uint32_t peer1;
  273. /**
  274. * The id of peer 2
  275. */
  276. uint32_t peer2;
  277. /**
  278. * Id of the host where peer2 is running
  279. */
  280. uint32_t peer2_host_id;
  281. };
  282. /**
  283. * This context information will be created for each host that is registered at
  284. * slave controllers during overlay connects.
  285. */
  286. struct RegisteredHostContext
  287. {
  288. /**
  289. * The host which is being registered
  290. */
  291. struct GNUNET_TESTBED_Host *reg_host;
  292. /**
  293. * The host of the controller which has to connect to the above rhost
  294. */
  295. struct GNUNET_TESTBED_Host *host;
  296. /**
  297. * Head of the ForwardedOverlayConnectContext DLL
  298. */
  299. struct ForwardedOverlayConnectContext *focc_dll_head;
  300. /**
  301. * Tail of the ForwardedOverlayConnectContext DLL
  302. */
  303. struct ForwardedOverlayConnectContext *focc_dll_tail;
  304. /**
  305. * Enumeration of states for this context
  306. */
  307. enum RHCState
  308. {
  309. /**
  310. * The initial state
  311. */
  312. RHC_INIT = 0,
  313. /**
  314. * State where we attempt to do the overlay connection again
  315. */
  316. RHC_DONE
  317. } state;
  318. };
  319. /**
  320. * Context data for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler
  321. */
  322. struct HandlerContext_ShutdownPeers
  323. {
  324. /**
  325. * The number of slave we expect to hear from since we forwarded the
  326. * #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS message to them
  327. */
  328. unsigned int nslaves;
  329. /**
  330. * Did we observe a timeout with respect to this operation at any of the
  331. * slaves
  332. */
  333. int timeout;
  334. };
  335. /**
  336. * Our configuration
  337. */
  338. extern struct GNUNET_CONFIGURATION_Handle *GST_config;
  339. /**
  340. * The master context; generated with the first INIT message
  341. */
  342. extern struct Context *GST_context;
  343. /**
  344. * DLL head for forwarded operation contexts
  345. */
  346. extern struct ForwardedOperationContext *fopcq_head;
  347. /**
  348. * DLL tail for forwarded operation contexts
  349. */
  350. extern struct ForwardedOperationContext *fopcq_tail;
  351. /**
  352. * A list of peers we know about
  353. */
  354. extern struct Peer **GST_peer_list;
  355. /**
  356. * Array of hosts
  357. */
  358. extern struct GNUNET_TESTBED_Host **GST_host_list;
  359. /**
  360. * Operation queue for open file descriptors
  361. */
  362. extern struct OperationQueue *GST_opq_openfds;
  363. /**
  364. * Timeout for operations which may take some time
  365. */
  366. const extern struct GNUNET_TIME_Relative GST_timeout;
  367. /**
  368. * The size of the peer list
  369. */
  370. extern unsigned int GST_peer_list_size;
  371. /**
  372. * The current number of peers running locally under this controller
  373. */
  374. extern unsigned int GST_num_local_peers;
  375. /**
  376. * The size of the host list
  377. */
  378. extern unsigned int GST_host_list_size;
  379. /**
  380. * The directory where to store load statistics data
  381. */
  382. extern char *GST_stats_dir;
  383. /**
  384. * Condition to check if host id is valid
  385. */
  386. #define VALID_HOST_ID(id) \
  387. ( ((id) < GST_host_list_size) && (NULL != GST_host_list[id]) )
  388. /**
  389. * Condition to check if peer id is valid
  390. */
  391. #define VALID_PEER_ID(id) \
  392. ( ((id) < GST_peer_list_size) && (NULL != GST_peer_list[id]) )
  393. /**
  394. * Similar to GNUNET_array_grow(); however instead of calling GNUNET_array_grow()
  395. * several times we call it only once. The array is also made to grow in steps
  396. * of LIST_GROW_STEP.
  397. *
  398. * @param ptr the array pointer to grow
  399. * @param size the size of array
  400. * @param accommodate_size the size which the array has to accommdate; after
  401. * this call the array will be big enough to accommdate sizes upto
  402. * accommodate_size
  403. */
  404. #define GST_array_grow_large_enough(ptr, size, accommodate_size) \
  405. do \
  406. { \
  407. unsigned int growth_size; \
  408. GNUNET_assert (size <= accommodate_size); \
  409. growth_size = size; \
  410. while (growth_size <= accommodate_size) \
  411. growth_size += LIST_GROW_STEP; \
  412. GNUNET_array_grow (ptr, size, growth_size); \
  413. GNUNET_assert (size > accommodate_size); \
  414. } while (0)
  415. /**
  416. * Function to destroy a peer
  417. *
  418. * @param peer the peer structure to destroy
  419. */
  420. void
  421. GST_destroy_peer (struct Peer *peer);
  422. /**
  423. * Stops and destroys all peers
  424. */
  425. void
  426. GST_destroy_peers (void);
  427. /**
  428. * Finds the route with directly connected host as destination through which
  429. * the destination host can be reached
  430. *
  431. * @param host_id the id of the destination host
  432. * @return the route with directly connected destination host; NULL if no route
  433. * is found
  434. */
  435. struct Route *
  436. GST_find_dest_route (uint32_t host_id);
  437. /**
  438. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT messages
  439. *
  440. * @param cls identification of the client
  441. * @param msg the actual message
  442. */
  443. void
  444. handle_overlay_connect (void *cls,
  445. const struct GNUNET_TESTBED_OverlayConnectMessage *msg);
  446. /**
  447. * Adds a host registration's request to a slave's registration queue
  448. *
  449. * @param slave the slave controller at which the given host has to be
  450. * registered
  451. * @param cb the host registration completion callback
  452. * @param cb_cls the closure for the host registration completion callback
  453. * @param host the host which has to be registered
  454. */
  455. void
  456. GST_queue_host_registration (struct Slave *slave,
  457. GNUNET_TESTBED_HostRegistrationCompletion cb,
  458. void *cb_cls, struct GNUNET_TESTBED_Host *host);
  459. /**
  460. * Callback to relay the reply msg of a forwarded operation back to the client
  461. *
  462. * @param cls ForwardedOperationContext
  463. * @param msg the message to relay
  464. */
  465. void
  466. GST_forwarded_operation_reply_relay (void *cls,
  467. const struct GNUNET_MessageHeader *msg);
  468. /**
  469. * Task to free resources when forwarded operation has been timedout
  470. *
  471. * @param cls the ForwardedOperationContext
  472. * @param tc the task context from scheduler
  473. */
  474. void
  475. GST_forwarded_operation_timeout (void *cls);
  476. /**
  477. * Clears the forwarded operations queue
  478. */
  479. void
  480. GST_clear_fopcq (void);
  481. /**
  482. * Send operation failure message to client
  483. *
  484. * @param client the client to which the failure message has to be sent to
  485. * @param operation_id the id of the failed operation
  486. * @param emsg the error message; can be NULL
  487. */
  488. void
  489. GST_send_operation_fail_msg (struct GNUNET_SERVICE_Client *client,
  490. uint64_t operation_id,
  491. const char *emsg);
  492. /**
  493. * Notify OC subsystem that @a client disconnected.
  494. *
  495. * @param client the client that disconnected
  496. */
  497. void
  498. GST_notify_client_disconnect_oc (struct GNUNET_SERVICE_Client *client);
  499. /**
  500. * Notify peers subsystem that @a client disconnected.
  501. *
  502. * @param client the client that disconnected
  503. */
  504. void
  505. GST_notify_client_disconnect_peers (struct GNUNET_SERVICE_Client *client);
  506. /**
  507. * Function to send generic operation success message to given client
  508. *
  509. * @param client the client to send the message to
  510. * @param operation_id the id of the operation which was successful
  511. */
  512. void
  513. GST_send_operation_success_msg (struct GNUNET_SERVICE_Client *client,
  514. uint64_t operation_id);
  515. /**
  516. * Check #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages
  517. *
  518. * @param cls identification of the client
  519. * @param msg the actual message
  520. * @return #GNUNET_OK if @a msg is well-formed
  521. */
  522. int
  523. check_remote_overlay_connect (void *cls,
  524. const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg);
  525. /**
  526. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages
  527. *
  528. * @param cls identification of the client
  529. * @param msg the actual message
  530. */
  531. void
  532. handle_remote_overlay_connect (void *cls,
  533. const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg);
  534. /**
  535. * Check #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages
  536. *
  537. * @param cls identification of the client
  538. * @param msg the actual message
  539. * @return #GNUNET_OK if @a msg is well-formed
  540. */
  541. int
  542. check_peer_create (void *cls,
  543. const struct GNUNET_TESTBED_PeerCreateMessage *msg);
  544. /**
  545. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages
  546. *
  547. * @param cls identification of the client
  548. * @param message the actual message
  549. */
  550. void
  551. handle_peer_create (void *cls,
  552. const struct GNUNET_TESTBED_PeerCreateMessage *msg);
  553. /**
  554. * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages
  555. *
  556. * @param cls identification of the client
  557. * @param msg the actual message
  558. */
  559. void
  560. handle_peer_destroy (void *cls,
  561. const struct GNUNET_TESTBED_PeerDestroyMessage *msg);
  562. /**
  563. * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages
  564. *
  565. * @param cls identification of the client
  566. * @param msg the actual message
  567. */
  568. void
  569. handle_peer_start (void *cls,
  570. const struct GNUNET_TESTBED_PeerStartMessage *msg);
  571. /**
  572. * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages
  573. *
  574. * @param cls identification of the client
  575. * @param message the actual message
  576. */
  577. void
  578. handle_peer_stop (void *cls,
  579. const struct GNUNET_TESTBED_PeerStopMessage *msg);
  580. /**
  581. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG messages
  582. *
  583. * @param cls identification of the client
  584. * @param msg the actual message
  585. */
  586. void
  587. handle_peer_get_config (void *cls,
  588. const struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg);
  589. /**
  590. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS messages
  591. *
  592. * @param cls identification of the client
  593. * @param msg the actual message
  594. */
  595. void
  596. handle_shutdown_peers (void *cls,
  597. const struct GNUNET_TESTBED_ShutdownPeersMessage *msg);
  598. /**
  599. * Check #GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message
  600. *
  601. * @param cls identification of client
  602. * @param msg the actual message
  603. * @return #GNUNET_OK if @a msg is well-formed
  604. */
  605. int
  606. check_manage_peer_service (void *cls,
  607. const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg);
  608. /**
  609. * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message
  610. *
  611. * @param cls identification of client
  612. * @param msg the actual message
  613. */
  614. void
  615. handle_manage_peer_service (void *cls,
  616. const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg);
  617. /**
  618. * Check #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages.
  619. *
  620. * @param cls identification of the client
  621. * @param msg the actual message
  622. * @return #GNUNET_OK if @a msg is well-formed
  623. */
  624. int
  625. check_peer_reconfigure (void *cls,
  626. const struct GNUNET_TESTBED_PeerReconfigureMessage *msg);
  627. /**
  628. * Handler for #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages.
  629. * Should stop the peer asyncronously, destroy it and create it again with the
  630. * new configuration.
  631. *
  632. * @param cls identification of the client
  633. * @param msg the actual message
  634. */
  635. void
  636. handle_peer_reconfigure (void *cls,
  637. const struct GNUNET_TESTBED_PeerReconfigureMessage *msg);
  638. /**
  639. * Frees the ManageServiceContext queue
  640. */
  641. void
  642. GST_free_mctxq (void);
  643. /**
  644. * Cleans up the queue used for forwarding link controllers requests
  645. */
  646. void
  647. GST_free_lcf (void);
  648. /**
  649. * Cleans up the route list
  650. */
  651. void
  652. GST_route_list_clear (void);
  653. /**
  654. * Processes a forwarded overlay connect context in the queue of the given RegisteredHostContext
  655. *
  656. * @param rhc the RegisteredHostContext
  657. */
  658. void
  659. GST_process_next_focc (struct RegisteredHostContext *rhc);
  660. /**
  661. * Cleans up ForwardedOverlayConnectContext
  662. *
  663. * @param focc the ForwardedOverlayConnectContext to cleanup
  664. */
  665. void
  666. GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc);
  667. /**
  668. * Clears all pending overlay connect contexts in queue
  669. */
  670. void
  671. GST_free_occq (void);
  672. /**
  673. * Clears all pending remote overlay connect contexts in queue
  674. */
  675. void
  676. GST_free_roccq (void);
  677. /**
  678. * Cleans up the Peer reconfigure context list
  679. */
  680. void
  681. GST_free_prcq (void);
  682. /**
  683. * Initializes the cache
  684. *
  685. * @param size the size of the cache
  686. */
  687. void
  688. GST_cache_init (unsigned int size);
  689. /**
  690. * Clear cache
  691. */
  692. void
  693. GST_cache_clear (void);
  694. /**
  695. * Looks up in the hello cache and returns the HELLO of the given peer
  696. *
  697. * @param peer_id the index of the peer whose HELLO has to be looked up
  698. * @return the HELLO message; NULL if not found
  699. */
  700. const struct GNUNET_MessageHeader *
  701. GST_cache_lookup_hello (const unsigned int peer_id);
  702. /**
  703. * Caches the HELLO of the given peer. Updates the HELLO if it was already
  704. * cached before
  705. *
  706. * @param peer_id the peer identity of the peer whose HELLO has to be cached
  707. * @param hello the HELLO message
  708. */
  709. void
  710. GST_cache_add_hello (const unsigned int peer_id,
  711. const struct GNUNET_MessageHeader *hello);
  712. /**
  713. * Initialize logging CPU and IO statisticfs. Checks the configuration for
  714. * "STATS_DIR" and logs to a file in that directory. The file is name is
  715. * generated from the hostname and the process's PID.
  716. */
  717. void
  718. GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
  719. /**
  720. * Shutdown the status calls module.
  721. */
  722. void
  723. GST_stats_destroy (void);
  724. /* End of gnunet-service-testbed.h */