diff options
Diffstat (limited to 'net/tipc/port.h')
-rw-r--r-- | net/tipc/port.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/net/tipc/port.h b/net/tipc/port.h index 73bbf442b346..8b9d87a3efae 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -44,6 +44,39 @@ | |||
44 | #include "dbg.h" | 44 | #include "dbg.h" |
45 | #include "node_subscr.h" | 45 | #include "node_subscr.h" |
46 | 46 | ||
47 | #define TIPC_FLOW_CONTROL_WIN 512 | ||
48 | |||
49 | typedef void (*tipc_msg_err_event) (void *usr_handle, u32 portref, | ||
50 | struct sk_buff **buf, unsigned char const *data, | ||
51 | unsigned int size, int reason, | ||
52 | struct tipc_portid const *attmpt_destid); | ||
53 | |||
54 | typedef void (*tipc_named_msg_err_event) (void *usr_handle, u32 portref, | ||
55 | struct sk_buff **buf, unsigned char const *data, | ||
56 | unsigned int size, int reason, | ||
57 | struct tipc_name_seq const *attmpt_dest); | ||
58 | |||
59 | typedef void (*tipc_conn_shutdown_event) (void *usr_handle, u32 portref, | ||
60 | struct sk_buff **buf, unsigned char const *data, | ||
61 | unsigned int size, int reason); | ||
62 | |||
63 | typedef void (*tipc_msg_event) (void *usr_handle, u32 portref, | ||
64 | struct sk_buff **buf, unsigned char const *data, | ||
65 | unsigned int size, unsigned int importance, | ||
66 | struct tipc_portid const *origin); | ||
67 | |||
68 | typedef void (*tipc_named_msg_event) (void *usr_handle, u32 portref, | ||
69 | struct sk_buff **buf, unsigned char const *data, | ||
70 | unsigned int size, unsigned int importance, | ||
71 | struct tipc_portid const *orig, | ||
72 | struct tipc_name_seq const *dest); | ||
73 | |||
74 | typedef void (*tipc_conn_msg_event) (void *usr_handle, u32 portref, | ||
75 | struct sk_buff **buf, unsigned char const *data, | ||
76 | unsigned int size); | ||
77 | |||
78 | typedef void (*tipc_continue_event) (void *usr_handle, u32 portref); | ||
79 | |||
47 | /** | 80 | /** |
48 | * struct user_port - TIPC user port (used with native API) | 81 | * struct user_port - TIPC user port (used with native API) |
49 | * @user_ref: id of user who created user port | 82 | * @user_ref: id of user who created user port |
@@ -68,6 +101,34 @@ struct user_port { | |||
68 | }; | 101 | }; |
69 | 102 | ||
70 | /** | 103 | /** |
104 | * struct tipc_port - TIPC port info available to socket API | ||
105 | * @usr_handle: pointer to additional user-defined information about port | ||
106 | * @lock: pointer to spinlock for controlling access to port | ||
107 | * @connected: non-zero if port is currently connected to a peer port | ||
108 | * @conn_type: TIPC type used when connection was established | ||
109 | * @conn_instance: TIPC instance used when connection was established | ||
110 | * @conn_unacked: number of unacknowledged messages received from peer port | ||
111 | * @published: non-zero if port has one or more associated names | ||
112 | * @congested: non-zero if cannot send because of link or port congestion | ||
113 | * @max_pkt: maximum packet size "hint" used when building messages sent by port | ||
114 | * @ref: unique reference to port in TIPC object registry | ||
115 | * @phdr: preformatted message header used when sending messages | ||
116 | */ | ||
117 | struct tipc_port { | ||
118 | void *usr_handle; | ||
119 | spinlock_t *lock; | ||
120 | int connected; | ||
121 | u32 conn_type; | ||
122 | u32 conn_instance; | ||
123 | u32 conn_unacked; | ||
124 | int published; | ||
125 | u32 congested; | ||
126 | u32 max_pkt; | ||
127 | u32 ref; | ||
128 | struct tipc_msg phdr; | ||
129 | }; | ||
130 | |||
131 | /** | ||
71 | * struct port - TIPC port structure | 132 | * struct port - TIPC port structure |
72 | * @publ: TIPC port info available to privileged users | 133 | * @publ: TIPC port info available to privileged users |
73 | * @port_list: adjacent ports in TIPC's global list of ports | 134 | * @port_list: adjacent ports in TIPC's global list of ports |
@@ -109,6 +170,76 @@ struct port { | |||
109 | extern spinlock_t tipc_port_list_lock; | 170 | extern spinlock_t tipc_port_list_lock; |
110 | struct port_list; | 171 | struct port_list; |
111 | 172 | ||
173 | /* | ||
174 | * TIPC port manipulation routines | ||
175 | */ | ||
176 | struct tipc_port *tipc_createport_raw(void *usr_handle, | ||
177 | u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), | ||
178 | void (*wakeup)(struct tipc_port *), const u32 importance); | ||
179 | |||
180 | int tipc_reject_msg(struct sk_buff *buf, u32 err); | ||
181 | |||
182 | int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode); | ||
183 | |||
184 | void tipc_acknowledge(u32 port_ref, u32 ack); | ||
185 | |||
186 | int tipc_createport(unsigned int tipc_user, void *usr_handle, | ||
187 | unsigned int importance, tipc_msg_err_event error_cb, | ||
188 | tipc_named_msg_err_event named_error_cb, | ||
189 | tipc_conn_shutdown_event conn_error_cb, tipc_msg_event msg_cb, | ||
190 | tipc_named_msg_event named_msg_cb, | ||
191 | tipc_conn_msg_event conn_msg_cb, | ||
192 | tipc_continue_event continue_event_cb, u32 *portref); | ||
193 | |||
194 | int tipc_deleteport(u32 portref); | ||
195 | |||
196 | int tipc_ownidentity(u32 portref, struct tipc_portid *port); | ||
197 | |||
198 | int tipc_portimportance(u32 portref, unsigned int *importance); | ||
199 | int tipc_set_portimportance(u32 portref, unsigned int importance); | ||
200 | |||
201 | int tipc_portunreliable(u32 portref, unsigned int *isunreliable); | ||
202 | int tipc_set_portunreliable(u32 portref, unsigned int isunreliable); | ||
203 | |||
204 | int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable); | ||
205 | int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable); | ||
206 | |||
207 | int tipc_publish(u32 portref, unsigned int scope, | ||
208 | struct tipc_name_seq const *name_seq); | ||
209 | int tipc_withdraw(u32 portref, unsigned int scope, | ||
210 | struct tipc_name_seq const *name_seq); | ||
211 | |||
212 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); | ||
213 | |||
214 | int tipc_disconnect(u32 portref); | ||
215 | |||
216 | int tipc_shutdown(u32 ref); | ||
217 | |||
218 | |||
219 | /* | ||
220 | * The following routines require that the port be locked on entry | ||
221 | */ | ||
222 | int tipc_disconnect_port(struct tipc_port *tp_ptr); | ||
223 | |||
224 | /* | ||
225 | * TIPC messaging routines | ||
226 | */ | ||
227 | #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */ | ||
228 | |||
229 | int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect); | ||
230 | |||
231 | int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, | ||
232 | unsigned int num_sect, struct iovec const *msg_sect); | ||
233 | |||
234 | int tipc_send2port(u32 portref, struct tipc_portid const *dest, | ||
235 | unsigned int num_sect, struct iovec const *msg_sect); | ||
236 | |||
237 | int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest, | ||
238 | struct sk_buff *buf, unsigned int dsz); | ||
239 | |||
240 | int tipc_multicast(u32 portref, struct tipc_name_seq const *seq, u32 domain, | ||
241 | unsigned int section_count, struct iovec const *msg); | ||
242 | |||
112 | int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, | 243 | int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, |
113 | struct iovec const *msg_sect, u32 num_sect, | 244 | struct iovec const *msg_sect, u32 num_sect, |
114 | int err); | 245 | int err); |