REORG: include: move pipe.h to haproxy/pipe{,-t}.h

No change was needed beyond a minor cleanup.
This commit is contained in:
Willy Tarreau 2020-06-04 08:32:23 +02:00
parent ba2f73d40e
commit 551271d99c
12 changed files with 106 additions and 108 deletions

View File

@ -29,7 +29,7 @@
#include <proto/frontend.h>
#include <proto/listener.h>
#include <proto/http_htx.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <proto/proxy.h>
#include <proto/sample.h>
#include <proto/server.h>

43
include/haproxy/pipe-t.h Normal file
View File

@ -0,0 +1,43 @@
/*
* include/haproxy/pipe-t.h
* Pipe management - types definitions.
*
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _HAPROXY_PIPE_T_H
#define _HAPROXY_PIPE_T_H
/* A pipe is described by its read and write FDs, and the data remaining in it.
* The FDs are valid if there are data pending. The user is not allowed to
* change the FDs.
*/
struct pipe {
int data; /* number of bytes present in the pipe */
int prod; /* FD the producer must write to ; -1 if none */
int cons; /* FD the consumer must read from ; -1 if none */
struct pipe *next;
};
#endif /* _HAPROXY_PIPE_T_H */
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/

54
include/haproxy/pipe.h Normal file
View File

@ -0,0 +1,54 @@
/*
* include/haproxy/pipe.h
* Pipe management - exported functions
*
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _HAPROXY_PIPE_H
#define _HAPROXY_PIPE_H
#include <haproxy/api.h>
#include <haproxy/pipe-t.h>
extern int pipes_used; /* # of pipes in use (2 fds each) */
extern int pipes_free; /* # of pipes unused (2 fds each) */
/* return a pre-allocated empty pipe. Try to allocate one if there isn't any
* left. NULL is returned if a pipe could not be allocated.
*/
struct pipe *get_pipe();
/* destroy a pipe, possibly because an error was encountered on it. Its FDs
* will be closed and it will not be reinjected into the live pool.
*/
void kill_pipe(struct pipe *p);
/* put back a unused pipe into the live pool. If it still has data in it, it is
* closed and not reinjected into the live pool. The caller is not allowed to
* use it once released.
*/
void put_pipe(struct pipe *p);
#endif /* _HAPROXY_PIPE_H */
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/

View File

@ -1,54 +0,0 @@
/*
include/proto/pipe.h
Pipe management
Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1
exclusively.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PROTO_PIPE_H
#define _PROTO_PIPE_H
#include <haproxy/api.h>
#include <types/pipe.h>
extern int pipes_used; /* # of pipes in use (2 fds each) */
extern int pipes_free; /* # of pipes unused (2 fds each) */
/* return a pre-allocated empty pipe. Try to allocate one if there isn't any
* left. NULL is returned if a pipe could not be allocated.
*/
struct pipe *get_pipe();
/* destroy a pipe, possibly because an error was encountered on it. Its FDs
* will be closed and it will not be reinjected into the live pool.
*/
void kill_pipe(struct pipe *p);
/* put back a unused pipe into the live pool. If it still has data in it, it is
* closed and not reinjected into the live pool. The caller is not allowed to
* use it once released.
*/
void put_pipe(struct pipe *p);
#endif /* _PROTO_PIPE_H */
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/

View File

@ -1,45 +0,0 @@
/*
include/types/pipe.h
Pipe management.
Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1
exclusively.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _TYPES_PIPE_H
#define _TYPES_PIPE_H
#include <haproxy/api-t.h>
/* A pipe is described by its read and write FDs, and the data remaining in it.
* The FDs are valid if there are data pending. The user is not allowed to
* change the FDs.
*/
struct pipe {
int data; /* number of bytes present in the pipe */
int prod; /* FD the producer must write to ; -1 if none */
int cons; /* FD the consumer must read from ; -1 if none */
struct pipe *next;
};
#endif /* _TYPES_PIPE_H */
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/

View File

@ -53,7 +53,7 @@
#include <proto/frontend.h>
#include <proto/log.h>
#include <proto/pattern.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <haproxy/protocol.h>
#include <proto/listener.h>
#include <proto/map.h>

View File

@ -18,7 +18,7 @@
#include <import/ebistree.h>
#include <types/pipe.h>
#include <haproxy/pipe-t.h>
#include <types/proxy.h>
#include <types/session.h>

View File

@ -18,7 +18,7 @@
#include <haproxy/pool.h>
#include <types/global.h>
#include <types/pipe.h>
#include <haproxy/pipe-t.h>
DECLARE_STATIC_POOL(pool_head_pipe, "pipe", sizeof(struct pipe));

View File

@ -32,7 +32,7 @@
#include <haproxy/fd.h>
#include <haproxy/freq_ctr.h>
#include <proto/log.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <proto/raw_sock.h>
#include <proto/stream_interface.h>
#include <proto/task.h>

View File

@ -57,7 +57,7 @@
#include <proto/http_htx.h>
#include <proto/log.h>
#include <proto/pattern.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <proto/listener.h>
#include <proto/map.h>
#include <proto/proxy.h>

View File

@ -52,7 +52,7 @@
#include <proto/raw_sock.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <proto/http_ana.h>
#include <proto/proxy.h>
#include <proto/queue.h>

View File

@ -30,13 +30,13 @@
#include <proto/connection.h>
#include <proto/http_htx.h>
#include <proto/mux_pt.h>
#include <proto/pipe.h>
#include <haproxy/pipe.h>
#include <proto/proxy.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
#include <types/pipe.h>
#include <haproxy/pipe-t.h>
/* functions used by default on a detached stream-interface */
static void stream_int_shutr(struct stream_interface *si);