162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * net/tipc/node.h: Include file for TIPC node management routines
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2000-2006, 2014-2016, Ericsson AB
562306a36Sopenharmony_ci * Copyright (c) 2005, 2010-2014, Wind River Systems
662306a36Sopenharmony_ci * All rights reserved.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
962306a36Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
1262306a36Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
1362306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
1462306a36Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
1562306a36Sopenharmony_ci *    documentation and/or other materials provided with the distribution.
1662306a36Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its
1762306a36Sopenharmony_ci *    contributors may be used to endorse or promote products derived from
1862306a36Sopenharmony_ci *    this software without specific prior written permission.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
2162306a36Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
2262306a36Sopenharmony_ci * Software Foundation.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2562306a36Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2662306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2762306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2862306a36Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2962306a36Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3062306a36Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3162306a36Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3262306a36Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3362306a36Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3462306a36Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE.
3562306a36Sopenharmony_ci */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#ifndef _TIPC_NODE_H
3862306a36Sopenharmony_ci#define _TIPC_NODE_H
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#include "addr.h"
4162306a36Sopenharmony_ci#include "net.h"
4262306a36Sopenharmony_ci#include "bearer.h"
4362306a36Sopenharmony_ci#include "msg.h"
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* Optional capabilities supported by this code version
4662306a36Sopenharmony_ci */
4762306a36Sopenharmony_cienum {
4862306a36Sopenharmony_ci	TIPC_SYN_BIT          = (1),
4962306a36Sopenharmony_ci	TIPC_BCAST_SYNCH      = (1 << 1),
5062306a36Sopenharmony_ci	TIPC_BCAST_STATE_NACK = (1 << 2),
5162306a36Sopenharmony_ci	TIPC_BLOCK_FLOWCTL    = (1 << 3),
5262306a36Sopenharmony_ci	TIPC_BCAST_RCAST      = (1 << 4),
5362306a36Sopenharmony_ci	TIPC_NODE_ID128       = (1 << 5),
5462306a36Sopenharmony_ci	TIPC_LINK_PROTO_SEQNO = (1 << 6),
5562306a36Sopenharmony_ci	TIPC_MCAST_RBCTL      = (1 << 7),
5662306a36Sopenharmony_ci	TIPC_GAP_ACK_BLOCK    = (1 << 8),
5762306a36Sopenharmony_ci	TIPC_TUNNEL_ENHANCED  = (1 << 9),
5862306a36Sopenharmony_ci	TIPC_NAGLE            = (1 << 10),
5962306a36Sopenharmony_ci	TIPC_NAMED_BCAST      = (1 << 11)
6062306a36Sopenharmony_ci};
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT           |  \
6362306a36Sopenharmony_ci				TIPC_BCAST_SYNCH       |   \
6462306a36Sopenharmony_ci				TIPC_BCAST_STATE_NACK  |   \
6562306a36Sopenharmony_ci				TIPC_BCAST_RCAST       |   \
6662306a36Sopenharmony_ci				TIPC_BLOCK_FLOWCTL     |   \
6762306a36Sopenharmony_ci				TIPC_NODE_ID128        |   \
6862306a36Sopenharmony_ci				TIPC_LINK_PROTO_SEQNO  |   \
6962306a36Sopenharmony_ci				TIPC_MCAST_RBCTL       |   \
7062306a36Sopenharmony_ci				TIPC_GAP_ACK_BLOCK     |   \
7162306a36Sopenharmony_ci				TIPC_TUNNEL_ENHANCED   |   \
7262306a36Sopenharmony_ci				TIPC_NAGLE             |   \
7362306a36Sopenharmony_ci				TIPC_NAMED_BCAST)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define INVALID_BEARER_ID -1
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_civoid tipc_node_stop(struct net *net);
7862306a36Sopenharmony_cibool tipc_node_get_id(struct net *net, u32 addr, u8 *id);
7962306a36Sopenharmony_ciu32 tipc_node_get_addr(struct tipc_node *node);
8062306a36Sopenharmony_cichar *tipc_node_get_id_str(struct tipc_node *node);
8162306a36Sopenharmony_civoid tipc_node_put(struct tipc_node *node);
8262306a36Sopenharmony_civoid tipc_node_get(struct tipc_node *node);
8362306a36Sopenharmony_cistruct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id,
8462306a36Sopenharmony_ci				   u16 capabilities, u32 hash_mixes,
8562306a36Sopenharmony_ci				   bool preliminary);
8662306a36Sopenharmony_ci#ifdef CONFIG_TIPC_CRYPTO
8762306a36Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx(struct tipc_node *__n);
8862306a36Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx_by_list(struct list_head *pos);
8962306a36Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx_by_addr(struct net *net, u32 addr);
9062306a36Sopenharmony_ci#endif
9162306a36Sopenharmony_ciu32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr);
9262306a36Sopenharmony_civoid tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128,
9362306a36Sopenharmony_ci			  struct tipc_bearer *bearer,
9462306a36Sopenharmony_ci			  u16 capabilities, u32 signature, u32 hash_mixes,
9562306a36Sopenharmony_ci			  struct tipc_media_addr *maddr,
9662306a36Sopenharmony_ci			  bool *respond, bool *dupl_addr);
9762306a36Sopenharmony_civoid tipc_node_delete_links(struct net *net, int bearer_id);
9862306a36Sopenharmony_civoid tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop);
9962306a36Sopenharmony_ciint tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
10062306a36Sopenharmony_ci			   char *linkname, size_t len);
10162306a36Sopenharmony_ciint tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,
10262306a36Sopenharmony_ci		   int selector);
10362306a36Sopenharmony_ciint tipc_node_distr_xmit(struct net *net, struct sk_buff_head *list);
10462306a36Sopenharmony_ciint tipc_node_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest,
10562306a36Sopenharmony_ci		       u32 selector);
10662306a36Sopenharmony_civoid tipc_node_subscribe(struct net *net, struct list_head *subscr, u32 addr);
10762306a36Sopenharmony_civoid tipc_node_unsubscribe(struct net *net, struct list_head *subscr, u32 addr);
10862306a36Sopenharmony_civoid tipc_node_broadcast(struct net *net, struct sk_buff *skb, int rc_dests);
10962306a36Sopenharmony_ciint tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port);
11062306a36Sopenharmony_civoid tipc_node_remove_conn(struct net *net, u32 dnode, u32 port);
11162306a36Sopenharmony_ciint tipc_node_get_mtu(struct net *net, u32 addr, u32 sel, bool connected);
11262306a36Sopenharmony_cibool tipc_node_is_up(struct net *net, u32 addr);
11362306a36Sopenharmony_ciu16 tipc_node_get_capabilities(struct net *net, u32 addr);
11462306a36Sopenharmony_ciint tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb);
11562306a36Sopenharmony_ciint tipc_nl_node_dump_link(struct sk_buff *skb, struct netlink_callback *cb);
11662306a36Sopenharmony_ciint tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info);
11762306a36Sopenharmony_ciint tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info);
11862306a36Sopenharmony_ciint tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info);
11962306a36Sopenharmony_ciint tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info);
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciint tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info);
12262306a36Sopenharmony_ciint tipc_nl_node_get_monitor(struct sk_buff *skb, struct genl_info *info);
12362306a36Sopenharmony_ciint tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb);
12462306a36Sopenharmony_ciint tipc_nl_node_dump_monitor_peer(struct sk_buff *skb,
12562306a36Sopenharmony_ci				   struct netlink_callback *cb);
12662306a36Sopenharmony_ci#ifdef CONFIG_TIPC_CRYPTO
12762306a36Sopenharmony_ciint tipc_nl_node_set_key(struct sk_buff *skb, struct genl_info *info);
12862306a36Sopenharmony_ciint tipc_nl_node_flush_key(struct sk_buff *skb, struct genl_info *info);
12962306a36Sopenharmony_ci#endif
13062306a36Sopenharmony_civoid tipc_node_pre_cleanup_net(struct net *exit_net);
13162306a36Sopenharmony_ci#endif
132