xref: /linux/net/tipc/subscr.h (revision 9ea1fd3c1a15c620d1e3d0aa269d34b705477003)
1b97bf3fdSPer Liden /*
2b97bf3fdSPer Liden  * net/tipc/subscr.h: Include file for TIPC subscription service
3b97bf3fdSPer Liden  *
4b97bf3fdSPer Liden  * Copyright (c) 2003-2005, Ericsson Research Canada
5b97bf3fdSPer Liden  * Copyright (c) 2005, Wind River Systems
6b97bf3fdSPer Liden  * Copyright (c) 2005-2006, Ericsson AB
7b97bf3fdSPer Liden  * All rights reserved.
8b97bf3fdSPer Liden  *
9b97bf3fdSPer Liden  * Redistribution and use in source and binary forms, with or without
10b97bf3fdSPer Liden  * modification, are permitted provided that the following conditions are met:
11b97bf3fdSPer Liden  *
12*9ea1fd3cSPer Liden  * 1. Redistributions of source code must retain the above copyright
13*9ea1fd3cSPer Liden  *    notice, this list of conditions and the following disclaimer.
14*9ea1fd3cSPer Liden  * 2. Redistributions in binary form must reproduce the above copyright
15*9ea1fd3cSPer Liden  *    notice, this list of conditions and the following disclaimer in the
16*9ea1fd3cSPer Liden  *    documentation and/or other materials provided with the distribution.
17*9ea1fd3cSPer Liden  * 3. Neither the names of the copyright holders nor the names of its
18*9ea1fd3cSPer Liden  *    contributors may be used to endorse or promote products derived from
19*9ea1fd3cSPer Liden  *    this software without specific prior written permission.
20*9ea1fd3cSPer Liden  *
21*9ea1fd3cSPer Liden  * Alternatively, this software may be distributed under the terms of the
22*9ea1fd3cSPer Liden  * GNU General Public License ("GPL") version 2 as published by the Free
23*9ea1fd3cSPer Liden  * Software Foundation.
24b97bf3fdSPer Liden  *
25b97bf3fdSPer Liden  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26b97bf3fdSPer Liden  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27b97bf3fdSPer Liden  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28b97bf3fdSPer Liden  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29b97bf3fdSPer Liden  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30b97bf3fdSPer Liden  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31b97bf3fdSPer Liden  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32b97bf3fdSPer Liden  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33b97bf3fdSPer Liden  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34b97bf3fdSPer Liden  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35b97bf3fdSPer Liden  * POSSIBILITY OF SUCH DAMAGE.
36b97bf3fdSPer Liden  */
37b97bf3fdSPer Liden 
38b97bf3fdSPer Liden #ifndef _TIPC_SUBSCR_H
39b97bf3fdSPer Liden #define _TIPC_SUBSCR_H
40b97bf3fdSPer Liden 
41b97bf3fdSPer Liden /**
42b97bf3fdSPer Liden  * struct subscription - TIPC network topology subscription object
43b97bf3fdSPer Liden  * @seq: name sequence associated with subscription
44b97bf3fdSPer Liden  * @timeout: duration of subscription (in ms)
45b97bf3fdSPer Liden  * @filter: event filtering to be done for subscription
46b97bf3fdSPer Liden  * @evt: template for events generated by subscription
47b97bf3fdSPer Liden  * @subscription_list: adjacent subscriptions in subscriber's subscription list
48b97bf3fdSPer Liden  * @nameseq_list: adjacent subscriptions in name sequence's subscription list
49b97bf3fdSPer Liden  * @timer_ref: reference to timer governing subscription duration (may be NULL)
50b97bf3fdSPer Liden  * @owner: pointer to subscriber object associated with this subscription
51b97bf3fdSPer Liden  */
52b97bf3fdSPer Liden 
53b97bf3fdSPer Liden struct subscription {
54b97bf3fdSPer Liden 	struct tipc_name_seq seq;
55b97bf3fdSPer Liden 	u32 timeout;
56b97bf3fdSPer Liden 	u32 filter;
57b97bf3fdSPer Liden 	struct tipc_event evt;
58b97bf3fdSPer Liden 	struct list_head subscription_list;
59b97bf3fdSPer Liden 	struct list_head nameseq_list;
60b97bf3fdSPer Liden 	struct timer_list timer;
61b97bf3fdSPer Liden 	struct subscriber *owner;
62b97bf3fdSPer Liden };
63b97bf3fdSPer Liden 
64b97bf3fdSPer Liden int subscr_overlap(struct subscription * sub,
65b97bf3fdSPer Liden 		   u32 found_lower,
66b97bf3fdSPer Liden 		   u32 found_upper);
67b97bf3fdSPer Liden 
68b97bf3fdSPer Liden void subscr_report_overlap(struct subscription * sub,
69b97bf3fdSPer Liden 			   u32 found_lower,
70b97bf3fdSPer Liden 			   u32 found_upper,
71b97bf3fdSPer Liden 			   u32 event,
72b97bf3fdSPer Liden 			   u32 port_ref,
73b97bf3fdSPer Liden 			   u32 node,
74b97bf3fdSPer Liden 			   int must_report);
75b97bf3fdSPer Liden 
76b97bf3fdSPer Liden int subscr_start(void);
77b97bf3fdSPer Liden 
78b97bf3fdSPer Liden void subscr_stop(void);
79b97bf3fdSPer Liden 
80b97bf3fdSPer Liden 
81b97bf3fdSPer Liden #endif
82