• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 struct routeup
17 {
18   int netlinkfd;  /* AF_NETLINK event socket */
19 };
20 
21 #ifdef TARGET_OS_LINUX
22 int routeup_setup (struct routeup *ifc);
23 int routeup_once (struct routeup *ifc, unsigned int timeout);
24 int routeup_process (struct routeup *rtc);
25 void routeup_teardown (struct routeup *ifc);
26 #else
routeup_setup(struct routeup * ifc)27 static inline int routeup_setup (struct routeup *ifc)
28 {
29   return 1;  /* Fail for platforms without support. */
30 }
routeup_once(struct routeup * ifc,unsigned int timeout)31 static inline int routeup_once (struct routeup *ifc, unsigned int timeout)
32 {
33   return -1;
34 }
routeup_process(struct routeup * rtc)35 static inline int routeup_process (struct routeup *rtc)
36 {
37   return -1;
38 }
routeup_teardown(struct routeup * ifc)39 static inline void routeup_teardown (struct routeup *ifc)
40 {
41 }
42 #endif
43 
44 #endif /* !ROUTEUP_H */
45