aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.h
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-01-29 12:25:09 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-01-29 12:25:09 +0000
commit13010a7ad8f3756733bbc67242cf1c90e60641cd (patch)
tree95dbf85d5499442619ba4dd6bc02a9588728d714 /src/testbed/gnunet-service-testbed.h
parent87af323234ce202f508d25b4ecf886a3e31a7560 (diff)
downloadgnunet-13010a7ad8f3756733bbc67242cf1c90e60641cd.tar.gz
gnunet-13010a7ad8f3756733bbc67242cf1c90e60641cd.zip
- towards caching transport handles along with HELLO messages
Diffstat (limited to 'src/testbed/gnunet-service-testbed.h')
-rw-r--r--src/testbed/gnunet-service-testbed.h115
1 files changed, 78 insertions, 37 deletions
diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h
index 157adc2ea..72ad5d15a 100644
--- a/src/testbed/gnunet-service-testbed.h
+++ b/src/testbed/gnunet-service-testbed.h
@@ -647,43 +647,6 @@ GST_destroy_peer (struct Peer *peer);
647 647
648 648
649/** 649/**
650 * Looks up in the hello cache and returns the HELLO of the given peer
651 *
652 * @param id the peer identity of the peer whose HELLO has to be looked up
653 * @return the HELLO message; NULL if not found
654 */
655const struct GNUNET_MessageHeader *
656GST_cache_lookup (const struct GNUNET_PeerIdentity *id);
657
658/**
659 * Caches the HELLO of the given peer. Updates the HELLO if it was already
660 * cached before
661 *
662 * @param id the peer identity of the peer whose HELLO has to be cached
663 * @param hello the HELLO message
664 */
665void
666GST_cache_add (const struct GNUNET_PeerIdentity *id,
667 const struct GNUNET_MessageHeader *hello);
668
669
670/**
671 * Initializes the cache
672 *
673 * @param size the size of the cache
674 */
675void
676GST_cache_init (unsigned int size);
677
678
679/**
680 * Clear cache
681 */
682void
683GST_cache_clear ();
684
685
686/**
687 * Finds the route with directly connected host as destination through which 650 * Finds the route with directly connected host as destination through which
688 * the destination host can be reached 651 * the destination host can be reached
689 * 652 *
@@ -801,5 +764,83 @@ void
801GST_free_roccq (); 764GST_free_roccq ();
802 765
803 766
767/**
768 * Initializes the cache
769 *
770 * @param size the size of the cache
771 */
772void
773GST_cache_init (unsigned int size);
774
775
776/**
777 * Clear cache
778 */
779void
780GST_cache_clear ();
781
782
783/**
784 * Looks up in the hello cache and returns the HELLO of the given peer
785 *
786 * @param peer_id the index of the peer whose HELLO has to be looked up
787 * @return the HELLO message; NULL if not found
788 */
789const struct GNUNET_MessageHeader *
790GST_cache_lookup_hello (const unsigned int peer_id);
791
792
793/**
794 * Caches the HELLO of the given peer. Updates the HELLO if it was already
795 * cached before
796 *
797 * @param id the peer identity of the peer whose HELLO has to be cached
798 * @param hello the HELLO message
799 */
800void
801GST_cache_add_hello (const unsigned int peer_id,
802 const struct GNUNET_MessageHeader *hello);
803
804
805/**
806 * Callback from cache with needed handles set
807 *
808 * @param cls the closure passed to GST_cache_get_handle_transport()
809 * @param ch the handle to CORE. Can be NULL if it is not requested
810 * @param th the handle to TRANSPORT. Can be NULL if it is not requested
811 */
812typedef void (*GST_cache_callback) (void *cls, struct GNUNET_CORE_Handle *ch,
813 struct GNUNET_TRANSPORT_Handle *th);
814
815
816/**
817 * Get a transport handle with the given configuration. If the handle is already
818 * cached before, it will be retured in the given callback; the peer_id is used to lookup in the
819 * cache. If not a new operation is started to open the transport handle and
820 * will be given in the callback when it is available.
821 *
822 * @param peer_id the index of the peer
823 * @param cfg the configuration with which the transport handle has to be
824 * created if it was not present in the cache
825 * @param cb the callback to notify when the transport handle is available
826 * @param cb_cls the closure for the above callback
827 * @return the handle which can be used cancel or mark that the handle is no
828 * longer being used
829 */
830struct GSTCacheGetHandle *
831GST_cache_get_handle_transport (unsigned int peer_id,
832 const struct GNUNET_CONFIGURATION_Handle *cfg,
833 GST_cache_callback cb,
834 void *cb_cls);
835
836
837/**
838 * Mark the GetCacheHandle as being done if a handle has been provided already
839 * or as being cancelled if the callback for the handle hasn't been called.
840 *
841 * @param cgh the CacheGetHandle handle
842 */
843void
844GST_cache_get_handle_done (struct GSTCacheGetHandle *cgh);
804 845
805/* End of gnunet-service-testbed.h */ 846/* End of gnunet-service-testbed.h */