root/opal/mca/if/if.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2010-2013 Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights
   7  *                         reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  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  * Define INADDR_NONE if we don't have it.  Solaris is the only system
  61  * where I have found that it does not exist, and the man page for
  62  * inet_addr() says that it returns -1 upon failure.  On Linux and
  63  * other systems with INADDR_NONE, it's just a #define to -1 anyway.
  64  * So just #define it to -1 here if it doesn't already exist.
  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; /* Can't use if_mtu because of a
  88                                   #define collision on some BSDs */
  89 } opal_if_t;
  90 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_if_t);
  91 
  92 
  93 /* "global" list of available interfaces */
  94 OPAL_DECLSPEC extern opal_list_t opal_if_list;
  95 
  96 /* global flags */
  97 OPAL_DECLSPEC extern bool opal_if_do_not_resolve;
  98 OPAL_DECLSPEC extern bool opal_if_retain_loopback;
  99 
 100 /**
 101  * Structure for if components.
 102  */
 103 struct opal_if_base_component_2_0_0_t {
 104     /** MCA base component */
 105     mca_base_component_t component;
 106     /** MCA base data */
 107     mca_base_component_data_t component_data;
 108 };
 109 /**
 110  * Convenience typedef
 111  */
 112 typedef struct opal_if_base_component_2_0_0_t opal_if_base_component_t;
 113 
 114 /*
 115  * Macro for use in components that are of type if
 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 /* OPAL_MCA_IF_IF_H */

/* [<][>][^][v][top][bottom][index][help] */