[PATCH] USB: drivers/usb/media/ov511.c: remove hooks for the decomp module
[linux-2.6/suspend2-2.6.18.git] / fs / ocfs2 / cluster / tcp.h
bloba6f4585501c82a1b16103ae7f1696845f9b5c8c4
1 /* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
4 * tcp.h
6 * Function prototypes
8 * Copyright (C) 2004 Oracle. All rights reserved.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 021110-1307, USA.
27 #ifndef O2CLUSTER_TCP_H
28 #define O2CLUSTER_TCP_H
30 #include <linux/socket.h>
31 #ifdef __KERNEL__
32 #include <net/sock.h>
33 #include <linux/tcp.h>
34 #else
35 #include <sys/socket.h>
36 #endif
37 #include <linux/inet.h>
38 #include <linux/in.h>
40 struct o2net_msg
42 __be16 magic;
43 __be16 data_len;
44 __be16 msg_type;
45 __be16 pad1;
46 __be32 sys_status;
47 __be32 status;
48 __be32 key;
49 __be32 msg_num;
50 __u8 buf[0];
53 typedef int (o2net_msg_handler_func)(struct o2net_msg *msg, u32 len, void *data);
55 #define O2NET_MAX_PAYLOAD_BYTES (4096 - sizeof(struct o2net_msg))
57 /* TODO: figure this out.... */
58 static inline int o2net_link_down(int err, struct socket *sock)
60 if (sock) {
61 if (sock->sk->sk_state != TCP_ESTABLISHED &&
62 sock->sk->sk_state != TCP_CLOSE_WAIT)
63 return 1;
66 if (err >= 0)
67 return 0;
68 switch (err) {
69 /* ????????????????????????? */
70 case -ERESTARTSYS:
71 case -EBADF:
72 /* When the server has died, an ICMP port unreachable
73 * message prompts ECONNREFUSED. */
74 case -ECONNREFUSED:
75 case -ENOTCONN:
76 case -ECONNRESET:
77 case -EPIPE:
78 return 1;
80 return 0;
83 enum {
84 O2NET_DRIVER_UNINITED,
85 O2NET_DRIVER_READY,
88 int o2net_init_tcp_sock(struct inode *inode);
89 int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
90 u8 target_node, int *status);
91 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
92 size_t veclen, u8 target_node, int *status);
93 int o2net_broadcast_message(u32 msg_type, u32 key, void *data, u32 len,
94 struct inode *group);
96 int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
97 o2net_msg_handler_func *func, void *data,
98 struct list_head *unreg_list);
99 void o2net_unregister_handler_list(struct list_head *list);
101 struct o2nm_node;
102 int o2net_register_hb_callbacks(void);
103 void o2net_unregister_hb_callbacks(void);
104 int o2net_start_listening(struct o2nm_node *node);
105 void o2net_stop_listening(struct o2nm_node *node);
106 void o2net_disconnect_node(struct o2nm_node *node);
108 int o2net_init(void);
109 void o2net_exit(void);
110 int o2net_proc_init(struct proc_dir_entry *parent);
111 void o2net_proc_exit(struct proc_dir_entry *parent);
113 #endif /* O2CLUSTER_TCP_H */