YAMI4 Core
core.h
1 // Copyright Maciej Sobczak 2008-2019.
2 // This file is part of YAMI4.
3 //
4 // YAMI4 is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // YAMI4 is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with YAMI4. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef YAMICORE_CORE_H_INCLUDED
18 #define YAMICORE_CORE_H_INCLUDED
19 
20 #include "channel_descriptor.h"
21 #include <cstddef>
22 
24 namespace yami
25 {
26 
28 namespace core
29 {
30 
32 enum result
33 {
34  ok,
48 };
49 
70 extern "C" typedef void (*incoming_message_dispatch_function)(
71  void * hint,
72  const char * source,
73  const char * header_buffers[],
74  std::size_t header_buffer_sizes[],
75  std::size_t num_of_header_buffers,
76  const char * body_buffers[],
77  std::size_t body_buffer_sizes[],
78  std::size_t num_of_body_buffers);
79 
90 extern "C" typedef void (*new_incoming_connection_function)(
91  void * hint,
92  const char * source,
93  std::size_t index, std::size_t sequence_number);
94 
103 extern "C" typedef void (*closed_connection_function)(
104  void * hint,
105  const char * name, result reason);
106 
121 extern "C" typedef void (*message_progress_function)(
122  void * hint,
123  std::size_t sent_bytes,
124  std::size_t total_byte_count);
125 
128 {
129  agent_closed, // (NULL, 0)
130  listener_added, // (target, 0)
131  listener_removed, // (target, 0)
132  incoming_connection_open, // (target, 0)
133  outgoing_connection_open, // (target, 0)
134  connection_closed, // (target, 0)
135  connection_error, // (target, 0)
136  message_sent, // (target, bytes)
137  message_received // (target, bytes)
138 };
139 
142 extern "C" typedef void (*event_notification_function)(
143  void * hint,
145  const char * str,
146  std::size_t size);
147 
149 extern "C" typedef void (*io_error_function)(
150  void * hint,
151  int error_code,
152  const char * description);
153 
154 } // namespace core
155 
156 } // namespace yami
157 
158 #endif // YAMICORE_CORE_H_INCLUDED
The expected type is different than the actual.
Definition: core.h:36
void(* closed_connection_function)(void *hint, const char *name, result reason)
Definition: core.h:103
void(* io_error_function)(void *hint, int error_code, const char *description)
Type of function callback for internal I/O error logging.
Definition: core.h:149
void(* message_progress_function)(void *hint, std::size_t sent_bytes, std::size_t total_byte_count)
Definition: core.h:121
Operation completed successfully.
Definition: core.h:34
void(* new_incoming_connection_function)(void *hint, const char *source, std::size_t index, std::size_t sequence_number)
Definition: core.h:90
Unable to perform the I/O operation.
Definition: core.h:44
The operation was not possible due to EOF.
Definition: core.h:46
The given object is in the wrong state.
Definition: core.h:47
Not enough memory.
Definition: core.h:38
event_notification
Type of internal event notification.
Definition: core.h:127
Namespace devoted for everything related to YAMI4.
Definition: agent.h:25
The nesting of parameters is too deep.
Definition: core.h:39
The given value was not recognized.
Definition: core.h:42
void(* incoming_message_dispatch_function)(void *hint, const char *source, const char *header_buffers[], std::size_t header_buffer_sizes[], std::size_t num_of_header_buffers, const char *body_buffers[], std::size_t body_buffer_sizes[], std::size_t num_of_body_buffers)
Definition: core.h:70
The given name was not found.
Definition: core.h:35
void(* event_notification_function)(void *hint, event_notification e, const char *str, std::size_t size)
Definition: core.h:142
Index out of range.
Definition: core.h:37
There are no entries.
Definition: core.h:41
The connection protocol is incorrect.
Definition: core.h:43
There is not enough space in the buffer.
Definition: core.h:40
The requested operation timed out.
Definition: core.h:45
result
General type for reporting success and error states.
Definition: core.h:32