|
by John Berry
Commercial Systems Division
This article provides more detailed information on the AIFPROCGET
enhancement, introduced in the article,
"AIF Enhancement to AIFPROCGET
Overview," in Chapter 3, "System Management."
AIFPROCGET, item 2149, was enhanced to retrieve
information on sockets owned by a given process (pin or pid). This item
can be used to request information on all or just incoming socket
connections belonging to a process. The maximum number of sockets that
can be opened per process is currently 1,024.
A pointer to the record type, connection_type, must be
passed into the AIFPROCGET parameter list. The caller is
responsible for initializing the connection_type. Each
entry has the following type definitions:
connection_type =
packed record
cnt : integer;
mode : integer;
entry : array[1..n] of conn_element_type;
end;
Record size: 4 + 4 + 20n bytes
Alignment : 4 bytes
n represents a user-defined size.
|
Field descriptions for the connection_type record structure
are as follows:
- cnt
- Maximum number of socket connections to return.
On input, the cnt field represents the number of allowable
elements in the entry array. On return, the cnt field will
contain the actual number of socket connections.
- mode
- Determines which type of socket connections to return.
Currently, it returns all or just incoming connections.
The mode field can be initialized with one of two constants:
0 When 0 is passed, all connections are returned.
1 When 1 is passed, incoming connections are returned.
- conn_element_type
- Connection information record. See the
next section, "conn_element_type Field," for more details.
Once AIFPROCGET returns, an array of connection entries are
available in the connection_type record structure.
Each entry has the following type definition:
conn_element_type =
packed record
local_ip_addr : bit32;
remote_ip_addr : bit32;
local_sap : bit16;
remote_sap : bit16;
socket_state : shortint;
flags : flag_type;
protocol : bit8;
socket_type : bit8;
filler : bit16;
end;
|
Field descriptions for the conn_element_type record structure
are as follows:
- local_ip_addr
- IP address of the local HP 3000.
- remote_ip_addr
- IP address of the remote machine.
- local_sap
- local TCP port number in use.
- remote_sap
- TCP port number allocated on remote machine.
- socket_state
- Socket state.
- flags
- flag_type record.
- protocol
- Protocol being used.
- socket_type
- Type of socket being used.
The flags field in conn_element_type has the
following record definition:
flag_type =
packed record
case integer of
1: (all : bit16);
2: (select_supported : boolean;
bsd_sk : boolean;
catch_all_flag : boolean;
tcp_msg_mode : boolean;
connection_initiator : boolean
filler : bit11);
end;
|
Field descriptions for the flag_type record structure are as
follows:
- select_supported
- True, if the select() function is supported
on this socket.
- bsd_sk
- True, if the connection is through a BSD Socket. False,
if the connection is through a NetIPC Socket.
- catch_all_flag
- True, if this is a NetIPC Socket using X.25 level
3 direct access and the socket was created with the catch_all_flag set.
- tcp_msg_mode
- True, if the connection is using TCP in message
mode.
- connection_initiator
- True, if the local process initiated the
connection.
The protocol, socket_type and
socket_state fields in conn_element_type will return
one of the following values:
PROTOCOLS
TRANSMISSION CONTROL PROTOCOL = 4
USER DATAGRAM PROTOCOL = 5
PACKET EXCHANGE PROTOCOL = 6
TYPES OF SOCKETS
CONNECTION SOCKET = 0
DATAGRAM SOCKET = 1
CALL SOCKET = 3
SOCKET STATES
INITIALIZED = -1
CONNECTING = 1
WAIT_CONFIRM = 2
DUPLEX_OPEN = 3
SIMPLEX_IN = 4
SIMPLEX_OUT = 5
CLOSED = 6
CONN_ABORTED = 7
BOUND = 8
LISTENING = 9
SHUT = 10
LINGERING = 11
|
Descriptions for the values of the socket_state field are as
follows:
- INITIALIZED
- Connection doesn't exist.
- CONNECTING
IPCCONNECT called, waiting for IPCRECV.
- WAIT_CONFIRM
IPCRECVCN done, user must accept/reject.
- DUPLEX_OPEN
- Connected, can send and receive data.
- SIMPLEX_IN
- Graceful close, can only receive.
- SIMPLEX_OUT
- Received graceful close, send only.
- CLOSED
- Both parties closed, user must shut down.
- CONN_ABORTED
- Connection aborted, user must shut down.
- BOUND
- Socket is bound to an address.
- LISTENING
- sk_listen has been called.
- SHUT
- Socket shutdown or encountered error.
- LINGERING
- Socket shutdown lingering pending.
|