| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * include/net/tipc/tipc.h: Main include file for TIPC users | 
 | 3 |  *  | 
| Per Liden | 9da1c8b | 2006-01-11 18:40:41 +0100 | [diff] [blame] | 4 |  * Copyright (c) 2003-2006, Ericsson AB | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 5 |  * Copyright (c) 2005,2010 Wind River Systems | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 6 |  * All rights reserved. | 
 | 7 |  * | 
| Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 8 |  * Redistribution and use in source and binary forms, with or without | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 9 |  * modification, are permitted provided that the following conditions are met: | 
 | 10 |  * | 
| Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 11 |  * 1. Redistributions of source code must retain the above copyright | 
 | 12 |  *    notice, this list of conditions and the following disclaimer. | 
 | 13 |  * 2. Redistributions in binary form must reproduce the above copyright | 
 | 14 |  *    notice, this list of conditions and the following disclaimer in the | 
 | 15 |  *    documentation and/or other materials provided with the distribution. | 
 | 16 |  * 3. Neither the names of the copyright holders nor the names of its | 
 | 17 |  *    contributors may be used to endorse or promote products derived from | 
 | 18 |  *    this software without specific prior written permission. | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 19 |  * | 
| Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 20 |  * Alternatively, this software may be distributed under the terms of the | 
 | 21 |  * GNU General Public License ("GPL") version 2 as published by the Free | 
 | 22 |  * Software Foundation. | 
 | 23 |  * | 
 | 24 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
 | 25 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
 | 26 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 
 | 27 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 
 | 28 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 
 | 29 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 
 | 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 | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 34 |  * POSSIBILITY OF SUCH DAMAGE. | 
 | 35 |  */ | 
 | 36 |  | 
 | 37 | #ifndef _NET_TIPC_H_ | 
 | 38 | #define _NET_TIPC_H_ | 
 | 39 |  | 
 | 40 | #ifdef __KERNEL__ | 
 | 41 |  | 
 | 42 | #include <linux/tipc.h> | 
 | 43 | #include <linux/skbuff.h> | 
 | 44 |  | 
 | 45 | /*  | 
 | 46 |  * Native API | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 47 |  */ | 
 | 48 |  | 
 | 49 | /* | 
 | 50 |  * TIPC operating mode routines | 
 | 51 |  */ | 
 | 52 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 53 | #define TIPC_NOT_RUNNING  0 | 
 | 54 | #define TIPC_NODE_MODE    1 | 
 | 55 | #define TIPC_NET_MODE     2 | 
 | 56 |  | 
 | 57 | typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr); | 
 | 58 |  | 
 | 59 | int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle); | 
 | 60 |  | 
 | 61 | void tipc_detach(unsigned int userref); | 
 | 62 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 63 | /* | 
 | 64 |  * TIPC port manipulation routines | 
 | 65 |  */ | 
 | 66 |  | 
 | 67 | typedef void (*tipc_msg_err_event) (void *usr_handle, | 
 | 68 | 				    u32 portref, | 
 | 69 | 				    struct sk_buff **buf, | 
 | 70 | 				    unsigned char const *data, | 
 | 71 | 				    unsigned int size, | 
 | 72 | 				    int reason,  | 
 | 73 | 				    struct tipc_portid const *attmpt_destid); | 
 | 74 |  | 
 | 75 | typedef void (*tipc_named_msg_err_event) (void *usr_handle, | 
 | 76 | 					  u32 portref, | 
 | 77 | 					  struct sk_buff **buf, | 
 | 78 | 					  unsigned char const *data, | 
 | 79 | 					  unsigned int size, | 
 | 80 | 					  int reason,  | 
 | 81 | 					  struct tipc_name_seq const *attmpt_dest); | 
 | 82 |  | 
 | 83 | typedef void (*tipc_conn_shutdown_event) (void *usr_handle, | 
 | 84 | 					  u32 portref, | 
 | 85 | 					  struct sk_buff **buf, | 
 | 86 | 					  unsigned char const *data, | 
 | 87 | 					  unsigned int size, | 
 | 88 | 					  int reason); | 
 | 89 |  | 
 | 90 | typedef void (*tipc_msg_event) (void *usr_handle, | 
 | 91 | 				u32 portref, | 
 | 92 | 				struct sk_buff **buf, | 
 | 93 | 				unsigned char const *data, | 
 | 94 | 				unsigned int size, | 
 | 95 | 				unsigned int importance,  | 
 | 96 | 				struct tipc_portid const *origin); | 
 | 97 |  | 
 | 98 | typedef void (*tipc_named_msg_event) (void *usr_handle, | 
 | 99 | 				      u32 portref, | 
 | 100 | 				      struct sk_buff **buf, | 
 | 101 | 				      unsigned char const *data, | 
 | 102 | 				      unsigned int size, | 
 | 103 | 				      unsigned int importance,  | 
 | 104 | 				      struct tipc_portid const *orig, | 
 | 105 | 				      struct tipc_name_seq const *dest); | 
 | 106 |  | 
 | 107 | typedef void (*tipc_conn_msg_event) (void *usr_handle, | 
 | 108 | 				     u32 portref, | 
 | 109 | 				     struct sk_buff **buf, | 
 | 110 | 				     unsigned char const *data, | 
 | 111 | 				     unsigned int size); | 
 | 112 |  | 
 | 113 | typedef void (*tipc_continue_event) (void *usr_handle,  | 
 | 114 | 				     u32 portref); | 
 | 115 |  | 
 | 116 | int tipc_createport(unsigned int tipc_user,  | 
 | 117 | 		    void *usr_handle,  | 
 | 118 | 		    unsigned int importance,  | 
 | 119 | 		    tipc_msg_err_event error_cb,  | 
 | 120 | 		    tipc_named_msg_err_event named_error_cb,  | 
 | 121 | 		    tipc_conn_shutdown_event conn_error_cb,  | 
 | 122 | 		    tipc_msg_event message_cb,  | 
 | 123 | 		    tipc_named_msg_event named_message_cb,  | 
 | 124 | 		    tipc_conn_msg_event conn_message_cb,  | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 125 | 		    tipc_continue_event continue_event_cb, | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 126 | 		    u32 *portref); | 
 | 127 |  | 
 | 128 | int tipc_deleteport(u32 portref); | 
 | 129 |  | 
 | 130 | int tipc_ownidentity(u32 portref, struct tipc_portid *port); | 
 | 131 |  | 
 | 132 | int tipc_portimportance(u32 portref, unsigned int *importance); | 
 | 133 | int tipc_set_portimportance(u32 portref, unsigned int importance); | 
 | 134 |  | 
 | 135 | int tipc_portunreliable(u32 portref, unsigned int *isunreliable); | 
 | 136 | int tipc_set_portunreliable(u32 portref, unsigned int isunreliable); | 
 | 137 |  | 
 | 138 | int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable); | 
 | 139 | int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable); | 
 | 140 |  | 
 | 141 | int tipc_publish(u32 portref, unsigned int scope,  | 
 | 142 | 		 struct tipc_name_seq const *name_seq); | 
 | 143 | int tipc_withdraw(u32 portref, unsigned int scope, | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 144 | 		  struct tipc_name_seq const *name_seq); | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 145 |  | 
 | 146 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); | 
 | 147 |  | 
 | 148 | int tipc_disconnect(u32 portref); | 
 | 149 |  | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 150 | int tipc_shutdown(u32 ref); | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 151 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 152 | /* | 
 | 153 |  * TIPC messaging routines | 
 | 154 |  */ | 
 | 155 |  | 
 | 156 | #define TIPC_PORT_IMPORTANCE 100	/* send using current port setting */ | 
 | 157 |  | 
 | 158 |  | 
 | 159 | int tipc_send(u32 portref, | 
 | 160 | 	      unsigned int num_sect, | 
 | 161 | 	      struct iovec const *msg_sect); | 
 | 162 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 163 | int tipc_send2name(u32 portref,  | 
 | 164 | 		   struct tipc_name const *name,  | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 165 | 		   u32 domain, | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 166 | 		   unsigned int num_sect, | 
 | 167 | 		   struct iovec const *msg_sect); | 
 | 168 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 169 | int tipc_send2port(u32 portref, | 
 | 170 | 		   struct tipc_portid const *dest, | 
 | 171 | 		   unsigned int num_sect, | 
 | 172 | 		   struct iovec const *msg_sect); | 
 | 173 |  | 
 | 174 | int tipc_send_buf2port(u32 portref, | 
 | 175 | 		       struct tipc_portid const *dest, | 
 | 176 | 		       struct sk_buff *buf, | 
 | 177 | 		       unsigned int dsz); | 
 | 178 |  | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 179 | int tipc_multicast(u32 portref,  | 
 | 180 | 		   struct tipc_name_seq const *seq,  | 
| Allan Stephens | 8e1c298 | 2010-05-11 14:30:09 +0000 | [diff] [blame] | 181 | 		   u32 domain,	/* currently unused */ | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 182 | 		   unsigned int section_count, | 
 | 183 | 		   struct iovec const *msg); | 
| Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 184 | #endif | 
 | 185 |  | 
 | 186 | #endif |