xref: /linux/net/tipc/subscr.h (revision e15f880409c807bb589e9492263564e80f0de6e9)
1b97bf3fdSPer Liden /*
2b97bf3fdSPer Liden  * net/tipc/subscr.h: Include file for TIPC subscription service
3b97bf3fdSPer Liden  *
49da1c8b6SPer Liden  * Copyright (c) 2003-2006, Ericsson AB
5b97bf3fdSPer Liden  * Copyright (c) 2005, 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_SUBSCR_H
38b97bf3fdSPer Liden #define _TIPC_SUBSCR_H
39b97bf3fdSPer Liden 
40*e15f8804SAllan Stephens struct subscription;
41*e15f8804SAllan Stephens 
42*e15f8804SAllan Stephens typedef void (*tipc_subscr_event) (struct subscription *sub,
43*e15f8804SAllan Stephens 				   u32 found_lower, u32 found_upper,
44*e15f8804SAllan Stephens 				   u32 event, u32 port_ref, u32 node);
45*e15f8804SAllan Stephens 
46b97bf3fdSPer Liden /**
47b97bf3fdSPer Liden  * struct subscription - TIPC network topology subscription object
48b97bf3fdSPer Liden  * @seq: name sequence associated with subscription
49b97bf3fdSPer Liden  * @timeout: duration of subscription (in ms)
50b97bf3fdSPer Liden  * @filter: event filtering to be done for subscription
51*e15f8804SAllan Stephens  * @event_cb: routine invoked when a subscription event is detected
52b97bf3fdSPer Liden  * @evt: template for events generated by subscription
53b97bf3fdSPer Liden  * @subscription_list: adjacent subscriptions in subscriber's subscription list
54b97bf3fdSPer Liden  * @nameseq_list: adjacent subscriptions in name sequence's subscription list
55b97bf3fdSPer Liden  * @timer_ref: reference to timer governing subscription duration (may be NULL)
56b97bf3fdSPer Liden  * @owner: pointer to subscriber object associated with this subscription
57b97bf3fdSPer Liden  */
58b97bf3fdSPer Liden 
59b97bf3fdSPer Liden struct subscription {
60b97bf3fdSPer Liden 	struct tipc_name_seq seq;
61b97bf3fdSPer Liden 	u32 timeout;
62b97bf3fdSPer Liden 	u32 filter;
63*e15f8804SAllan Stephens 	tipc_subscr_event event_cb;
64b97bf3fdSPer Liden 	struct tipc_event evt;
65b97bf3fdSPer Liden 	struct list_head subscription_list;
66b97bf3fdSPer Liden 	struct list_head nameseq_list;
67b97bf3fdSPer Liden 	struct timer_list timer;
68b97bf3fdSPer Liden 	struct subscriber *owner;
69b97bf3fdSPer Liden };
70b97bf3fdSPer Liden 
714323add6SPer Liden int tipc_subscr_overlap(struct subscription * sub,
72b97bf3fdSPer Liden 			u32 found_lower,
73b97bf3fdSPer Liden 			u32 found_upper);
74b97bf3fdSPer Liden 
754323add6SPer Liden void tipc_subscr_report_overlap(struct subscription * sub,
76b97bf3fdSPer Liden 				u32 found_lower,
77b97bf3fdSPer Liden 				u32 found_upper,
78b97bf3fdSPer Liden 				u32 event,
79b97bf3fdSPer Liden 				u32 port_ref,
80b97bf3fdSPer Liden 				u32 node,
81b97bf3fdSPer Liden 				int must_report);
82b97bf3fdSPer Liden 
834323add6SPer Liden int tipc_subscr_start(void);
84b97bf3fdSPer Liden 
854323add6SPer Liden void tipc_subscr_stop(void);
86b97bf3fdSPer Liden 
87b97bf3fdSPer Liden 
88b97bf3fdSPer Liden #endif
89