add: filters
add: schedule api calls
This commit is contained in:
		
							parent
							
								
									a2dfcebf3f
								
							
						
					
					
						commit
						a38a6e63b3
					
				
					 23 changed files with 171 additions and 95 deletions
				
			
		| 
						 | 
				
			
			@ -7,7 +7,7 @@
 | 
			
		|||
int
 | 
			
		||||
helpers::bind_tcp_server(const char *addr, const char *port, int max_client_backlog)
 | 
			
		||||
{
 | 
			
		||||
    struct addrinfo hints, *res;
 | 
			
		||||
    struct addrinfo hints{}, *res;
 | 
			
		||||
    int fd;
 | 
			
		||||
    int status;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ helpers::get_server_port(int fd)
 | 
			
		|||
    {
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    struct sockaddr_in sin;
 | 
			
		||||
    struct sockaddr_in sin{};
 | 
			
		||||
    socklen_t addrlen = sizeof(sin);
 | 
			
		||||
    if(getsockname(fd, (struct sockaddr *)&sin, &addrlen) == 0)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,14 +8,14 @@ parse_HHMM(const char *begin, uint16_t *h, uint16_t *m)
 | 
			
		|||
    uint16_t tmp_h, tmp_m;
 | 
			
		||||
    char *check = nullptr;
 | 
			
		||||
 | 
			
		||||
    tmp_h = strtol(begin, &check, 10);
 | 
			
		||||
    tmp_h = (uint16_t)strtol(begin, &check, 10);
 | 
			
		||||
    if(begin == check)
 | 
			
		||||
    {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    begin = check + 1;
 | 
			
		||||
    tmp_m = strtol(begin, &check, 10);
 | 
			
		||||
    tmp_m = (uint16_t)strtol(begin, &check, 10);
 | 
			
		||||
    if(begin == check)
 | 
			
		||||
    {
 | 
			
		||||
        return 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -48,13 +48,13 @@ helpers::parse_periods(Json::Value periods_json)
 | 
			
		|||
        {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        start = (h * 60) + m;
 | 
			
		||||
        start = (uint16_t)((h * 60) + m);
 | 
			
		||||
 | 
			
		||||
        if(parse_HHMM(end_str, &h, &m))
 | 
			
		||||
        {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        end = (h * 60) + m;
 | 
			
		||||
        end = (uint16_t)((h * 60) + m);
 | 
			
		||||
 | 
			
		||||
        if(start < 0 || start > 24 * 60 || end < 0 || end > 24 * 60)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,9 +6,9 @@
 | 
			
		|||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
helpers::send_udp_broadcast(const char *addr, int port, const char* message)
 | 
			
		||||
helpers::send_udp_broadcast(const char *addr, uint16_t port, const char* message)
 | 
			
		||||
{
 | 
			
		||||
    struct sockaddr_in their_addr;
 | 
			
		||||
    struct sockaddr_in their_addr{};
 | 
			
		||||
    int fd;
 | 
			
		||||
 | 
			
		||||
    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue