Linux Audio

Check our new training course

Loading...
v4.17
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright 2006 IBM Corporation
  4 * IUCV protocol stack for Linux on zSeries
  5 * Version 1.0
  6 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
  7 *
  8 */
  9
 10#ifndef __AFIUCV_H
 11#define __AFIUCV_H
 12
 13#include <asm/types.h>
 14#include <asm/byteorder.h>
 15#include <linux/list.h>
 16#include <linux/poll.h>
 17#include <linux/socket.h>
 18#include <net/iucv/iucv.h>
 19
 20#ifndef AF_IUCV
 21#define AF_IUCV		32
 22#define PF_IUCV		AF_IUCV
 23#endif
 24
 25/* Connection and socket states */
 26enum {
 27	IUCV_CONNECTED = 1,
 28	IUCV_OPEN,
 29	IUCV_BOUND,
 30	IUCV_LISTEN,
 31	IUCV_DISCONN,
 32	IUCV_CLOSING,
 33	IUCV_CLOSED
 34};
 35
 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
 42
 43/* IUCV socket address */
 44struct 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 */
 51};
 52
 53
 54/* Common socket structures and functions */
 55struct sock_msg_q {
 56	struct iucv_path	*path;
 57	struct iucv_message	msg;
 58	struct list_head	list;
 59	spinlock_t		lock;
 60};
 61
 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
 66#define AF_IUCV_FLAG_SHT 0x10
 67
 68struct af_iucv_trans_hdr {
 69	u16 magic;
 70	u8 version;
 71	u8 flags;
 72	u16 window;
 73	char destNodeID[8];
 74	char destUserID[8];
 75	char destAppName[16];
 76	char srcNodeID[8];
 77	char srcUserID[8];
 78	char srcAppName[16];             /* => 70 bytes */
 79	struct iucv_message iucv_hdr;    /* => 33 bytes */
 80	u8 pad;                          /* total 104 bytes */
 81} __packed;
 82
 
 
 
 
 
 83enum iucv_tx_notify {
 84	/* transmission of skb is completed and was successful */
 85	TX_NOTIFY_OK = 0,
 86	/* target is unreachable */
 87	TX_NOTIFY_UNREACHABLE = 1,
 88	/* transfer pending queue full */
 89	TX_NOTIFY_TPQFULL = 2,
 90	/* general error */
 91	TX_NOTIFY_GENERALERROR = 3,
 92	/* transmission of skb is pending - may interleave
 93	 * with TX_NOTIFY_DELAYED_* */
 94	TX_NOTIFY_PENDING = 4,
 95	/* transmission of skb was done successfully (delayed) */
 96	TX_NOTIFY_DELAYED_OK = 5,
 97	/* target unreachable (detected delayed) */
 98	TX_NOTIFY_DELAYED_UNREACHABLE = 6,
 99	/* general error (detected delayed) */
100	TX_NOTIFY_DELAYED_GENERALERROR = 7,
101};
102
103#define iucv_sk(__sk) ((struct iucv_sock *) __sk)
104
105#define AF_IUCV_TRANS_IUCV 0
106#define AF_IUCV_TRANS_HIPER 1
107
108struct iucv_sock {
109	struct sock		sk;
110	char			src_user_id[8];
111	char			src_name[8];
112	char			dst_user_id[8];
113	char			dst_name[8];
 
 
114	struct list_head	accept_q;
115	spinlock_t		accept_q_lock;
116	struct sock		*parent;
117	struct iucv_path	*path;
118	struct net_device	*hs_dev;
119	struct sk_buff_head	send_skb_q;
120	struct sk_buff_head	backlog_skb_q;
121	struct sock_msg_q	message_q;
122	unsigned int		send_tag;
123	u8			flags;
124	u16			msglimit;
125	u16			msglimit_peer;
 
126	atomic_t		msg_sent;
127	atomic_t		msg_recv;
128	atomic_t		pendings;
129	int			transport;
130	void                    (*sk_txnotify)(struct sk_buff *skb,
131					       enum iucv_tx_notify n);
132};
133
134struct iucv_skb_cb {
135	u32	class;		/* target class of message */
136	u32	tag;		/* tag associated with message */
137	u32	offset;		/* offset for skb receival */
138};
139
140#define IUCV_SKB_CB(__skb)	((struct iucv_skb_cb *)&((__skb)->cb[0]))
141
142/* iucv socket options (SOL_IUCV) */
143#define SO_IPRMDATA_MSG	0x0080		/* send/recv IPRM_DATA msgs */
144#define SO_MSGLIMIT	0x1000		/* get/set IUCV MSGLIMIT */
145#define SO_MSGSIZE	0x0800		/* get maximum msgsize */
146
147/* iucv related control messages (scm) */
148#define SCM_IUCV_TRGCLS	0x0001		/* target class control message */
149
150struct iucv_sock_list {
151	struct hlist_head head;
152	rwlock_t	  lock;
153	atomic_t	  autobind_name;
154};
155
156__poll_t iucv_sock_poll(struct file *file, struct socket *sock,
157			    poll_table *wait);
158void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
159void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
160void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
161void iucv_accept_unlink(struct sock *sk);
162struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
163
164#endif /* __IUCV_H */
v6.2
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright 2006 IBM Corporation
  4 * IUCV protocol stack for Linux on zSeries
  5 * Version 1.0
  6 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
  7 *
  8 */
  9
 10#ifndef __AFIUCV_H
 11#define __AFIUCV_H
 12
 13#include <asm/types.h>
 14#include <asm/byteorder.h>
 15#include <linux/list.h>
 16#include <linux/poll.h>
 17#include <linux/socket.h>
 18#include <net/iucv/iucv.h>
 19
 20#ifndef AF_IUCV
 21#define AF_IUCV		32
 22#define PF_IUCV		AF_IUCV
 23#endif
 24
 25/* Connection and socket states */
 26enum {
 27	IUCV_CONNECTED = 1,
 28	IUCV_OPEN,
 29	IUCV_BOUND,
 30	IUCV_LISTEN,
 31	IUCV_DISCONN,
 32	IUCV_CLOSING,
 33	IUCV_CLOSED
 34};
 35
 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
 42
 43/* IUCV socket address */
 44struct 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 */
 51};
 52
 53
 54/* Common socket structures and functions */
 55struct sock_msg_q {
 56	struct iucv_path	*path;
 57	struct iucv_message	msg;
 58	struct list_head	list;
 59	spinlock_t		lock;
 60};
 61
 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
 66#define AF_IUCV_FLAG_SHT 0x10
 67
 68struct af_iucv_trans_hdr {
 69	u16 magic;
 70	u8 version;
 71	u8 flags;
 72	u16 window;
 73	char destNodeID[8];
 74	char destUserID[8];
 75	char destAppName[16];
 76	char srcNodeID[8];
 77	char srcUserID[8];
 78	char srcAppName[16];             /* => 70 bytes */
 79	struct iucv_message iucv_hdr;    /* => 33 bytes */
 80	u8 pad;                          /* total 104 bytes */
 81} __packed;
 82
 83static inline struct af_iucv_trans_hdr *iucv_trans_hdr(struct sk_buff *skb)
 84{
 85	return (struct af_iucv_trans_hdr *)skb_network_header(skb);
 86}
 87
 88enum iucv_tx_notify {
 89	/* transmission of skb is completed and was successful */
 90	TX_NOTIFY_OK = 0,
 91	/* target is unreachable */
 92	TX_NOTIFY_UNREACHABLE = 1,
 93	/* transfer pending queue full */
 94	TX_NOTIFY_TPQFULL = 2,
 95	/* general error */
 96	TX_NOTIFY_GENERALERROR = 3,
 97	/* transmission of skb is pending - may interleave
 98	 * with TX_NOTIFY_DELAYED_* */
 99	TX_NOTIFY_PENDING = 4,
100	/* transmission of skb was done successfully (delayed) */
101	TX_NOTIFY_DELAYED_OK = 5,
102	/* target unreachable (detected delayed) */
103	TX_NOTIFY_DELAYED_UNREACHABLE = 6,
104	/* general error (detected delayed) */
105	TX_NOTIFY_DELAYED_GENERALERROR = 7,
106};
107
108#define iucv_sk(__sk) ((struct iucv_sock *) __sk)
109
110#define AF_IUCV_TRANS_IUCV 0
111#define AF_IUCV_TRANS_HIPER 1
112
113struct iucv_sock {
114	struct sock		sk;
115	struct_group(init,
116		char		src_user_id[8];
117		char		src_name[8];
118		char		dst_user_id[8];
119		char		dst_name[8];
120	);
121	struct list_head	accept_q;
122	spinlock_t		accept_q_lock;
123	struct sock		*parent;
124	struct iucv_path	*path;
125	struct net_device	*hs_dev;
126	struct sk_buff_head	send_skb_q;
127	struct sk_buff_head	backlog_skb_q;
128	struct sock_msg_q	message_q;
129	unsigned int		send_tag;
130	u8			flags;
131	u16			msglimit;
132	u16			msglimit_peer;
133	atomic_t		skbs_in_xmit;
134	atomic_t		msg_sent;
135	atomic_t		msg_recv;
136	atomic_t		pendings;
137	int			transport;
138	void			(*sk_txnotify)(struct sock *sk,
139					       enum iucv_tx_notify n);
140};
141
142struct iucv_skb_cb {
143	u32	class;		/* target class of message */
144	u32	tag;		/* tag associated with message */
145	u32	offset;		/* offset for skb receival */
146};
147
148#define IUCV_SKB_CB(__skb)	((struct iucv_skb_cb *)&((__skb)->cb[0]))
149
150/* iucv socket options (SOL_IUCV) */
151#define SO_IPRMDATA_MSG	0x0080		/* send/recv IPRM_DATA msgs */
152#define SO_MSGLIMIT	0x1000		/* get/set IUCV MSGLIMIT */
153#define SO_MSGSIZE	0x0800		/* get maximum msgsize */
154
155/* iucv related control messages (scm) */
156#define SCM_IUCV_TRGCLS	0x0001		/* target class control message */
157
158struct iucv_sock_list {
159	struct hlist_head head;
160	rwlock_t	  lock;
161	atomic_t	  autobind_name;
162};
 
 
 
 
 
 
 
 
163
164#endif /* __IUCV_H */