qtoq_accept()--Accept QoS Sockets Connection API


  Syntax
 #include <qtoqsapi.h>

 int qtoq_accept(
                int               socket_descriptor,
                int               req_type,
                struct sockaddr   *address,
                int               *address_length,
                qos_req           *qos_data,
                unsigned int      *qos_session,
                int               *qos_descriptor,
                )

  Service Program Name: QSYS/QTOQSAPI

  Default Public Authority: *EXCLUDE

  Threadsafe: Yes

The qtoq_accept() API provides simplified Quality of Service support for connection-oriented sockets communications between RSVP aware applications on a client and server. The standard accept() sockets call can be replaced with this API.


Parameters

socket_descriptor
(Input) Required

An opened socket descriptor that has been bound to the IP address and port from which the application will accept connection requests.

req_type
Input) Required

The type of QoS service being requested. The possible values are:

REQ_SIGNAL_RET_EVENTS (1) Use normal RSVP signaling and return RSVP events to the calling program.
REQ_SIGNAL_NORET_EVENTS (2) Use normal RSVP signaling without returning events to the calling program.
REQ_NOSIGNAL (3) See if the RSVP rule for the requested connection has been defined as "no signaling." If yes, then load the requested rule.

address
(Output) Required

Pointer to a sockaddr structure where the IP address and port of the client requesting the connection will be stored.

Address_length
(Input/Output) Required

Pointer to an integer where the size of the address variable is given to the API and the length of the returned client address will be stored.

qos_data
(Input) Required

Pointer to a qos_req data structure that defines the type of service being requested and the source and destination addresses of the request.

The qos_req data structure is defined as follows:

typedef struct

{
int         service;     /* Values can be GUARANTEED_SERV (2) 
                                          or CONTROLLED_LOAD_SERV (5) */
union
  {
  struct   CL_spec                 /* Controlled-Load service      */
    {
    float         TB_Tspec_r;       /* token bucket rate in bytes/sec  */
    float         TB_Tspec_b;       /* token bucket depth in bytes     */
    float         TB_Tspec_p;       /* token bucket peak in bytes/sec  */
    unsigned long TB_Tspec_m;       /* min policed unit in bytes       */
    unsigned long TB_Tspec_M;       /* max packet size in bytes        */
    } CL_spec;
  struct Guar_spec   /* Guaranteed service              */
    {
    float         Guar_R;           /* guaranteed rate in bytes/sec    */
    unsigned long Guar_S;           /* slack term in microsecs         */
    } Guar_spec;
  }   spec_u;
} qos_spec_t;

typedef struct
  {
  struct  sockaddr        dest;        /* Destination address/port  */
  int                     d_length;    /* Destination  address length*/
  struct  sockaddr        source;      /* Source address/port       */
  int                     s_length;    /* Source address length     */
  int                     style;       /* Style of  Reservation.     */
  qos_spec_t              Spec;        /* Flow info                 */
  unsigned char           result;      /* API status                */
  }  qos_req;  /* End of QoS request structure */\
qos_session
(Output) Required

Pointer to an integer value where the unique QoS session ID can be stored. This ID is required for all future QoS API calls.

qos_descriptor
(Output) Optional

Pointer to an integer where the value of the descriptor that the application can wait on for RSVP events is stored. This value is set to NULL if it is not used.


Authorities

None.


Return Values

0 if successful.
-1 if function failed. Errno indicates error reason.


Error Conditions

When qtoq_accept() fails errno can be set to one of the following:

[EBADF]

Descriptor not valid.

[EFAULT]

Bad address.

[ECONNABORTED]

Connection ended abnormally. An accept() was issued on a socket for which receives have been disallowed (due to a shutdown() call).

This also could be encountered if time elapsed since a successful Rbind() is greater than the margin allowed by the associated SOCKS server.

[EFAULT]

Bad address. System detected an address that was not valid while attempting to access the address or address_length parameters.

[EINTR]

Interrupted function call.

[EINVAL]

Parameter not valid. This error code indicates one of the following:

[EIO]

Input/output error.

[EMFILE]

Too many descriptions for this process.

[ENFILE]

Too many descriptions in system.

[ENOBUFS]

There is not enough buffer space for the requested operation.

[ENOTSOCK]

The specified descriptor does not reference a socket.

[EOPNOTSUPP]

Operation not supported. The socket_descriptor parameter references a socket that does not support the accept(). The accept() is valid only on sockets that are connection-oriented (for example, type of SOCK_STREAM).

[EUNATCH]

The protocol required to support the specified address family is not available at this time.

[EUNKNOWN]

Unknown system state.

[EWOULDBLOCK]
Operation would have caused the thread to be suspended.


Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPFA081 E Unable to set return value or error code.


Usage Notes

  1. The application program can choose to be signaled when RSVP events occur or allow the QoS server to handle the events. If the server handles the events, the application program will not be informed if the RSVP signaling fails or if the requested reservations have been changed by the network.
  2. The REQ_NOSIGNAL request type will be honored only if a policy exists that matches the requested connection and it is marked as a "no signaling" policy. Otherwise, an [ENOTSUPPORT] error will be returned.

Related Information

For a description of the RSVP protocol, see RFC 2205 on the RFC Pages for The Internet Engineering Task Force.Link outside Information Center



API introduced: V5R2
Top | UNIX-Type APIs | APIs by category