2014-06-19 14:38:55 +02:00
|
|
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
|
|
|
2015-10-15 19:25:31 +02:00
|
|
|
#ifndef foosdndiscfoo
|
|
|
|
#define foosdndiscfoo
|
2014-06-19 14:38:55 +02:00
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright (C) 2014 Intel Corporation. All rights reserved.
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
|
|
|
#include "sd-event.h"
|
|
|
|
|
|
|
|
enum {
|
2015-10-16 17:07:47 +02:00
|
|
|
SD_NDISC_EVENT_ROUTER_ADVERTISMENT_NONE = 0,
|
|
|
|
SD_NDISC_EVENT_ROUTER_ADVERTISMENT_TIMEOUT = 1,
|
|
|
|
SD_NDISC_EVENT_ROUTER_ADVERTISMENT_OTHER = 2,
|
|
|
|
SD_NDISC_EVENT_ROUTER_ADVERTISMENT_MANAGED = 3,
|
2014-06-19 14:38:55 +02:00
|
|
|
};
|
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
typedef struct sd_ndisc sd_ndisc;
|
2014-06-19 14:38:55 +02:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
typedef void(*sd_ndisc_callback_t)(sd_ndisc *nd, int event,
|
2014-06-19 14:38:55 +02:00
|
|
|
void *userdata);
|
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb,
|
2014-06-19 14:38:55 +02:00
|
|
|
void *userdata);
|
2015-10-16 17:07:47 +02:00
|
|
|
int sd_ndisc_set_index(sd_ndisc *nd, int interface_index);
|
|
|
|
int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr);
|
2014-06-19 14:38:55 +02:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int priority);
|
|
|
|
int sd_ndisc_detach_event(sd_ndisc *nd);
|
|
|
|
sd_event *sd_ndisc_get_event(sd_ndisc *nd);
|
2014-06-19 14:38:55 +02:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
sd_ndisc *sd_ndisc_ref(sd_ndisc *nd);
|
|
|
|
sd_ndisc *sd_ndisc_unref(sd_ndisc *nd);
|
|
|
|
int sd_ndisc_new(sd_ndisc **ret);
|
2014-06-19 14:38:55 +02:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *mtu);
|
2015-01-20 18:35:59 +01:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
int sd_ndisc_stop(sd_ndisc *nd);
|
|
|
|
int sd_ndisc_router_discovery_start(sd_ndisc *nd);
|
2014-06-19 14:38:55 +02:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
#define SD_NDISC_ADDRESS_FORMAT_STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
|
2015-01-20 18:36:01 +01:00
|
|
|
|
2015-10-16 17:07:47 +02:00
|
|
|
#define SD_NDISC_ADDRESS_FORMAT_VAL(address) \
|
2015-01-20 18:36:01 +01:00
|
|
|
be16toh((address).s6_addr16[0]), \
|
|
|
|
be16toh((address).s6_addr16[1]), \
|
|
|
|
be16toh((address).s6_addr16[2]), \
|
|
|
|
be16toh((address).s6_addr16[3]), \
|
|
|
|
be16toh((address).s6_addr16[4]), \
|
|
|
|
be16toh((address).s6_addr16[5]), \
|
|
|
|
be16toh((address).s6_addr16[6]), \
|
|
|
|
be16toh((address).s6_addr16[7])
|
|
|
|
|
2014-06-19 14:38:55 +02:00
|
|
|
#endif
|