1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2007 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
15 * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
16 * reserved.
17 * Copyright (c) 2017 IBM Corporation. All rights reserved.
18 * $COPYRIGHT$
19 *
20 * Additional copyrights may follow
21 *
22 * $HEADER$
23 */
24
25 #ifndef OMPI_INFOSUBSCRIBE_H
26 #define OMPI_INFOSUBSCRIBE_H
27
28 #include <string.h>
29
30 #include "opal/class/opal_list.h"
31 #include "opal/class/opal_pointer_array.h"
32 #include "opal/class/opal_hash_table.h"
33 #include "opal/threads/mutex.h"
34 #include "opal/util/info.h"
35
36 #include "opal/mca/base/mca_base_var_enum.h"
37
38
39 #define INFO_SUBSCRIBER_SIZE 5
40
41 struct opal_infosubscriber_t {
42 opal_object_t s_base;
43 opal_hash_table_t s_subscriber_table;
44 opal_info_t *s_info;
45 };
46 typedef struct opal_infosubscriber_t opal_infosubscriber_t;
47
48 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_infosubscriber_t);
49
50 typedef char*(opal_key_interest_callback_t)(opal_infosubscriber_t*, char*, char*);
51
52 /**
53 * opal_infosubscribe_change_info - Make changes to a Comm/Win/File Info
54 *
55 * @param type Comm/Win/File
56 * @param object corresponding Com/Win/File object
57 * @param old_info previous info setting
58 * @param new_info new info setting
59 *
60 * @retval OPAL status
61 *
62 * Notifies subscribers of info's that have gone away and new info settings
63 */
64 int opal_infosubscribe_change_info(opal_infosubscriber_t*, opal_info_t *);
65
66
67 /**
68 * opal_infosubscribe_subscribe - Request to be updated about info changes to a Comm/Win/File Info
69 *
70 * @param type Comm/Win/File of obj
71 * @param obj either a comm, win or file
72 * @param key info key being set
73 * @param initial_value default value (or NULL if none)
74 * @param callback callback to be called when key changes
75 *
76 * @retval OPAL status
77 *
78 * Notifies subscribers of info's that have gone away and new info settings
79 * Does not try to optimize settings that are the same between old and new
80 * info's.
81 */
82 int opal_infosubscribe_subscribe(opal_infosubscriber_t*, char *, char *, opal_key_interest_callback_t);
83
84 #endif /* OMPI_INFO_H */