Blame view

RIOT/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c 1.39 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  /*
   * Copyright (C) 2016 Cenk Gündoğan <mail@cgundogan.de>
   *
   * This file is subject to the terms and conditions of the GNU Lesser
   * General Public License v2.1. See the file LICENSE in the top level
   * directory for more details.
   *
   */
  
  /*
   * @ingroup gnrc_rpl
   * @{
   *
   * @file
   * @brief   Auto initialization for gnrc_rpl
   *
   * @author  Cenk Gündoğan <mail@cgundogan.de>
   */
  
  #ifdef MODULE_AUTO_INIT_GNRC_RPL
  
  #include "net/gnrc.h"
  #include "net/gnrc/rpl.h"
  
  #define ENABLE_DEBUG (0)
  #include "debug.h"
  
  void auto_init_gnrc_rpl(void)
  {
  #if (GNRC_NETIF_NUMOF == 1)
      kernel_pid_t ifs[GNRC_NETIF_NUMOF];
      gnrc_netif_get(ifs);
      DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n", ifs[0]);
      gnrc_rpl_init(ifs[0]);
      return;
  #elif defined(GNRC_RPL_DEFAULT_NETIF)
      if (gnrc_netif_exist(GNRC_RPL_DEFAULT_NETIF)) {
          DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n",
                GNRC_RPL_DEFAULT_NETIF);
          gnrc_rpl_init(GNRC_RPL_DEFAULT_NETIF);
          return;
      }
      DEBUG("auto_init_gnrc_rpl: could not initialize RPL on interface %" PRIkernel_pid" - "
            "interface does not exist\n", GNRC_RPL_DEFAULT_NETIF);
      return;
  #else
      DEBUG("auto_init_gnrc_rpl: please specify an interface by setting GNRC_RPL_DEFAULT_NETIF\n");
  #endif
  }
  #else
  typedef int dont_be_pedantic;
  #endif /* MODULE_AUTO_INIT_GNRC_RPL */
  
  /** @} */