root/opal/mca/pmix/pmix4x/pmix/src/mca/pif/pif.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) 2016-2018 Intel, Inc.  All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #ifndef PMIX_MCA_PIF_PIF_H
  15 #define PMIX_MCA_PIF_PIF_H
  16 
  17 #include "pmix_config.h"
  18 
  19 #include <string.h>
  20 #ifdef HAVE_UNISTD_H
  21 #include <unistd.h>
  22 #endif
  23 #include <errno.h>
  24 #ifdef HAVE_SYS_TYPES_H
  25 #include <sys/types.h>
  26 #endif
  27 #ifdef HAVE_SYS_SOCKET_H
  28 #include <sys/socket.h>
  29 #endif
  30 #ifdef HAVE_SYS_SOCKIO_H
  31 #include <sys/sockio.h>
  32 #endif
  33 #ifdef HAVE_SYS_IOCTL_H
  34 #include <sys/ioctl.h>
  35 #endif
  36 #ifdef HAVE_NETINET_IN_H
  37 #include <netinet/in.h>
  38 #endif
  39 #ifdef HAVE_ARPA_INET_H
  40 #include <arpa/inet.h>
  41 #endif
  42 #ifdef HAVE_NET_IF_H
  43 #include <net/if.h>
  44 #endif
  45 #ifdef HAVE_NETDB_H
  46 #include <netdb.h>
  47 #endif
  48 #ifdef HAVE_IFADDRS_H
  49 #include <ifaddrs.h>
  50 #endif
  51 
  52 #include "src/util/pif.h"
  53 #include "src/mca/mca.h"
  54 #include "src/mca/base/base.h"
  55 
  56 BEGIN_C_DECLS
  57 
  58 /*
  59  * Define INADDR_NONE if we don't have it.  Solaris is the only system
  60  * where I have found that it does not exist, and the man page for
  61  * inet_addr() says that it returns -1 upon failure.  On Linux and
  62  * other systems with INADDR_NONE, it's just a #define to -1 anyway.
  63  * So just #define it to -1 here if it doesn't already exist.
  64  */
  65 
  66 #if !defined(INADDR_NONE)
  67 #define INADDR_NONE -1
  68 #endif
  69 
  70 #define DEFAULT_NUMBER_INTERFACES 10
  71 #define MAX_PIFCONF_SIZE 10 * 1024 * 1024
  72 
  73 
  74 typedef struct pmix_pif_t {
  75     pmix_list_item_t     super;
  76     char                if_name[IF_NAMESIZE+1];
  77     int                 if_index;
  78     uint16_t            if_kernel_index;
  79     uint16_t            af_family;
  80     int                 if_flags;
  81     int                 if_speed;
  82     struct sockaddr_storage  if_addr;
  83     uint32_t            if_mask;
  84     uint32_t            if_bandwidth;
  85     uint8_t             if_mac[6];
  86     int                 ifmtu; /* Can't use if_mtu because of a
  87                                   #define collision on some BSDs */
  88 } pmix_pif_t;
  89 PMIX_CLASS_DECLARATION(pmix_pif_t);
  90 
  91 
  92 /* "global" list of available interfaces */
  93 extern pmix_list_t pmix_if_list;
  94 
  95 /* global flags */
  96 extern bool pmix_if_do_not_resolve;
  97 extern bool pmix_if_retain_loopback;
  98 
  99 /**
 100  * Structure for if components.
 101  */
 102 struct pmix_pif_base_component_2_0_0_t {
 103     /** MCA base component */
 104     pmix_mca_base_component_t base;
 105     /** MCA base data */
 106     pmix_mca_base_component_data_t data;
 107 };
 108 /**
 109  * Convenience typedef
 110  */
 111 typedef struct pmix_pif_base_component_2_0_0_t pmix_pif_base_component_t;
 112 
 113 /*
 114  * Macro for use in components that are of type pif
 115  */
 116 #define PMIX_PIF_BASE_VERSION_2_0_0 \
 117     PMIX_MCA_BASE_VERSION_1_0_0("pif", 2, 0, 0)
 118 
 119 END_C_DECLS
 120 
 121 #endif /* PMIX_MCA_PIF_PIF_H */

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