1b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden/*
2b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * net/tipc/name_table.h: Include file for TIPC name table code
3c43072852649d8382b81237ce51195bcec36f24aYOSHIFUJI Hideaki *
4593a5f22d8035b1396a958b6bbde9f13c0f09549Per Liden * Copyright (c) 2000-2006, Ericsson AB
5f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
6b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * All rights reserved.
7b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden *
89ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * Redistribution and use in source and binary forms, with or without
9b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * modification, are permitted provided that the following conditions are met:
10b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden *
119ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * 1. Redistributions of source code must retain the above copyright
129ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *    notice, this list of conditions and the following disclaimer.
139ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * 2. Redistributions in binary form must reproduce the above copyright
149ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *    notice, this list of conditions and the following disclaimer in the
159ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *    documentation and/or other materials provided with the distribution.
169ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * 3. Neither the names of the copyright holders nor the names of its
179ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *    contributors may be used to endorse or promote products derived from
189ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *    this software without specific prior written permission.
19b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden *
209ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * Alternatively, this software may be distributed under the terms of the
219ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * GNU General Public License ("GPL") version 2 as published by the Free
229ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * Software Foundation.
239ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden *
249ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
259ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
269ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
279ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
289ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
299ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
309ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
319ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
329ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
339ea1fd3c1a15c620d1e3d0aa269d34b705477003Per Liden * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * POSSIBILITY OF SUCH DAMAGE.
35b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden */
36b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
37b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden#ifndef _TIPC_NAME_TABLE_H
38b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden#define _TIPC_NAME_TABLE_H
39b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
40b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden#include "node_subscr.h"
41b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
42fead39098badacbfb5890de9a10e5b265788a524Paul Gortmakerstruct tipc_subscription;
434584310b4a787c9b70e5507a8b5288ba32b0a909Paul Gortmakerstruct tipc_port_list;
44b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
45b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden/*
46b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * TIPC name types reserved for internal TIPC use (both current and planned)
47b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden */
480e65967e33be61e5f67727edd4ea829b47676fc0Allan Stephens#define TIPC_ZM_SRV 3		/* zone master service name type */
49b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
50b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden/**
51b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * struct publication - info about a published (name or) name sequence
52b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @type: name sequence type
53b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @lower: name sequence lower bound
54b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @upper: name sequence upper bound
55b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @scope: scope of publication
56b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @node: network address of publishing port's node
57b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @ref: publishing port
58b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @key: publication key
59b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @subscr: subscription to "node down" event (for off-node publications only)
60b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @local_list: adjacent entries in list of publications made by this node
61b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * @pport_list: adjacent entries in list of publications made by this port
62f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens * @node_list: adjacent matching name seq publications with >= node scope
63f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens * @cluster_list: adjacent matching name seq publications with >= cluster scope
64f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens * @zone_list: adjacent matching name seq publications with >= zone scope
65c43072852649d8382b81237ce51195bcec36f24aYOSHIFUJI Hideaki *
66b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden * Note that the node list, cluster list, and zone list are circular lists.
67b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden */
68b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Lidenstruct publication {
69b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 type;
70b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 lower;
71b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 upper;
72b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 scope;
73b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 node;
74b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 ref;
75b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	u32 key;
766c00055a819ce8a6e2c3af2f65d4ea1a8559c491David S. Miller	struct tipc_node_subscr subscr;
77b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	struct list_head local_list;
78b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden	struct list_head pport_list;
79f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens	struct list_head node_list;
80f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens	struct list_head cluster_list;
81f6f0a4d2d05f758f011a506731e84160d140304bAllan Stephens	struct list_head zone_list;
82b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden};
83b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
84b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
854323add67792ced172d0d93b8b2e6187023115f1Per Lidenextern rwlock_t tipc_nametbl_lock;
86b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
874323add67792ced172d0d93b8b2e6187023115f1Per Lidenstruct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
884323add67792ced172d0d93b8b2e6187023115f1Per Lidenu32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
89c43072852649d8382b81237ce51195bcec36f24aYOSHIFUJI Hideakiint tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
90ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmaker			      struct tipc_port_list *dports);
914323add67792ced172d0d93b8b2e6187023115f1Per Lidenstruct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
92ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmaker					 u32 scope, u32 port_ref, u32 key);
934323add67792ced172d0d93b8b2e6187023115f1Per Lidenint tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
944323add67792ced172d0d93b8b2e6187023115f1Per Lidenstruct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
95ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmaker					     u32 scope, u32 node, u32 ref,
96ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmaker					     u32 key);
97ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmakerstruct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node,
98ae8509c420122866344bde1241e31858d0aa2fbcPaul Gortmaker					     u32 ref, u32 key);
99fead39098badacbfb5890de9a10e5b265788a524Paul Gortmakervoid tipc_nametbl_subscribe(struct tipc_subscription *s);
100fead39098badacbfb5890de9a10e5b265788a524Paul Gortmakervoid tipc_nametbl_unsubscribe(struct tipc_subscription *s);
1014323add67792ced172d0d93b8b2e6187023115f1Per Lidenint tipc_nametbl_init(void);
1024323add67792ced172d0d93b8b2e6187023115f1Per Lidenvoid tipc_nametbl_stop(void);
103b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden
104b97bf3fd8f6a16966d4f18983b2c40993ff937d4Per Liden#endif
105