2017-02-23 19:17:39 +01:00
|
|
|
/* *****************************************************************************
|
|
|
|
* 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/>.
|
|
|
|
* ************************************************************************** */
|
2017-01-04 16:14:37 +01:00
|
|
|
#ifndef LIBP7_SERVER_H
|
|
|
|
# define LIBP7_SERVER_H
|
2017-01-19 12:59:20 +01:00
|
|
|
# include <libp7.h>
|
|
|
|
# ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
# endif
|
2017-01-04 16:14:37 +01:00
|
|
|
|
2017-03-24 16:03:27 +01:00
|
|
|
/* 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 */
|
|
|
|
|
2017-03-27 14:45:48 +02:00
|
|
|
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);
|
2017-03-24 16:03:27 +01:00
|
|
|
|
|
|
|
/* And here is the function for serving a 'classical' server: */
|
2017-01-04 16:14:37 +01:00
|
|
|
|
2017-03-23 15:39:47 +01:00
|
|
|
extern int p7_serve(p7_handle_t *handle, p7_server_t *info,
|
2017-01-16 13:38:11 +01:00
|
|
|
p7_filesystem_t *filesystems);
|
2017-01-04 16:14:37 +01:00
|
|
|
|
2017-01-19 12:59:20 +01:00
|
|
|
# ifdef __cplusplus
|
|
|
|
}
|
|
|
|
# endif
|
2017-01-04 16:14:37 +01:00
|
|
|
#endif /* LIBP7_SERVER_H */
|