forked from bg111/asterisk-chan-dongle
-
Notifications
You must be signed in to change notification settings - Fork 106
/
error.h
78 lines (73 loc) · 1.63 KB
/
error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
Copyright (C) 2020 Max von Buelow <[email protected]>
*/
#ifndef ERROR_H_INCLUDED
#define ERROR_H_INCLUDED
#include "export.h" /* EXPORT_DECL EXPORT_DEF */
#include "mutils.h"
enum error {
E_UNKNOWN = 0,
E_DEVICE_DISABLED,
E_DEVICE_NOT_FOUND,
E_DEVICE_DISCONNECTED,
E_INVALID_USSD,
E_INVALID_PHONE_NUMBER,
E_PARSE_UTF8,
E_PARSE_UCS2,
E_ENCODE_GSM7,
E_PACK_GSM7,
E_DECODE_GSM7, /* 10 */
E_SMSDB,
E_QUEUE,
E_BUILD_PDU,
E_PARSE_CMGR_LINE,
E_DEPRECATED_CMGR_TEXT,
E_INVALID_TPDU_LENGTH,
E_MALFORMED_HEXSTR,
E_INVALID_SCA,
E_INVALID_TPDU_TYPE,
E_PARSE_TPDU, /* 20 */
E_INVALID_TIMESTAMP,
E_INVALID_CHARSET,
E_BUILD_SCA,
E_BUILD_PHONE_NUMBER,
E_2BIG
};
INLINE_DECL const char *error2str(int err)
{
static const char * const errors[] = {
"Unknown error", /* 0 */
"Device disabled",
"Device not found",
"Device disconnected",
"Invalid USSD",
"Invalid phone number",
"Cannot parse UTF-8",
"Cannot parse UCS-2",
"Cannot encode GSM7",
"Cannot pack GSM7",
"Cannot decode GSM7", /* 10 */
"SMSDB error",
"Queue error",
"PDU building error",
"Can't parse +CMGR response line",
("Parsing messages in TEXT mode is not supported anymore; "
"This message should never appear. Nevertheless, if this "
"message appears, please report on GitHub."),
"Invalid TPDU length in CMGR PDU status line",
"Malformed hex string",
"Invalid SCA",
"Invalid TPDU type",
"Cannot parse TPDU", /* 20 */
"Invalid timestamp",
"Invalid charset",
"Cannot build SCA",
"Cannot build phone number",
"Input too large"
};
return enum2str(err,
errors,
ITEMS_OF(errors));
}
EXPORT_DECL __thread int chan_dongle_err;
#endif