aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_contact.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_contact.h')
-rw-r--r--src/messenger/gnunet-service-messenger_contact.h112
1 files changed, 0 insertions, 112 deletions
diff --git a/src/messenger/gnunet-service-messenger_contact.h b/src/messenger/gnunet-service-messenger_contact.h
deleted file mode 100644
index 4a4f8bf0f..000000000
--- a/src/messenger/gnunet-service-messenger_contact.h
+++ /dev/null
@@ -1,112 +0,0 @@
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 */
20/**
21 * @author Tobias Frisch
22 * @file src/messenger/gnunet-service-messenger_contact.h
23 * @brief GNUnet MESSENGER service
24 */
25
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"
31#include "gnunet_identity_service.h"
32
33struct GNUNET_MESSENGER_SrvContact
34{
35 char *name;
36 size_t rc;
37
38 struct GNUNET_IDENTITY_PublicKey public_key;
39};
40
41/**
42 * Creates and allocates a new contact with a given public <i>key</i> from an EGO.
43 *
44 * @param key Public key
45 * @return New contact
46 */
47struct GNUNET_MESSENGER_SrvContact*
48create_contact (const struct GNUNET_IDENTITY_PublicKey *key);
49
50/**
51 * Destroys a contact and frees its memory fully.
52 *
53 * @param contact Contact
54 */
55void
56destroy_contact (struct GNUNET_MESSENGER_SrvContact *contact);
57
58/**
59 * Returns the current name of a given <i>contact</i> or NULL if no valid name was assigned yet.
60 *
61 * @param contact Contact
62 * @return Name of the contact or NULL
63 */
64const char*
65get_contact_name (const struct GNUNET_MESSENGER_SrvContact *contact);
66
67/**
68 * Changes the current name of a given <i>contact</i> by copying it from the parameter <i>name</i>.
69 *
70 * @param contact Contact
71 * @param name Valid name (may not be NULL!)
72 */
73void
74set_contact_name (struct GNUNET_MESSENGER_SrvContact *contact, const char *name);
75
76/**
77 * Returns the public key of a given <i>contact</i>.
78 *
79 * @param contact Contact
80 * @return Public key of the contact
81 */
82const struct GNUNET_IDENTITY_PublicKey*
83get_contact_key (const struct GNUNET_MESSENGER_SrvContact *contact);
84
85/**
86 * Increases the reference counter of a given <i>contact</i> which is zero as default.
87 *
88 * @param contact Contact
89 */
90void
91increase_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact);
92
93/**
94 * Decreases the reference counter if possible (can not underflow!) of a given <i>contact</i>
95 * and returns GNUNET_YES if the counter is equal to zero, otherwise GNUNET_NO.
96 *
97 * @param contact Contact
98 * @return GNUNET_YES or GNUNET_NO depending on the reference counter
99 */
100int
101decrease_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact);
102
103/**
104 * Returns the resulting hashcode of the public key from a given <i>contact</i>.
105 *
106 * @param contact Contact
107 * @return Hash of the contacts public key
108 */
109const struct GNUNET_HashCode*
110get_contact_id_from_key (const struct GNUNET_MESSENGER_SrvContact *contact);
111
112#endif //GNUNET_SERVICE_MESSENGER_CONTACT_H