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>
17 #include <net/iucv/iucv.h>
21 #define PF_IUCV AF_IUCV
24 /* Connection and socket states */
36 #define IUCV_QUEUELEN_DEFAULT 65535
37 #define IUCV_HIPER_MSGLIM_DEFAULT 128
38 #define IUCV_CONN_TIMEOUT (HZ * 40)
39 #define IUCV_DISCONN_TIMEOUT (HZ * 2)
40 #define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
41 #define IUCV_BUFSIZE_DEFAULT 32768
43 /* IUCV socket address */
44 struct sockaddr_iucv {
45 sa_family_t siucv_family;
46 unsigned short siucv_port; /* Reserved */
47 unsigned int siucv_addr; /* Reserved */
48 char siucv_nodeid[8]; /* Reserved */
49 char siucv_user_id[8]; /* Guest User Id */
50 char siucv_name[8]; /* Application Name */
54 /* Common socket structures and functions */
56 struct iucv_path *path;
57 struct iucv_message msg;
58 struct list_head list;
62 #define AF_IUCV_FLAG_ACK 0x1
63 #define AF_IUCV_FLAG_SYN 0x2
64 #define AF_IUCV_FLAG_FIN 0x4
65 #define AF_IUCV_FLAG_WIN 0x8
67 struct af_iucv_trans_hdr {
77 char srcAppName[16]; /* => 70 bytes */
78 struct iucv_message iucv_hdr; /* => 33 bytes */
79 u8 pad; /* total 104 bytes */
83 /* transmission of skb is completed and was successful */
85 /* target is unreachable */
86 TX_NOTIFY_UNREACHABLE = 1,
87 /* transfer pending queue full */
88 TX_NOTIFY_TPQFULL = 2,
90 TX_NOTIFY_GENERALERROR = 3,
91 /* transmission of skb is pending - may interleave
92 * with TX_NOTIFY_DELAYED_* */
93 TX_NOTIFY_PENDING = 4,
94 /* transmission of skb was done successfully (delayed) */
95 TX_NOTIFY_DELAYED_OK = 5,
96 /* target unreachable (detected delayed) */
97 TX_NOTIFY_DELAYED_UNREACHABLE = 6,
98 /* general error (detected delayed) */
99 TX_NOTIFY_DELAYED_GENERALERROR = 7,
102 #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
104 #define AF_IUCV_TRANS_IUCV 0
105 #define AF_IUCV_TRANS_HIPER 1
113 struct list_head accept_q;
114 spinlock_t accept_q_lock;
116 struct iucv_path *path;
117 struct sk_buff_head send_skb_q;
118 struct sk_buff_head backlog_skb_q;
119 struct sock_msg_q message_q;
120 unsigned int send_tag;
128 void (*sk_txnotify)(struct sk_buff *skb,
129 enum iucv_tx_notify n);
132 /* iucv socket options (SOL_IUCV) */
133 #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
134 #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
136 /* iucv related control messages (scm) */
137 #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
139 struct iucv_sock_list {
140 struct hlist_head head;
142 atomic_t autobind_name;
145 unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
147 void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
148 void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
149 void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
150 void iucv_accept_unlink(struct sock *sk);
151 struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
153 #endif /* __IUCV_H */