add: file sending capability
This commit is contained in:
		
							parent
							
								
									6178ef3c7b
								
							
						
					
					
						commit
						760cec9a20
					
				
					 18 changed files with 79 additions and 53 deletions
				
			
		| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#include <mongoose.h>
 | 
			
		||||
#include <confini.h>
 | 
			
		||||
 | 
			
		||||
typedef enum
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +30,7 @@ typedef struct
 | 
			
		|||
    run_type_t run_type;
 | 
			
		||||
    char server_port[6];
 | 
			
		||||
    uint16_t discovery_port;
 | 
			
		||||
    struct mg_serve_http_opts http_server_opts;
 | 
			
		||||
} config_t;
 | 
			
		||||
 | 
			
		||||
extern config_t global_config;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ typedef struct
 | 
			
		|||
    int alloced_content;
 | 
			
		||||
} endpoint_response_t;
 | 
			
		||||
 | 
			
		||||
typedef void (*endpoint_func_f)(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
typedef void (*endpoint_func_f)(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -48,10 +48,10 @@ typedef struct
 | 
			
		|||
} endpoint_t;
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
endpoint_func_index(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
endpoint_func_index(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
endpoint_func_not_found(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
endpoint_func_not_found(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
endpoint_response_text(endpoint_response_t *response, int status_code, const char *content, int content_length);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,27 +4,27 @@
 | 
			
		|||
#include <router.h>
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_discover_POST(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_discover_POST(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_PUT(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_PUT(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_DELETE(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_DELETE(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_relays_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_relays_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_relays_INT_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_relays_INT_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_controllers_STR_relays_INT_PUT(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
#endif /* CORE_ENDPOINTS_API_V1_CONTROLLERS_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,9 +4,9 @@
 | 
			
		|||
#include <router.h>
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_relays_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_relays_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_relays_tag_STR_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_relays_tag_STR_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
#endif /* CORE_ENDPOINTS_API_V1_RELAYS_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,21 +4,21 @@
 | 
			
		|||
#include <router.h>
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_POST(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_POST(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_STR_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_STR_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_STR_PUT(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_STR_PUT(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_STR_DELETE(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_STR_DELETE(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
api_v1_schedules_tag_STR_GET(struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
api_v1_schedules_tag_STR_GET(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
 | 
			
		||||
 | 
			
		||||
#endif /* CORE_ENDPOINTS_API_V1_SCHEDULES_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue