Function
The vn_setpeer operation presets
the peer address that is associated with a socket. This causes all
datagrams that are sent using the specified socket to be sent to the
address that is specified here. Only datagrams that are sent from
the specified address are received.
Input parameter format
vn_setpeer (Token_structure,
OSI_structure,
Audit_structure,
Sockaddr_length,
Sockaddr,
Option,
Return_value,
Return_code,
Reason_code)
Parameters
- Token_structure
- Supplied parameter
- Type:
- TOKSTR
- Length:
- Specified by TOKSTR.ts_hdr.cblen.
The Token_structure represents the file (vnode)
that is being operated on. It contains the PFS's initialization token,
mount token, and the file token. Refer to LFS/PFS control block structure for
a discussion of this structure, and to the TOKSTR typedef in BPXYPFSI
in Interface structures for C language servers and clients for its mapping.
- OSI_structure
- Supplied and returned parameter
- Type:
- OSI
- Length:
- Specified by OSI.osi_hdr.cblen.
The OSI_structure contains information that is used
by the OSI operations that may be called by the PFS. See OSI services for more information.
It also contains
MVS-specific information that needs to be passed to the PFS, including
SMF accounting fields, a work area, a recovery area, and an optional
pointer to an output ATTR structure. For more details on the OSI structure,
see The OSI structure.
This area is mapped by
the OSI typedef in BPXYPFSI in Interface structures for C language servers and clients.
- Audit_structure
- Supplied parameter
- Type:
- CRED
- Length:
- Specified by CRED.cred_hdr.cblen.
The Audit_structure contains information that is
used by the security product for access checks and auditing. It is
passed to most SAF routines that are invoked by the PFS.
Refer
to Security responsibilities and considerations for a discussion of security processing,
and to the CRED typedef in BPXYPFSI in Interface structures for C language servers and clients for
the mapping of this structure.
- Sockaddr_length
- Supplied and returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword that supplies the length of the Sockaddr
buffer and returns the length of the Sockaddr structure that is returned.
- Sockaddr
- Supplied and returned parameter
- Type:
- Structure
- Length:
- Specified by Sockaddr_length
A structure that varies depending on the address
family type. It contains the address that is to be used for this
operation. For an example of this mapping for AF_INET, see in.h.
- Option
- Supplied parameter
- Type:
- Integer
- Length:
- Fullword
A fullword that specifies the option of the vn_setpeer
operation to use. These values are mapped by socket.h.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_setpeer operation returns
the results of the operation, as one of the following:
- Return_value
- Meaning
- -1
- The operation was not successful. The Return_code and Reason_Code
values must be filled in by the PFS when Return_value is -1.
- 0
- The operation was successful.
- Return_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_setpeer operation stores
the return code. The vn_setpeer operation returns Return_code only
if Return_value is -1. For a complete list of supported
return code values, see z/OS UNIX System Services Messages and Codes.
The vn_setpeer operation should support
at least the following error value:
Return_code |
Explanation |
---|
EINVAL |
The address length that was specified is not the size of a
valid address for the specified address family. |
- Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
A fullword in which the vn_setpeer operation stores
the reason code. The vn_setpeer operation returns Reason_code only
if Return_value is -1. Reason_code further qualifies
the Return_code value. These reason codes are documented by the PFS.
Implementation notes
- Overview of vn_setpeer processing
The vn_setpeer call is new for POSIX 1003.12, and is not currently
supported by any of the socket PFSs.
- Specific processing notes
- Calling setpeer() with the option set to SO_SET causes all datagrams
that are sent through this socket to be sent to the address that is
specified by sockaddr. Only datagrams that originate from sockaddr
are received.
- Calling setpeer() with the option set to SO_SET on the passive
end of a virtual circuit before calling listen() or connect() causes
an error. Calling connect() and specifying a destination address
with setpeer causes an error. Calling setpeer() after a connection
is established is an error.
- The result of calling setpeer() with the option set to SO_SET
on an endpoint that has already had the destination address preset
causes an error if the underlying protocol does not support multiple
peer addresses for a given endpoint.
- Serialization provided by the LFS
The vn_setpeer operation is invoked with an exclusive latch
held on the vnode of the socket.
- Security calls to be made by the PFS
- None.