GNUnet  0.11.x
gnunet-service-messenger_contact.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2020 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #ifndef GNUNET_SERVICE_MESSENGER_CONTACT_H
27 #define GNUNET_SERVICE_MESSENGER_CONTACT_H
28 
29 #include "platform.h"
30 #include "gnunet_crypto_lib.h"
32 
34 {
35  char *name;
36  size_t rc;
37 
39 };
40 
49 
55 void
57 
64 const char*
65 get_contact_name (const struct GNUNET_MESSENGER_SrvContact *contact);
66 
73 void
74 set_contact_name (struct GNUNET_MESSENGER_SrvContact *contact, const char *name);
75 
82 const struct GNUNET_IDENTITY_PublicKey*
83 get_contact_key (const struct GNUNET_MESSENGER_SrvContact *contact);
84 
90 void
92 
100 int
102 
109 const struct GNUNET_HashCode*
111 
112 #endif //GNUNET_SERVICE_MESSENGER_CONTACT_H
const struct GNUNET_HashCode * get_contact_id_from_key(const struct GNUNET_MESSENGER_SrvContact *contact)
Returns the resulting hashcode of the public key from a given contact.
const struct GNUNET_IDENTITY_PublicKey * get_contact_key(const struct GNUNET_MESSENGER_SrvContact *contact)
Returns the public key of a given contact.
cryptographic primitives for GNUnet
A 512-bit hashcode.
int decrease_contact_rc(struct GNUNET_MESSENGER_SrvContact *contact)
Decreases the reference counter if possible (can not underflow!) of a given contact and returns GNUNE...
struct GNUNET_HashCode key
The key used in the DHT.
const char * get_contact_name(const struct GNUNET_MESSENGER_SrvContact *contact)
Returns the current name of a given contact or NULL if no valid name was assigned yet...
struct GNUNET_IDENTITY_PublicKey public_key
An identity key as per LSD0001.
void increase_contact_rc(struct GNUNET_MESSENGER_SrvContact *contact)
Increases the reference counter of a given contact which is zero as default.
void set_contact_name(struct GNUNET_MESSENGER_SrvContact *contact, const char *name)
Changes the current name of a given contact by copying it from the parameter name.
void destroy_contact(struct GNUNET_MESSENGER_SrvContact *contact)
Destroys a contact and frees its memory fully.
struct GNUNET_MESSENGER_SrvContact * create_contact(const struct GNUNET_IDENTITY_PublicKey *key)
Creates and allocates a new contact with a given public key from an EGO.