Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * net/tipc/monitor.h
0003  *
0004  * Copyright (c) 2015, Ericsson AB
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions are met:
0009  *
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions and the following disclaimer.
0012  * 2. Redistributions in binary form must reproduce the above copyright
0013  *    notice, this list of conditions and the following disclaimer in the
0014  *    documentation and/or other materials provided with the distribution.
0015  * 3. Neither the names of the copyright holders nor the names of its
0016  *    contributors may be used to endorse or promote products derived from
0017  *    this software without specific prior written permission.
0018  *
0019  * Alternatively, this software may be distributed under the terms of the
0020  * GNU General Public License ("GPL") version 2 as published by the Free
0021  * Software Foundation.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0033  * POSSIBILITY OF SUCH DAMAGE.
0034  */
0035 
0036 #ifndef _TIPC_MONITOR_H
0037 #define _TIPC_MONITOR_H
0038 
0039 #include "netlink.h"
0040 
0041 /* struct tipc_mon_state: link instance's cache of monitor list and domain state
0042  * @list_gen: current generation of this node's monitor list
0043  * @gen: current generation of this node's local domain
0044  * @peer_gen: most recent domain generation received from peer
0045  * @acked_gen: most recent generation of self's domain acked by peer
0046  * @monitoring: this peer endpoint should continuously monitored
0047  * @probing: peer endpoint should be temporarily probed for potential loss
0048  * @synched: domain record's generation has been synched with peer after reset
0049  */
0050 struct tipc_mon_state {
0051     u16 list_gen;
0052     u16 peer_gen;
0053     u16 acked_gen;
0054     bool monitoring :1;
0055     bool probing    :1;
0056     bool reset      :1;
0057     bool synched    :1;
0058 };
0059 
0060 int tipc_mon_create(struct net *net, int bearer_id);
0061 void tipc_mon_delete(struct net *net, int bearer_id);
0062 
0063 void tipc_mon_peer_up(struct net *net, u32 addr, int bearer_id);
0064 void tipc_mon_peer_down(struct net *net, u32 addr, int bearer_id);
0065 void tipc_mon_prep(struct net *net, void *data, int *dlen,
0066            struct tipc_mon_state *state, int bearer_id);
0067 void tipc_mon_rcv(struct net *net, void *data, u16 dlen, u32 addr,
0068           struct tipc_mon_state *state, int bearer_id);
0069 void tipc_mon_get_state(struct net *net, u32 addr,
0070             struct tipc_mon_state *state,
0071             int bearer_id);
0072 void tipc_mon_remove_peer(struct net *net, u32 addr, int bearer_id);
0073 
0074 int tipc_nl_monitor_set_threshold(struct net *net, u32 cluster_size);
0075 int tipc_nl_monitor_get_threshold(struct net *net);
0076 int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg,
0077               u32 bearer_id);
0078 int tipc_nl_add_monitor_peer(struct net *net, struct tipc_nl_msg *msg,
0079                  u32 bearer_id, u32 *prev_node);
0080 void tipc_mon_reinit_self(struct net *net);
0081 
0082 extern const int tipc_max_domain_size;
0083 #endif