2 This file is part of GNUnet
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
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file peerstore/peerstore_common.h
23 * @brief Helper peerstore functions
24 * @author Omar Tarabai
27 #include "peerstore.h"
30 * PEERSTORE single record
32 struct GNUNET_PEERSTORE_Record
36 * Responsible sub system string
43 struct GNUNET_PeerIdentity *peer;
63 struct GNUNET_TIME_Relative lifetime;
68 * Creates a record message ready to be sent
70 * @param sub_system sub system string
71 * @param peer Peer identity (can be NULL)
72 * @param key record key string (can be NULL)
73 * @param value record value BLOB (can be NULL)
74 * @param value_size record value size in bytes (set to 0 if value is NULL)
75 * @param lifetime relative time after which the record expires
76 * @return pointer to record message struct
78 struct StoreRecordMessage *
79 PEERSTORE_create_record_message(const char *sub_system,
80 const struct GNUNET_PeerIdentity *peer,
84 struct GNUNET_TIME_Relative lifetime);
87 * Parses a message carrying a record
89 * @param message the actual message
90 * @return Pointer to record or NULL if error
92 struct GNUNET_PEERSTORE_Record *
93 PEERSTORE_parse_record_message(const struct GNUNET_MessageHeader *message);