author | Tero Marttila <terom@fixme.fi> |
Tue, 10 Mar 2009 03:29:53 +0200 | |
changeset 31 | 98ea2bd59195 |
parent 30 | 7f8dd120933f |
child 37 | 4fe4a3c4496e |
permissions | -rw-r--r-- |
6 | 1 |
|
2 |
#include "error.h" |
|
3 |
||
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
4 |
// for the error_desc tables |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
5 |
#include "sock.h" |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
6 |
#include "sock_gnutls.h" |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
7 |
|
7 | 8 |
#include <string.h> |
9 |
#include <stdio.h> |
|
10 |
||
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
11 |
struct error_desc _core_error_desc[] = { |
31 | 12 |
{ ERR_CALLOC, "calloc", ERR_EXTRA_NONE }, |
13 |
{ ERR_GETADDRINFO, "getaddrinfo", ERR_EXTRA_GAI }, |
|
14 |
{ ERR_GETADDRINFO_EMPTY, "getaddrinfo: no results", ERR_EXTRA_NONE }, |
|
15 |
{ ERR_EVENT_NEW, "event_new", ERR_EXTRA_NONE }, |
|
16 |
{ ERR_EVENT_ADD, "event_add", ERR_EXTRA_NONE }, |
|
17 |
{ ERR_EVSQL_NEW_PQ, "evsql_new_pq", ERR_EXTRA_NONE }, |
|
18 |
{ _ERR_INVALID, NULL, 0 } |
|
7 | 19 |
|
31 | 20 |
}, _sock_error_desc[] = { |
21 |
{ ERR_SOCKET, "socket", ERR_EXTRA_ERRNO }, |
|
22 |
{ ERR_CONNECT, "connect", ERR_EXTRA_ERRNO }, |
|
23 |
{ ERR_READ, "read", ERR_EXTRA_ERRNO }, |
|
24 |
{ ERR_READ_EOF, "read: EOF", ERR_EXTRA_NONE }, |
|
25 |
{ ERR_WRITE, "write", ERR_EXTRA_ERRNO }, |
|
26 |
{ ERR_WRITE_EOF, "write: EOF", ERR_EXTRA_NONE }, |
|
27 |
{ ERR_FCNTL, "fcntl", ERR_EXTRA_ERRNO }, |
|
28 |
{ ERR_CLOSE, "close", ERR_EXTRA_ERRNO }, |
|
29 |
{ _ERR_INVALID, NULL, 0 } |
|
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
30 |
|
31 | 31 |
}, _sock_gnutls_error_desc[] = { |
32 |
{ ERR_GNUTLS_CERT_ALLOC_CRED, "gnutls_certificate_allocate_credentials", ERR_EXTRA_GNUTLS }, |
|
33 |
{ ERR_GNUTLS_GLOBAL_INIT, "gnutls_global_init", ERR_EXTRA_GNUTLS }, |
|
34 |
{ ERR_GNUTLS_SET_DEFAULT_PRIORITY, "gnutls_set_default_priority", ERR_EXTRA_GNUTLS }, |
|
35 |
{ ERR_GNUTLS_CRED_SET, "gnutls_credentials_set", ERR_EXTRA_GNUTLS }, |
|
36 |
{ ERR_GNUTLS_HANDSHAKE, "gnutls_handshake", ERR_EXTRA_GNUTLS }, |
|
37 |
{ ERR_GNUTLS_RECORD_SEND, "gnutls_record_send", ERR_EXTRA_GNUTLS }, |
|
38 |
{ ERR_GNUTLS_RECORD_RECV, "gnutls_record_recv", ERR_EXTRA_GNUTLS }, |
|
39 |
{ ERR_GNUTLS_RECORD_GET_DIRECTION, "gnutls_record_get_direction", ERR_EXTRA_GNUTLS }, |
|
40 |
{ _ERR_INVALID, NULL, 0 } |
|
41 |
||
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
42 |
}; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
43 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
44 |
/** |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
45 |
* Array of error_desc tables |
6 | 46 |
*/ |
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
47 |
static struct error_desc* _desc_tables[] = { |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
48 |
_core_error_desc, |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
49 |
_sock_error_desc, |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
50 |
_sock_gnutls_error_desc, |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
51 |
NULL |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
52 |
}; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
53 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
54 |
/** |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
55 |
* Look up the error_desc for the given error code |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
56 |
*/ |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
57 |
static const struct error_desc* error_lookup_desc (err_t code) |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
58 |
{ |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
59 |
struct error_desc **desc_table, *desc = NULL; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
60 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
61 |
// iterate over each defined error_desc array |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
62 |
for (desc_table = _desc_tables; desc_table; desc_table++) { |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
63 |
for (desc = *desc_table; desc->code && desc->name; desc++) { |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
64 |
// compare code |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
65 |
if (desc->code == code) |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
66 |
// found |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
67 |
return desc; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
68 |
} |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
69 |
} |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
70 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
71 |
// not found |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
72 |
return NULL; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
73 |
} |
6 | 74 |
|
75 |
const char *error_name (err_t code) |
|
76 |
{ |
|
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
77 |
const struct error_desc *desc; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
78 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
79 |
// do we have an error_desc for it? |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
80 |
if ((desc = error_lookup_desc(code))) |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
81 |
return desc->name; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
82 |
else |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
83 |
// unknown |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
84 |
return "[unknown]"; |
6 | 85 |
} |
86 |
||
8
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
7
diff
changeset
|
87 |
const char *error_msg (const struct error_info *err) |
7 | 88 |
{ |
89 |
static char msg[ERROR_MSG_MAXLEN]; |
|
30
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
90 |
const struct error_desc *desc; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
91 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
92 |
// do we have an error_desc for it? |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
93 |
if ((desc = error_lookup_desc(err->code)) == NULL) |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
94 |
// ??? |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
95 |
snprintf(msg, ERROR_MSG_MAXLEN, "[%#.8x]: %#.8x", err->code, err->extra); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
96 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
97 |
else |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
98 |
// intrepret .extra |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
99 |
switch (desc->extra_type) { |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
100 |
case ERR_EXTRA_NONE: |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
101 |
// no additional info |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
102 |
snprintf(msg, ERROR_MSG_MAXLEN, "%s", desc->name); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
103 |
break; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
104 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
105 |
case ERR_EXTRA_ERRNO: |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
106 |
// strerror |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
107 |
snprintf(msg, ERROR_MSG_MAXLEN, "%s: %s", desc->name, strerror(err->extra)); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
108 |
break; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
109 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
110 |
case ERR_EXTRA_GAI: |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
111 |
// gai_strerror |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
112 |
snprintf(msg, ERROR_MSG_MAXLEN, "%s: %s", desc->name, gai_strerror(err->extra)); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
113 |
break; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
114 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
115 |
case ERR_EXTRA_GNUTLS: |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
116 |
// gnutls_strerror |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
117 |
snprintf(msg, ERROR_MSG_MAXLEN, "%s: %s", desc->name, gnutls_strerror(err->extra)); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
118 |
break; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
119 |
|
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
120 |
default: |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
121 |
// ??? |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
122 |
snprintf(msg, ERROR_MSG_MAXLEN, "%s: %#.8x", desc->name, err->extra); |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
123 |
break; |
7f8dd120933f
rework error to use a struct error_desc, and move ERR_SOCK/ERR_GNUTLS definitions to sock.h/sock_gnutls.h. error_desc definitions are still in error.c, though :(
Tero Marttila <terom@fixme.fi>
parents:
10
diff
changeset
|
124 |
} |
7 | 125 |
|
126 |
// return static pointer |
|
127 |
return msg; |
|
128 |
} |
|
129 |