1/*
2 * routeup.h - routeup library interface
3 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 *
7 * Call routeup_setup() to initialize a routeup context, then call
8 * routeup_once() until it returns nonzero (indicating an error) or until
9 * you're no longer interested in route changes. Call routeup_teardown()
10 * when you're done with an routeup context.
11 */
12
13#ifndef ROUTEUP_H
14#define ROUTEUP_H
15
16struct routeup
17{
18  int netlinkfd;  /* AF_NETLINK event socket */
19};
20
21#ifdef TARGET_OS_LINUX
22int routeup_setup (struct routeup *ifc);
23int routeup_once (struct routeup *ifc, unsigned int timeout);
24int routeup_process (struct routeup *rtc);
25void routeup_teardown (struct routeup *ifc);
26#else
27static inline int routeup_setup (struct routeup *ifc)
28{
29  return 1;  /* Fail for platforms without support. */
30}
31static inline int routeup_once (struct routeup *ifc, unsigned int timeout)
32{
33  return -1;
34}
35static inline int routeup_process (struct routeup *rtc)
36{
37  return -1;
38}
39static inline void routeup_teardown (struct routeup *ifc)
40{
41}
42#endif
43
44#endif /* !ROUTEUP_H */
45