1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifndef OPAL_MCA_IF_IF_H
16 #define OPAL_MCA_IF_IF_H
17
18 #include "opal_config.h"
19
20 #include <string.h>
21 #ifdef HAVE_UNISTD_H
22 #include <unistd.h>
23 #endif
24 #include <errno.h>
25 #ifdef HAVE_SYS_TYPES_H
26 #include <sys/types.h>
27 #endif
28 #ifdef HAVE_SYS_SOCKET_H
29 #include <sys/socket.h>
30 #endif
31 #ifdef HAVE_SYS_SOCKIO_H
32 #include <sys/sockio.h>
33 #endif
34 #ifdef HAVE_SYS_IOCTL_H
35 #include <sys/ioctl.h>
36 #endif
37 #ifdef HAVE_NETINET_IN_H
38 #include <netinet/in.h>
39 #endif
40 #ifdef HAVE_ARPA_INET_H
41 #include <arpa/inet.h>
42 #endif
43 #ifdef HAVE_NET_IF_H
44 #include <net/if.h>
45 #endif
46 #ifdef HAVE_NETDB_H
47 #include <netdb.h>
48 #endif
49 #ifdef HAVE_IFADDRS_H
50 #include <ifaddrs.h>
51 #endif
52
53 #include "opal/util/if.h"
54 #include "opal/mca/mca.h"
55 #include "opal/mca/base/base.h"
56
57 BEGIN_C_DECLS
58
59
60
61
62
63
64
65
66
67 #if !defined(INADDR_NONE)
68 #define INADDR_NONE -1
69 #endif
70
71 #define DEFAULT_NUMBER_INTERFACES 10
72 #define MAX_IFCONF_SIZE 10 * 1024 * 1024
73
74
75 typedef struct opal_if_t {
76 opal_list_item_t super;
77 char if_name[IF_NAMESIZE];
78 int if_index;
79 uint16_t if_kernel_index;
80 uint16_t af_family;
81 int if_flags;
82 int if_speed;
83 struct sockaddr_storage if_addr;
84 uint32_t if_mask;
85 uint32_t if_bandwidth;
86 uint8_t if_mac[6];
87 int ifmtu;
88
89 } opal_if_t;
90 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_if_t);
91
92
93
94 OPAL_DECLSPEC extern opal_list_t opal_if_list;
95
96
97 OPAL_DECLSPEC extern bool opal_if_do_not_resolve;
98 OPAL_DECLSPEC extern bool opal_if_retain_loopback;
99
100
101
102
103 struct opal_if_base_component_2_0_0_t {
104
105 mca_base_component_t component;
106
107 mca_base_component_data_t component_data;
108 };
109
110
111
112 typedef struct opal_if_base_component_2_0_0_t opal_if_base_component_t;
113
114
115
116
117 #define OPAL_IF_BASE_VERSION_2_0_0 \
118 OPAL_MCA_BASE_VERSION_2_1_0("if", 2, 0, 0)
119
120 END_C_DECLS
121
122 #endif