Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * include/net/tipc/tipc_bearer.h: Include file for privileged access to TIPC bearers |
| 3 | * |
| 4 | * Copyright (c) 2003-2005, Ericsson Research Canada |
| 5 | * Copyright (c) 2005, Wind River Systems |
| 6 | * Copyright (c) 2005-2006, Ericsson AB |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions are met: |
| 11 | * |
| 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. |
| 20 | * |
| 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. |
| 32 | */ |
| 33 | |
| 34 | #ifndef _NET_TIPC_BEARER_H_ |
| 35 | #define _NET_TIPC_BEARER_H_ |
| 36 | |
| 37 | #ifdef __KERNEL__ |
| 38 | |
| 39 | #include <linux/tipc.h> |
| 40 | #include <linux/skbuff.h> |
| 41 | #include <linux/spinlock.h> |
| 42 | |
| 43 | /** |
| 44 | * struct tipc_bearer - TIPC bearer info available to privileged users |
| 45 | * @usr_handle: pointer to additional user-defined information about bearer |
| 46 | * @mtu: max packet size bearer can support |
| 47 | * @blocked: non-zero if bearer is blocked |
| 48 | * @lock: spinlock for controlling access to bearer |
| 49 | * @addr: media-specific address associated with bearer |
| 50 | * @name: bearer name (format = media:interface) |
| 51 | * |
| 52 | * Note: TIPC initializes "name" and "lock" fields; user is responsible for |
| 53 | * initialization all other fields when a bearer is enabled. |
| 54 | */ |
| 55 | |
| 56 | struct tipc_bearer { |
| 57 | void *usr_handle; |
| 58 | u32 mtu; |
| 59 | int blocked; |
| 60 | spinlock_t lock; |
| 61 | struct tipc_media_addr addr; |
| 62 | char name[TIPC_MAX_BEARER_NAME]; |
| 63 | }; |
| 64 | |
| 65 | |
| 66 | int tipc_register_media(u32 media_type, |
| 67 | char *media_name, |
| 68 | int (*enable)(struct tipc_bearer *), |
| 69 | void (*disable)(struct tipc_bearer *), |
| 70 | int (*send_msg)(struct sk_buff *, |
| 71 | struct tipc_bearer *, |
| 72 | struct tipc_media_addr *), |
| 73 | char *(*addr2str)(struct tipc_media_addr *a, |
| 74 | char *str_buf, |
| 75 | int str_size), |
| 76 | struct tipc_media_addr *bcast_addr, |
| 77 | const u32 bearer_priority, |
| 78 | const u32 link_tolerance, /* [ms] */ |
| 79 | const u32 send_window_limit); |
| 80 | |
| 81 | void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr); |
| 82 | |
| 83 | int tipc_block_bearer(const char *name); |
| 84 | void tipc_continue(struct tipc_bearer *tb_ptr); |
| 85 | |
| 86 | int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority); |
| 87 | int tipc_disable_bearer(const char *name); |
| 88 | |
| 89 | |
| 90 | #endif |
| 91 | |
| 92 | #endif |