test-dhcp-server.c revision bd57b45029ff25067704c9538e79f31e71c10045
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek/***
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek This file is part of systemd.
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek Copyright (C) 2013 Intel Corporation. All rights reserved.
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek Copyright (C) 2014 Tom Gundersen
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek (at your option) any later version.
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek***/
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include <netinet/if_ether.h>
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include <assert.h>
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include <errno.h>
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include "sd-event.h"
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include "event-util.h"
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include "sd-dhcp-server.h"
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek#include "dhcp-server-internal.h"
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmekstatic void test_basic(sd_event *event) {
29fc0ddcd737af906986d4029579d4dfe838ba02Zbigniew Jędrzejewski-Szmek _cleanup_dhcp_server_unref_ sd_dhcp_server *server = NULL;
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering struct in_addr address_lo = {
6482f6269c87d2249e52e889a63adbdd50f2d691Ronny Chevalier .s_addr = htonl(INADDR_LOOPBACK),
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering };
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering struct in_addr address_any = {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek .s_addr = htonl(INADDR_ANY),
799a8f39d8eb9ea725e85a598c0f5dbd658c8ba7Zbigniew Jędrzejewski-Szmek };
799a8f39d8eb9ea725e85a598c0f5dbd658c8ba7Zbigniew Jędrzejewski-Szmek
799a8f39d8eb9ea725e85a598c0f5dbd658c8ba7Zbigniew Jędrzejewski-Szmek /* attach to loopback interface */
50a0b0717563d08c027a16a896bff8d7754eab9eZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_new(&server, 1) >= 0);
29fc0ddcd737af906986d4029579d4dfe838ba02Zbigniew Jędrzejewski-Szmek assert_se(server);
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering
7449bc1f34c206e3ff8e274cd74e2db950d492a1Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_attach_event(server, event, 0) >= 0);
7449bc1f34c206e3ff8e274cd74e2db950d492a1Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_attach_event(server, event, 0) == -EBUSY);
7449bc1f34c206e3ff8e274cd74e2db950d492a1Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_get_event(server) == event);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_detach_event(server) >= 0);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(!sd_dhcp_server_get_event(server));
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_attach_event(server, NULL, 0) >= 0);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_attach_event(server, NULL, 0) == -EBUSY);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_ref(server) == server);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(!sd_dhcp_server_unref(server));
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_start(server) == -EUNATCH);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_address(server, &address_any) == -EINVAL);
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering assert_se(sd_dhcp_server_set_address(server, &address_lo) >= 0);
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering assert_se(sd_dhcp_server_set_address(server, &address_lo) == -EBUSY);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_lease_pool(server, &address_any, 1) == -EINVAL);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_lease_pool(server, &address_lo, 0) == -EINVAL);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_lease_pool(server, &address_lo, 1) >= 0);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_lease_pool(server, &address_lo, 1) == -EBUSY);
8847551bcbfa8265bae04f567bb1aadc7b480325Zbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_start(server) >= 0);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_start(server) == -EBUSY);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_stop(server) >= 0);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_stop(server) >= 0);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_start(server) >= 0);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek}
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek
8847551bcbfa8265bae04f567bb1aadc7b480325Zbigniew Jędrzejewski-Szmekstatic void test_message_handler(void) {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek _cleanup_dhcp_server_unref_ sd_dhcp_server *server = NULL;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek struct {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek DHCPMessage message;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek struct {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t code;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t length;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t type;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek } _packed_ option_type;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek struct {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t code;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t length;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek be32_t address;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek } _packed_ option_requested_ip;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek struct {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t code;
c33b329709ebe2755181980a050d02ec7c81ed87Michal Schmidt uint8_t length;
c33b329709ebe2755181980a050d02ec7c81ed87Michal Schmidt be32_t address;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek } _packed_ option_server_id;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek uint8_t end;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek } _packed_ test = {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek .message.op = BOOTREQUEST,
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek .message.htype = ARPHRD_ETHER,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .message.hlen = ETHER_ADDR_LEN,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .message.xid = htobe32(0x12345678),
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .message.chaddr = { 'A', 'B', 'C', 'D', 'E', 'F' },
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .option_type.code = DHCP_OPTION_MESSAGE_TYPE,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .option_type.length = 1,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .option_type.type = DHCP_DISCOVER,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek .end = DHCP_OPTION_END,
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek };
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek struct in_addr address_lo = {
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt .s_addr = htonl(INADDR_LOOPBACK),
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt };
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_new(&server, 1) >= 0);
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_address(server, &address_lo) >= 0);
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt assert_se(sd_dhcp_server_attach_event(server, NULL, 0) >= 0);
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt assert_se(sd_dhcp_server_start(server) >= 0);
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek assert_se(sd_dhcp_server_set_lease_pool(server, &address_lo, 10) >= 0);
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek test.end = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek /* TODO, shouldn't this fail? */
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.end = DHCP_OPTION_END;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_type.code = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_type.length = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_type.type = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_type.code = DHCP_OPTION_MESSAGE_TYPE;
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.option_type.length = 1;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_type.type = DHCP_DISCOVER;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.message.op = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.message.op = BOOTREQUEST;
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.message.htype = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.message.htype = ARPHRD_ETHER;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.message.hlen = 0;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.message.hlen = ETHER_ADDR_LEN;
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_OFFER);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.option_type.type = DHCP_REQUEST;
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.option_requested_ip.code = DHCP_OPTION_REQUESTED_IP_ADDRESS;
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering test.option_requested_ip.length = 4;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_requested_ip.address = htobe32(0x12345678);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_NAK);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_server_id.code = DHCP_OPTION_SERVER_IDENTIFIER;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_server_id.length = 4;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_server_id.address = htobe32(INADDR_LOOPBACK);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_requested_ip.address = htobe32(INADDR_LOOPBACK + 3);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == DHCP_ACK);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_server_id.address = htobe32(0x12345678);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_requested_ip.address = htobe32(INADDR_LOOPBACK + 3);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_server_id.address = htobe32(INADDR_LOOPBACK);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test.option_requested_ip.address = htobe32(INADDR_LOOPBACK + 30);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(dhcp_server_handle_message(server, (DHCPMessage*)&test, sizeof(test)) == 0);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek}
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmek
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmekint main(int argc, char *argv[]) {
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt _cleanup_event_unref_ sd_event *e;
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt log_set_max_level(LOG_DEBUG);
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt log_parse_environment();
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmek log_open();
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek assert_se(sd_event_new(&e) >= 0);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test_basic(e);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek test_message_handler();
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek return 0;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek}
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek