|
RCube
Rcube Rest Server calculates sail routes based on Grib files and sailing boat polar files
|
#include <stdbool.h>#include <dirent.h>#include <errno.h>#include <stdarg.h>#include <time.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <unistd.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <limits.h>#include <locale.h>#include "glibwrapper.h"#include "r3types.h"#include "r3util.h"#include "engine.h"#include "grib.h"#include "readgriball.h"#include "polar.h"#include "inline.h"#include "option.h"#include <sys/stat.h>#include <fcntl.h>#include <signal.h>
Go to the source code of this file.
Data Structures | |
| struct | ClientRequest |
| Client Request description. More... | |
| struct | FileInfo |
| Structure to store file information. More... | |
Macros | |
| #define | SYNOPSYS "<port> | -<option> [<parameter file>]" |
| RCube is a routing software for sailing. | |
| #define | MAX_SIZE_REQUEST 2048 |
| #define | MAX_SIZE_RESOURCE_NAME 256 |
| #define | PATTERN "GFS" |
| #define | MAX_SIZE_FEED_BACK 1024 |
| #define | ADMIN_LEVEL 10 |
| #define | BIG_BUFFER_SIZE (300*MILLION) |
| #define | MAX_SIZE_MESS 100000 |
| #define | GPX_ROUTE_FILE_NAME "gpxroute.tmp" |
Enumerations | |
| enum | { REQ_KILL = -1793 , REQ_TEST = 0 , REQ_ROUTING = 1 , REQ_COORD = 2 , REQ_FORBID = 3 , REQ_POLAR = 4 , REQ_GRIB = 5 , REQ_DIR = 6 , REQ_PAR_RAW = 7 , REQ_PAR_JSON = 8 , REQ_INIT = 9 , REQ_FEEDBACK = 10 , REQ_DUMP_FILE = 11 , REQ_NEAREST_PORT = 12 , REQ_MARKS = 13 , REQ_CHECK_GRIB = 14 , REQ_GPX_ROUTE = 15 , REQ_GRIB_DUMP = 16 } |
Functions | |
| static void | polygonToJson (MyPolygon *po, char *str, size_t maxLen) |
| Generate Json array for polygon. | |
| static bool | updateWindGrib (ClientRequest *clientReq, char *checkMessage, size_t maxLen) |
| update Grib file if required | |
| static bool | updateCurrentGrib (ClientRequest *clientReq, char *checkMessage, size_t maxLen) |
| update current file if required | |
| static double | approxSegmentLengthNm (double lat0, double lon0, double lat1, double lon1) |
| Approximate great-circle segment length in nautical miles. | |
| static bool | segmentOverSea (double lat0, double lon0, double lat1, double lon1) |
| Check if the straight segment between (lat0, lon0) and (lat1, lon1) stays entirely over allowed sea areas. | |
| static int | checkRoute (const SailRoute *route) |
| Check that every consecutive segment of a route is fully over sea. | |
| static void | forbidToJson (char *res, size_t maxLen) |
| Exclusion zone is an array of polygons. | |
| static char * | isochronesToStrCatJson (char *res, size_t maxLen) |
| generate json description of isochrones. | |
| static char * | isoDescToStrCatJson (char *res, size_t maxLen) |
| generate json description of isochrones decriptor. | |
| static char * | routeToJson (SailRoute *route, bool isoc, bool isoDesc, char *res, size_t maxLen) |
| generate json description of track boats | |
| static double | round4 (double x) |
| static void | infoCoordToJson (double lat, double lon, ClientRequest *clientReq, char *res, size_t maxLen) |
| information associated to coord (lat lon) isSea, isSeaTolerant, grib wind and current | |
| static bool | getRealIPAddress (const char *headers, char *clientAddress, size_t bufferSize) |
| Retrieves the real client IP address from HTTP headers. | |
| static char * | extractUserAgent (const char *saveBuffer) |
| extract user agent | |
| static int | extractLevel (const char *buffer) |
| extract level | |
| static bool | allowedLevel (ClientRequest *clientReq) |
| compare level of authorization with request | |
| static int | compareByName (const void *a, const void *b) |
| Comparator to sort by name (ascending order) | |
| static int | compareByMtime (const void *a, const void *b) |
| Comparator to sort by modification date (most recent first) | |
| static bool | matchFilter (const char *filename, const char **filter) |
| Checks if the filename matches one of the suffixes in the filter. | |
| static char * | nearestPortToStrJson (double lat, double lon, char *out, size_t maxLen) |
| return neareAst port to lat, lon | |
| static char * | jsonEscapeStrdup (const char *s) |
| Escape JSON string ; malloc(), to free() | |
| static char * | listDirToStrJson (char *root, char *dir, bool sortByName, const char *pattern, const char **filter, char *out, size_t maxLen) |
| static bool | initContext (const char *parameterFileName, const char *pattern) |
| Make initialization return false if readParam or readGribAll fail. | |
| static const char * | getCurrentDate () |
| date for logging | |
| static void | handleFeedbackRequest (const char *fileName, const char *date, const char *clientIPAddress, const char *string) |
| store feedback information | |
| static void | logRequest (const char *fileName, const char *date, int serverPort, const char *remote_addr, char *dataReq, const char *userAgent, ClientRequest *client, double duration) |
| log client Request side effect: dataReq is modified | |
| static bool | decodeHttpReq (const char *req, ClientRequest *clientReq) |
| decode request from client and fill ClientRequest structure return true if correct false if impossible to decode | |
| static bool | checkParamAndUpdate (ClientRequest *clientReq, char *checkMessage, size_t maxLen) |
| check validity of parameters | |
| static const char * | getMimeType (const char *path) |
| Translate extension in MIME type. | |
| static void | serveStaticFile (int client_socket, const char *requested_path) |
| serve static file | |
| int | memoryUsage (void) |
| Return the current memory usage (resident set size) in kilobytes. | |
| static char * | testToJson (int serverPort, const char *clientIP, const char *userAgent, int level, char *out, size_t maxLen) |
| Provide system information. | |
| void | sendBinaryResponse (int sock, const void *data, size_t len, const char *shortnames) |
| send over network binary data | |
| static void | buildInitialOfShortNameList (const Zone *zone, char *str, size_t len) |
| build list of short names. | |
| static bool | launchAction (int serverPort, int sock, ClientRequest *clientReq, const char *date, const char *clientIPAddress, const char *userAgent, char *outBuffer, size_t maxLen) |
| launch action and returns outBuffer after execution | |
| static int | sendAll (int fd, const void *buf, size_t len) |
| robust send | |
| static bool | handleClient (int serverPort, int clientFd, struct sockaddr_in *client_addr) |
| Handle client connection and launch actions. | |
| int | main (int argc, char *argv[]) |
| main server first argument (mandatory): port number second argument (optionnal): parameter file | |
Variables | |
| char * | bigBuffer = NULL |
| const char * | filter [] = {".csv", ".pol", ".grb", ".grb2", ".log", ".txt", ".par", ".yaml", ".json", NULL} |
| const int | typeLevel [16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
| char | parameterFileName [MAX_SIZE_FILE_NAME] |
| ClientRequest | clientReq |
| #define ADMIN_LEVEL 10 |
Definition at line 40 of file r3server.c.
| #define BIG_BUFFER_SIZE (300*MILLION) |
Definition at line 41 of file r3server.c.
| #define GPX_ROUTE_FILE_NAME "gpxroute.tmp" |
Definition at line 43 of file r3server.c.
| #define MAX_SIZE_FEED_BACK 1024 |
Definition at line 39 of file r3server.c.
| #define MAX_SIZE_MESS 100000 |
Definition at line 42 of file r3server.c.
| #define MAX_SIZE_REQUEST 2048 |
Definition at line 36 of file r3server.c.
| #define MAX_SIZE_RESOURCE_NAME 256 |
Definition at line 37 of file r3server.c.
| #define PATTERN "GFS" |
Definition at line 38 of file r3server.c.
| #define SYNOPSYS "<port> | -<option> [<parameter file>]" |
RCube is a routing software for sailing.
It computes the optimal route from a starting point (pOr) to a destination point (pDest) at a given START_TIME, using GRIB weather data and a boat polar diagram. to launch : r3server <port number> [parameter file]
Definition at line 35 of file r3server.c.
| anonymous enum |
Definition at line 50 of file r3server.c.
|
static |
compare level of authorization with request
Definition at line 579 of file r3server.c.
References ADMIN_LEVEL, clientReq, ClientRequest::level, ClientRequest::model, REQ_KILL, ClientRequest::type, and typeLevel.
Referenced by handleClient().

|
static |
Approximate great-circle segment length in nautical miles.
This function estimates the distance between two geographic points (lat0, lon0) and (lat1, lon1) in nautical miles (NM) using a local equirectangular projection. For routing validation this is accurate enough and cheaper than a full haversine.
Latitudes and longitudes are expressed in decimal degrees.
Definition at line 198 of file r3server.c.
References DEG_TO_RAD.
Referenced by segmentOverSea().

|
static |
build list of short names.
Only initials. Result can be uv, uvg, uvw, uvwg. uv mandatory. Response is false if not u and v
Definition at line 1262 of file r3server.c.
References isPresentGrib(), uvPresentGrib(), and zone.
Referenced by launchAction().


|
static |
check validity of parameters
Definition at line 973 of file r3server.c.
References Par::allwaysSea, Pp::amure, ClientRequest::boats, buildRootName(), clientReq, ClientRequest::cogStep, Par::cogStep, competitors, ClientRequest::constCurrentD, Par::constCurrentD, ClientRequest::constCurrentS, Par::constCurrentS, ClientRequest::constWave, Par::constWave, ClientRequest::constWindTwd, Par::constWindTwd, ClientRequest::constWindTws, Par::constWindTws, Zone::dataDate, Zone::dataTime, ClientRequest::dayEfficiency, Par::dayEfficiency, ClientRequest::epochStart, ClientRequest::forbid, g_path_get_basename(), g_strlcpy, gribDateTimeToEpoch(), Par::gribFileName, ClientRequest::gribName, hasSlash(), ClientRequest::initialAmure, isInZone(), isSeaTolerant(), ClientRequest::jFactor, Par::jFactor, ClientRequest::kFactor, Par::kFactor, ClientRequest::lat, Pp::lat, WayPoint::lat, Competitor::lat, Zone::latMax, Zone::latMin, ClientRequest::lon, Pp::lon, WayPoint::lon, Competitor::lon, Zone::lonLeft, Zone::lonRight, MAX, MAX_SIZE_DIR_NAME, MAX_SIZE_FILE_NAME, MAX_SIZE_NAME, ClientRequest::maxWind, Par::maxWind, ClientRequest::model, mostRecentFile(), ClientRequest::motorSpeed, Par::motorSpeed, WayPointList::n, CompetitorsList::n, ClientRequest::name, Competitor::name, name, ClientRequest::nBoats, ClientRequest::nightEfficiency, Par::nightEfficiency, ClientRequest::nSectors, Par::nSectors, Zone::nTimeStamp, ClientRequest::nWp, par, Par::pDest, ClientRequest::penalty0, Par::penalty0, ClientRequest::penalty1, Par::penalty1, ClientRequest::penalty2, Par::penalty2, Par::polarFileName, ClientRequest::polarName, polMat, Par::pOr, ClientRequest::rangeCog, Par::rangeCog, readPolar(), sailPolMat, ClientRequest::staminaVR, Par::staminaVR, Par::startTimeInHours, CompetitorsList::t, WayPointList::t, ClientRequest::threshold, Par::threshold, Zone::timeStamp, ClientRequest::timeStep, tIsSea, Par::tStep, updateCurrentGrib(), updateWindGrib(), Par::wavePolFileName, wavePolMat, ClientRequest::wavePolName, wayPoints, ClientRequest::withCurrent, Par::withCurrent, ClientRequest::withWaves, Par::withWaves, Par::workingDir, ClientRequest::wp, ClientRequest::xWind, Par::xWind, and zone.
Referenced by launchAction().


|
static |
Check that every consecutive segment of a route is fully over sea.
The route is assumed to be an ordered list of waypoints. For each pair of consecutive waypoints, segmentOverSea() is called. If any segment crosses land or a forbidden area, the function returns false.
| route | pointer to SailRoute. |
Definition at line 277 of file r3server.c.
References SailPoint::lat, SailPoint::lon, SailRoute::n, route, segmentOverSea(), and SailRoute::t.
Referenced by routeToJson().


|
static |
Comparator to sort by modification date (most recent first)
Definition at line 601 of file r3server.c.
References FileInfo::mtime, and FileInfo::name.
Referenced by listDirToStrJson().

|
static |
Comparator to sort by name (ascending order)
Definition at line 595 of file r3server.c.
References FileInfo::name.
Referenced by listDirToStrJson().

|
static |
decode request from client and fill ClientRequest structure return true if correct false if impossible to decode
Definition at line 858 of file r3server.c.
References ClientRequest::boats, clientReq, ClientRequest::cogStep, ClientRequest::constCurrentD, ClientRequest::constCurrentS, ClientRequest::constWave, ClientRequest::constWindTwd, ClientRequest::constWindTws, ClientRequest::currentGribName, ClientRequest::dayEfficiency, ClientRequest::dirName, ClientRequest::epochStart, ClientRequest::feedback, ClientRequest::fileName, ClientRequest::forbid, g_str_has_prefix(), g_strfreev(), g_strlcpy, g_strsplit(), g_strstrip(), ClientRequest::gribName, ClientRequest::initialAmure, ClientRequest::isoc, ClientRequest::isoDesc, ClientRequest::jFactor, ClientRequest::kFactor, ClientRequest::lat, ClientRequest::lon, MAX_N_COMPETITORS, MAX_N_WAY_POINT, MAX_SIZE_NAME, ClientRequest::maxWind, ClientRequest::model, ClientRequest::motorSpeed, ClientRequest::name, name, ClientRequest::nBoats, ClientRequest::nightEfficiency, ClientRequest::nSectors, ClientRequest::nWp, ClientRequest::penalty0, ClientRequest::penalty1, ClientRequest::penalty2, ClientRequest::polarName, ClientRequest::rangeCog, ClientRequest::sortByName, ClientRequest::staminaVR, ClientRequest::threshold, ClientRequest::timeStep, ClientRequest::type, ClientRequest::wavePolName, ClientRequest::withCurrent, ClientRequest::withWaves, ClientRequest::wp, and ClientRequest::xWind.
Referenced by handleClient().


|
static |
extract level
Definition at line 570 of file r3server.c.
References ADMIN_LEVEL, Par::authent, and par.
Referenced by handleClient().

|
static |
extract user agent
Definition at line 556 of file r3server.c.
Referenced by handleClient().

|
static |
Exclusion zone is an array of polygons.
Definition at line 286 of file r3server.c.
References forbidZones, Par::nForbidZone, par, and polygonToJson().
Referenced by launchAction().


|
static |
date for logging
Definition at line 813 of file r3server.c.
Referenced by handleClient().

|
static |
Translate extension in MIME type.
Definition at line 1115 of file r3server.c.
Referenced by serveStaticFile().

|
static |
Retrieves the real client IP address from HTTP headers.
| headers | A string containing the HTTP headers. |
| clientAddress | Buffer to store the client's IP address. |
| bufferSize | Size of the clientAddress buffer. |
Definition at line 530 of file r3server.c.
References g_strlcpy, and g_strstrip().
Referenced by handleClient().


|
static |
Handle client connection and launch actions.
Definition at line 1466 of file r3server.c.
References allowedLevel(), BIG_BUFFER_SIZE, bigBuffer, clientReq, decodeHttpReq(), extractLevel(), extractUserAgent(), g_strlcpy, getCurrentDate(), getRealIPAddress(), launchAction(), ClientRequest::level, Par::logFileName, logRequest(), MAX_SIZE_LINE, MAX_SIZE_REQUEST, monotonic(), par, sendAll(), and serveStaticFile().
Referenced by main().


|
static |
store feedback information
Definition at line 822 of file r3server.c.
Referenced by launchAction().

|
static |
information associated to coord (lat lon) isSea, isSeaTolerant, grib wind and current
Definition at line 485 of file r3server.c.
References clientReq, currentZone, Zone::dataDate, Zone::dataTime, findWindGrib(), gribDateTimeToEpoch(), Par::gribFileName, isInZone(), isSea(), isSeaTolerant(), MAX_SIZE_MESS, Zone::nTimeStamp, par, round4(), Zone::timeStamp, tIsSea, tMax, updateWindGrib(), and zone.
Referenced by launchAction().


|
static |
Make initialization
return false if readParam or readGribAll fail.
Definition at line 760 of file r3server.c.
References Par::currentGribFileName, currentZone, Zone::dataDate, Zone::dataTime, SailRoute::destinationReached, gribDateTimeToStr(), Par::gribFileName, hasSlash(), Par::isSeaFileName, MAX_SIZE_DIR_NAME, MAX_SIZE_LINE, MAX_SIZE_TEXT, mostRecentFile(), Par::mostRecentGrib, SailRoute::n, nIsoc, par, parameterFileName, Par::polarFileName, polMat, readGribAll(), readIsSea(), readParam(), readPolar(), route, sailPolMat, updateIsSeaWithForbiddenAreas(), Par::wavePolFileName, wavePolMat, Par::web, WIND, Par::workingDir, and zone.
Referenced by launchAction(), and main().


|
static |
generate json description of isochrones.
Concatenate it to res
Definition at line 302 of file r3server.c.
References Pp::father, IsoDesc::first, g_strlcat, Pp::id, isocArray, isoDesc, Pp::lat, Pp::lon, MAX_SIZE_ISOC, nIsoc, and IsoDesc::size.
Referenced by routeToJson().

|
static |
generate json description of isochrones decriptor.
Conatenate te description to res
Definition at line 343 of file r3server.c.
References g_strlcat, isoDesc, and nIsoc.
Referenced by routeToJson().

|
static |
Escape JSON string ; malloc(), to free()
Definition at line 631 of file r3server.c.
Referenced by listDirToStrJson().

|
static |
launch action and returns outBuffer after execution
Definition at line 1275 of file r3server.c.
References bigBuffer, ClientRequest::boats, buildInitialOfShortNameList(), buildRootName(), buildUVGWarray(), checkGribToStr(), checkParamAndUpdate(), clientReq, competitors, ClientRequest::currentGribName, ClientRequest::dirName, exportRouteToGpx(), ClientRequest::feedback, Par::feedbackFileName, ClientRequest::fileName, filter, forbidToJson(), g_strlcpy, GPX_ROUTE_FILE_NAME, ClientRequest::gribName, gribToStrJson(), handleFeedbackRequest(), hasSlash(), infoCoordToJson(), initContext(), ClientRequest::isoc, ClientRequest::isoDesc, ClientRequest::lat, ClientRequest::level, listDirToStrJson(), ClientRequest::lon, Par::marksFileName, MAX_SIZE_DIR_NAME, MAX_SIZE_FILE_NAME, MAX_SIZE_NAME, MAX_SIZE_TEXT, ClientRequest::model, mostRecentFile(), SailRoute::n, ClientRequest::nBoats, nearestPortToStrJson(), normalizeSpaces(), ClientRequest::nWp, par, parameterFileName, paramToStrJson(), PATTERN, Par::polarFileName, ClientRequest::polarName, polToStrJson(), readMarkCSVToJson(), readTextFile(), REQ_CHECK_GRIB, REQ_COORD, REQ_DIR, REQ_DUMP_FILE, REQ_FEEDBACK, REQ_FORBID, REQ_GPX_ROUTE, REQ_GRIB, REQ_GRIB_DUMP, REQ_INIT, REQ_KILL, REQ_MARKS, REQ_NEAREST_PORT, REQ_PAR_JSON, REQ_PAR_RAW, REQ_POLAR, REQ_ROUTING, REQ_TEST, SailRoute::ret, route, routeToJson(), ROUTING_ERROR, routingLaunch(), CompetitorsList::runIndex, sendBinaryResponse(), ClientRequest::sortByName, TEMP_FILE_NAME, testToJson(), tGribData, ClientRequest::type, updateCurrentGrib(), updateWindGrib(), WIND, Par::workingDir, ClientRequest::wp, writeParam(), and zone.
Referenced by handleClient().


|
static |
Lists the regular files in the directory constructed from root/dir, applies a pattern filter ans a suffix filter if provided, sorts the list either by name or by modification date (most recent first), and generates a JSON string containing an array of arrays in the format [filename, size, modification date].
In case of an error (e.g., unable to open the directory), the error is printed to the console and a corresponding JSON error response is returned.
Definition at line 675 of file r3server.c.
References compareByMtime(), compareByName(), filter, g_str_has_prefix(), g_strlcat, jsonEscapeStrdup(), matchFilter(), MAX_SIZE_LINE, FileInfo::mtime, FileInfo::name, name, and FileInfo::size.
Referenced by launchAction().


|
static |
log client Request side effect: dataReq is modified
Definition at line 834 of file r3server.c.
References g_strdelimit(), g_strlcpy, g_strstrip(), MAX_SIZE_LINE, and ClientRequest::type.
Referenced by handleClient().


| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
main server first argument (mandatory): port number second argument (optionnal): parameter file
Definition at line 1574 of file r3server.c.
References BIG_BUFFER_SIZE, bigBuffer, clientReq, CURRENT, g_strlcpy, handleClient(), initContext(), isocArray, isoDesc, monotonic(), optionManage(), parameterFileName, PARAMETERS_FILE, REQ_KILL, route, SYNOPSYS, SailRoute::t, tGribData, tIsSea, ClientRequest::type, and WIND.

|
static |
Checks if the filename matches one of the suffixes in the filter.
Definition at line 609 of file r3server.c.
References filter, and g_str_has_suffix().
Referenced by listDirToStrJson().


| int memoryUsage | ( | void | ) |
Return the current memory usage (resident set size) in kilobytes.
Definition at line 1187 of file r3server.c.
Referenced by testToJson().

|
static |
return neareAst port to lat, lon
Definition at line 620 of file r3server.c.
References MAX_SIZE_NAME, nearestPort(), par, and Par::tidesFileName.
Referenced by launchAction().


|
static |
Generate Json array for polygon.
Definition at line 125 of file r3server.c.
References Point::lat, Point::lon, MyPolygon::n, and MyPolygon::points.
Referenced by forbidToJson().

|
inlinestatic |
Definition at line 477 of file r3server.c.
Referenced by infoCoordToJson().

|
static |
generate json description of track boats
Definition at line 369 of file r3server.c.
References SailRoute::babordDist, SailRoute::calculationTime, checkRoute(), SailRoute::competitorIndex, competitors, Par::currentGribFileName, SailRoute::destinationReached, SailRoute::duration, SailPoint::father, fSailName(), fTwa(), SailPoint::g, g_path_get_basename(), g_strlcat, Par::gribFileName, SailPoint::id, isochronesToStrCatJson(), SailRoute::isocTimeStep, isoDesc, isoDescToStrCatJson(), SailRoute::lastPointInfo, SailRoute::lastStepDuration, SailRoute::lastStepWpDuration, SailPoint::lat, Zone::latMax, Zone::latMin, SailPoint::lCap, SailPoint::ld, LIMIT_SOG, SailPoint::lon, Zone::lonLeft, Zone::lonRight, MAX_SIZE_MESS, MAX_SIZE_NAME, SailPoint::motor, SailRoute::motorDist, SailRoute::n, Competitor::name, SailRoute::nAmureChange, SailRoute::nSailChange, SailRoute::nWayPoints, SailPoint::oCap, SailPoint::od, par, SailRoute::polarFileName, SailRoute::ret, route, SailPoint::sail, SailPoint::sog, SailPoint::stamina, CompetitorsList::t, SailRoute::t, SailPoint::time, SailPoint::toIndexWp, SailRoute::totDist, SailRoute::tribordDist, SailPoint::twd, SailPoint::tws, SailPoint::w, Par::wavePolFileName, and zone.
Referenced by launchAction().


|
static |
Check if the straight segment between (lat0, lon0) and (lat1, lon1) stays entirely over allowed sea areas.
The function samples intermediate points along the geodesic segment (approximated as a straight interpolation in lat/lon space) and calls isSea(lat, lon) on each sample.
Rationale:
Assumptions:
| lat0 | start latitude in decimal degrees |
| lon0 | start longitude in decimal degrees |
| lat1 | end latitude in decimal degrees |
| lon1 | end longitude in decimal degrees |
Definition at line 235 of file r3server.c.
References approxSegmentLengthNm(), CLAMP, isSea(), and tIsSea.
Referenced by checkRoute().


|
static |
robust send
Definition at line 1450 of file r3server.c.
Referenced by handleClient().

| void sendBinaryResponse | ( | int | sock, |
| const void * | data, | ||
| size_t | len, | ||
| const char * | shortnames | ||
| ) |
send over network binary data
Definition at line 1234 of file r3server.c.
Referenced by launchAction().

|
static |
serve static file
Definition at line 1131 of file r3server.c.
References getMimeType(), par, and Par::web.
Referenced by handleClient().


|
static |
Provide system information.
Definition at line 1205 of file r3server.c.
References currentZone, formatThousandSep(), gribReaderVersion(), MAX_SIZE_LINE, MAX_SIZE_TEXT_FILE, memoryUsage(), Zone::nbLat, Zone::nbLon, Zone::nTimeStamp, PROG_AUTHOR, PROG_NAME, PROG_VERSION, and zone.
Referenced by launchAction().


|
static |
update current file if required
Definition at line 166 of file r3server.c.
References buildRootName(), clientReq, CURRENT, Par::currentGribFileName, ClientRequest::currentGribName, currentZone, g_strlcpy, MAX_SIZE_FILE_NAME, par, and readGribAll().
Referenced by checkParamAndUpdate(), and launchAction().


|
static |
update Grib file if required
Definition at line 143 of file r3server.c.
References buildRootName(), clientReq, g_strlcpy, Par::gribFileName, ClientRequest::gribName, MAX_SIZE_FILE_NAME, par, readGribAll(), WIND, and zone.
Referenced by checkParamAndUpdate(), infoCoordToJson(), and launchAction().


| char* bigBuffer = NULL |
Definition at line 45 of file r3server.c.
Referenced by handleClient(), launchAction(), and main().
| ClientRequest clientReq |
Definition at line 115 of file r3server.c.
Referenced by allowedLevel(), checkParamAndUpdate(), decodeHttpReq(), handleClient(), infoCoordToJson(), launchAction(), main(), updateCurrentGrib(), and updateWindGrib().
| const char* filter[] = {".csv", ".pol", ".grb", ".grb2", ".log", ".txt", ".par", ".yaml", ".json", NULL} |
Definition at line 48 of file r3server.c.
Referenced by launchAction(), listDirToStrJson(), and matchFilter().
| char parameterFileName[MAX_SIZE_FILE_NAME] |
Definition at line 59 of file r3server.c.
Referenced by initContext(), launchAction(), and main().
| const int typeLevel[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
Definition at line 57 of file r3server.c.
Referenced by allowedLevel().