Commit 111dbe27 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Merge branch 'release/1.13.0'

parents 6aad23d2 8f58c4c1
Pipeline #6526 passed with stages
in 1 minute and 36 seconds
......@@ -63,7 +63,7 @@ build:
- make -f makefile.unix
- cd -
# Configure and build ew2openapi
- make -f makefile.unix static
- make -f makefile.unix clean static
# Copy binary in the current directory
- cp $EW_INSTALL_HOME/$EW_INSTALL_VERSION/bin/ew2openapi ./
# Create not existing directory
......@@ -74,6 +74,7 @@ build:
- echo $EW_INSTALL_HOME/$EW_INSTALL_VERSION/
artifacts:
paths:
- $EW_INSTALL_HOME/$EW_INSTALL_VERSION/include
- $EW_INSTALL_HOME/$EW_INSTALL_VERSION/lib
- $EW_INSTALL_HOME/$EW_INSTALL_VERSION/bin
- $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment
......@@ -95,47 +96,6 @@ test:
- . $EW_INSTALL_HOME/$EW_INSTALL_VERSION/environment/ew_linux.bash
# Run ew2openapi without argument
- ./ew2openapi
# Test ew2openapi standalone with TYPE_PICK_SCNL input file
- ew2openapi TYPE_PICK_SCNL ./test/pick_ew/message.pick_scnl ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/message.pick_scnl.json > j2.json
# Test ew2openapi standalone with TYPE_QUAKE2K input file
- ew2openapi TYPE_QUAKE2K ./test/binder_ew/message.quake2k ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/message.quake2k.json > j2.json
# Test ew2openapi standalone with TYPE_LINK input file
- ew2openapi TYPE_LINK ./test/binder_ew/message.link ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/message.link.json > j2.json
# Test ew2openapi standalone with ARC input file
- ./ew2openapi TYPE_HYP2000ARC ./test/arc/20180205-080122.0009627.arc ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/20180205-080122.0009627.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
- grep -w -v "hostname" j1.json > jj1.json
- grep -w -v "hostname" j2.json > jj2.json
- diff jj1.json jj2.json
# Test ew2openapi standalone with ARC input file
- ./ew2openapi TYPE_HYP2000ARC ./test/arc/20170118-1014097.arc ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/20170118-1014097.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
- grep -w -v "hostname" j1.json > jj1.json
- grep -w -v "hostname" j2.json > jj2.json
- diff jj1.json jj2.json
# Test ew2openapi standalone with TYPE_MAGNITUDE input file
- ew2openapi TYPE_MAGNITUDE ./test/localmag/lm_75662.localmag ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/lm_75662.localmag.json > j2.json
# Test ew2openapi standalone with TYPE_STRONGMOTIONII input file
- ./ew2openapi TYPE_STRONGMOTIONII ./test/gmew/APRC.HHE.IV.--.001.gmew ./test/json/output_test.json
- jq '.' ./test/json/output_test.json > j1.json
- jq '.' ./test/json/APRC.HHE.IV.--.001.gmew.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
- grep -w -v "hostname" j1.json > jj1.json
- grep -w -v "hostname" j2.json > jj2.json
- diff jj1.json jj2.json
# Run ew2openapi tests
- make -f makefile.unix clean static test
......@@ -2,6 +2,12 @@
ew2openapi Release History
#########################
* Release 1.13.0 (2021/01/22)
- Add warning message about delay message handling and number of items in queue to process. Issue #35 (2021/01/20)
- Move ew2openapi test in makefile.unix. Issue #40 (2021/01/15)
- Optimize compilation and clean code. Issue #41 (2021/01/20)
- Set User-Agent in request header based on ew2openapi name and version. Issue #42 (2021/01/21)
* Release 1.12.0 (2020/12/18)
- Checkout Earthworm from official Subversion repository in gitlab-ci.yml. Issue #14 (2020/04/20)
- Major changes in source for making easy new system integrations. Issue #31 (2020/04/20)
......
1.12.0 - 2020-12-18
\ No newline at end of file
1.13.0 (2021-01-22)
\ No newline at end of file
......@@ -55,6 +55,8 @@ S = ./src
B = $(EW_HOME)/$(EW_VERSION)/bin
L = $(EW_HOME)/$(EW_VERSION)/lib
SCRIPT_UPDATE_VERSION_FROM_HISTORY = ./scripts/update_ew2openapi_version_h_from_HISTORY.sh
BINARIES = \
$(S)/ew2openapi_handler_quakedb_ws.o \
$(S)/ew2openapi_handler_rabbitmq.o \
......@@ -110,6 +112,9 @@ $B/$(APP): $(BINARIES) $(HEADERS)
$(S)/%.o : %.c
$(CC) $(CFLAGS) -c $<
version: HISTORY $(SCRIPT_UPDATE_VERSION_FROM_HISTORY)
$(SCRIPT_UPDATE_VERSION_FROM_HISTORY)
lint:
lint $S/ew2openapi.c $(GLOBALFLAGS)
......@@ -130,3 +135,47 @@ test: $(B)/$(APP)
grep -w -v "hostname" j1.json > jj1.json
grep -w -v "hostname" j2.json > jj2.json
diff jj1.json jj2.json
# Test ew2openapi standalone with TYPE_PICK_SCNL input file
$(B)/$(APP) TYPE_PICK_SCNL ./test/pick_ew/message.pick_scnl ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/message.pick_scnl.json > j2.json
# Test ew2openapi standalone with TYPE_QUAKE2K input file
$(B)/$(APP) TYPE_QUAKE2K ./test/binder_ew/message.quake2k ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/message.quake2k.json > j2.json
# Test ew2openapi standalone with TYPE_LINK input file
$(B)/$(APP) TYPE_LINK ./test/binder_ew/message.link ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/message.link.json > j2.json
# Test ew2openapi standalone with ARC input file
$(B)/$(APP) TYPE_HYP2000ARC ./test/arc/20180205-080122.0009627.arc ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/20180205-080122.0009627.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
grep -w -v "hostname" j1.json > jj1.json
grep -w -v "hostname" j2.json > jj2.json
diff jj1.json jj2.json
# Test ew2openapi standalone with ARC input file
$(B)/$(APP) TYPE_HYP2000ARC ./test/arc/20170118-1014097.arc ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/20170118-1014097.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
grep -w -v "hostname" j1.json > jj1.json
grep -w -v "hostname" j2.json > jj2.json
diff jj1.json jj2.json
# Test ew2openapi standalone with TYPE_MAGNITUDE input file
$(B)/$(APP) TYPE_MAGNITUDE ./test/localmag/lm_75662.localmag ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/lm_75662.localmag.json > j2.json
# Test ew2openapi standalone with TYPE_STRONGMOTIONII input file
$(B)/$(APP) TYPE_STRONGMOTIONII ./test/gmew/APRC.HHE.IV.--.001.gmew ./test/json/output_test.json
jq '.' ./test/json/output_test.json > j1.json
jq '.' ./test/json/APRC.HHE.IV.--.001.gmew.json > j2.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j1.json > jj1.json
# - sed -e 's/"hostname":[[:space:]]*"\([^"]\+\)"/"hostname": "DIFF_IGNORE_HOSTNAME"/' j2.json > jj2.json
grep -w -v "hostname" j1.json > jj1.json
grep -w -v "hostname" j2.json > jj2.json
diff jj1.json jj2.json
......@@ -8,12 +8,17 @@ FILE_ew2openapi_version=${DIRNAME}/../src/ew2openapi_version.h
RELEASE_PREFIX_STRING="* Release"
grep "${RELEASE_PREFIX_STRING}" ${FILE_HISTORY} | head -n 1 | sed -e "s/${RELEASE_PREFIX_STRING}//" | sed -e "s/^[ ]*//" -e "s/[ ]*$//" -e "s/[ ][ ]*/ /g" -e "s/[()]//g" -e "s/\//-/g" | awk '{printf "%s - %s", $1, $2;}' > ${FILE_VERSION}
# grep "${RELEASE_PREFIX_STRING}" ${FILE_HISTORY} | head -n 1 | sed -e "s/${RELEASE_PREFIX_STRING}//" | sed -e "s/^[ ]*//" -e "s/[ ]*$//" -e "s/[ ][ ]*/ /g" -e "s/[()]//g" -e "s/\//-/g" | awk '{printf "%s - %s", $1, $2;}' > ${FILE_VERSION}
grep "${RELEASE_PREFIX_STRING}" ${FILE_HISTORY} | head -n 1 | sed -e "s/${RELEASE_PREFIX_STRING}//" | sed -e "s/^[ ]*//" -e "s/[ ]*$//" -e "s/[ ][ ]*/ /g" -e "s/\//-/g" | awk '{printf "%s %s", $1, $2;}' > ${FILE_VERSION}
VERSION="`cat ${FILE_VERSION}`"
echo "/* DO NOT EDIT. Automatically generated. Change file HISTORY in ew2openapi_version main directory. */" > ${FILE_ew2openapi_version}
echo "#define EW2OPENAPI_NAME \"ew2openapi\"" >> ${FILE_ew2openapi_version}
echo "#define EW2OPENAPI_VERSION \"${VERSION}\"" >> ${FILE_ew2openapi_version}
echo "#define EW2OPENAPI_NAME_AND_VERSION EW2OPENAPI_NAME\" \"EW2OPENAPI_VERSION" >> ${FILE_ew2openapi_version}
echo "#define EW2OPENAPI_USERAGENT EW2OPENAPI_NAME\"/\"EW2OPENAPI_VERSION" >> ${FILE_ew2openapi_version}
echo "#define EW2OPENAPI_URL_PATH \"quakedb/ew/v1\"" >> ${FILE_ew2openapi_version}
cat ${FILE_ew2openapi_version}
......@@ -125,7 +125,7 @@ int main( int argc, char **argv ) {
params.cmdname = argv[0];
if ( argc != 2 && argc != 4)
{
fprintf( stderr, "%s %s\n", params.cmdname, EW2OPENAPI_VERSION);
fprintf( stderr, "%s\n", EW2OPENAPI_NAME_AND_VERSION);
fprintf( stderr, "\n" );
fprintf( stderr, "Earthworm module for transporting Earthworm messages from rings to:\n");
fprintf( stderr, " - ew2openapi Webservice\n");
......@@ -648,6 +648,9 @@ thr_ret MessageHandler( void *p )
char *Wrmsg = NULL; /* message to get from queue */
long msgSize;
long inkey;
time_t time_now;
time_t time_msg;
double difftime_seconds;
TYPE_DATA_HANDLER data_handler;
int (*p_data_handler_func_handle) (TYPE_DATA_HANDLER *) = NULL;
......@@ -727,6 +730,8 @@ thr_ret MessageHandler( void *p )
}
/* Set for safety but only after checking ret value */
memcpy(&time_msg, &Wrmsg[msgSize - sizeof(time_msg)], sizeof(time_msg));
msgSize -= sizeof(time_msg);
Wrmsg[msgSize] = '\0';
/* Determine which GetLogo this message used */
......@@ -830,8 +835,13 @@ thr_ret MessageHandler( void *p )
RequestSpecificMutex(&mutex_OutQueue);
num_elements_in_queue = getNumOfElementsInQueue(&OutQueue);
ReleaseSpecificMutex(&mutex_OutQueue);
if(num_elements_in_queue > 1) {
ew2openapi_logit("et", "Current number of elements in queue: %d.\n", num_elements_in_queue);
/* Get time message delay handler in seconds */
time(&time_now); difftime_seconds = difftime(time_now, time_msg);
/* WARNING message about possible delay based on following conditions */
if(difftime_seconds >= 5.0 || num_elements_in_queue >= 5) {
ew2openapi_logit("et", "WARNING: Current number of elements in queue: %d. Last message delay %.0f seconds.\n", num_elements_in_queue, difftime_seconds);
}
/* At the end of the loop */
......@@ -877,6 +887,7 @@ thr_ret MessageStacker( void *p )
*********************************/
char *msgb = NULL; /* msg retrieved from transport */
char errText[STR_LEN_ERRTEXT]; /* string for log/error/heartbeat messages */
time_t time_msg;
/* set last character to zero */
errText[STR_LEN_ERRTEXT-1]=0;
......@@ -980,6 +991,9 @@ thr_ret MessageStacker( void *p )
/* Process retrieved msg (ret==GET_OK,GET_MISS,GET_NOTRACK)
***********************************************************/
time(&time_msg);
memcpy(&msgb[recsize], &time_msg, sizeof(time_msg));
recsize += sizeof(time_msg);
msgb[recsize] = '\0';
/* put the message into the queue */
......@@ -1046,7 +1060,7 @@ thr_ret QueueDumpFile( void *p )
MSG_LOGO reclogo;
int ret;
long msgSize;
char errText[STR_LEN_ERRTEXT];
// char errText[STR_LEN_ERRTEXT];
char *Wrmsg = NULL; /* message to get from queue */
unsigned char inseq = 0;
......@@ -1062,7 +1076,7 @@ thr_ret QueueDumpFile( void *p )
initqueue( &LocOutQueue, (unsigned long)params->QueueSize,(unsigned long)(params->MaxMsgSize+1));
/* set last character to zero */
errText[STR_LEN_ERRTEXT-1]=0;
// errText[STR_LEN_ERRTEXT-1]=0;
/* Allocate buffer for reading message from queue */
if ( ( Wrmsg = (char *) malloc(params->MaxMsgSize+1) ) == NULL )
......@@ -1154,6 +1168,7 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
char* str;
unsigned char modid;
char processor[30];
int len = 0;
params->HeartBeatRing[0] = 0;
params->nRings = 0;
......@@ -1331,6 +1346,13 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
if ( (str = k_str() ) ) {
strncpy(params->ApiBaseUrl, str, 1023);
params->ApiBaseUrl[1023] = '\0';
/* if occurs, trim last character equal to '/' */
len = strlen(params->ApiBaseUrl);
if(params->ApiBaseUrl[len - 1] == '/') {
params->ApiBaseUrl[len - 1] = '\0';
}
}
}
......
......@@ -4,13 +4,12 @@
#include <earthworm.h>
#include "ew2openapi_version.h"
#include "ew2openapi_logit.h"
#include "ew2openapi_handler_quakedb_ws.h"
#include "ew2openapi_json_utils.h"
#include "ew2openapi_handler_status.h"
#define MAX_API_URL 1024
/* Private functions */
long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_t len, MSG_LOGO *reclogo, char flag_geojson);
......@@ -20,7 +19,13 @@ int ew2openapi_handler_quakedb_ws_init(TYPE_PARAMS *params) {
CURLcode ret_curl;
long flags = CURL_GLOBAL_ALL;
ret_curl = curl_global_init(flags);
/* TODO set ret based on ret_curl */
/* Exit if ret_curl is non-zero https://curl.se/libcurl/c/curl_global_init.html */
if(ret_curl != 0) {
ew2openapi_logit("et", "ew2openapi_handler_quakedb_ws_init(): initialization error. Exit.\n");
exit(-1);
}
return ret;
}
......@@ -68,6 +73,7 @@ static size_t ew2openapi_handler_quakedb_ws_WRITEFUNCTION_ew2openapi_logit(void
return realsize;
}
#define MAX_LEN_TYPE_EW_MESSAGE 64
/* Send Earthworm message to EWOpenAPI */
long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_t len, MSG_LOGO *reclogo, char flag_geojson)
......@@ -79,13 +85,13 @@ long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_
unsigned long i = 0;
char ch;
char apiurl[MAX_API_URL];
char url[MAX_API_URL];
char api_type_ew_msg[MAX_API_URL];
char api_type_ew_msg[MAX_LEN_TYPE_EW_MESSAGE];
const char *JsonObj_pre = "{\"data\":";
const char *JsonObj_post = "}";
size_t JsonObj_len = len + strlen(JsonObj_pre) + strlen(JsonObj_post) + 10;
char *JsonObj = malloc(JsonObj_len);
struct curl_slist *headers = NULL;
const char *curl_header_accept_json = "Accept: application/json";
const char *curl_header_content_type_json = "Content-Type: application/json";
......@@ -100,13 +106,12 @@ long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_
return curl_http_code;
}
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, (flag_geojson)? curl_header_accept_geojson : curl_header_accept_json);
headers = curl_slist_append(headers, (flag_geojson)? curl_header_content_type_geojson : curl_header_content_type_json);
headers = curl_slist_append(headers, "charsets: utf-8");
/* Build part of API url based on Earthworm message type */
strncpy(api_type_ew_msg, GetTypeName(reclogo->type), MAX_API_URL);
strncpy(api_type_ew_msg, GetTypeName(reclogo->type), MAX_LEN_TYPE_EW_MESSAGE - 1);
/* Remove from Earthworm messate type API url first 5 characters 'TYPE_',
* and lowercase the others. */
......@@ -122,8 +127,7 @@ long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_
}
api_type_ew_msg[i] = '\0';
snprintf(apiurl, MAX_API_URL, "%s", api_type_ew_msg);
snprintf(url, MAX_API_URL, "%s/%s", ApiBaseUrl, apiurl);
snprintf(url, MAX_API_URL - MAX_LEN_TYPE_EW_MESSAGE - sizeof(EW2OPENAPI_URL_PATH) - 1, "%s/%s/%s", ApiBaseUrl, EW2OPENAPI_URL_PATH, api_type_ew_msg);
ew2openapi_logit("et", "URL-DATA: %s\n", url);
ew2openapi_logit("et", "JSON-DATA: %s\n", JsonObj);
......@@ -133,7 +137,7 @@ long ew2openapi_handler_quakedb_ws_sendstring(char *ApiBaseUrl, char *buf, size_
if(curl) {
/* some servers don't like requests that are made without a user-agent
field, so we provide one */
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_setopt(curl, CURLOPT_USERAGENT, EW2OPENAPI_USERAGENT);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
......@@ -213,9 +217,6 @@ int ew2openapi_handler_quakedb_ws_handle(TYPE_DATA_HANDLER *data_handler) {
/* Init values before error classification */
handler_status_code = HANDLER_STATUS_OK;
if(curl_http_code < 0 && curl_http_code >= 300) {
ew2openapi_logit("et", "HTTP CODE: %ld\n", curl_http_code);
}
switch(curl_http_code) {
/* Generic errors: network connection, ... */
case -1:
......
......@@ -31,12 +31,12 @@ int amqp_sendstring(char *buf, size_t len, long inkey, MSG_LOGO *logo, TYPE_PARA
char const *hostname;
int port, status;
char const *exchange;
#define MAX_MESSAGE_FORMAT_STRING 1024
#define MAX_MESSAGE_FORMAT_STRING 16
char send_message_format_string[MAX_MESSAGE_FORMAT_STRING];
#define MAX_ROUTINGKEY_LEN 1024
#define MAX_ROUTINGKEY_LEN 255
char routingkey_var[MAX_ROUTINGKEY_LEN];
char const *routingkey;
char const *messagebody;
// char const *messagebody;
char const *vhost;
char const *username;
char const *password;
......@@ -59,7 +59,7 @@ int amqp_sendstring(char *buf, size_t len, long inkey, MSG_LOGO *logo, TYPE_PARA
break;
}
snprintf(routingkey_var, MAX_ROUTINGKEY_LEN-1, "EW.%s.%s.%s.%s.%s.%s", params->ewinstancename, GetKeyName(inkey), GetInstName(logo->instid), GetModIdName(logo->mod), GetTypeName(logo->type), send_message_format_string);
snprintf(routingkey_var, MAX_ROUTINGKEY_LEN - MAX_MESSAGE_FORMAT_STRING - 1, "EW.%s.%s.%s.%s.%s.%s", params->ewinstancename, GetKeyName(inkey), GetInstName(logo->instid), GetModIdName(logo->mod), GetTypeName(logo->type), send_message_format_string);
amqp_message.bytes = buf;
amqp_message.len = len;
......@@ -72,7 +72,7 @@ int amqp_sendstring(char *buf, size_t len, long inkey, MSG_LOGO *logo, TYPE_PARA
password = params->rmq_password;
routingkey = routingkey_var;
messagebody = buf;
// messagebody = buf;
conn = amqp_new_connection();
......
......@@ -185,7 +185,6 @@ char *get_json_string_from_magnitude_ew_struct(MAG_INFO *magSum, MAG_CHAN_INFO *
char *get_json_string_from_magnitude_ew_msg(char *msg, int msg_size, MSG_LOGO *reclogo, char *ewInstanceName, char *ewUserName, char *ewHostName) {
char *ret = NULL;
int error = 0;
char Text[1024];
MAG_INFO magSum;
MAG_CHAN_INFO *magChan = NULL;
......@@ -200,21 +199,18 @@ char *get_json_string_from_magnitude_ew_msg(char *msg, int msg_size, MSG_LOGO *r
{
sprintf( Text, "Error reading magnitude summary: %s", msg );
ew2openapi_logit("et", "%s", Text);
error = -1;
} else {
magChanSize = 4 * MAX_PHS_PER_EQ * sizeof (MAG_CHAN_INFO);
if ((magChan = (MAG_CHAN_INFO *) malloc (magChanSize)) == NULL)
{
sprintf( Text, "Error allocating memory for magnitude stations");
ew2openapi_logit("et", "%s", Text);
error = -1;
} else {
/* Fill the MAG_CHAN_INFO struct from the received message */
if (rd_chan_mag (msg, msg_size, magChan, magChanSize) < 0)
{
sprintf( Text, "Error reading magnitude station info: %s", msg );
ew2openapi_logit("et", "%s", Text);
error = -1;
} else {
ret = get_json_string_from_magnitude_ew_struct(&magSum, magChan, reclogo, ewInstanceName, ewUserName, ewHostName);
}
......
......@@ -21,7 +21,8 @@ char *get_json_string_from_pick_scnl_ew_struct(EWPICK *pick, MSG_LOGO *reclogo,
static char json_string[MAX_JSON_STRING_PICKCODA];
char tpick_datetime[EW2OPENAPI_DATETIME_MAXLEN_STR];
int isite;
double lat = 0.0, lon = 0.0, elev = 0.0;
double lat = 0.0, lon = 0.0;
// double elev = 0.0;
char Text[1024];
/*
......@@ -92,7 +93,7 @@ char *get_json_string_from_pick_scnl_ew_struct(EWPICK *pick, MSG_LOGO *reclogo,
} else {
lat = Site[isite].lat;
lon = Site[isite].lon;
elev = Site[isite].elev;
// elev = Site[isite].elev;
}
jobj = json_object_new_geojson_from_json_object(jobj, lon, lat);
......
......@@ -118,7 +118,8 @@ char *get_json_string_from_link_ew_struct(LINK *link, MSG_LOGO *reclogo, char *e
/* from eqassemple eqas_quake2k() processes a TYPE_QUAKE2K message from binder */
/****************************************************************************/
int read_quake2k(char *msg, int msg_size, QUAKE2K *quake) {
double tOrigin, tNow;
double tOrigin;
// double tNow;
int narg;
char Text[4096];
......@@ -135,7 +136,7 @@ int read_quake2k(char *msg, int msg_size, QUAKE2K *quake) {
return EW_FAILURE;
}
tNow = tnow();
// tNow = tnow();
tOrigin = julsec17( quake->timestr );
if ( tOrigin == 0. ) {
sprintf( Text, "eqas_quake2k: Error decoding quake time: %s", quake->timestr );
......
......@@ -52,8 +52,8 @@ void ew2openapi_logit( const char *flag, const char *format, ... )
} else {
int flag_stdout = 0; /* 1 if output is also to stdout */
int flag_stderr = 0; /* 1 if output is also to stderr */
int flag_time_stamp = 0; /* 1 if output is time-stamped */
int flag_pid_stamp = 0; /* 1 if output is pid-stamped */
// int flag_time_stamp = 0; /* 1 if output is time-stamped */
// int flag_pid_stamp = 0; /* 1 if output is pid-stamped */
static const char *fl;
/* Check flag argument
......@@ -63,8 +63,8 @@ void ew2openapi_logit( const char *flag, const char *format, ... )
{
if ( *fl == 'o' ) flag_stdout = 1;
if ( *fl == 'e' ) flag_stderr = 1;
if ( *fl == 't' ) flag_time_stamp = 1;
if ( *fl == 'd' ) flag_pid_stamp = 1;
// if ( *fl == 't' ) flag_time_stamp = 1;
// if ( *fl == 'd' ) flag_pid_stamp = 1;
fl++;
}
......
......@@ -15,6 +15,8 @@
#define FILENAME_MAXLEN 1024
#define MAX_NUM_OF_RINGS 30
#define MAX_API_URL 1024
struct TYPE_PARAMS;
typedef struct {
......@@ -42,7 +44,7 @@ typedef struct TYPE_PARAMS {
int QueueSize; /* max messages in output circular buffer */
char QueueFilename[FILENAME_MAXLEN]; /* Filename for dumping and undumping the queue */
char ewinstancename[256]; /* EW instance name */
char ApiBaseUrl[1024]; /* Api Base URL */
char ApiBaseUrl[MAX_API_URL]; /* Api Base URL */
int WaitSecAfterServiceError; /* Seconds to wait after a Service Error */
char rmq_hostname[256]; /* RabbitMQ hostname */
int rmq_port; /* RabbitMQ port */
......
/* DO NOT EDIT. Automatically generated. Change file HISTORY in ew2openapi_version main directory. */
#define EW2OPENAPI_VERSION "1.12.0 - 2020-12-18"
#define EW2OPENAPI_NAME "ew2openapi"
#define EW2OPENAPI_VERSION "1.13.0 (2021-01-22)"
#define EW2OPENAPI_NAME_AND_VERSION EW2OPENAPI_NAME" "EW2OPENAPI_VERSION
#define EW2OPENAPI_USERAGENT EW2OPENAPI_NAME"/"EW2OPENAPI_VERSION
#define EW2OPENAPI_URL_PATH "quakedb/ew/v1"
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment