/* * This file is part of the Owl Positioning System (OwlPS) project. * It is subject to the copyright notice and license terms in the * COPYRIGHT.t2t file found in the top-level directory of this * distribution and at * https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t * No part of the OwlPS Project, including this file, may be copied, * modified, propagated, or distributed except according to the terms * contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be * distributed along with this file, either separately or by replacing * this notice by the COPYRIGHT.t2t file's contents. * *********************************************************************** * * This is the header file of OwlPS UDP-to-HTTP. */ #ifndef _OWLPS_UDP_TO_HTTP_H_ #define _OWLPS_UDP_TO_HTTP_H_ #include /* Arguments & program configuration */ #define OPTIONS "hl:qt:vV" // getopt string #define DEFAULT_HTTP_PORT 8080 #define DEFAULT_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" #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 ; void parse_command_line(const int argc, char *const *argv) ; void parse_options(const int argc, char *const *argv) ; void check_configuration(void) ; void print_configuration(void) ; int receive_udp(void) ; void store_result(owl_result *const result) ; int init_tcp_socket(void) ; void* tcp_server(void *const NULL_value) ; int extract_request_from_message(char client_request[CLIENT_REQUEST_STRLEN], const char *const client_message) ; void prepare_answer(const int request_id) ; void realloc_answer(const size_t new_size) ; void free_results_list(void) ; void print_usage(void) ; void print_version(void) ; #endif // _OWLPS_UDP_TO_HTTP_H_