18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * net/tipc/node.h: Include file for TIPC node management routines 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) 2000-2006, 2014-2016, Ericsson AB 58c2ecf20Sopenharmony_ci * Copyright (c) 2005, 2010-2014, Wind River Systems 68c2ecf20Sopenharmony_ci * All rights reserved. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 98c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 128c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 138c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 148c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 158c2ecf20Sopenharmony_ci * documentation and/or other materials provided with the distribution. 168c2ecf20Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its 178c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived from 188c2ecf20Sopenharmony_ci * this software without specific prior written permission. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the 218c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free 228c2ecf20Sopenharmony_ci * Software Foundation. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 258c2ecf20Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 268c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 278c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 288c2ecf20Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 298c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 308c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 318c2ecf20Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 328c2ecf20Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 338c2ecf20Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 348c2ecf20Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE. 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#ifndef _TIPC_NODE_H 388c2ecf20Sopenharmony_ci#define _TIPC_NODE_H 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#include "addr.h" 418c2ecf20Sopenharmony_ci#include "net.h" 428c2ecf20Sopenharmony_ci#include "bearer.h" 438c2ecf20Sopenharmony_ci#include "msg.h" 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* Optional capabilities supported by this code version 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_cienum { 488c2ecf20Sopenharmony_ci TIPC_SYN_BIT = (1), 498c2ecf20Sopenharmony_ci TIPC_BCAST_SYNCH = (1 << 1), 508c2ecf20Sopenharmony_ci TIPC_BCAST_STATE_NACK = (1 << 2), 518c2ecf20Sopenharmony_ci TIPC_BLOCK_FLOWCTL = (1 << 3), 528c2ecf20Sopenharmony_ci TIPC_BCAST_RCAST = (1 << 4), 538c2ecf20Sopenharmony_ci TIPC_NODE_ID128 = (1 << 5), 548c2ecf20Sopenharmony_ci TIPC_LINK_PROTO_SEQNO = (1 << 6), 558c2ecf20Sopenharmony_ci TIPC_MCAST_RBCTL = (1 << 7), 568c2ecf20Sopenharmony_ci TIPC_GAP_ACK_BLOCK = (1 << 8), 578c2ecf20Sopenharmony_ci TIPC_TUNNEL_ENHANCED = (1 << 9), 588c2ecf20Sopenharmony_ci TIPC_NAGLE = (1 << 10), 598c2ecf20Sopenharmony_ci TIPC_NAMED_BCAST = (1 << 11) 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \ 638c2ecf20Sopenharmony_ci TIPC_BCAST_SYNCH | \ 648c2ecf20Sopenharmony_ci TIPC_BCAST_STATE_NACK | \ 658c2ecf20Sopenharmony_ci TIPC_BCAST_RCAST | \ 668c2ecf20Sopenharmony_ci TIPC_BLOCK_FLOWCTL | \ 678c2ecf20Sopenharmony_ci TIPC_NODE_ID128 | \ 688c2ecf20Sopenharmony_ci TIPC_LINK_PROTO_SEQNO | \ 698c2ecf20Sopenharmony_ci TIPC_MCAST_RBCTL | \ 708c2ecf20Sopenharmony_ci TIPC_GAP_ACK_BLOCK | \ 718c2ecf20Sopenharmony_ci TIPC_TUNNEL_ENHANCED | \ 728c2ecf20Sopenharmony_ci TIPC_NAGLE | \ 738c2ecf20Sopenharmony_ci TIPC_NAMED_BCAST) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define INVALID_BEARER_ID -1 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_civoid tipc_node_stop(struct net *net); 788c2ecf20Sopenharmony_cibool tipc_node_get_id(struct net *net, u32 addr, u8 *id); 798c2ecf20Sopenharmony_ciu32 tipc_node_get_addr(struct tipc_node *node); 808c2ecf20Sopenharmony_cichar *tipc_node_get_id_str(struct tipc_node *node); 818c2ecf20Sopenharmony_civoid tipc_node_put(struct tipc_node *node); 828c2ecf20Sopenharmony_civoid tipc_node_get(struct tipc_node *node); 838c2ecf20Sopenharmony_cistruct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id, 848c2ecf20Sopenharmony_ci u16 capabilities, u32 hash_mixes, 858c2ecf20Sopenharmony_ci bool preliminary); 868c2ecf20Sopenharmony_ci#ifdef CONFIG_TIPC_CRYPTO 878c2ecf20Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx(struct tipc_node *__n); 888c2ecf20Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx_by_list(struct list_head *pos); 898c2ecf20Sopenharmony_cistruct tipc_crypto *tipc_node_crypto_rx_by_addr(struct net *net, u32 addr); 908c2ecf20Sopenharmony_ci#endif 918c2ecf20Sopenharmony_ciu32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr); 928c2ecf20Sopenharmony_civoid tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128, 938c2ecf20Sopenharmony_ci struct tipc_bearer *bearer, 948c2ecf20Sopenharmony_ci u16 capabilities, u32 signature, u32 hash_mixes, 958c2ecf20Sopenharmony_ci struct tipc_media_addr *maddr, 968c2ecf20Sopenharmony_ci bool *respond, bool *dupl_addr); 978c2ecf20Sopenharmony_civoid tipc_node_delete_links(struct net *net, int bearer_id); 988c2ecf20Sopenharmony_civoid tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop); 998c2ecf20Sopenharmony_ciint tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, 1008c2ecf20Sopenharmony_ci char *linkname, size_t len); 1018c2ecf20Sopenharmony_ciint tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, 1028c2ecf20Sopenharmony_ci int selector); 1038c2ecf20Sopenharmony_ciint tipc_node_distr_xmit(struct net *net, struct sk_buff_head *list); 1048c2ecf20Sopenharmony_ciint tipc_node_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, 1058c2ecf20Sopenharmony_ci u32 selector); 1068c2ecf20Sopenharmony_civoid tipc_node_subscribe(struct net *net, struct list_head *subscr, u32 addr); 1078c2ecf20Sopenharmony_civoid tipc_node_unsubscribe(struct net *net, struct list_head *subscr, u32 addr); 1088c2ecf20Sopenharmony_civoid tipc_node_broadcast(struct net *net, struct sk_buff *skb, int rc_dests); 1098c2ecf20Sopenharmony_ciint tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port); 1108c2ecf20Sopenharmony_civoid tipc_node_remove_conn(struct net *net, u32 dnode, u32 port); 1118c2ecf20Sopenharmony_ciint tipc_node_get_mtu(struct net *net, u32 addr, u32 sel, bool connected); 1128c2ecf20Sopenharmony_cibool tipc_node_is_up(struct net *net, u32 addr); 1138c2ecf20Sopenharmony_ciu16 tipc_node_get_capabilities(struct net *net, u32 addr); 1148c2ecf20Sopenharmony_ciint tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); 1158c2ecf20Sopenharmony_ciint tipc_nl_node_dump_link(struct sk_buff *skb, struct netlink_callback *cb); 1168c2ecf20Sopenharmony_ciint tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info); 1178c2ecf20Sopenharmony_ciint tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info); 1188c2ecf20Sopenharmony_ciint tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info); 1198c2ecf20Sopenharmony_ciint tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info); 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ciint tipc_nl_node_set_monitor(struct sk_buff *skb, struct genl_info *info); 1228c2ecf20Sopenharmony_ciint tipc_nl_node_get_monitor(struct sk_buff *skb, struct genl_info *info); 1238c2ecf20Sopenharmony_ciint tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb); 1248c2ecf20Sopenharmony_ciint tipc_nl_node_dump_monitor_peer(struct sk_buff *skb, 1258c2ecf20Sopenharmony_ci struct netlink_callback *cb); 1268c2ecf20Sopenharmony_ci#ifdef CONFIG_TIPC_CRYPTO 1278c2ecf20Sopenharmony_ciint tipc_nl_node_set_key(struct sk_buff *skb, struct genl_info *info); 1288c2ecf20Sopenharmony_ciint tipc_nl_node_flush_key(struct sk_buff *skb, struct genl_info *info); 1298c2ecf20Sopenharmony_ci#endif 1308c2ecf20Sopenharmony_civoid tipc_node_pre_cleanup_net(struct net *exit_net); 1318c2ecf20Sopenharmony_ci#endif 132