Loading src/pathcomp/backend/pathComp_RESTapi.c +15 −9 Original line number Diff line number Diff line Loading @@ -873,6 +873,9 @@ void parse_capacity_object(cJSON* capacity, struct capacity_t* c) { void parse_json_device_endpoints_array(cJSON* endPointsArray, struct device_t* d) { for (gint i = 0; i < cJSON_GetArraySize(endPointsArray); i++) { d->numEndPoints++; if (d->numEndPoints >= MAX_DEV_ENDPOINT_LENGTH) { DEBUG_PC("d->numEndPoints(%d) exceeded MAX_DEV_ENDPOINT_LENGTH(%d)", d->numEndPoints, MAX_DEV_ENDPOINT_LENGTH); } struct endPoint_t* endpoint = &(d->endPoints[i]); cJSON* item = cJSON_GetArrayItem(endPointsArray, i); Loading Loading @@ -1395,6 +1398,7 @@ gint parsing_json_obj (guchar *data, GIOChannel *source) { DEBUG_PC("STARTING PARSING JSON CONTENTS"); parsing_json_obj_pathComp_request (root, source); DEBUG_PC("ENDING PARSING JSON CONTENTS"); // Release the root JSON object variable cJSON_free (root); g_free(print); Loading Loading @@ -1910,10 +1914,10 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) } contentLength[i] = '\0'; body_length = atoi (contentLength); //DEBUG_PC ("Body length: %d (%s) in Bytes", body_length, contentLength); DEBUG_PC ("Body length: %d (%s) in Bytes", body_length, contentLength); } } //DEBUG_PC("Read Entire HTTP Header"); DEBUG_PC("Read Entire HTTP Header"); if (body_length == 0) { DEBUG_PC ("--- NO REST API Body length (length = %d) ---", body_length); return TRUE; Loading @@ -1921,7 +1925,7 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Processing Body of the Request ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //DEBUG_PC ("REST API Request - Body -"); DEBUG_PC ("REST API Request - Body -"); nbytes = read_channel (source, (guchar *)(client->ibuf->data + client->ibuf->putp), body_length); if ((nbytes < 0) && (body_length > 0)) { DEBUG_PC ("nbytes: %d; body_length: %d", nbytes, body_length); Loading @@ -1941,6 +1945,7 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) // Create the active service List activeServList = NULL; DEBUG_PC("Parsing JSON..."); // Process the json contents and store relevant information at Device, Link, // and network connectivity service gint ret = parsing_json_obj (client->ibuf->data, source); Loading @@ -1949,11 +1954,12 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) RESTapi_stop(client, source, fd); return FALSE; } DEBUG_PC("Parsing done"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Trigger the path computation ////////////////////////////////////////////////////////////////////////////////////////////////////////////// //DEBUG_PC ("Triggering the computation"); DEBUG_PC ("Triggering the computation"); struct compRouteOutputList_t *compRouteOutputList = create_route_list (); gint httpCode = triggering_routeComp (compRouteOutputList, algId); Loading src/pathcomp/backend/pathComp_RESTapi.h +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ #define REST_API_METHOD_HTTP 3 #define REST_API_METHOD_PUT 4 #define MAXLENGTH 131072 #define MAXLENGTH 1024*1024 // 131072 // LGR: increased stream size; otherwise fails for big networks //////////////////////////////////////////////////// // Client Struct for connecting to PATH COMP SERVER Loading Loading
src/pathcomp/backend/pathComp_RESTapi.c +15 −9 Original line number Diff line number Diff line Loading @@ -873,6 +873,9 @@ void parse_capacity_object(cJSON* capacity, struct capacity_t* c) { void parse_json_device_endpoints_array(cJSON* endPointsArray, struct device_t* d) { for (gint i = 0; i < cJSON_GetArraySize(endPointsArray); i++) { d->numEndPoints++; if (d->numEndPoints >= MAX_DEV_ENDPOINT_LENGTH) { DEBUG_PC("d->numEndPoints(%d) exceeded MAX_DEV_ENDPOINT_LENGTH(%d)", d->numEndPoints, MAX_DEV_ENDPOINT_LENGTH); } struct endPoint_t* endpoint = &(d->endPoints[i]); cJSON* item = cJSON_GetArrayItem(endPointsArray, i); Loading Loading @@ -1395,6 +1398,7 @@ gint parsing_json_obj (guchar *data, GIOChannel *source) { DEBUG_PC("STARTING PARSING JSON CONTENTS"); parsing_json_obj_pathComp_request (root, source); DEBUG_PC("ENDING PARSING JSON CONTENTS"); // Release the root JSON object variable cJSON_free (root); g_free(print); Loading Loading @@ -1910,10 +1914,10 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) } contentLength[i] = '\0'; body_length = atoi (contentLength); //DEBUG_PC ("Body length: %d (%s) in Bytes", body_length, contentLength); DEBUG_PC ("Body length: %d (%s) in Bytes", body_length, contentLength); } } //DEBUG_PC("Read Entire HTTP Header"); DEBUG_PC("Read Entire HTTP Header"); if (body_length == 0) { DEBUG_PC ("--- NO REST API Body length (length = %d) ---", body_length); return TRUE; Loading @@ -1921,7 +1925,7 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Processing Body of the Request ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //DEBUG_PC ("REST API Request - Body -"); DEBUG_PC ("REST API Request - Body -"); nbytes = read_channel (source, (guchar *)(client->ibuf->data + client->ibuf->putp), body_length); if ((nbytes < 0) && (body_length > 0)) { DEBUG_PC ("nbytes: %d; body_length: %d", nbytes, body_length); Loading @@ -1941,6 +1945,7 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) // Create the active service List activeServList = NULL; DEBUG_PC("Parsing JSON..."); // Process the json contents and store relevant information at Device, Link, // and network connectivity service gint ret = parsing_json_obj (client->ibuf->data, source); Loading @@ -1949,11 +1954,12 @@ gboolean RESTapi_activity(GIOChannel *source, GIOCondition cond, gpointer data) RESTapi_stop(client, source, fd); return FALSE; } DEBUG_PC("Parsing done"); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Trigger the path computation ////////////////////////////////////////////////////////////////////////////////////////////////////////////// //DEBUG_PC ("Triggering the computation"); DEBUG_PC ("Triggering the computation"); struct compRouteOutputList_t *compRouteOutputList = create_route_list (); gint httpCode = triggering_routeComp (compRouteOutputList, algId); Loading
src/pathcomp/backend/pathComp_RESTapi.h +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ #define REST_API_METHOD_HTTP 3 #define REST_API_METHOD_PUT 4 #define MAXLENGTH 131072 #define MAXLENGTH 1024*1024 // 131072 // LGR: increased stream size; otherwise fails for big networks //////////////////////////////////////////////////// // Client Struct for connecting to PATH COMP SERVER Loading