Blame view

include/net/iucv/af_iucv.h 4.08 KB
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  /*
   * Copyright 2006 IBM Corporation
   * IUCV protocol stack for Linux on zSeries
   * Version 1.0
   * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
   *
   */
  
  #ifndef __AFIUCV_H
  #define __AFIUCV_H
  
  #include <asm/types.h>
  #include <asm/byteorder.h>
  #include <linux/list.h>
  #include <linux/poll.h>
  #include <linux/socket.h>
3881ac441   Ursula Braun   af_iucv: add Hipe...
17
  #include <net/iucv/iucv.h>
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
18
19
20
21
22
23
24
25
26
27
28
29
  
  #ifndef AF_IUCV
  #define AF_IUCV		32
  #define PF_IUCV		AF_IUCV
  #endif
  
  /* Connection and socket states */
  enum {
  	IUCV_CONNECTED = 1,
  	IUCV_OPEN,
  	IUCV_BOUND,
  	IUCV_LISTEN,
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
30
  	IUCV_DISCONN,
561e03600   Jennifer Hunt   [AF_IUCV]: Implem...
31
  	IUCV_CLOSING,
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
32
33
34
35
  	IUCV_CLOSED
  };
  
  #define IUCV_QUEUELEN_DEFAULT	65535
3881ac441   Ursula Braun   af_iucv: add Hipe...
36
  #define IUCV_HIPER_MSGLIM_DEFAULT	128
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  #define IUCV_CONN_TIMEOUT	(HZ * 40)
  #define IUCV_DISCONN_TIMEOUT	(HZ * 2)
  #define IUCV_CONN_IDLE_TIMEOUT	(HZ * 60)
  #define IUCV_BUFSIZE_DEFAULT	32768
  
  /* IUCV socket address */
  struct sockaddr_iucv {
  	sa_family_t	siucv_family;
  	unsigned short	siucv_port;		/* Reserved */
  	unsigned int	siucv_addr;		/* Reserved */
  	char		siucv_nodeid[8];	/* Reserved */
  	char		siucv_user_id[8];	/* Guest User Id */
  	char		siucv_name[8];		/* Application Name */
  };
  
  
  /* Common socket structures and functions */
f0703c80e   Ursula Braun   [AF_IUCV]: postpo...
54
55
56
57
58
59
  struct sock_msg_q {
  	struct iucv_path	*path;
  	struct iucv_message	msg;
  	struct list_head	list;
  	spinlock_t		lock;
  };
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
60

3881ac441   Ursula Braun   af_iucv: add Hipe...
61
62
63
64
  #define AF_IUCV_FLAG_ACK 0x1
  #define AF_IUCV_FLAG_SYN 0x2
  #define AF_IUCV_FLAG_FIN 0x4
  #define AF_IUCV_FLAG_WIN 0x8
82492a355   Ursula Braun   af_iucv: add shut...
65
  #define AF_IUCV_FLAG_SHT 0x10
3881ac441   Ursula Braun   af_iucv: add Hipe...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  
  struct af_iucv_trans_hdr {
  	u16 magic;
  	u8 version;
  	u8 flags;
  	u16 window;
  	char destNodeID[8];
  	char destUserID[8];
  	char destAppName[16];
  	char srcNodeID[8];
  	char srcUserID[8];
  	char srcAppName[16];             /* => 70 bytes */
  	struct iucv_message iucv_hdr;    /* => 33 bytes */
  	u8 pad;                          /* total 104 bytes */
  } __packed;
  
  enum iucv_tx_notify {
  	/* transmission of skb is completed and was successful */
  	TX_NOTIFY_OK = 0,
  	/* target is unreachable */
  	TX_NOTIFY_UNREACHABLE = 1,
  	/* transfer pending queue full */
  	TX_NOTIFY_TPQFULL = 2,
  	/* general error */
  	TX_NOTIFY_GENERALERROR = 3,
  	/* transmission of skb is pending - may interleave
  	 * with TX_NOTIFY_DELAYED_* */
  	TX_NOTIFY_PENDING = 4,
  	/* transmission of skb was done successfully (delayed) */
  	TX_NOTIFY_DELAYED_OK = 5,
  	/* target unreachable (detected delayed) */
  	TX_NOTIFY_DELAYED_UNREACHABLE = 6,
  	/* general error (detected delayed) */
  	TX_NOTIFY_DELAYED_GENERALERROR = 7,
  };
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
101
  #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
