1321936Shselasky/*
2321936Shselasky * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
3321936Shselasky * Copyright (c) 2007 Lawrence Livermore National Lab
4321936Shselasky *
5321936Shselasky * This software is available to you under a choice of one of two
6321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
7321936Shselasky * General Public License (GPL) Version 2, available from the file
8321936Shselasky * COPYING in the main directory of this source tree, or the
9321936Shselasky * OpenIB.org BSD license below:
10321936Shselasky *
11321936Shselasky *     Redistribution and use in source and binary forms, with or
12321936Shselasky *     without modification, are permitted provided that the following
13321936Shselasky *     conditions are met:
14321936Shselasky *
15321936Shselasky *      - Redistributions of source code must retain the above
16321936Shselasky *        copyright notice, this list of conditions and the following
17321936Shselasky *        disclaimer.
18321936Shselasky *
19321936Shselasky *      - Redistributions in binary form must reproduce the above
20321936Shselasky *        copyright notice, this list of conditions and the following
21321936Shselasky *        disclaimer in the documentation and/or other materials
22321936Shselasky *        provided with the distribution.
23321936Shselasky *
24321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31321936Shselasky * SOFTWARE.
32321936Shselasky *
33321936Shselasky */
34321936Shselasky
35321936Shselasky#ifndef _CL_NODE_NAME_MAP_H_
36321936Shselasky#define _CL_NODE_NAME_MAP_H_
37321936Shselasky
38321936Shselasky#include <stdio.h>
39321936Shselasky#include <stdint.h>
40321936Shselasky#include <complib/cl_qmap.h>
41321936Shselasky
42321936Shselasky/* NOTE: this may modify the parameter "nodedesc". */
43321936Shselaskychar *clean_nodedesc(char *nodedesc);
44321936Shselasky
45321936Shselaskytypedef struct _name_map_item {
46321936Shselasky	cl_map_item_t item;
47321936Shselasky	uint64_t guid;
48321936Shselasky	char *name;
49321936Shselasky} name_map_item_t;
50321936Shselasky
51321936Shselaskytypedef cl_qmap_t nn_map_t;
52321936Shselasky
53321936Shselasky/**
54321936Shselasky * Node name map interface.
55321936Shselasky * It is OK to pass NULL for the node_name_map[_fp] parameters.
56321936Shselasky */
57321936Shselaskynn_map_t *open_node_name_map(const char *node_name_map);
58321936Shselaskyvoid  close_node_name_map(nn_map_t *map);
59321936Shselaskychar *remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc);
60321936Shselasky	/* NOTE: parameter "nodedesc" may be modified here. */
61321936Shselaskyint parse_node_map(const char *file_name,
62321936Shselasky		   int (*create)(void *, uint64_t, char *), void *cxt);
63321936Shselasky
64321936Shselasky#endif				/* _CL_NODE_NAME_MAP_H_ */
65