-
Notifications
You must be signed in to change notification settings - Fork 96
/
INTERFACE_CHANGES
130 lines (111 loc) · 5.08 KB
/
INTERFACE_CHANGES
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
TODO: document --compat_1x effects
[uri]:
This module has been completely rewritten for RFC 3986 conformance.
u_uri_parse has been removed: the new parsing interface, which also takes
a bitmask of parsing options as its second parameter, is:
* int u_uri_crumble (const char *s, u_uri_opts_t opts, u_uri_t **pu)
instead of the old:
* int u_uri_parse (const char *s, u_uri_t **pu)
Also, u_uri_t is now opaque type and its attributes can be accessed only
through their getter methods:
* const char *u_uri_get_scheme (u_uri_t *u)
* const char *u_uri_get_user (u_uri_t *u)
* const char *u_uri_get_pwd (u_uri_t *u)
* const char *u_uri_get_host (u_uri_t *u)
* const char *u_uri_get_port (u_uri_t *u)
* const char *u_uri_get_authority (u_uri_t *u)
* const char *u_uri_get_path (u_uri_t *u)
* const char *u_uri_get_query (u_uri_t *u)
* const char *u_uri_get_fragment (u_uri_t *u)
* const char *u_uri_get_userinfo (u_uri_t *u);
A new interface for building conformant URI string as been added:
* int u_uri_knead (u_uri_t *u, char s[U_URI_STRMAX])
together with the needed setter methods:
* int u_uri_set_scheme (u_uri_t *u, const char *val)
* int u_uri_set_user (u_uri_t *u, const char *val)
* int u_uri_set_pwd (u_uri_t *u, const char *val)
* int u_uri_set_host (u_uri_t *u, const char *val)
* int u_uri_set_port (u_uri_t *u, const char *val)
* int u_uri_set_authority (u_uri_t *u, const char *val)
* int u_uri_set_path (u_uri_t *u, const char *val)
* int u_uri_set_query (u_uri_t *u, const char *val)
* int u_uri_set_fragment (u_uri_t *u, const char *val)
* int u_uri_set_userinfo (u_uri_t *u, const char *val);
The u_uri_parse function accepts as last optional argument a bitmask of
U_URI_OPTS_* to tweak some parsing choices.
[buf]:
u_buf_t is now opaque. Type attributes can be accessed only through their
getter methods, which where already present in 1.x:
* void *u_buf_ptr (u_buf_t *buf);
* size_t u_buf_len (u_buf_t *buf);
* size_t u_buf_size (u_buf_t *buf);
[net]:
This module has been completely revamped, both implementation and
interfaces have changed dramatically, the rationale being "more simplicity":
the creation of sockets using UNIX IPC, TCP, UDP and SCTP over IPv4 and
IPv6 is carried out through the very same interface.
The sole chance for your application to be backwards compatible is in case
it used the u_net_sock() only (which is indeed likely to happen).
Interfaces removed:
* u_net_sock_tcp
* u_net_sock_udp
* u_net_sock_unix
* u_net_tcp4_ssock
* u_net_tcp4_csock
* u_net_tcp6_ssock
* u_net_tcp6_csock
* u_net_unix_ssock
* u_net_unix_csock
* u_net_uri2sin
* u_net_uri2sun
* u_net_addr_new
Interfaces changed:
* u_net_uri2addr
the socket 'mode' has been added as a mandatory input parameter
* u_net_sock (XXX u_net_sd, see compat.h)
the socket 'mode' has been added as an optional input parameter in
a backwards-compatible way
Newly added interfaces:
* u_net_sock_by_addr
* u_net_addr_set_opts
* u_net_addr_add_opts
* u_net_addr_can_accept
* u_socket
* u_connect
* u_listen
* u_bind
* u_setsockopt
* u_getsockopt
* u_sa_ntop
* u_inet_ntop
[array]
The setter/getter methods for generic pointers have been restyled. See
http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2008-10/msg01683.html
for details about the reason why we had to move. The following interfaces
have been modified: they give back the error code through a result argument,
and the generic (ie. void*) pointer as the returned value:
New interfaces:
* void *u_array_get_ptr (u_array_t *da, size_t idx, int *prc);
* void *u_array_set_ptr (u_array_t *da, size_t idx, void *v, int *prc);
Old (removed) interfaces:
* int u_array_get_ptr (u_array_t *da, size_t idx, void **pv);
* int u_array_set_ptr (u_array_t *da, size_t idx, void *v, void **pold);
Note that the returned pointer is not sufficient to point out a failure in
the get/set operation, since a NULL value could be perfectly valid:
*always* use '*prc' to discriminate between a good (i.e. *prc == 0) and bad
(i.e. *prc == -1) run.
[misc]
The following interfaces have been deprecated:
* u_tokenize in favour of u_strtok
* u_strncpy in favour of u_strlcpy
[carpal]
The following macros have been renamed to avoid name clash with <err.h>
functions:
* dbg() becomes u_dbg()
* info() becomes u_info()
* notice() becomes u_notice()
* warn() becomes u_warn()
* err() becomes u_err()
* crit() becomes u_crit()
* alert() becomes u_alert()
* emerg() becomes u_emerg()