00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <stdio.h>
00018 #include "dtn_errno.h"
00019
00020
00021 char*
00022 dtn_strerror(int err)
00023 {
00024 switch(err) {
00025 case DTN_SUCCESS: return "success";
00026 case DTN_EINVAL: return "invalid argument";
00027 case DTN_EXDR: return "error in xdr routines";
00028 case DTN_ECOMM: return "error in ipc communication";
00029 case DTN_ECONNECT: return "error connecting to server";
00030 case DTN_ETIMEOUT: return "operation timed out";
00031 case DTN_ESIZE: return "payload too large";
00032 case DTN_ENOTFOUND: return "not found";
00033 case DTN_EINTERNAL: return "internal error";
00034 case DTN_EINPOLL: return "illegal operation called after dtn_poll";
00035 case DTN_EBUSY: return "registration already in use";
00036 case DTN_EVERSION: return "ipc version mismatch";
00037 case DTN_EMSGTYPE: return "unknown ipc message type";
00038 case DTN_ENOSPACE: return "no storage space";
00039 case -1: return "(invalid error code -1)";
00040 }
00041
00042
00043
00044
00045
00046 static char buf[128];
00047 snprintf(buf, sizeof(buf), "(unknown error %d)", err);
00048 return buf;
00049 }
00050