diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-24 11:58:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-24 11:58:31 +0000 |
commit | 3bca0a62abc14e5fe36e1c80ff487e0051dad562 (patch) | |
tree | 25a9dc36162d498910f6e41aa85a0d3863e0c1c0 /src/peerstore/peerstore_common.h | |
parent | d02c15600b668a30e091d2c5c59d918bb1e4fee7 (diff) | |
download | gnunet-3bca0a62abc14e5fe36e1c80ff487e0051dad562.tar.gz gnunet-3bca0a62abc14e5fe36e1c80ff487e0051dad562.zip |
migrate peerstore to new service MQ API
Diffstat (limited to 'src/peerstore/peerstore_common.h')
-rw-r--r-- | src/peerstore/peerstore_common.h | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/peerstore/peerstore_common.h b/src/peerstore/peerstore_common.h index 4b806bf91..3d938b5da 100644 --- a/src/peerstore/peerstore_common.h +++ b/src/peerstore/peerstore_common.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) | 3 | Copyright (C) 2013-2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -23,7 +23,6 @@ | |||
23 | * @brief Helper peerstore functions | 23 | * @brief Helper peerstore functions |
24 | * @author Omar Tarabai | 24 | * @author Omar Tarabai |
25 | */ | 25 | */ |
26 | |||
27 | #include "platform.h" | 26 | #include "platform.h" |
28 | #include "peerstore.h" | 27 | #include "peerstore.h" |
29 | 28 | ||
@@ -33,28 +32,10 @@ | |||
33 | */ | 32 | */ |
34 | void | 33 | void |
35 | PEERSTORE_hash_key (const char *sub_system, | 34 | PEERSTORE_hash_key (const char *sub_system, |
36 | const struct GNUNET_PeerIdentity *peer, const char *key, | 35 | const struct GNUNET_PeerIdentity *peer, |
36 | const char *key, | ||
37 | struct GNUNET_HashCode *ret); | 37 | struct GNUNET_HashCode *ret); |
38 | 38 | ||
39 | /** | ||
40 | * Creates a record message ready to be sent | ||
41 | * | ||
42 | * @param sub_system sub system string | ||
43 | * @param peer Peer identity (can be NULL) | ||
44 | * @param key record key string (can be NULL) | ||
45 | * @param value record value BLOB (can be NULL) | ||
46 | * @param value_size record value size in bytes (set to 0 if value is NULL) | ||
47 | * @param expiry absolute time after which the record expires | ||
48 | * @param msg_type message type to be set in header | ||
49 | * @return pointer to record message struct | ||
50 | */ | ||
51 | struct StoreRecordMessage * | ||
52 | PEERSTORE_create_record_message (const char *sub_system, | ||
53 | const struct GNUNET_PeerIdentity *peer, | ||
54 | const char *key, const void *value, | ||
55 | size_t value_size, | ||
56 | struct GNUNET_TIME_Absolute *expiry, | ||
57 | uint16_t msg_type); | ||
58 | 39 | ||
59 | /** | 40 | /** |
60 | * Creates a MQ envelope for a single record | 41 | * Creates a MQ envelope for a single record |
@@ -72,20 +53,23 @@ PEERSTORE_create_record_message (const char *sub_system, | |||
72 | struct GNUNET_MQ_Envelope * | 53 | struct GNUNET_MQ_Envelope * |
73 | PEERSTORE_create_record_mq_envelope (const char *sub_system, | 54 | PEERSTORE_create_record_mq_envelope (const char *sub_system, |
74 | const struct GNUNET_PeerIdentity *peer, | 55 | const struct GNUNET_PeerIdentity *peer, |
75 | const char *key, const void *value, | 56 | const char *key, |
57 | const void *value, | ||
76 | size_t value_size, | 58 | size_t value_size, |
77 | struct GNUNET_TIME_Absolute *expiry, | 59 | struct GNUNET_TIME_Absolute *expiry, |
78 | enum GNUNET_PEERSTORE_StoreOption options, | 60 | enum GNUNET_PEERSTORE_StoreOption options, |
79 | uint16_t msg_type); | 61 | uint16_t msg_type); |
80 | 62 | ||
63 | |||
81 | /** | 64 | /** |
82 | * Parses a message carrying a record | 65 | * Parses a message carrying a record |
83 | * | 66 | * |
84 | * @param message the actual message | 67 | * @param srm the actual message |
85 | * @return Pointer to record or NULL if error | 68 | * @return Pointer to record or NULL on error |
86 | */ | 69 | */ |
87 | struct GNUNET_PEERSTORE_Record * | 70 | struct GNUNET_PEERSTORE_Record * |
88 | PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message); | 71 | PEERSTORE_parse_record_message (const struct StoreRecordMessage *srm); |
72 | |||
89 | 73 | ||
90 | /** | 74 | /** |
91 | * Free any memory allocated for this record | 75 | * Free any memory allocated for this record |
@@ -94,3 +78,5 @@ PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message); | |||
94 | */ | 78 | */ |
95 | void | 79 | void |
96 | PEERSTORE_destroy_record (struct GNUNET_PEERSTORE_Record *record); | 80 | PEERSTORE_destroy_record (struct GNUNET_PEERSTORE_Record *record); |
81 | |||
82 | /* end of peerstore_common.h */ | ||