Branch data Line data Source code
1 : : // SPDX-License-Identifier: GPL-3.0-or-later
2 : : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
3 : :
4 : : #pragma once
5 : :
6 : : #if !defined (VALENT_INSIDE) && !defined (VALENT_COMPILATION)
7 : : # error "Only <valent.h> can be included directly."
8 : : #endif
9 : :
10 : : #include <json-glib/json-glib.h>
11 : :
12 : : #include "../core/valent-context.h"
13 : :
14 : : G_BEGIN_DECLS
15 : :
16 : : #define VALENT_TYPE_CHANNEL (valent_channel_get_type())
17 : :
18 : : VALENT_AVAILABLE_IN_1_0
19 [ + - + - : 3056 : G_DECLARE_DERIVABLE_TYPE (ValentChannel, valent_channel, VALENT, CHANNEL, ValentObject)
+ - + - ]
20 : :
21 : : struct _ValentChannelClass
22 : : {
23 : : ValentObjectClass parent_class;
24 : :
25 : : /* virtual functions */
26 : : void (*download) (ValentChannel *channel,
27 : : JsonNode *packet,
28 : : GCancellable *cancellable,
29 : : GAsyncReadyCallback callback,
30 : : gpointer user_data);
31 : : GIOStream * (*download_finish) (ValentChannel *channel,
32 : : GAsyncResult *result,
33 : : GError **error);
34 : : void (*upload) (ValentChannel *channel,
35 : : JsonNode *packet,
36 : : GCancellable *cancellable,
37 : : GAsyncReadyCallback callback,
38 : : gpointer user_data);
39 : : GIOStream * (*upload_finish) (ValentChannel *channel,
40 : : GAsyncResult *result,
41 : : GError **error);
42 : :
43 : : /*< private >*/
44 : : gpointer padding[8];
45 : : };
46 : :
47 : :
48 : : VALENT_AVAILABLE_IN_1_0
49 : : GIOStream * valent_channel_ref_base_stream (ValentChannel *channel);
50 : : VALENT_AVAILABLE_IN_1_0
51 : : GTlsCertificate * valent_channel_ref_certificate (ValentChannel *channel);
52 : : VALENT_AVAILABLE_IN_1_0
53 : : JsonNode * valent_channel_get_identity (ValentChannel *channel);
54 : : VALENT_AVAILABLE_IN_1_0
55 : : GTlsCertificate * valent_channel_ref_peer_certificate (ValentChannel *channel);
56 : : VALENT_AVAILABLE_IN_1_0
57 : : JsonNode * valent_channel_get_peer_identity (ValentChannel *channel);
58 : : VALENT_AVAILABLE_IN_1_0
59 : : void valent_channel_download (ValentChannel *channel,
60 : : JsonNode *packet,
61 : : GCancellable *cancellable,
62 : : GAsyncReadyCallback callback,
63 : : gpointer user_data);
64 : : VALENT_AVAILABLE_IN_1_0
65 : : GIOStream * valent_channel_download_finish (ValentChannel *channel,
66 : : GAsyncResult *result,
67 : : GError **error);
68 : : VALENT_AVAILABLE_IN_1_0
69 : : void valent_channel_upload (ValentChannel *channel,
70 : : JsonNode *packet,
71 : : GCancellable *cancellable,
72 : : GAsyncReadyCallback callback,
73 : : gpointer user_data);
74 : : VALENT_AVAILABLE_IN_1_0
75 : : GIOStream * valent_channel_upload_finish (ValentChannel *channel,
76 : : GAsyncResult *result,
77 : : GError **error);
78 : : VALENT_AVAILABLE_IN_1_0
79 : : void valent_channel_read_packet (ValentChannel *channel,
80 : : GCancellable *cancellable,
81 : : GAsyncReadyCallback callback,
82 : : gpointer user_data);
83 : : VALENT_AVAILABLE_IN_1_0
84 : : JsonNode * valent_channel_read_packet_finish (ValentChannel *channel,
85 : : GAsyncResult *result,
86 : : GError **error);
87 : : VALENT_AVAILABLE_IN_1_0
88 : : void valent_channel_write_packet (ValentChannel *channel,
89 : : JsonNode *packet,
90 : : GCancellable *cancellable,
91 : : GAsyncReadyCallback callback,
92 : : gpointer user_data);
93 : : VALENT_AVAILABLE_IN_1_0
94 : : gboolean valent_channel_write_packet_finish (ValentChannel *channel,
95 : : GAsyncResult *result,
96 : : GError **error);
97 : : VALENT_AVAILABLE_IN_1_0
98 : : gboolean valent_channel_close (ValentChannel *channel,
99 : : GCancellable *cancellable,
100 : : GError **error);
101 : : VALENT_AVAILABLE_IN_1_0
102 : : void valent_channel_close_async (ValentChannel *channel,
103 : : GCancellable *cancellable,
104 : : GAsyncReadyCallback callback,
105 : : gpointer user_data);
106 : : VALENT_AVAILABLE_IN_1_0
107 : : gboolean valent_channel_close_finish (ValentChannel *channel,
108 : : GAsyncResult *result,
109 : : GError **error);
110 : :
111 : : G_END_DECLS
112 : :
|