3881ac441   Ursula Braun   af_iucv: add Hipe...
102
103
  #define AF_IUCV_TRANS_IUCV 0
  #define AF_IUCV_TRANS_HIPER 1
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
104
105
106
107
108
109
110
  struct iucv_sock {
  	struct sock		sk;
  	char			src_user_id[8];
  	char			src_name[8];
  	char			dst_user_id[8];
  	char			dst_name[8];
  	struct list_head	accept_q;
febca281f   Ursula Braun   [AF_IUCV]: Add lo...
111
  	spinlock_t		accept_q_lock;
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
112
113
  	struct sock		*parent;
  	struct iucv_path	*path;
800c5eb7b   Ursula Braun   af_iucv: change n...
114
  	struct net_device	*hs_dev;
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
115
  	struct sk_buff_head	send_skb_q;
561e03600   Jennifer Hunt   [AF_IUCV]: Implem...
116
  	struct sk_buff_head	backlog_skb_q;
f0703c80e   Ursula Braun   [AF_IUCV]: postpo...
117
  	struct sock_msg_q	message_q;
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
118
  	unsigned int		send_tag;
9d5c5d8f4   Hendrik Brueckner   af_iucv: add sock...
119
  	u8			flags;
09488e2e0   Hendrik Brueckner   af_iucv: New sock...
120
  	u16			msglimit;
3881ac441   Ursula Braun   af_iucv: add Hipe...
121
122
123
124
125
126
127
  	u16			msglimit_peer;
  	atomic_t		msg_sent;
  	atomic_t		msg_recv;
  	atomic_t		pendings;
  	int			transport;
  	void                    (*sk_txnotify)(struct sk_buff *skb,
  					       enum iucv_tx_notify n);
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
128
  };
f9c41a62b   Ursula Braun   af_iucv: fix recv...
129
130
131
132
133
134
135
  struct iucv_skb_cb {
  	u32	class;		/* target class of message */
  	u32	tag;		/* tag associated with message */
  	u32	offset;		/* offset for skb receival */
  };
  
  #define IUCV_SKB_CB(__skb)	((struct iucv_skb_cb *)&((__skb)->cb[0]))
9d5c5d8f4   Hendrik Brueckner   af_iucv: add sock...
136
137
  /* iucv socket options (SOL_IUCV) */
  #define SO_IPRMDATA_MSG	0x0080		/* send/recv IPRM_DATA msgs */
09488e2e0   Hendrik Brueckner   af_iucv: New sock...
138
  #define SO_MSGLIMIT	0x1000		/* get/set IUCV MSGLIMIT */
51363b875   Ursula Braun   af_iucv: allow re...
139
  #define SO_MSGSIZE	0x0800		/* get maximum msgsize */
9d5c5d8f4   Hendrik Brueckner   af_iucv: add sock...
140

44b1e6b5f   Hendrik Brueckner   af_iucv: Modify i...
141
142
  /* iucv related control messages (scm) */
  #define SCM_IUCV_TRGCLS	0x0001		/* target class control message */
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
143
144
145
146
147
  struct iucv_sock_list {
  	struct hlist_head head;
  	rwlock_t	  lock;
  	atomic_t	  autobind_name;
  };
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
148
149
  unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
  			    poll_table *wait);
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
150
151
  void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
  void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
eac3731bd   Jennifer Hunt   [S390]: Add AF_IU...
152
153
154
155
156
  void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
  void iucv_accept_unlink(struct sock *sk);
  struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
  
  #endif /* __IUCV_H */