2 * include/net/tipc/tipc_bearer.h: Include file for privileged access to TIPC bearers
4 * Copyright (c) 2003-2005, Ericsson Research Canada
5 * Copyright (c) 2005, Wind River Systems
6 * Copyright (c) 2005-2006, Ericsson AB
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 * Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _NET_TIPC_BEARER_H_
35 #define _NET_TIPC_BEARER_H_
39 #include <linux/tipc_config.h>
40 #include <linux/skbuff.h>
41 #include <linux/spinlock.h>
44 * Identifiers of supported TIPC media types
47 #define TIPC_MEDIA_TYPE_ETH 1
49 struct tipc_media_addr {
52 __u8 eth_addr[6]; /* Ethernet bearer */
54 /* Prototypes for other possible bearer types */
63 } addr_in; /* IP-based bearer */
64 __u16 sock_descr; /* generic socket bearer */
70 * struct tipc_bearer - TIPC bearer info available to privileged users
71 * @usr_handle: pointer to additional user-defined information about bearer
72 * @mtu: max packet size bearer can support
73 * @blocked: non-zero if bearer is blocked
74 * @lock: spinlock for controlling access to bearer
75 * @addr: media-specific address associated with bearer
76 * @name: bearer name (format = media:interface)
78 * Note: TIPC initializes "name" and "lock" fields; user is responsible for
79 * initialization all other fields when a bearer is enabled.
87 struct tipc_media_addr addr;
88 char name[TIPC_MAX_BEARER_NAME];
92 int tipc_register_media(u32 media_type,
94 int (*enable)(struct tipc_bearer *),
95 void (*disable)(struct tipc_bearer *),
96 int (*send_msg)(struct sk_buff *,
98 struct tipc_media_addr *),
99 char *(*addr2str)(struct tipc_media_addr *a,
102 struct tipc_media_addr *bcast_addr,
103 const u32 bearer_priority,
104 const u32 link_tolerance, /* [ms] */
105 const u32 send_window_limit);
107 void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
109 int tipc_block_bearer(const char *name);
110 void tipc_continue(struct tipc_bearer *tb_ptr);
112 int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority);
113 int tipc_disable_bearer(const char *name);