blob: aec24380414fb24d9376e3cbaa2de808e11936a2 [file] [log] [blame]
Willy Tarreaudd815982007-10-16 12:25:14 +02001/*
2 include/proto/protocols.h
3 This file declares generic protocol primitives.
4
5 Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation, version 2.1
10 exclusively.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
22#ifndef _PROTO_PROTOCOLS_H
23#define _PROTO_PROTOCOLS_H
24
25#include <types/protocols.h>
26
27/* Registers the protocol <proto> */
28void protocol_register(struct protocol *proto);
29
30/* Unregisters the protocol <proto>. Note that all listeners must have
31 * previously been unbound.
32 */
33void protocol_unregister(struct protocol *proto);
34
35/* binds all listeneres of all registered protocols. Returns a composition
36 * of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
37 */
38int protocol_bind_all(void);
39
40/* unbinds all listeners of all registered protocols. They are also closed.
41 * This must be performed before calling exit() in order to get a chance to
42 * remove file-system based sockets and pipes.
43 * Returns a composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
44 */
45int protocol_unbind_all(void);
46
47/* enables all listeners of all registered protocols. This is intended to be
48 * used after a fork() to enable reading on all file descriptors. Returns a
49 * composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
50 */
51int protocol_enable_all(void);
52
53
54#endif /* _PROTO_PROTOCOLS_H */
55
56/*
57 * Local variables:
58 * c-indent-level: 8
59 * c-basic-offset: 8
60 * End:
61 */