2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 1993, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#include "mt.h"
2N/A#include <unistd.h>
2N/A#include <stdio.h>
2N/A#include <stddef.h>
2N/A#include <libintl.h>
2N/A#include <stropts.h>
2N/A#include <xti.h>
2N/A#include "tx.h"
2N/A
2N/Astatic const char __nsl_dom[] = "SUNW_OST_NETRPC";
2N/A
2N/Astatic char *_xti_errlist[] = {
2N/A "No Error", /* 0 */
2N/A "Incorrect address format", /* 1 - TBADADDR */
2N/A "Incorrect options format", /* 2 - TBADOPT */
2N/A "Illegal permissions", /* 3 - TACCES */
2N/A "Illegal file descriptor", /* 4 - TBADF */
2N/A "Couldn't allocate address", /* 5 - TNOADDR */
2N/A "Routine will place interface out of state", /* 6 - TOUTSTATE */
2N/A "Illegal called/calling sequence number", /* 7 - TBADSEQ */
2N/A "System error", /* 8 - TSYSERR */
2N/A "An event requires attention", /* 9 - TLOOK */
2N/A "Illegal amount of data", /* 10 - TBADDATA */
2N/A "Buffer not large enough", /* 11 - TBUFOVFLW */
2N/A "Can't send message - (blocked)", /* 12 - TFLOW */
2N/A "No message currently available", /* 13 - TNODATA */
2N/A "Disconnect message not found", /* 14 - TNODIS */
2N/A "Unitdata error message not found", /* 15 - TNOUDERR */
2N/A "Incorrect flags specified", /* 16 - TBADFLAG */
2N/A "Orderly release message not found", /* 17 - TNOREL */
2N/A "Primitive not supported by provider", /* 18 - TNOTSUPPORT */
2N/A "State is in process of changing", /* 19 - TSTATECHNG */
2N/A
2N/A /* Following error codes are new in XTI */
2N/A
2N/A "Unsupported structure type requested", /* 20 - TNOSTRUCTYPE */
2N/A "Invalid transport provider name", /* 21 - TBADNAME */
2N/A "Listener queue length limit is zero", /* 22 - TBADQLEN */
2N/A "Transport address is in use", /* 23 - TADDRBUSY */
2N/A "Outstanding connection indications", /* 24 - TINDOUT */
2N/A "Listener-acceptor transport provider mismatch",
2N/A /* 25 - TPROVMISMATCH */
2N/A "Connection acceptor has listen queue length limit greater than zero",
2N/A /* 26 - TRESQLEN */
2N/A"Connection acceptor-listener address not same but required by transport",
2N/A /* 27 - TRESADDR */
2N/A "Incoming connection queue is full", /* 28 - TQFULL */
2N/A "Protocol error on transport primitive", /* 29 - TPROTO */
2N/A};
2N/A
2N/Astatic int _xti_nerr = A_CNT(_xti_errlist)-1; /* take off entry t_errno 0 */
2N/A
2N/Aconst char *
2N/A_tx_strerror(int errnum, int api_semantics)
2N/A{
2N/A static char buf[BUFSIZ];
2N/A
2N/A if (_T_IS_XTI(api_semantics)) {
2N/A if (errnum <= _xti_nerr && errnum >= 0)
2N/A return (dgettext(__nsl_dom, _xti_errlist[errnum]));
2N/A (void) snprintf(buf, sizeof (buf), "%d: %s", errnum,
2N/A dgettext(__nsl_dom, "error unknown"));
2N/A return ((const char *)buf);
2N/A }
2N/A
2N/A /* TX_TLI_API */
2N/A /*
2N/A * This code for TLI only. It uses "t_nerr" and "t_errlist"
2N/A * which are exposed interfaces in the t_error() man page.
2N/A * XTI uses different array to avoid binary compatibility
2N/A * issues in using the exposed array. [ XTI t_error() does
2N/A * not mention the error message list array ]
2N/A *
2N/A * For the moment we simply index into the t_errlist[] array.
2N/A * When the array fills (we cannot allow it to expand in size
2N/A * or binary compatibility will be broken), this code will need
2N/A * modification. See the comment in _errlst.c.
2N/A */
2N/A if (errnum < t_nerr && errnum >= 0)
2N/A return (dgettext(__nsl_dom, t_errlist[errnum]));
2N/A (void) snprintf(buf, sizeof (buf), "%d: %s", errnum,
2N/A dgettext(__nsl_dom, "error unknown"));
2N/A return ((const char *)buf);
2N/A}