135c55c98SJon Paul Maloy /* 235c55c98SJon Paul Maloy * net/tipc/monitor.h 335c55c98SJon Paul Maloy * 435c55c98SJon Paul Maloy * Copyright (c) 2015, Ericsson AB 535c55c98SJon Paul Maloy * All rights reserved. 635c55c98SJon Paul Maloy * 735c55c98SJon Paul Maloy * Redistribution and use in source and binary forms, with or without 835c55c98SJon Paul Maloy * modification, are permitted provided that the following conditions are met: 935c55c98SJon Paul Maloy * 1035c55c98SJon Paul Maloy * 1. Redistributions of source code must retain the above copyright 1135c55c98SJon Paul Maloy * notice, this list of conditions and the following disclaimer. 1235c55c98SJon Paul Maloy * 2. Redistributions in binary form must reproduce the above copyright 1335c55c98SJon Paul Maloy * notice, this list of conditions and the following disclaimer in the 1435c55c98SJon Paul Maloy * documentation and/or other materials provided with the distribution. 1535c55c98SJon Paul Maloy * 3. Neither the names of the copyright holders nor the names of its 1635c55c98SJon Paul Maloy * contributors may be used to endorse or promote products derived from 1735c55c98SJon Paul Maloy * this software without specific prior written permission. 1835c55c98SJon Paul Maloy * 1935c55c98SJon Paul Maloy * Alternatively, this software may be distributed under the terms of the 2035c55c98SJon Paul Maloy * GNU General Public License ("GPL") version 2 as published by the Free 2135c55c98SJon Paul Maloy * Software Foundation. 2235c55c98SJon Paul Maloy * 2335c55c98SJon Paul Maloy * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2435c55c98SJon Paul Maloy * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2535c55c98SJon Paul Maloy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2635c55c98SJon Paul Maloy * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2735c55c98SJon Paul Maloy * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2835c55c98SJon Paul Maloy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2935c55c98SJon Paul Maloy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3035c55c98SJon Paul Maloy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3135c55c98SJon Paul Maloy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3235c55c98SJon Paul Maloy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3335c55c98SJon Paul Maloy * POSSIBILITY OF SUCH DAMAGE. 3435c55c98SJon Paul Maloy */ 3535c55c98SJon Paul Maloy 3635c55c98SJon Paul Maloy #ifndef _TIPC_MONITOR_H 3735c55c98SJon Paul Maloy #define _TIPC_MONITOR_H 3835c55c98SJon Paul Maloy 39cf6f7e1dSParthasarathy Bhuvaragan #include "netlink.h" 40cf6f7e1dSParthasarathy Bhuvaragan 4135c55c98SJon Paul Maloy /* struct tipc_mon_state: link instance's cache of monitor list and domain state 4235c55c98SJon Paul Maloy * @list_gen: current generation of this node's monitor list 4335c55c98SJon Paul Maloy * @gen: current generation of this node's local domain 4435c55c98SJon Paul Maloy * @peer_gen: most recent domain generation received from peer 4535c55c98SJon Paul Maloy * @acked_gen: most recent generation of self's domain acked by peer 4635c55c98SJon Paul Maloy * @monitoring: this peer endpoint should continuously monitored 4735c55c98SJon Paul Maloy * @probing: peer endpoint should be temporarily probed for potential loss 4835c55c98SJon Paul Maloy * @synched: domain record's generation has been synched with peer after reset 4935c55c98SJon Paul Maloy */ 5035c55c98SJon Paul Maloy struct tipc_mon_state { 5135c55c98SJon Paul Maloy u16 list_gen; 5235c55c98SJon Paul Maloy u16 peer_gen; 5335c55c98SJon Paul Maloy u16 acked_gen; 5435c55c98SJon Paul Maloy bool monitoring :1; 5535c55c98SJon Paul Maloy bool probing :1; 5635c55c98SJon Paul Maloy bool reset :1; 5735c55c98SJon Paul Maloy bool synched :1; 5835c55c98SJon Paul Maloy }; 5935c55c98SJon Paul Maloy 6035c55c98SJon Paul Maloy int tipc_mon_create(struct net *net, int bearer_id); 6135c55c98SJon Paul Maloy void tipc_mon_delete(struct net *net, int bearer_id); 6235c55c98SJon Paul Maloy 6335c55c98SJon Paul Maloy void tipc_mon_peer_up(struct net *net, u32 addr, int bearer_id); 6435c55c98SJon Paul Maloy void tipc_mon_peer_down(struct net *net, u32 addr, int bearer_id); 6535c55c98SJon Paul Maloy void tipc_mon_prep(struct net *net, void *data, int *dlen, 6635c55c98SJon Paul Maloy struct tipc_mon_state *state, int bearer_id); 6735c55c98SJon Paul Maloy void tipc_mon_rcv(struct net *net, void *data, u16 dlen, u32 addr, 6835c55c98SJon Paul Maloy struct tipc_mon_state *state, int bearer_id); 6935c55c98SJon Paul Maloy void tipc_mon_get_state(struct net *net, u32 addr, 7035c55c98SJon Paul Maloy struct tipc_mon_state *state, 7135c55c98SJon Paul Maloy int bearer_id); 7235c55c98SJon Paul Maloy void tipc_mon_remove_peer(struct net *net, u32 addr, int bearer_id); 7335c55c98SJon Paul Maloy 747b3f5229SParthasarathy Bhuvaragan int tipc_nl_monitor_set_threshold(struct net *net, u32 cluster_size); 75bf1035b2SParthasarathy Bhuvaragan int tipc_nl_monitor_get_threshold(struct net *net); 76cf6f7e1dSParthasarathy Bhuvaragan int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg, 77cf6f7e1dSParthasarathy Bhuvaragan u32 bearer_id); 78cf6f7e1dSParthasarathy Bhuvaragan int tipc_nl_add_monitor_peer(struct net *net, struct tipc_nl_msg *msg, 79cf6f7e1dSParthasarathy Bhuvaragan u32 bearer_id, u32 *prev_node); 80*46cb01eeSHoang Le void tipc_mon_reinit_self(struct net *net); 81bf1035b2SParthasarathy Bhuvaragan 8235c55c98SJon Paul Maloy extern const int tipc_max_domain_size; 8335c55c98SJon Paul Maloy #endif 84