1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
|
.\" af_iucv.7
.\"
.\"
.\" Copyright IBM Corp. 2008, 2009.
.\" Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
.\" ----------------------------------------------------------------------
.TH AF_IUCV 7 "September 2009" "s390-tools" "Linux Programmer's Manual"
.SH NAME
iucv, AF_IUCV \- Sockets for z/VM IUCV communication
.
.
.
.SH SYNOPSIS
.B #include <sys/socket.h>
.IB iucv_stream_socket " = socket(AF_IUCV, SOCK_STREAM, 0);"
.br
.IB iucv_packet_socket " = socket(AF_IUCV, SOCK_SEQPACKET, 0);"
.
.
.
.SH DESCRIPTION
The Inter-User Communication Vehicle (IUCV) is a z/VM communication facility
that enables a program running in one z/VM guest virtual machine to communicate
with another z/VM guest virtual machine, or with the control program (CP), or
even with itself.
The AF_IUCV address family provides communication and addressing in the IUCV
domain. In the IUCV domain, address spaces or virtual machines can use the
socket interface to communicate with other virtual machines or address spaces
within the same z/VM guest operating system.
AF_IUCV connects socket applications running on different Linux guest operating
systems, or it connects a Linux application to another socket application
running in another z/VM guest operating system (like z/VM CMS).
The AF_IUCV address family supports stream-oriented sockets
(\f(CWSOCK_STREAM\fP) and connection-oriented datagram sockets
(\f(CWSOCK_SEQPACKET\fP). Stream-oriented sockets fragment data over several
native IUCV messages, whereas sockets of type SOCK_SEQPACKET map a particular
socket write or read operation to a single native IUCV message.
.SS Features
The AF_IUCV address family provides:
.PP
.IP "\(bu" 2
Multiple outgoing socket connections from a Linux guest operating system.
.IP "\(bu" 2
Multiple incoming socket connections to a Linux guest operating system.
.IP "\(bu" 2
Socket communication with applications utilizing CMS AF_IUCV support.
.
.
.
.
.SH "ADDRESS FORMAT"
.ft CW
.in +0.25i
.nf
#define AF_IUCV 32
struct sockaddr_iucv {
sa_family_t siucv_family; /* AF_IUCV */
unsigned short siucv_port; /* reserved */
unsigned int siucv_addr; /* reserved */
char siucv_nodeid[8]; /* reserved */
char siucv_userid[8]; /* guest user id */
char siucv_name[8]; /* application name */
};
.fi
.in -0.25i
.ft R
.TP
.B siucv_family
is set to
.BR AF_IUCV
(= 32)
.
.TP
.B siucv_port, siucv_addr, siucv_nodeid
are reserved for future use. The
.B siucv_port
and
.B siucv_addr
fields must be zero. The
.B siucv_nodeid
field must be set to exactly eight blank characters.
.
.TP
.B siucv_userid
is set to the z/VM user ID of the Linux guest virtual machine running the
application that owns the address. The field must be eight characters long,
padded with blanks on the right.
For
.BR bind "(2), " siucv_userid
must contain blanks only to allow AF_IUCV to set the z/VM user ID of the Linux
guest operating system.
.
.TP
.B siucv_name
is set to the application name by which the socket is known. Servers advertise
application names and clients use these application names to connect to servers.
This field must be eight characters long, padded with blanks on the right.
.
.
.
.SH "SOCKET OPTIONS"
Socket options can be set with
.BR setsockopt (2)
and read with
.BR getsockopt (2)
by specifying \f(CWSOL_IUCV\fP as the socket level.
.TP
.B SO_IPRMDATA_MSG
Enables the application to send up to seven bytes of socket data in the
parameter list of an IUCV message. Use this option to increase performance
when transferring small amounts of data.
To send data in the parameter list, specify a non-zero integer value.
.RS
.TP
.B Note:
Use this option with care, older AF_IUCV versions do not support receiving
socket data in the parameter list and shut down the socket on which
a parameter list message has been received.
.RE
.
.TP
.B SO_MSGLIMIT
Modifies the message limit for new IUCV communication paths. The message
limit specifies the maximum number of outstanding messages that are allowed
for established connections. This setting can be lowered by z/VM when an IUCV
connection is established.
The message limit is an integer value in range 1 to 65535.
The default value is 65535.
The message limit must be set before
.BR connect "(2) or " listen (2)
is called for sockets.
.br
For sockets that are already connected or listening for connections,
the message limit cannot be changed.
.br
New sockets created by
.BR accept (2)
inherit the message limit that has been set for the listening socket.
.BR getsockopt (2)
returns the default message limit or the limit that has been set.
For connected sockets, the current message limit is returned. The current
message limit is assigned by z/VM for each connection and it depends
on the IUCV MSGLIMIT statement specified for the z/VM guest virtual machine.
The current message limit is the lower value of the socket option and the
value specified for the IUCV MSGLIMIT statement.
See the SECURITY section below for setting IUCV MSGLIMIT authorizations.
.
.
.
.SH "ANCILLARY DATA"
Ancillary data is sent and received using the
.BR sendmsg (2)
and
.BR recvmsg (2)\fR.\fP
To send ancillary data, set the \fBcmsg_level\fP field of struct \fBcmsghdr\fP
to \f(CWSOL_IUCV\fP and the \fBcmsg_type\fP field to the type.
.br
For more information see
.BR cmsg (3).
.TP
.B SCM_IUCV_TRGCLS
Send or receive IUCV target class information. The IUCV target class can be used
to classify and identify an IUCV message at IUCV protocol level. If the target
class is not specified as ancillary data, it is set to zero.
The target class is a number of type \fBuint32_t\fP.
.
.
.
.
.SH SECURITY
This section provides an overview of the required IUCV statements for your z/VM
guest virtual machine. For details and for general IUCV setup information for
z/VM guests virtual machines see
.I z/VM CP Programming Services
and
.I z/VM CP Planning and Administration\fR.\fP
.
.
.SS "Granting IUCV authorizations"
Use the
.B IUCV
directory control statement to grant the necessary authorizations.
.
.TP
.B IUCV ALLOW
allows any other z/VM virtual machine to establish a communication path with
this z/VM virtual machine. With this statement, no further authorization is
required in the z/VM virtual machine that initiates the communication.
.
.TP
.B IUCV ANY
allows this z/VM guest virtual machine to establish a communication path with
any other z/VM guest virtual machine.
.
.TP
.B IUCV \fIuser_ID\fP
allows this z/VM guest virtual machine to establish a communication path to the
z/VM guest virtual machine with the z/VM user ID \fIuser_ID\fP.
.PP
You can specify multiple IUCV statements. To any of these IUCV statements you
can append the
.B MSGLIMIT \fIlimit\fP
parameter.
\fIlimit\fP specifies the maximum number of outstanding messages that are
allowed for each connection authorized by this statement.
If no value is specified for \fBMSGLIMIT\fP, AF_IUCV requests 65535,
which is the maximum supported by IUCV.
.
.
.SS "Setting a connection limit"
Use the \fBOPTION\fP statement to limit the number of concurrent connections.
.TP
.B OPTION MAXCONN \fImaxno\fP
\fImaxno\fP specifies the maximum number of IUCV connections allowed for this
virtual machine. The default is 64. The maximum is 65535.
.
.
.SS "Example"
These sample statements allow any z/VM guest virtual machine to connect to your
z/VM guest virtual machine with a maximum of 10\^000 outstanding messages for each
incoming connection. Your z/VM guest virtual machine is permitted to connect to
all other z/VM guest virtual machines. The total number of connections for your
z/VM guest virtual machine cannot exceed 100.
.ft CW
.in +0.25i
.nf
IUCV ALLOW MSGLIMIT 10000
IUCV ANY
OPTION MAXCONN 100
.fi
.in -0.25i
.ft
.
.
.
.
.SH ERRORS
Several socket operations return error conditions that have a special meaning in
the context of AF_IUCV. Those error conditions, and the respective descriptions
are listed below.
See the manual page of the respective socket operation for a complete list
of errors.
.TP
.B ECONNREFUSED
.BR connect (2)
called but the target z/VM guest virtual machine is not listening on the
application name.
.
.TP
.B ENETUNREACH
.BR connect (2)
called but the target z/VM guest virtual machine is not logged on.
Ensure that the z/VM guest virtual machine to which your application wants to
connect is logged on.
.
.TP
.B EAGAIN
.BR connect (2)
called but the maximum number of connections is exceeded for the calling or for
the target z/VM guest virtual machine.
This error can be temporary and the application may try again after some time.
If the error occurs repeatedly, try to increase the maximum number of
connections (for one or both z/VM guest virtual machines).
See the SECURITY section about the required authorization statement.
.B sendmsg (2)
called but the maximum number of outstanding IUCV messages for the socket
connection is reached; i.e. there are data available that has not yet been
received by the communication partner.
.br
If necessary, change the IUCV message limit as explained in section
"IUCV AUTHORIZATIONS".
.
.TP
.B EACCES
.BR connect (2)
called but the calling z/VM guest virtual machine is missing IUCV authorization.
See the SECURITY section about required IUCV authorizations.
.
.TP
.B EINVAL
.BR connect (2)
or
.BR bind (2)
called but the AF_IUCV setting in the
.I siucv_family
field of the passed address is missing.
.BR listen (2)
called but the AF_IUCV socket has not yet been bound to an address.
Always call
.BR bind (2)
before
.BR listen (2).
.BR setsockopt (2)
called with option \fBSO_MSGLIMIT\fP for sockets that are already connected.
.
.TP
.B ENOPROTOOPT
.BR setsockopt (2),
or
.BR getsockopt (2)
called but the socket level has not been set to \f(CWSOL_IUCV\fP, or the
specified socket option is not supported.
.
.TP
.B EOPNOTSUPP
.BR sendmsg (2)
or
.BR recvmsg (2)
might be called with the
.I MSG_OOB
flag set.
AF_IUCV does not support sending or receiving \fIout-of-band\fP data on its
sockets.
For \f(CWSOCK_SEQPACKET\fP sockets,
.BR sendmsg (2)
called without the
.I MSG_EOR
flag set.
AF_IUCV does not support segmentation, and thus, the "end-of-record"
(\fIMSG_EOR\fP) flag must always be set.
.
.TP
.B EPROTONOSUPPORT
.BR socket (2)
called with a protocol that is not supported. The socket protocol parameter
must be either zero or \f(CWPF_IUCV\fP.
.
.TP
.B EAFNOSUPPORT
.BR socket (2)
called with \f(CWAF_IUCV\fP but the AF_IUCV address family is not
supported by the current Linux kernel. Ensure that your Linux kernel has been
compiled with support for the AF_IUCV address family.
.
.PP
Other errors can be generated by the generic socket layer. See the respective
manual pages for more information.
.
.
.
.SH "SEE ALSO"
.BR connect (2),
.BR recvmsg (2),
.BR sendmsg (2),
.BR socket (2),
.BR setsockopt (2),
.BR getsockopt (2),
.BR cmsg (3),
.BR socket (7)
.I "Linux on System z - Device Drivers, Features, and Commands"
.br
.I "z/VM CP Planning and Administration"
.br
.I "z/VM CP Programming Services"
.
.
.
.SH "HISTORY"
.TP
.B AF_IUCV, version 1.0
Initial version.
.TP
.B AF_IUCV, version 1.1
.RS 4
.IP "\(bu" 4
Support for sending socket data in the parameter list of an IUCV message
(\f(CWSO_IPRMDATA_MSG\fP).
.IP "\(bu" 4
Access the target class of an IUCV message as ancillary data using
.BR sendmsg "(2) and " recvmsg (2).
.IP "\(bu" 4
Support for \f(CWSOCK_SEQPACKET\fP sockets to facilitate development of native
IUCV applications that interact with AF_IUCV.
.RE
|