root/orte/util/listener.h

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

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2006 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2006-2013 Los Alamos National Security, LLC.
  13  *                         All rights reserved.
  14  * Copyright (c) 2010-2011 Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2015      Intel, Inc. All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #ifndef ORTE_LISTENER_H
  24 #define ORTE_LISTENER_H
  25 
  26 #include "orte_config.h"
  27 
  28 #ifdef HAVE_SYS_TYPES_H
  29 #include <sys/types.h>
  30 #endif
  31 #ifdef HAVE_SYS_SOCKET_H
  32 #include <sys/socket.h>
  33 #endif
  34 
  35 #include "opal/class/opal_list.h"
  36 #include "opal/mca/event/event.h"
  37 
  38 /* callback prototype */
  39 typedef void (*orte_listener_callback_fn_t)(int sd, short args, void *cbdata);
  40 
  41 /*
  42  * Data structure for accepting connections.
  43  */
  44 typedef struct orte_listener_t {
  45     opal_list_item_t item;
  46     int sd;
  47     opal_event_base_t *evbase;
  48     orte_listener_callback_fn_t handler;
  49 } orte_listener_t;
  50 OBJ_CLASS_DECLARATION(orte_listener_t);
  51 
  52 typedef struct {
  53     opal_object_t super;
  54     opal_event_t ev;
  55     int fd;
  56     struct sockaddr_storage addr;
  57 } orte_pending_connection_t;
  58 OBJ_CLASS_DECLARATION(orte_pending_connection_t);
  59 
  60 ORTE_DECLSPEC int orte_start_listening(void);
  61 ORTE_DECLSPEC void orte_stop_listening(void);
  62 ORTE_DECLSPEC int orte_register_listener(struct sockaddr* address, opal_socklen_t addrlen,
  63                                          opal_event_base_t *evbase,
  64                                          orte_listener_callback_fn_t handler);
  65 
  66 #endif /* ORTE_LISTENER_H */

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