tipc_bearer.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #ifndef _NET_TIPC_BEARER_H_
  34. #define _NET_TIPC_BEARER_H_
  35. #ifdef __KERNEL__
  36. #include <linux/tipc.h>
  37. #include <linux/skbuff.h>
  38. #include <linux/spinlock.h>
  39. /**
  40. * struct tipc_bearer - TIPC bearer info available to privileged users
  41. * @usr_handle: pointer to additional user-defined information about bearer
  42. * @mtu: max packet size bearer can support
  43. * @blocked: non-zero if bearer is blocked
  44. * @lock: spinlock for controlling access to bearer
  45. * @addr: media-specific address associated with bearer
  46. * @name: bearer name (format = media:interface)
  47. *
  48. * Note: TIPC initializes "name" and "lock" fields; user is responsible for
  49. * initialization all other fields when a bearer is enabled.
  50. */
  51. struct tipc_bearer {
  52. void *usr_handle;
  53. u32 mtu;
  54. int blocked;
  55. spinlock_t lock;
  56. struct tipc_media_addr addr;
  57. char name[TIPC_MAX_BEARER_NAME];
  58. };
  59. int tipc_register_media(u32 media_type,
  60. char *media_name,
  61. int (*enable)(struct tipc_bearer *),
  62. void (*disable)(struct tipc_bearer *),
  63. int (*send_msg)(struct sk_buff *,
  64. struct tipc_bearer *,
  65. struct tipc_media_addr *),
  66. char *(*addr2str)(struct tipc_media_addr *a,
  67. char *str_buf,
  68. int str_size),
  69. struct tipc_media_addr *bcast_addr,
  70. const u32 bearer_priority,
  71. const u32 link_tolerance, /* [ms] */
  72. const u32 send_window_limit);
  73. void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
  74. int tipc_block_bearer(const char *name);
  75. void tipc_continue(struct tipc_bearer *tb_ptr);
  76. int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority);
  77. int tipc_disable_bearer(const char *name);
  78. #endif
  79. #endif