1b97bf3fdSPer Liden /* 2b97bf3fdSPer Liden * net/tipc/node.h: Include file for TIPC node management routines 3b97bf3fdSPer Liden * 402d11ca2SJon Paul Maloy * Copyright (c) 2000-2006, 2014-2016, Ericsson AB 546651c59SYing Xue * Copyright (c) 2005, 2010-2014, Wind River Systems 6b97bf3fdSPer Liden * All rights reserved. 7b97bf3fdSPer Liden * 8b97bf3fdSPer Liden * Redistribution and use in source and binary forms, with or without 9b97bf3fdSPer Liden * modification, are permitted provided that the following conditions are met: 10b97bf3fdSPer Liden * 119ea1fd3cSPer Liden * 1. Redistributions of source code must retain the above copyright 129ea1fd3cSPer Liden * notice, this list of conditions and the following disclaimer. 139ea1fd3cSPer Liden * 2. Redistributions in binary form must reproduce the above copyright 149ea1fd3cSPer Liden * notice, this list of conditions and the following disclaimer in the 159ea1fd3cSPer Liden * documentation and/or other materials provided with the distribution. 169ea1fd3cSPer Liden * 3. Neither the names of the copyright holders nor the names of its 179ea1fd3cSPer Liden * contributors may be used to endorse or promote products derived from 189ea1fd3cSPer Liden * this software without specific prior written permission. 199ea1fd3cSPer Liden * 209ea1fd3cSPer Liden * Alternatively, this software may be distributed under the terms of the 219ea1fd3cSPer Liden * GNU General Public License ("GPL") version 2 as published by the Free 229ea1fd3cSPer Liden * Software Foundation. 23b97bf3fdSPer Liden * 24b97bf3fdSPer Liden * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25b97bf3fdSPer Liden * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26b97bf3fdSPer Liden * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27b97bf3fdSPer Liden * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 28b97bf3fdSPer Liden * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29b97bf3fdSPer Liden * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30b97bf3fdSPer Liden * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31b97bf3fdSPer Liden * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32b97bf3fdSPer Liden * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33b97bf3fdSPer Liden * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34b97bf3fdSPer Liden * POSSIBILITY OF SUCH DAMAGE. 35b97bf3fdSPer Liden */ 36b97bf3fdSPer Liden 37b97bf3fdSPer Liden #ifndef _TIPC_NODE_H 38b97bf3fdSPer Liden #define _TIPC_NODE_H 39b97bf3fdSPer Liden 408f92df6aSAllan Stephens #include "addr.h" 418f92df6aSAllan Stephens #include "net.h" 42b97bf3fdSPer Liden #include "bearer.h" 4316e166b8SJon Paul Maloy #include "msg.h" 44b97bf3fdSPer Liden 45fd556f20SJon Paul Maloy /* Optional capabilities supported by this code version 46fd556f20SJon Paul Maloy */ 47fd556f20SJon Paul Maloy enum { 4825b9221bSJon Maloy TIPC_SYN_BIT = (1), 4910724cc7SJon Paul Maloy TIPC_BCAST_SYNCH = (1 << 1), 5002d11ca2SJon Paul Maloy TIPC_BCAST_STATE_NACK = (1 << 2), 5101fd12bbSJon Paul Maloy TIPC_BLOCK_FLOWCTL = (1 << 3), 5275da2163SJon Maloy TIPC_BCAST_RCAST = (1 << 4), 539012de50SJon Maloy TIPC_NODE_ID128 = (1 << 5), 54ff2ebbfbSHoang Le TIPC_LINK_PROTO_SEQNO = (1 << 6), 559195948fSTuong Lien TIPC_MCAST_RBCTL = (1 << 7), 564929a932STuong Lien TIPC_GAP_ACK_BLOCK = (1 << 8), 57c0bceb97SJon Maloy TIPC_TUNNEL_ENHANCED = (1 << 9), 58cad2929dSHoang Huu Le TIPC_NAGLE = (1 << 10), 59cad2929dSHoang Huu Le TIPC_NAMED_BCAST = (1 << 11) 60fd556f20SJon Paul Maloy }; 61fd556f20SJon Paul Maloy 6225b9221bSJon Maloy #define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \ 6325b9221bSJon Maloy TIPC_BCAST_SYNCH | \ 6402d11ca2SJon Paul Maloy TIPC_BCAST_STATE_NACK | \ 6501fd12bbSJon Paul Maloy TIPC_BCAST_RCAST | \ 6620263641SJon Maloy TIPC_BLOCK_FLOWCTL | \ 679012de50SJon Maloy TIPC_NODE_ID128 | \ 68ff2ebbfbSHoang Le TIPC_LINK_PROTO_SEQNO | \ 699195948fSTuong Lien TIPC_MCAST_RBCTL | \ 704929a932STuong Lien TIPC_GAP_ACK_BLOCK | \ 71c0bceb97SJon Maloy TIPC_TUNNEL_ENHANCED | \ 72cad2929dSHoang Huu Le TIPC_NAGLE | \ 73cad2929dSHoang Huu Le TIPC_NAMED_BCAST) 74c0bceb97SJon Maloy 7538206d59SJon Paul Maloy #define INVALID_BEARER_ID -1 76fd556f20SJon Paul Maloy 77f2f9800dSYing Xue void tipc_node_stop(struct net *net); 783e5cf362SJon Maloy bool tipc_node_get_id(struct net *net, u32 addr, u8 *id); 79b4b9771bSTuong Lien u32 tipc_node_get_addr(struct tipc_node *node); 804cbf8ac2STuong Lien char *tipc_node_get_id_str(struct tipc_node *node); 81fc1b6d6dSTuong Lien void tipc_node_put(struct tipc_node *node); 82*1ef6f7c9STuong Lien void tipc_node_get(struct tipc_node *node); 83fc1b6d6dSTuong Lien struct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id, 84fc1b6d6dSTuong Lien u16 capabilities, u32 hash_mixes, 85fc1b6d6dSTuong Lien bool preliminary); 86fc1b6d6dSTuong Lien #ifdef CONFIG_TIPC_CRYPTO 87fc1b6d6dSTuong Lien struct tipc_crypto *tipc_node_crypto_rx(struct tipc_node *__n); 88fc1b6d6dSTuong Lien struct tipc_crypto *tipc_node_crypto_rx_by_list(struct list_head *pos); 89*1ef6f7c9STuong Lien struct tipc_crypto *tipc_node_crypto_rx_by_addr(struct net *net, u32 addr); 90fc1b6d6dSTuong Lien #endif 9125b0b9c4SJon Maloy u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr); 9225b0b9c4SJon Maloy void tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128, 93cf148816SJon Paul Maloy struct tipc_bearer *bearer, 94f73b1281SHoang Le u16 capabilities, u32 signature, u32 hash_mixes, 95cf148816SJon Paul Maloy struct tipc_media_addr *maddr, 96cf148816SJon Paul Maloy bool *respond, bool *dupl_addr); 976144a996SJon Paul Maloy void tipc_node_delete_links(struct net *net, int bearer_id); 98682cd3cfSGhantaKrishnamurthy MohanKrishna void tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop); 99f2f9800dSYing Xue int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, 100f2f9800dSYing Xue char *linkname, size_t len); 101af9b028eSJon Paul Maloy int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, 102af9b028eSJon Paul Maloy int selector); 103f70d37b7SJon Maloy int tipc_node_distr_xmit(struct net *net, struct sk_buff_head *list); 104af9b028eSJon Paul Maloy int tipc_node_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, 105af9b028eSJon Paul Maloy u32 selector); 1061d7e1c25SJon Paul Maloy void tipc_node_subscribe(struct net *net, struct list_head *subscr, u32 addr); 1071d7e1c25SJon Paul Maloy void tipc_node_unsubscribe(struct net *net, struct list_head *subscr, u32 addr); 108cad2929dSHoang Huu Le void tipc_node_broadcast(struct net *net, struct sk_buff *skb, int rc_dests); 109f2f9800dSYing Xue int tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port); 110f2f9800dSYing Xue void tipc_node_remove_conn(struct net *net, u32 dnode, u32 port); 111f73b1281SHoang Le int tipc_node_get_mtu(struct net *net, u32 addr, u32 sel, bool connected); 11238077b8eSJon Maloy bool tipc_node_is_up(struct net *net, u32 addr); 11360020e18SJon Paul Maloy u16 tipc_node_get_capabilities(struct net *net, u32 addr); 1143e4b6ab5SRichard Alpe int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); 11538206d59SJon Paul Maloy int tipc_nl_node_dump_link(struct sk_buff *skb, struct netlink_callback *cb); 1165be9c086SJon Paul Maloy int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info); 1175be9c086SJon Paul Maloy int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info); 1185be9c086SJon Paul Maloy int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info); 119b3404022SRichard Alpe int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info); 12016e166b8SJon Paul Maloy 1217b3f5229SParthasarathy Bhuvaragan int tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info); 122bf1035b2SParthasarathy Bhuvaragan int tipc_nl_node_get_monitor(struct sk_buff *skb, struct genl_info *info); 123cf6f7e1dSParthasarathy Bhuvaragan int tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb); 124cf6f7e1dSParthasarathy Bhuvaragan int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb, 125cf6f7e1dSParthasarathy Bhuvaragan struct netlink_callback *cb); 126e1f32190STuong Lien #ifdef CONFIG_TIPC_CRYPTO 127e1f32190STuong Lien int tipc_nl_node_set_key(struct sk_buff *skb, struct genl_info *info); 128e1f32190STuong Lien int tipc_nl_node_flush_key(struct sk_buff *skb, struct genl_info *info); 129e1f32190STuong Lien #endif 130f73b1281SHoang Le void tipc_node_pre_cleanup_net(struct net *exit_net); 131b97bf3fdSPer Liden #endif 132