diff options
Diffstat (limited to 'doc/tutorial-examples')
26 files changed, 0 insertions, 348 deletions
diff --git a/doc/tutorial-examples/001.c b/doc/tutorial-examples/001.c deleted file mode 100644 index 7f6699dd22..0000000000 --- a/doc/tutorial-examples/001.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <gnunet/platform.h> -#include <gnunet/gnunet_util_lib.h> - -static int ret; - -static void -run (void *cls, - char *const *args, - const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *cfg) -{ - // main code here - ret = 0; -} - -int -main (int argc, char *const *argv) -{ - struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_END - }; - return (GNUNET_OK == - GNUNET_PROGRAM_run (argc, - argv, - "binary-name", - gettext_noop ("binary description text"), - options, &run, NULL)) ? ret : 1; -} - diff --git a/doc/tutorial-examples/002.c b/doc/tutorial-examples/002.c deleted file mode 100644 index 02233fd619..0000000000 --- a/doc/tutorial-examples/002.c +++ /dev/null @@ -1,17 +0,0 @@ -static char *string_option; -static int a_flag; - -// ... - struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_string ('s', "name", "SOMESTRING", - gettext_noop ("text describing the string_option NAME"), - &string_option}, - GNUNET_GETOPT_option_flag ('f', "flag", - gettext_noop ("text describing the flag option"), - &a_flag), - GNUNET_GETOPT_OPTION_END - }; - string_option = NULL; - a_flag = GNUNET_SYSERR; -// ... - diff --git a/doc/tutorial-examples/003.c b/doc/tutorial-examples/003.c deleted file mode 100644 index d13681ca60..0000000000 --- a/doc/tutorial-examples/003.c +++ /dev/null @@ -1,7 +0,0 @@ - struct GNUNET_MQ_MessageHandlers handlers[] = { - // ... - GNUNET_MQ_handler_end () - }; - struct GNUNET_MQ_Handle *mq; - - mq = GNUNET_CLIENT_connect (cfg, "service-name", handlers, &error_cb, NULL); diff --git a/doc/tutorial-examples/004.c b/doc/tutorial-examples/004.c deleted file mode 100644 index 0ef0079070..0000000000 --- a/doc/tutorial-examples/004.c +++ /dev/null @@ -1,5 +0,0 @@ -struct GNUNET_MessageHeader -{ - uint16_t size GNUNET_PACKED; - uint16_t type GNUNET_PACKED; -}; diff --git a/doc/tutorial-examples/005.c b/doc/tutorial-examples/005.c deleted file mode 100644 index 0c459f509d..0000000000 --- a/doc/tutorial-examples/005.c +++ /dev/null @@ -1,8 +0,0 @@ -struct GNUNET_MQ_Envelope *env; -struct GNUNET_MessageHeader *msg; - -env = GNUNET_MQ_msg_extra (msg, payload_size, GNUNET_MY_MESSAGE_TYPE); -memcpy (&msg[1], &payload, payload_size); -// Send message via message queue 'mq' -GNUNET_mq_send (mq, env); - diff --git a/doc/tutorial-examples/006.c b/doc/tutorial-examples/006.c deleted file mode 100644 index 944d2b18c7..0000000000 --- a/doc/tutorial-examples/006.c +++ /dev/null @@ -1,31 +0,0 @@ -static void -handle_fix (void *cls, const struct MyMessage *msg) -{ - // process 'msg' -} - -static int -check_var (void *cls, const struct MyVarMessage *msg) -{ - // check 'msg' is well-formed - return GNUNET_OK; -} - -static void -handle_var (void *cls, const struct MyVarMessage *msg) -{ - // process 'msg' -} - -struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_fixed_size (fix, - GNUNET_MESSAGE_TYPE_MY_FIX, - struct MyMessage, - NULL), - GNUNET_MQ_hd_fixed_size (var, - GNUNET_MESSAGE_TYPE_MY_VAR, - struct MyVarMessage, - NULL), - - GNUNET_MQ_handler_end () -}; diff --git a/doc/tutorial-examples/007.c b/doc/tutorial-examples/007.c deleted file mode 100644 index 096539e432..0000000000 --- a/doc/tutorial-examples/007.c +++ /dev/null @@ -1,10 +0,0 @@ -GNUNET_SERVICE_MAIN -("service-name", - GNUNET_SERVICE_OPTION_NONE, - &run, - &client_connect_cb, - &client_disconnect_cb, - NULL, - GNUNET_MQ_hd_fixed_size (...), - GNUNET_MQ_hd_var_size (...), - GNUNET_MQ_handler_end ()); diff --git a/doc/tutorial-examples/008.c b/doc/tutorial-examples/008.c deleted file mode 100644 index 2dffe2cf91..0000000000 --- a/doc/tutorial-examples/008.c +++ /dev/null @@ -1,22 +0,0 @@ -static void -run (void *cls, - const struct GNUNET_CONFIGURATION_Handle *c, - struct GNUNET_SERVICE_Handle *service) -{ -} - -static void * -client_connect_cb (void *cls, - struct GNUNET_SERVICE_Client *c, - struct GNUNET_MQ_Handle *mq) -{ - return c; -} - -static void -client_disconnect_cb (void *cls, - struct GNUNET_SERVICE_Client *c, - void *internal_cls) -{ - GNUNET_assert (c == internal_cls); -} diff --git a/doc/tutorial-examples/009.c b/doc/tutorial-examples/009.c deleted file mode 100644 index 26d918fb02..0000000000 --- a/doc/tutorial-examples/009.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <gnunet/gnunet_core_service.h> - -struct GNUNET_CORE_Handle * -GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, - void *cls, - GNUNET_CORE_StartupCallback init, - GNUNET_CORE_ConnectEventHandler connects, - GNUNET_CORE_DisconnectEventHandler disconnects, - const struct GNUNET_MQ_MessageHandler *handlers); diff --git a/doc/tutorial-examples/010.c b/doc/tutorial-examples/010.c deleted file mode 100644 index 33494490db..0000000000 --- a/doc/tutorial-examples/010.c +++ /dev/null @@ -1,8 +0,0 @@ -void * -connects (void *cls, - const struct GNUNET_PeerIdentity *peer, - struct GNUNET_MQ_Handle *mq) -{ - return mq; -} - diff --git a/doc/tutorial-examples/011.c b/doc/tutorial-examples/011.c deleted file mode 100644 index 23bc051de1..0000000000 --- a/doc/tutorial-examples/011.c +++ /dev/null @@ -1,8 +0,0 @@ -void -disconnects (void *cls, - const struct GNUNET_PeerIdentity * peer) -{ - /* Remove peer's identity from known peers */ - /* Make sure no messages are sent to peer from now on */ -} - diff --git a/doc/tutorial-examples/012.c b/doc/tutorial-examples/012.c deleted file mode 100644 index cb21d78ab2..0000000000 --- a/doc/tutorial-examples/012.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "gnunet_peerstore_service.h" - -peerstore_handle = GNUNET_PEERSTORE_connect (cfg); - diff --git a/doc/tutorial-examples/013.c b/doc/tutorial-examples/013.c deleted file mode 100644 index 6792417e19..0000000000 --- a/doc/tutorial-examples/013.c +++ /dev/null @@ -1,12 +0,0 @@ -struct GNUNET_PEERSTORE_StoreContext * -GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h, - const char *sub_system, - const struct GNUNET_PeerIdentity *peer, - const char *key, - const void *value, - size_t size, - struct GNUNET_TIME_Absolute expiry, - enum GNUNET_PEERSTORE_StoreOption options, - GNUNET_PEERSTORE_Continuation cont, - void *cont_cls); - diff --git a/doc/tutorial-examples/014.c b/doc/tutorial-examples/014.c deleted file mode 100644 index ce204f7956..0000000000 --- a/doc/tutorial-examples/014.c +++ /dev/null @@ -1,9 +0,0 @@ -struct GNUNET_PEERSTORE_IterateContext * -GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h, - const char *sub_system, - const struct GNUNET_PeerIdentity *peer, - const char *key, - struct GNUNET_TIME_Relative timeout, - GNUNET_PEERSTORE_Processor callback, - void *callback_cls); - diff --git a/doc/tutorial-examples/015.c b/doc/tutorial-examples/015.c deleted file mode 100644 index 0dd267e8e3..0000000000 --- a/doc/tutorial-examples/015.c +++ /dev/null @@ -1,8 +0,0 @@ -struct GNUNET_PEERSTORE_WatchContext * -GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h, - const char *sub_system, - const struct GNUNET_PeerIdentity *peer, - const char *key, - GNUNET_PEERSTORE_Processor callback, - void *callback_cls); - diff --git a/doc/tutorial-examples/016.c b/doc/tutorial-examples/016.c deleted file mode 100644 index d8db4b3b8c..0000000000 --- a/doc/tutorial-examples/016.c +++ /dev/null @@ -1,3 +0,0 @@ -void -GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc); - diff --git a/doc/tutorial-examples/017.c b/doc/tutorial-examples/017.c deleted file mode 100644 index c4acbc0883..0000000000 --- a/doc/tutorial-examples/017.c +++ /dev/null @@ -1,3 +0,0 @@ -void -GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first); - diff --git a/doc/tutorial-examples/018.c b/doc/tutorial-examples/018.c deleted file mode 100644 index 3fc22584c8..0000000000 --- a/doc/tutorial-examples/018.c +++ /dev/null @@ -1,2 +0,0 @@ -dht_handle = GNUNET_DHT_connect (cfg, parallel_requests); - diff --git a/doc/tutorial-examples/019.c b/doc/tutorial-examples/019.c deleted file mode 100644 index d016d381bb..0000000000 --- a/doc/tutorial-examples/019.c +++ /dev/null @@ -1,15 +0,0 @@ -message_sent_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) -{ - // Request has left local node -} - -struct GNUNET_DHT_PutHandle * -GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, - const struct GNUNET_HashCode *key, - uint32_t desired_replication_level, - enum GNUNET_DHT_RouteOption options, - enum GNUNET_BLOCK_Type type, size_t size, const void *data, - struct GNUNET_TIME_Absolute exp, - struct GNUNET_TIME_Relative timeout, - GNUNET_DHT_PutContinuation cont, void *cont_cls) - diff --git a/doc/tutorial-examples/020.c b/doc/tutorial-examples/020.c deleted file mode 100644 index 5ecba1c169..0000000000 --- a/doc/tutorial-examples/020.c +++ /dev/null @@ -1,24 +0,0 @@ -static void -get_result_iterator (void *cls, struct GNUNET_TIME_Absolute expiration, - const struct GNUNET_HashCode *key, - const struct GNUNET_PeerIdentity *get_path, - unsigned int get_path_length, - const struct GNUNET_PeerIdentity *put_path, - unsigned int put_path_length, - enum GNUNET_BLOCK_Type type, size_t size, const void *data) -{ - // Optionally: - GNUNET_DHT_get_stop (get_handle); -} - -get_handle = - GNUNET_DHT_get_start (dht_handle, - block_type, - &key, - replication, - GNUNET_DHT_RO_NONE, - NULL, - 0, - &get_result_iterator, - cls) - diff --git a/doc/tutorial-examples/021.c b/doc/tutorial-examples/021.c deleted file mode 100644 index 688a31fe0e..0000000000 --- a/doc/tutorial-examples/021.c +++ /dev/null @@ -1,13 +0,0 @@ -static enum GNUNET_BLOCK_EvaluationResult -block_plugin_SERVICE_evaluate (void *cls, - enum GNUNET_BLOCK_Type type, - struct GNUNET_BlockGroup *bg, - const GNUNET_HashCode *query, - const void *xquery, - size_t xquery_size, - const void *reply_block, - size_t reply_block_size) -{ - // Verify type, block and bg -} - diff --git a/doc/tutorial-examples/022.c b/doc/tutorial-examples/022.c deleted file mode 100644 index a373619bd3..0000000000 --- a/doc/tutorial-examples/022.c +++ /dev/null @@ -1,8 +0,0 @@ -static int -block_plugin_SERVICE_get_key (void *cls, enum GNUNET_BLOCK_Type type, - const void *block, size_t block_size, - struct GNUNET_HashCode *key) -{ - // Store the key in the key argument, return GNUNET_OK on success. -} - diff --git a/doc/tutorial-examples/023.c b/doc/tutorial-examples/023.c deleted file mode 100644 index 820c38b10a..0000000000 --- a/doc/tutorial-examples/023.c +++ /dev/null @@ -1,17 +0,0 @@ -void * -libgnunet_plugin_block_SERVICE_init (void *cls) -{ - static enum GNUNET_BLOCK_Type types[] = - { - GNUNET_BLOCK_TYPE_SERVICE_BLOCKYPE, - GNUNET_BLOCK_TYPE_ANY - }; - struct GNUNET_BLOCK_PluginFunctions *api; - - api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions); - api->evaluate = &block_plugin_SERICE_evaluate; - api->get_key = &block_plugin_SERVICE_get_key; - api->types = types; - return api; -} - diff --git a/doc/tutorial-examples/024.c b/doc/tutorial-examples/024.c deleted file mode 100644 index 2e84b5905c..0000000000 --- a/doc/tutorial-examples/024.c +++ /dev/null @@ -1,9 +0,0 @@ -void * -libgnunet_plugin_block_SERVICE_done (void *cls) -{ - struct GNUNET_TRANSPORT_PluginFunctions *api = cls; - - GNUNET_free (api); - return NULL; -} - diff --git a/doc/tutorial-examples/025.c b/doc/tutorial-examples/025.c deleted file mode 100644 index 66d4f80eca..0000000000 --- a/doc/tutorial-examples/025.c +++ /dev/null @@ -1,15 +0,0 @@ - plugindir = $(libdir)/gnunet - - plugin_LTLIBRARIES = \ - libgnunet_plugin_block_ext.la - libgnunet_plugin_block_ext_la_SOURCES = \ - plugin_block_ext.c - libgnunet_plugin_block_ext_la_LIBADD = \ - $(prefix)/lib/libgnunethello.la \ - $(prefix)/lib/libgnunetblock.la \ - $(prefix)/lib/libgnunetutil.la - libgnunet_plugin_block_ext_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) - libgnunet_plugin_block_ext_la_DEPENDENCIES = \ - $(prefix)/lib/libgnunetblock.la - diff --git a/doc/tutorial-examples/026.c b/doc/tutorial-examples/026.c deleted file mode 100644 index 264e0b6b97..0000000000 --- a/doc/tutorial-examples/026.c +++ /dev/null @@ -1,52 +0,0 @@ -static void -get_callback (void *cls, - enum GNUNET_DHT_RouteOption options, - enum GNUNET_BLOCK_Type type, - uint32_t hop_count, - uint32_t desired_replication_level, - unsigned int path_length, - const struct GNUNET_PeerIdentity *path, - const struct GNUNET_HashCode * key) -{ -} - - -static void -get_resp_callback (void *cls, - enum GNUNET_BLOCK_Type type, - const struct GNUNET_PeerIdentity *get_path, - unsigned int get_path_length, - const struct GNUNET_PeerIdentity *put_path, - unsigned int put_path_length, - struct GNUNET_TIME_Absolute exp, - const struct GNUNET_HashCode * key, - const void *data, - size_t size) -{ -} - - -static void -put_callback (void *cls, - enum GNUNET_DHT_RouteOption options, - enum GNUNET_BLOCK_Type type, - uint32_t hop_count, - uint32_t desired_replication_level, - unsigned int path_length, - const struct GNUNET_PeerIdentity *path, - struct GNUNET_TIME_Absolute exp, - const struct GNUNET_HashCode * key, - const void *data, - size_t size) -{ -} - - -monitor_handle = GNUNET_DHT_monitor_start (dht_handle, - block_type, - key, - &get_callback, - &get_resp_callback, - &put_callback, - cls); - |