JULEA
jmessage.h
Go to the documentation of this file.
1 /*
2  * JULEA - Flexible storage framework
3  * Copyright (C) 2010-2024 Michael Kuhn
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
23 #ifndef JULEA_MESSAGE_H
24 #define JULEA_MESSAGE_H
25 
26 #if !defined(JULEA_H) && !defined(JULEA_COMPILATION)
27 #error "Only <julea.h> can be included directly."
28 #endif
29 
30 #include <glib.h>
31 #include <gio/gio.h>
32 
33 G_BEGIN_DECLS
34 
42 {
66 };
67 
68 typedef enum JMessageType JMessageType;
69 
70 struct JMessage;
71 
72 typedef struct JMessage JMessage;
73 
74 G_END_DECLS
75 
76 #include <core/jsemantics.h>
77 
78 G_BEGIN_DECLS
79 
91 JMessage* j_message_new(JMessageType op_type, gsize length);
92 
104 
118 JMessage* j_message_ref(JMessage* message);
119 
129 void j_message_unref(JMessage* message);
130 
131 G_DEFINE_AUTOPTR_CLEANUP_FUNC(JMessage, j_message_unref)
132 
133 
144 
155 guint32 j_message_get_count(JMessage const* message);
156 
168 gboolean j_message_append_1(JMessage* message, gconstpointer data);
169 
182 gboolean j_message_append_4(JMessage* message, gconstpointer data);
183 
196 gboolean j_message_append_8(JMessage* message, gconstpointer data);
197 
213 gboolean j_message_append_n(JMessage* message, gconstpointer data, gsize length);
214 
229 gboolean j_message_append_string(JMessage* message, gchar const* str);
230 
241 gchar j_message_get_1(JMessage* message);
242 
254 gint32 j_message_get_4(JMessage* message);
255 
267 gint64 j_message_get_8(JMessage* message);
268 
280 gpointer j_message_get_n(JMessage* message, gsize length);
281 
292 gchar const* j_message_get_string(JMessage* message);
293 
305 gboolean j_message_send(JMessage* message, gpointer stream);
306 
318 gboolean j_message_receive(JMessage* message, gpointer stream);
319 
331 gboolean j_message_read(JMessage* message, GInputStream* stream);
332 
344 gboolean j_message_write(JMessage* message, GOutputStream* stream);
345 
356 void j_message_add_send(JMessage* message, gconstpointer data, guint64 length);
357 
367 void j_message_add_operation(JMessage* message, gsize length);
368 
378 void j_message_set_semantics(JMessage* message, JSemantics* semantics);
379 
391 
396 G_END_DECLS
397 
398 #endif
gint64 j_message_get_8(JMessage *message)
Definition: jmessage.c:541
gboolean j_message_append_string(JMessage *message, gchar const *str)
Definition: jmessage.c:497
gint32 j_message_get_4(JMessage *message)
Definition: jmessage.c:524
void j_message_set_semantics(JMessage *message, JSemantics *semantics)
Definition: jmessage.c:755
JMessage * j_message_ref(JMessage *message)
Definition: jmessage.c:346
void j_message_unref(JMessage *message)
Definition: jmessage.c:358
gchar j_message_get_1(JMessage *message)
Definition: jmessage.c:508
gboolean j_message_append_n(JMessage *message, gconstpointer data, gsize length)
Definition: jmessage.c:477
JMessageType
Definition: jmessage.h:42
gchar const * j_message_get_string(JMessage *message)
Definition: jmessage.c:574
JMessage * j_message_new_reply(JMessage *message)
Definition: jmessage.c:320
gboolean j_message_append_1(JMessage *message, gconstpointer data)
Definition: jmessage.c:413
JSemantics * j_message_get_semantics(JMessage *message)
Definition: jmessage.c:792
void j_message_add_operation(JMessage *message, gsize length)
Definition: jmessage.c:740
gboolean j_message_append_4(JMessage *message, gconstpointer data)
Definition: jmessage.c:433
guint32 j_message_get_count(JMessage const *message)
Definition: jmessage.c:398
gboolean j_message_append_8(JMessage *message, gconstpointer data)
Definition: jmessage.c:455
void j_message_add_send(JMessage *message, gconstpointer data, guint64 length)
Definition: jmessage.c:722
gboolean j_message_write(JMessage *message, GOutputStream *stream)
Definition: jmessage.c:669
gboolean j_message_read(JMessage *message, GInputStream *stream)
Definition: jmessage.c:625
gboolean j_message_send(JMessage *message, gpointer stream)
Definition: jmessage.c:603
gboolean j_message_receive(JMessage *message, gpointer stream)
Definition: jmessage.c:589
gpointer j_message_get_n(JMessage *message, gsize length)
Definition: jmessage.c:558
G_END_DECLS G_BEGIN_DECLS JMessage * j_message_new(JMessageType op_type, gsize length)
Definition: jmessage.c:290
JMessageType j_message_get_type(JMessage const *message)
Definition: jmessage.c:383
@ J_MESSAGE_OBJECT_GET_ALL
Definition: jmessage.h:48
@ J_MESSAGE_KV_GET_ALL
Definition: jmessage.h:57
@ J_MESSAGE_DB_INSERT
Definition: jmessage.h:62
@ J_MESSAGE_DB_SCHEMA_CREATE
Definition: jmessage.h:59
@ J_MESSAGE_OBJECT_READ
Definition: jmessage.h:50
@ J_MESSAGE_OBJECT_DELETE
Definition: jmessage.h:47
@ J_MESSAGE_STATISTICS
Definition: jmessage.h:45
@ J_MESSAGE_DB_SCHEMA_GET
Definition: jmessage.h:60
@ J_MESSAGE_OBJECT_CREATE
Definition: jmessage.h:46
@ J_MESSAGE_PING
Definition: jmessage.h:44
@ J_MESSAGE_OBJECT_WRITE
Definition: jmessage.h:53
@ J_MESSAGE_DB_QUERY
Definition: jmessage.h:65
@ J_MESSAGE_NONE
Definition: jmessage.h:43
@ J_MESSAGE_DB_SCHEMA_DELETE
Definition: jmessage.h:61
@ J_MESSAGE_KV_GET
Definition: jmessage.h:56
@ J_MESSAGE_OBJECT_SYNC
Definition: jmessage.h:52
@ J_MESSAGE_KV_GET_BY_PREFIX
Definition: jmessage.h:58
@ J_MESSAGE_KV_PUT
Definition: jmessage.h:54
@ J_MESSAGE_KV_DELETE
Definition: jmessage.h:55
@ J_MESSAGE_DB_UPDATE
Definition: jmessage.h:63
@ J_MESSAGE_OBJECT_GET_BY_PREFIX
Definition: jmessage.h:49
@ J_MESSAGE_OBJECT_STATUS
Definition: jmessage.h:51
@ J_MESSAGE_DB_DELETE
Definition: jmessage.h:64
Definition: jmessage.c:121
gchar * data
Definition: jmessage.c:135
Definition: jsemantics.c:42