diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/net.h | 2 | ||||
-rw-r--r-- | include/linux/socket.h | 4 | ||||
-rw-r--r-- | include/net/iucv/af_iucv.h | 106 |
3 files changed, 110 insertions, 2 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index f28d8a2e2c91..4db21e63d8d2 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -24,7 +24,7 @@ | |||
24 | struct poll_table_struct; | 24 | struct poll_table_struct; |
25 | struct inode; | 25 | struct inode; |
26 | 26 | ||
27 | #define NPROTO 32 /* should be enough for now.. */ | 27 | #define NPROTO 33 /* should be enough for now.. */ |
28 | 28 | ||
29 | #define SYS_SOCKET 1 /* sys_socket(2) */ | 29 | #define SYS_SOCKET 1 /* sys_socket(2) */ |
30 | #define SYS_BIND 2 /* sys_bind(2) */ | 30 | #define SYS_BIND 2 /* sys_bind(2) */ |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 92cd38efad7f..fcd35a210e7f 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -187,7 +187,8 @@ struct ucred { | |||
187 | #define AF_LLC 26 /* Linux LLC */ | 187 | #define AF_LLC 26 /* Linux LLC */ |
188 | #define AF_TIPC 30 /* TIPC sockets */ | 188 | #define AF_TIPC 30 /* TIPC sockets */ |
189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ | 189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ |
190 | #define AF_MAX 32 /* For now.. */ | 190 | #define AF_IUCV 32 /* IUCV sockets */ |
191 | #define AF_MAX 33 /* For now.. */ | ||
191 | 192 | ||
192 | /* Protocol families, same as address families. */ | 193 | /* Protocol families, same as address families. */ |
193 | #define PF_UNSPEC AF_UNSPEC | 194 | #define PF_UNSPEC AF_UNSPEC |
@@ -220,6 +221,7 @@ struct ucred { | |||
220 | #define PF_LLC AF_LLC | 221 | #define PF_LLC AF_LLC |
221 | #define PF_TIPC AF_TIPC | 222 | #define PF_TIPC AF_TIPC |
222 | #define PF_BLUETOOTH AF_BLUETOOTH | 223 | #define PF_BLUETOOTH AF_BLUETOOTH |
224 | #define PF_IUCV AF_IUCV | ||
223 | #define PF_MAX AF_MAX | 225 | #define PF_MAX AF_MAX |
224 | 226 | ||
225 | /* Maximum queue length specifiable by listen. */ | 227 | /* Maximum queue length specifiable by listen. */ |
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h new file mode 100644 index 000000000000..04d1abb72d25 --- /dev/null +++ b/include/net/iucv/af_iucv.h | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * Copyright 2006 IBM Corporation | ||
3 | * IUCV protocol stack for Linux on zSeries | ||
4 | * Version 1.0 | ||
5 | * Author(s): Jennifer Hunt <jenhunt@us.ibm.com> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef __AFIUCV_H | ||
10 | #define __AFIUCV_H | ||
11 | |||
12 | #include <asm/types.h> | ||
13 | #include <asm/byteorder.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/poll.h> | ||
16 | #include <linux/socket.h> | ||
17 | |||
18 | #ifndef AF_IUCV | ||
19 | #define AF_IUCV 32 | ||
20 | #define PF_IUCV AF_IUCV | ||
21 | #endif | ||
22 | |||
23 | /* Connection and socket states */ | ||
24 | enum { | ||
25 | IUCV_CONNECTED = 1, | ||
26 | IUCV_OPEN, | ||
27 | IUCV_BOUND, | ||
28 | IUCV_LISTEN, | ||
29 | IUCV_SEVERED, | ||
30 | IUCV_DISCONN, | ||
31 | IUCV_CLOSED | ||
32 | }; | ||
33 | |||
34 | #define IUCV_QUEUELEN_DEFAULT 65535 | ||
35 | #define IUCV_CONN_TIMEOUT (HZ * 40) | ||
36 | #define IUCV_DISCONN_TIMEOUT (HZ * 2) | ||
37 | #define IUCV_CONN_IDLE_TIMEOUT (HZ * 60) | ||
38 | #define IUCV_BUFSIZE_DEFAULT 32768 | ||
39 | |||
40 | /* IUCV socket address */ | ||
41 | struct sockaddr_iucv { | ||
42 | sa_family_t siucv_family; | ||
43 | unsigned short siucv_port; /* Reserved */ | ||
44 | unsigned int siucv_addr; /* Reserved */ | ||
45 | char siucv_nodeid[8]; /* Reserved */ | ||
46 | char siucv_user_id[8]; /* Guest User Id */ | ||
47 | char siucv_name[8]; /* Application Name */ | ||
48 | }; | ||
49 | |||
50 | |||
51 | /* Common socket structures and functions */ | ||
52 | |||
53 | #define iucv_sk(__sk) ((struct iucv_sock *) __sk) | ||
54 | |||
55 | struct iucv_sock { | ||
56 | struct sock sk; | ||
57 | char src_user_id[8]; | ||
58 | char src_name[8]; | ||
59 | char dst_user_id[8]; | ||
60 | char dst_name[8]; | ||
61 | struct list_head accept_q; | ||
62 | struct sock *parent; | ||
63 | struct iucv_path *path; | ||
64 | struct sk_buff_head send_skb_q; | ||
65 | unsigned int send_tag; | ||
66 | }; | ||
67 | |||
68 | struct iucv_sock_list { | ||
69 | struct hlist_head head; | ||
70 | rwlock_t lock; | ||
71 | atomic_t autobind_name; | ||
72 | }; | ||
73 | |||
74 | static void iucv_sock_destruct(struct sock *sk); | ||
75 | static void iucv_sock_cleanup_listen(struct sock *parent); | ||
76 | static void iucv_sock_kill(struct sock *sk); | ||
77 | static void iucv_sock_close(struct sock *sk); | ||
78 | static int iucv_sock_create(struct socket *sock, int proto); | ||
79 | static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, | ||
80 | int addr_len); | ||
81 | static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr, | ||
82 | int alen, int flags); | ||
83 | static int iucv_sock_listen(struct socket *sock, int backlog); | ||
84 | static int iucv_sock_accept(struct socket *sock, struct socket *newsock, | ||
85 | int flags); | ||
86 | static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr, | ||
87 | int *len, int peer); | ||
88 | static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | ||
89 | struct msghdr *msg, size_t len); | ||
90 | static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
91 | struct msghdr *msg, size_t len, int flags); | ||
92 | unsigned int iucv_sock_poll(struct file *file, struct socket *sock, | ||
93 | poll_table *wait); | ||
94 | static int iucv_sock_release(struct socket *sock); | ||
95 | static int iucv_sock_shutdown(struct socket *sock, int how); | ||
96 | |||
97 | void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); | ||
98 | void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); | ||
99 | int iucv_sock_wait_state(struct sock *sk, int state, int state2, | ||
100 | unsigned long timeo); | ||
101 | int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo); | ||
102 | void iucv_accept_enqueue(struct sock *parent, struct sock *sk); | ||
103 | void iucv_accept_unlink(struct sock *sk); | ||
104 | struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock); | ||
105 | |||
106 | #endif /* __IUCV_H */ | ||