3 * Copyright (C) 2009 Martin 'povik' Poviser (martin.povik@gmail.com)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU 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.
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 General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #define PIPE_BUFFER_PART_SIZE 128
26 #define FD_PIPE 0x1000
28 typedef struct pipe_buffer
{
29 BYTE buffer
[PIPE_BUFFER_PART_SIZE
];
30 struct pipe_buffer
*next
, *prev
;
34 pipe_buffer_t
*buffer_list_start
;
35 pipe_buffer_t
*buffer_list_end
;
36 unsigned int buffer_start_pos
;
37 unsigned int buffer_end_len
;
39 struct pipe
*next
, *prev
;
42 pipe_t
*pipe_get (int fd
);
43 void pipe_close (int fd
);
44 int pipe_write (pipe_t
*p
, BYTE
*buffer
, unsigned int buffer_len
);
45 int pipe_read (pipe_t
*p
, BYTE
*buffer
, unsigned int buffer_len
);
46 int pipe (int fds
[2]);