/* * This file is part of the Owl Positioning System (OwlPS). * OwlPS is a project of the University of Franche-Comte * (Université de Franche-Comté), France. * * Copyright © Université de Franche-Comté 2007-2012. * * Corresponding author: Matteo Cypriani * *********************************************************************** * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/or redistribute the software under the terms of the CeCILL * license as circulated by CEA, CNRS and INRIA at the following URL: * http://www.cecill.info * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided * only with a limited warranty and the software's authors, the holder * of the economic rights, and the successive licensors have only * limited liability. * * In this respect, the user's attention is drawn to the risks * associated with loading, using, modifying and/or developing or * reproducing the software by the user in light of its specific status * of free software, that may mean that it is complicated to manipulate, * and that also therefore means that it is reserved for developers and * experienced professionals having in-depth computer knowledge. Users * are therefore encouraged to load and test the software's suitability * as regards their requirements in conditions enabling the security of * their systems and/or data to be ensured and, more generally, to use * and operate it in the same conditions as regards security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL license and that you accept its terms. * *********************************************************************** * * This is the header file of OwlPS UDP-to-HTTP. */ #ifndef _OWLPS_UDP_TO_HTTP_H_ #define _OWLPS_UDP_TO_HTTP_H_ #include #define TCP_PORT 8080 #define NB_CONNECTIONS 1 #define CLIENT_MESSAGE_STRLEN 2500 #define CLIENT_REQUEST_STRLEN 21 #define SIMPLE_RESULTS_ID 1 #define SIMPLE_RESULTS_REQUEST "ReadSimpleResults" #define SIMPLE_RESULTS_ANSWER "SimpleResults" #define RESULTS_ID 2 #define RESULTS_REQUEST "ReadResults" #define RESULTS_ANSWER "Results" #ifndef OWLPS_VERSION # define OWLPS_VERSION "unknown version" #endif // OWLPS_VERSION #define ANSWER_HDR \ "HTTP/1.1 200 OK\n" \ "Date: Sat, 01 Jan 0001 00:00:01 GMT\n" \ "Server: OwlPS UDP-to-HTTP ["OWLPS_VERSION"]\n" \ "Access-Control-Allow-Origin: *\n" \ "Connection: close\n" \ "Content-Type: text/html\n" \ "\n" #define ANSWER_HDR_STRLEN strlen(ANSWER_HDR) typedef struct _results_list { owl_result *result ; struct _results_list *next ; } results_list ; int receive_udp(void) ; void store_result(owl_result *result) ; int init_tcp_socket(void) ; void* tcp_server(void *NULL_value) ; int extract_request_from_message(char client_request[CLIENT_REQUEST_STRLEN], char *client_message) ; void prepare_answer(int request_id) ; void realloc_answer(size_t new_size) ; void free_results_list(void) ; #endif // _OWLPS_UDP_TO_HTTP_H_