48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
/* *****************************************************************************
|
|
* libp7/server.h -- libp7 server header.
|
|
* Copyright (C) 2016-2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
|
|
*
|
|
* This file is part of libp7.
|
|
* libp7 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; either version 3.0 of the License,
|
|
* or (at your option) any later version.
|
|
*
|
|
* libp7 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 libp7; if not, see <http://www.gnu.org/licenses/>.
|
|
* ************************************************************************** */
|
|
#ifndef LIBP7_SERVER_H
|
|
# define LIBP7_SERVER_H
|
|
# include <libp7.h>
|
|
# ifdef __cplusplus
|
|
extern "C" {
|
|
# endif
|
|
|
|
/* libp7 allow you to be a server. There are different levels:
|
|
* - one level where you answer to the command and roleswap directly;
|
|
* - one level where libp7 answers to the commands, using your callbacks
|
|
* and information (more appropriate for making a classical calculator
|
|
* server).
|
|
*
|
|
* Here is the function for serving directly: TODO */
|
|
|
|
typedef int (*p7_server_callback_t)(void *cookie, p7_handle_t *handle);
|
|
|
|
extern int p7_serve_directly(p7_handle_t *handle,
|
|
p7_server_callback_t *callbacks, void *cookie);
|
|
|
|
/* And here is the function for serving a 'classical' server: */
|
|
|
|
extern int p7_serve(p7_handle_t *handle, p7_server_t *info,
|
|
p7_filesystem_t *filesystems);
|
|
|
|
# ifdef __cplusplus
|
|
}
|
|
# endif
|
|
#endif /* LIBP7_SERVER_H */
|