| 1 |
|
| 2 |
/* |
| 3 |
WARNING: Generated from ../scripts/generate-error-types.tcl |
| 4 |
|
| 5 |
DO NOT MODIFY. |
| 6 |
|
| 7 |
Copyright applies as per the generator script. |
| 8 |
*/ |
| 9 |
|
| 10 |
#include <cstddef> |
| 11 |
|
| 12 |
|
| 13 |
namespace srt |
| 14 |
{ |
| 15 |
// MJ_SUCCESS 'Success' |
| 16 |
|
| 17 |
const char* strerror_msgs_success [] = { |
| 18 |
"Success", // MN_NONE = 0 |
| 19 |
"" |
| 20 |
}; |
| 21 |
|
| 22 |
// MJ_SETUP 'Connection setup failure' |
| 23 |
|
| 24 |
const char* strerror_msgs_setup [] = { |
| 25 |
"Connection setup failure", // MN_NONE = 0 |
| 26 |
"Connection setup failure: connection timed out", // MN_TIMEOUT = 1 |
| 27 |
"Connection setup failure: connection rejected", // MN_REJECTED = 2 |
| 28 |
"Connection setup failure: unable to create/configure SRT socket", // MN_NORES = 3 |
| 29 |
"Connection setup failure: aborted for security reasons", // MN_SECURITY = 4 |
| 30 |
"Connection setup failure: socket closed during operation", // MN_CLOSED = 5 |
| 31 |
"" |
| 32 |
}; |
| 33 |
|
| 34 |
// MJ_CONNECTION '' |
| 35 |
|
| 36 |
const char* strerror_msgs_connection [] = { |
| 37 |
"", // MN_NONE = 0 |
| 38 |
"Connection was broken", // MN_CONNLOST = 1 |
| 39 |
"Connection does not exist", // MN_NOCONN = 2 |
| 40 |
"" |
| 41 |
}; |
| 42 |
|
| 43 |
// MJ_SYSTEMRES 'System resource failure' |
| 44 |
|
| 45 |
const char* strerror_msgs_systemres [] = { |
| 46 |
"System resource failure", // MN_NONE = 0 |
| 47 |
"System resource failure: unable to create new threads", // MN_THREAD = 1 |
| 48 |
"System resource failure: unable to allocate buffers", // MN_MEMORY = 2 |
| 49 |
"System resource failure: unable to allocate a system object", // MN_OBJECT = 3 |
| 50 |
"" |
| 51 |
}; |
| 52 |
|
| 53 |
// MJ_FILESYSTEM 'File system failure' |
| 54 |
|
| 55 |
const char* strerror_msgs_filesystem [] = { |
| 56 |
"File system failure", // MN_NONE = 0 |
| 57 |
"File system failure: cannot seek read position", // MN_SEEKGFAIL = 1 |
| 58 |
"File system failure: failure in read", // MN_READFAIL = 2 |
| 59 |
"File system failure: cannot seek write position", // MN_SEEKPFAIL = 3 |
| 60 |
"File system failure: failure in write", // MN_WRITEFAIL = 4 |
| 61 |
"" |
| 62 |
}; |
| 63 |
|
| 64 |
// MJ_NOTSUP 'Operation not supported' |
| 65 |
|
| 66 |
const char* strerror_msgs_notsup [] = { |
| 67 |
"Operation not supported", // MN_NONE = 0 |
| 68 |
"Operation not supported: Cannot do this operation on a BOUND socket", // MN_ISBOUND = 1 |
| 69 |
"Operation not supported: Cannot do this operation on a CONNECTED or LISTENING socket", // MN_ISCONNECTED = 2 |
| 70 |
"Operation not supported: Bad parameters", // MN_INVAL = 3 |
| 71 |
"Operation not supported: Invalid socket ID", // MN_SIDINVAL = 4 |
| 72 |
"Operation not supported: Cannot do this operation on an UNBOUND socket", // MN_ISUNBOUND = 5 |
| 73 |
"Operation not supported: Socket is not in listening state", // MN_NOLISTEN = 6 |
| 74 |
"Operation not supported: Listen/accept is not supported in rendezvous connection setup", // MN_ISRENDEZVOUS = 7 |
| 75 |
"Operation not supported: Cannot call connect on UNBOUND socket in rendezvous connection setup", // MN_ISRENDUNBOUND = 8 |
| 76 |
"Operation not supported: Incorrect use of Message API (sendmsg/recvmsg)", // MN_INVALMSGAPI = 9 |
| 77 |
"Operation not supported: Incorrect use of Buffer API (send/recv) or File API (sendfile/recvfile)", // MN_INVALBUFFERAPI = 10 |
| 78 |
"Operation not supported: Another socket is already listening on the same port", // MN_BUSY = 11 |
| 79 |
"Operation not supported: Message too large to send (exceeds send buffer size)", // MN_XSIZE = 12 |
| 80 |
"Operation not supported: Invalid epoll ID", // MN_EIDINVAL = 13 |
| 81 |
"Operation not supported: All sockets removed from epoll, waiting would deadlock", // MN_EEMPTY = 14 |
| 82 |
"Operation not supported: Another socket is bound to that port and is not reusable for requested settings", // MN_BUSYPORT = 15 |
| 83 |
"" |
| 84 |
}; |
| 85 |
|
| 86 |
// MJ_AGAIN 'Non-blocking call failure' |
| 87 |
|
| 88 |
const char* strerror_msgs_again [] = { |
| 89 |
"Non-blocking call failure", // MN_NONE = 0 |
| 90 |
"Non-blocking call failure: no buffer available for sending", // MN_WRAVAIL = 1 |
| 91 |
"Non-blocking call failure: no data available for reading", // MN_RDAVAIL = 2 |
| 92 |
"Non-blocking call failure: transmission timed out", // MN_XMTIMEOUT = 3 |
| 93 |
"Non-blocking call failure: early congestion notification", // MN_CONGESTION = 4 |
| 94 |
"" |
| 95 |
}; |
| 96 |
|
| 97 |
// MJ_PEERERROR 'The peer side has signaled an error' |
| 98 |
|
| 99 |
const char* strerror_msgs_peererror [] = { |
| 100 |
"The peer side has signaled an error", // MN_NONE = 0 |
| 101 |
"" |
| 102 |
}; |
| 103 |
|
| 104 |
|
| 105 |
const char** strerror_array_major [] = { |
| 106 |
strerror_msgs_success, // MJ_SUCCESS = 0 |
| 107 |
strerror_msgs_setup, // MJ_SETUP = 1 |
| 108 |
strerror_msgs_connection, // MJ_CONNECTION = 2 |
| 109 |
strerror_msgs_systemres, // MJ_SYSTEMRES = 3 |
| 110 |
strerror_msgs_filesystem, // MJ_FILESYSTEM = 4 |
| 111 |
strerror_msgs_notsup, // MJ_NOTSUP = 5 |
| 112 |
strerror_msgs_again, // MJ_AGAIN = 6 |
| 113 |
strerror_msgs_peererror, // MJ_PEERERROR = 7 |
| 114 |
NULL |
| 115 |
}; |
| 116 |
|
| 117 |
#define SRT_ARRAY_SIZE(ARR) sizeof(ARR) / sizeof(ARR[0]) |
| 118 |
|
| 119 |
const size_t strerror_array_sizes [] = { |
| 120 |
SRT_ARRAY_SIZE(strerror_msgs_success) - 1, |
| 121 |
SRT_ARRAY_SIZE(strerror_msgs_setup) - 1, |
| 122 |
SRT_ARRAY_SIZE(strerror_msgs_connection) - 1, |
| 123 |
SRT_ARRAY_SIZE(strerror_msgs_systemres) - 1, |
| 124 |
SRT_ARRAY_SIZE(strerror_msgs_filesystem) - 1, |
| 125 |
SRT_ARRAY_SIZE(strerror_msgs_notsup) - 1, |
| 126 |
SRT_ARRAY_SIZE(strerror_msgs_again) - 1, |
| 127 |
SRT_ARRAY_SIZE(strerror_msgs_peererror) - 1, |
| 128 |
0 |
| 129 |
}; |
| 130 |
|
| 131 |
|
| 132 |
const char* strerror_get_message(size_t major, size_t minor) |
| 133 |
{ |
| 134 |
static const char* const undefined = "UNDEFINED ERROR"; |
| 135 |
|
| 136 |
// Extract the major array |
| 137 |
if (major >= sizeof(strerror_array_major)/sizeof(const char**)) |
| 138 |
{ |
| 139 |
return undefined; |
| 140 |
} |
| 141 |
|
| 142 |
const char** array = strerror_array_major[major]; |
| 143 |
const size_t size = strerror_array_sizes[major]; |
| 144 |
|
| 145 |
if (minor >= size) |
| 146 |
{ |
| 147 |
return undefined; |
| 148 |
} |
| 149 |
|
| 150 |
return array[minor]; |
| 151 |
} |
| 152 |
|
| 153 |
|
| 154 |
} // namespace srt |