2007-10-16 10:25:14 +00:00
|
|
|
/*
|
|
|
|
include/proto/protocols.h
|
|
|
|
This file declares generic protocol primitives.
|
|
|
|
|
|
|
|
Copyright (C) 2000-2007 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_PROTOCOLS_H
|
|
|
|
#define _PROTO_PROTOCOLS_H
|
|
|
|
|
|
|
|
#include <types/protocols.h>
|
|
|
|
|
2007-10-28 20:59:24 +00:00
|
|
|
/* This function adds the specified listener's file descriptor to the polling
|
|
|
|
* lists if it is in the LI_LISTEN state. The listener enters LI_READY or
|
|
|
|
* LI_FULL state depending on its number of connections.
|
|
|
|
*/
|
|
|
|
void enable_listener(struct listener *listener);
|
|
|
|
|
|
|
|
/* This function removes the specified listener's file descriptor from the
|
|
|
|
* polling lists if it is in the LI_READY or in the LI_FULL state. The listener
|
|
|
|
* enters LI_LISTEN.
|
|
|
|
*/
|
|
|
|
void disable_listener(struct listener *listener);
|
|
|
|
|
|
|
|
/* This function adds all of the protocol's listener's file descriptors to the
|
|
|
|
* polling lists when they are in the LI_LISTEN state. It is intended to be
|
|
|
|
* used as a protocol's generic enable_all() primitive, for use after the
|
|
|
|
* fork(). It puts the listeners into LI_READY or LI_FULL states depending on
|
|
|
|
* their number of connections. It always returns ERR_NONE.
|
|
|
|
*/
|
|
|
|
int enable_all_listeners(struct protocol *proto);
|
|
|
|
|
|
|
|
/* This function removes all of the protocol's listener's file descriptors from
|
|
|
|
* the polling lists when they are in the LI_READY or LI_FULL states. It is
|
|
|
|
* intended to be used as a protocol's generic disable_all() primitive. It puts
|
|
|
|
* the listeners into LI_LISTEN, and always returns ERR_NONE.
|
|
|
|
*/
|
|
|
|
int disable_all_listeners(struct protocol *proto);
|
|
|
|
|
2007-10-28 21:13:50 +00:00
|
|
|
/* This function closes the listening socket for the specified listener,
|
|
|
|
* provided that it's already in a listening state. The listener enters the
|
|
|
|
* LI_ASSIGNED state. It always returns ERR_NONE. This function is intended
|
|
|
|
* to be used as a generic function for standard protocols.
|
|
|
|
*/
|
|
|
|
int unbind_listener(struct listener *listener);
|
|
|
|
|
2007-10-16 10:25:14 +00:00
|
|
|
/* Registers the protocol <proto> */
|
|
|
|
void protocol_register(struct protocol *proto);
|
|
|
|
|
|
|
|
/* Unregisters the protocol <proto>. Note that all listeners must have
|
|
|
|
* previously been unbound.
|
|
|
|
*/
|
|
|
|
void protocol_unregister(struct protocol *proto);
|
|
|
|
|
|
|
|
/* binds all listeneres of all registered protocols. Returns a composition
|
|
|
|
* of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
|
|
|
|
*/
|
|
|
|
int protocol_bind_all(void);
|
|
|
|
|
|
|
|
/* unbinds all listeners of all registered protocols. They are also closed.
|
|
|
|
* This must be performed before calling exit() in order to get a chance to
|
|
|
|
* remove file-system based sockets and pipes.
|
|
|
|
* Returns a composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
|
|
|
|
*/
|
|
|
|
int protocol_unbind_all(void);
|
|
|
|
|
|
|
|
/* enables all listeners of all registered protocols. This is intended to be
|
|
|
|
* used after a fork() to enable reading on all file descriptors. Returns a
|
|
|
|
* composition of ERR_NONE, ERR_RETRYABLE, ERR_FATAL.
|
|
|
|
*/
|
|
|
|
int protocol_enable_all(void);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _PROTO_PROTOCOLS_H */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* c-indent-level: 8
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|