2 * Copyright 2006 IBM Corporation
3 * IUCV protocol stack for Linux on zSeries
5 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
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>
20 #define PF_IUCV AF_IUCV
23 /* Connection and socket states */
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
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 */
51 /* Common socket structures and functions */
53 #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
61 struct list_head accept_q;
63 struct iucv_path *path;
64 struct sk_buff_head send_skb_q;
65 unsigned int send_tag;
68 struct iucv_sock_list {
69 struct hlist_head head;
71 atomic_t autobind_name;
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,
81 static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
83 static int iucv_sock_listen(struct socket *sock, int backlog);
84 static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
86 static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
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,
94 static int iucv_sock_release(struct socket *sock);
95 static int iucv_sock_shutdown(struct socket *sock, int how);
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);
106 #endif /* __IUCV_H */