1 /*
2  * thread-pipe.h
3  *
4  *
5  * Authors:
6  *  Michi <st101564@stud.uni-stuttgart.de>
7  *
8  * Web page: https://ahoi.io/project/oregano
9  *
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of the
14  * License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this program; if not, write to the
23  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24  * Boston, MA 02110-1301, USA.
25  */
26 
27 #ifndef THREAD_PIPE_H_
28 #define THREAD_PIPE_H_
29 
30 #define THREAD_PIPE_MAX_BUFFER_BLOCK_COUNTER_DEFAULT 20
31 #define THREAD_PIPE_MAX_BUFFER_SIZE_TOTAL_DEFAULT 2048
32 
33 typedef struct _ThreadPipe ThreadPipe;
34 
35 /**
36  * Constructor
37  */
38 ThreadPipe *thread_pipe_new(
39 		guint max_buffer_block_counter,
40 		gsize max_buffer_size_total);
41 
42 /**
43  * functions for writing thread
44  */
45 gboolean thread_pipe_push(ThreadPipe *pipe, gpointer data, gsize size);
46 // Destructor
47 void thread_pipe_set_write_eof(ThreadPipe *pipe);
48 
49 /**
50  * functions for reading thread
51  */
52 ThreadPipe *thread_pipe_pop(ThreadPipe *pipe, gpointer *data_out, gsize *size);
53 ThreadPipe *thread_pipe_pop_line(ThreadPipe *pipe, gchar **data_out, gsize *size);
54 // Destructor
55 void thread_pipe_set_read_eof(ThreadPipe *pipe);
56 
57 #endif /* THREAD_PIPE_H_ */
58