setpeer (BPX1SPR, BPX4SPR) — Preset the peer address associated with a socket
Function
The setpeer callable service presets the peer address that is associated with a socket.
Requirements
| Operation | Environment |
|---|---|
| Authorization: | Supervisor state or problem state, any PSW key |
| Dispatchable unit mode: | Task or SRB |
| Cross memory mode: | PASN = HASN |
| AMODE (BPX1SPR): | 31-bit task or SRB mode |
| AMODE (BPX4SPR): | 64-bit task mode only |
| ASC mode: | Primary mode |
| Interrupt status: | Enabled for interrupts |
| Locks: | Unlocked |
| Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
Format
CALL BPX1SPR,(Socket_descriptor,
Sockaddr_length,
Sockaddr,
Option,
Return_value,
Return_code,
Reason_code)AMODE 64 callers use BPX4SPR with the same parameters.
Parameters
- Socket_descriptor
- Supplied parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword that contains the socket file descriptor for which the setpeer is to be done.
- Sockaddr_length
- Supplied and returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a field that contains the length of Sockaddr.
- Sockaddr
- Supplied and returned parameter
- Type:
- Structure
- Length:
- Length specified by Sockaddr_length
The name of a socket address structure that contains the peer address. See BPXYSOCK — Map SOCKADDR structure and constants for more information about the format of this field.
- Option
- Supplied and returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a field that indicates the conditions of the setpeer request. See BPXYSOCK — Map SOCKADDR structure and constants for more information about this field.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the setpeer service returns one of the following:0if the request is successful.-1if the request is not successful.
- Return_code
- Returned parameter
- Type:
- Integer
- Character set:
- N/A
- Length:
- Fullword
The name of a fullword in which the setpeer service stores the return code. The setpeer service returns Return_code only if Return_value is-1. For a list of return code values, see Return codes (errnos) in z/OS UNIX System Services Messages and Codes.The setpeer service can return one of the following values in the Return_code parameter:Return_code Explanation EBADF The socket descriptor is incorrect. The following reason codes can accompany the return code: JRFileDesNotInUse, JRFileNotOpen. ENOTSOCK Socket_descriptor does not refer to a valid socket descriptor. The following reason code can accompany the return code: JRMustBeSocket. - Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the setpeer service stores the reason code. The setpeer service returns Reason_code only if Return_value is
-1. Reason_code further qualifies the Return_code value. For a list of reason codes, see Reason codes in z/OS UNIX System Services Messages and Codes.
Usage notes
- The setpeer service is not supported by AF_UNIX, AF_INET, or AF_INET6.
- See Callable services available to SRB mode routines for more information about programming considerations for SRB mode.
Characteristics and restrictions
There are no restrictions on the use of the setpeer service.