name_distr.c (d392da5207352f09030e95d9ea335a4225667ec0) name_distr.c (8f92df6ad49da958d97e171762d0a97a3dc738f1)
1/*
2 * net/tipc/name_distr.c: TIPC name distribution code
3 *
4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include "core.h"
1/*
2 * net/tipc/name_distr.c: TIPC name distribution code
3 *
4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include "core.h"
38#include "cluster.h"
39#include "dbg.h"
38#include "addr.h"
40#include "link.h"
39#include "link.h"
41#include "msg.h"
42#include "name_distr.h"
43
44#define ITEM_SIZE sizeof(struct distr_item)
45
46/**
47 * struct distr_item - publication info distributed to other nodes
48 * @type: name sequence type
49 * @lower: name sequence lower bound

--- 54 unchanged lines hidden (view full) ---

104 if (buf != NULL) {
105 msg = buf_msg(buf);
106 tipc_msg_init(msg, NAME_DISTRIBUTOR, type, LONG_H_SIZE, dest);
107 msg_set_size(msg, LONG_H_SIZE + size);
108 }
109 return buf;
110}
111
40#include "name_distr.h"
41
42#define ITEM_SIZE sizeof(struct distr_item)
43
44/**
45 * struct distr_item - publication info distributed to other nodes
46 * @type: name sequence type
47 * @lower: name sequence lower bound

--- 54 unchanged lines hidden (view full) ---

102 if (buf != NULL) {
103 msg = buf_msg(buf);
104 tipc_msg_init(msg, NAME_DISTRIBUTOR, type, LONG_H_SIZE, dest);
105 msg_set_size(msg, LONG_H_SIZE + size);
106 }
107 return buf;
108}
109
110static void named_cluster_distribute(struct sk_buff *buf)
111{
112 struct sk_buff *buf_copy;
113 struct tipc_node *n_ptr;
114 u32 n_num;
115
116 for (n_num = 1; n_num <= tipc_net.highest_node; n_num++) {
117 n_ptr = tipc_net.nodes[n_num];
118 if (n_ptr && tipc_node_has_active_links(n_ptr)) {
119 buf_copy = skb_copy(buf, GFP_ATOMIC);
120 if (!buf_copy)
121 break;
122 msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
123 tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr);
124 }
125 }
126
127 buf_discard(buf);
128}
129
112/**
113 * tipc_named_publish - tell other nodes about a new publication by this node
114 */
115
116void tipc_named_publish(struct publication *publ)
117{
118 struct sk_buff *buf;
119 struct distr_item *item;

--- 4 unchanged lines hidden (view full) ---

124 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
125 if (!buf) {
126 warn("Publication distribution failure\n");
127 return;
128 }
129
130 item = (struct distr_item *)msg_data(buf_msg(buf));
131 publ_to_item(item, publ);
130/**
131 * tipc_named_publish - tell other nodes about a new publication by this node
132 */
133
134void tipc_named_publish(struct publication *publ)
135{
136 struct sk_buff *buf;
137 struct distr_item *item;

--- 4 unchanged lines hidden (view full) ---

142 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
143 if (!buf) {
144 warn("Publication distribution failure\n");
145 return;
146 }
147
148 item = (struct distr_item *)msg_data(buf_msg(buf));
149 publ_to_item(item, publ);
132 dbg("tipc_named_withdraw: broadcasting publish msg\n");
133 tipc_cltr_broadcast(buf);
150 dbg("tipc_named_publish: broadcasting publish msg\n");
151 named_cluster_distribute(buf);
134}
135
136/**
137 * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
138 */
139
140void tipc_named_withdraw(struct publication *publ)
141{

--- 7 unchanged lines hidden (view full) ---

149 if (!buf) {
150 warn("Withdrawl distribution failure\n");
151 return;
152 }
153
154 item = (struct distr_item *)msg_data(buf_msg(buf));
155 publ_to_item(item, publ);
156 dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
152}
153
154/**
155 * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
156 */
157
158void tipc_named_withdraw(struct publication *publ)
159{

--- 7 unchanged lines hidden (view full) ---

167 if (!buf) {
168 warn("Withdrawl distribution failure\n");
169 return;
170 }
171
172 item = (struct distr_item *)msg_data(buf_msg(buf));
173 publ_to_item(item, publ);
174 dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
157 tipc_cltr_broadcast(buf);
175 named_cluster_distribute(buf);
158}
159
160/**
161 * tipc_named_node_up - tell specified node about all publications by this node
162 */
163
164void tipc_named_node_up(unsigned long node)
165{

--- 153 unchanged lines hidden ---
176}
177
178/**
179 * tipc_named_node_up - tell specified node about all publications by this node
180 */
181
182void tipc_named_node_up(unsigned long node)
183{

--- 153 unchanged lines hidden ---